OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 virtual InlineCacheState GetICState() { | 147 virtual InlineCacheState GetICState() { |
148 return UnaryOpIC::ToState(operand_type_); | 148 return UnaryOpIC::ToState(operand_type_); |
149 } | 149 } |
150 | 150 |
151 virtual void FinishCode(Handle<Code> code) { | 151 virtual void FinishCode(Handle<Code> code) { |
152 code->set_unary_op_type(operand_type_); | 152 code->set_unary_op_type(operand_type_); |
153 } | 153 } |
154 }; | 154 }; |
155 | 155 |
156 | 156 |
157 class BinaryOpStub: public CodeStub { | |
158 public: | |
159 BinaryOpStub(Token::Value op, OverwriteMode mode) | |
160 : op_(op), | |
161 mode_(mode), | |
162 operands_type_(BinaryOpIC::UNINITIALIZED), | |
163 result_type_(BinaryOpIC::UNINITIALIZED) { | |
164 use_sse3_ = CpuFeatures::IsSupported(SSE3); | |
165 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); | |
166 } | |
167 | |
168 BinaryOpStub( | |
169 int key, | |
170 BinaryOpIC::TypeInfo operands_type, | |
171 BinaryOpIC::TypeInfo result_type = BinaryOpIC::UNINITIALIZED) | |
172 : op_(OpBits::decode(key)), | |
173 mode_(ModeBits::decode(key)), | |
174 use_sse3_(SSE3Bits::decode(key)), | |
175 operands_type_(operands_type), | |
176 result_type_(result_type) { } | |
177 | |
178 private: | |
179 enum SmiCodeGenerateHeapNumberResults { | |
180 ALLOW_HEAPNUMBER_RESULTS, | |
181 NO_HEAPNUMBER_RESULTS | |
182 }; | |
183 | |
184 Token::Value op_; | |
185 OverwriteMode mode_; | |
186 bool use_sse3_; | |
187 | |
188 // Operand type information determined at runtime. | |
189 BinaryOpIC::TypeInfo operands_type_; | |
190 BinaryOpIC::TypeInfo result_type_; | |
191 | |
192 virtual void PrintName(StringStream* stream); | |
193 | |
194 // Minor key encoding in 16 bits RRRTTTSOOOOOOOMM. | |
195 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; | |
196 class OpBits: public BitField<Token::Value, 2, 7> {}; | |
197 class SSE3Bits: public BitField<bool, 9, 1> {}; | |
198 class OperandTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 10, 3> {}; | |
199 class ResultTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 13, 3> {}; | |
200 | |
201 Major MajorKey() { return BinaryOp; } | |
202 int MinorKey() { | |
203 return OpBits::encode(op_) | |
204 | ModeBits::encode(mode_) | |
205 | SSE3Bits::encode(use_sse3_) | |
206 | OperandTypeInfoBits::encode(operands_type_) | |
207 | ResultTypeInfoBits::encode(result_type_); | |
208 } | |
209 | |
210 void Generate(MacroAssembler* masm); | |
211 void GenerateGeneric(MacroAssembler* masm); | |
212 void GenerateSmiCode(MacroAssembler* masm, | |
213 Label* slow, | |
214 SmiCodeGenerateHeapNumberResults heapnumber_results); | |
215 void GenerateLoadArguments(MacroAssembler* masm); | |
216 void GenerateReturn(MacroAssembler* masm); | |
217 void GenerateUninitializedStub(MacroAssembler* masm); | |
218 void GenerateSmiStub(MacroAssembler* masm); | |
219 void GenerateInt32Stub(MacroAssembler* masm); | |
220 void GenerateHeapNumberStub(MacroAssembler* masm); | |
221 void GenerateOddballStub(MacroAssembler* masm); | |
222 void GenerateStringStub(MacroAssembler* masm); | |
223 void GenerateBothStringStub(MacroAssembler* masm); | |
224 void GenerateGenericStub(MacroAssembler* masm); | |
225 void GenerateAddStrings(MacroAssembler* masm); | |
226 | |
227 void GenerateHeapResultAllocation(MacroAssembler* masm, Label* alloc_failure); | |
228 void GenerateRegisterArgsPush(MacroAssembler* masm); | |
229 void GenerateTypeTransition(MacroAssembler* masm); | |
230 void GenerateTypeTransitionWithSavedArgs(MacroAssembler* masm); | |
231 | |
232 virtual int GetCodeKind() { return Code::BINARY_OP_IC; } | |
233 | |
234 virtual InlineCacheState GetICState() { | |
235 return BinaryOpIC::ToState(operands_type_); | |
236 } | |
237 | |
238 virtual void FinishCode(Handle<Code> code) { | |
239 code->set_binary_op_type(operands_type_); | |
240 code->set_binary_op_result_type(result_type_); | |
241 } | |
242 | |
243 friend class CodeGenerator; | |
244 }; | |
245 | |
246 | |
247 class StringHelper : public AllStatic { | 157 class StringHelper : public AllStatic { |
248 public: | 158 public: |
249 // Generate code for copying characters using a simple loop. This should only | 159 // Generate code for copying characters using a simple loop. This should only |
250 // be used in places where the number of characters is small and the | 160 // be used in places where the number of characters is small and the |
251 // additional setup and checking in GenerateCopyCharactersREP adds too much | 161 // additional setup and checking in GenerateCopyCharactersREP adds too much |
252 // overhead. Copying of overlapping regions is not supported. | 162 // overhead. Copying of overlapping regions is not supported. |
253 static void GenerateCopyCharacters(MacroAssembler* masm, | 163 static void GenerateCopyCharacters(MacroAssembler* masm, |
254 Register dest, | 164 Register dest, |
255 Register src, | 165 Register src, |
256 Register count, | 166 Register count, |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 Register address_; | 637 Register address_; |
728 RememberedSetAction remembered_set_action_; | 638 RememberedSetAction remembered_set_action_; |
729 SaveFPRegsMode save_fp_regs_mode_; | 639 SaveFPRegsMode save_fp_regs_mode_; |
730 RegisterAllocation regs_; | 640 RegisterAllocation regs_; |
731 }; | 641 }; |
732 | 642 |
733 | 643 |
734 } } // namespace v8::internal | 644 } } // namespace v8::internal |
735 | 645 |
736 #endif // V8_IA32_CODE_STUBS_IA32_H_ | 646 #endif // V8_IA32_CODE_STUBS_IA32_H_ |
OLD | NEW |