| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 2814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2825 __ cmp(result, factory()->the_hole_value()); | 2825 __ cmp(result, factory()->the_hole_value()); |
| 2826 DeoptimizeIf(equal, instr->environment()); | 2826 DeoptimizeIf(equal, instr->environment()); |
| 2827 } | 2827 } |
| 2828 } | 2828 } |
| 2829 | 2829 |
| 2830 | 2830 |
| 2831 template <class T> | 2831 template <class T> |
| 2832 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { | 2832 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { |
| 2833 DCHECK(FLAG_vector_ics); | 2833 DCHECK(FLAG_vector_ics); |
| 2834 Register vector = ToRegister(instr->temp_vector()); | 2834 Register vector = ToRegister(instr->temp_vector()); |
| 2835 DCHECK(vector.is(LoadIC::VectorRegister())); | 2835 DCHECK(vector.is(FullVectorLoadConvention::VectorRegister())); |
| 2836 __ mov(vector, instr->hydrogen()->feedback_vector()); | 2836 __ mov(vector, instr->hydrogen()->feedback_vector()); |
| 2837 // No need to allocate this register. | 2837 // No need to allocate this register. |
| 2838 DCHECK(LoadIC::SlotRegister().is(eax)); | 2838 DCHECK(FullVectorLoadConvention::SlotRegister().is(eax)); |
| 2839 __ mov(LoadIC::SlotRegister(), | 2839 __ mov(FullVectorLoadConvention::SlotRegister(), |
| 2840 Immediate(Smi::FromInt(instr->hydrogen()->slot()))); | 2840 Immediate(Smi::FromInt(instr->hydrogen()->slot()))); |
| 2841 } | 2841 } |
| 2842 | 2842 |
| 2843 | 2843 |
| 2844 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 2844 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
| 2845 DCHECK(ToRegister(instr->context()).is(esi)); | 2845 DCHECK(ToRegister(instr->context()).is(esi)); |
| 2846 DCHECK(ToRegister(instr->global_object()).is(LoadIC::ReceiverRegister())); | 2846 DCHECK(ToRegister(instr->global_object()) |
| 2847 .is(LoadConvention::ReceiverRegister())); |
| 2847 DCHECK(ToRegister(instr->result()).is(eax)); | 2848 DCHECK(ToRegister(instr->result()).is(eax)); |
| 2848 | 2849 |
| 2849 __ mov(LoadIC::NameRegister(), instr->name()); | 2850 __ mov(LoadConvention::NameRegister(), instr->name()); |
| 2850 if (FLAG_vector_ics) { | 2851 if (FLAG_vector_ics) { |
| 2851 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 2852 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
| 2852 } | 2853 } |
| 2853 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 2854 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
| 2854 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); | 2855 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); |
| 2855 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2856 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2856 } | 2857 } |
| 2857 | 2858 |
| 2858 | 2859 |
| 2859 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 2860 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2973 } else if (operand->IsRegister()) { | 2974 } else if (operand->IsRegister()) { |
| 2974 __ push(ToRegister(operand)); | 2975 __ push(ToRegister(operand)); |
| 2975 } else { | 2976 } else { |
| 2976 __ push(ToOperand(operand)); | 2977 __ push(ToOperand(operand)); |
| 2977 } | 2978 } |
| 2978 } | 2979 } |
| 2979 | 2980 |
| 2980 | 2981 |
| 2981 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 2982 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
| 2982 DCHECK(ToRegister(instr->context()).is(esi)); | 2983 DCHECK(ToRegister(instr->context()).is(esi)); |
| 2983 DCHECK(ToRegister(instr->object()).is(LoadIC::ReceiverRegister())); | 2984 DCHECK(ToRegister(instr->object()).is(LoadConvention::ReceiverRegister())); |
| 2984 DCHECK(ToRegister(instr->result()).is(eax)); | 2985 DCHECK(ToRegister(instr->result()).is(eax)); |
| 2985 | 2986 |
| 2986 __ mov(LoadIC::NameRegister(), instr->name()); | 2987 __ mov(LoadConvention::NameRegister(), instr->name()); |
| 2987 if (FLAG_vector_ics) { | 2988 if (FLAG_vector_ics) { |
| 2988 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); | 2989 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); |
| 2989 } | 2990 } |
| 2990 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); | 2991 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); |
| 2991 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2992 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2992 } | 2993 } |
| 2993 | 2994 |
| 2994 | 2995 |
| 2995 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 2996 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
| 2996 Register function = ToRegister(instr->function()); | 2997 Register function = ToRegister(instr->function()); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3201 return Operand(elements_pointer_reg, | 3202 return Operand(elements_pointer_reg, |
| 3202 ToRegister(key), | 3203 ToRegister(key), |
| 3203 scale_factor, | 3204 scale_factor, |
| 3204 base_offset); | 3205 base_offset); |
| 3205 } | 3206 } |
| 3206 } | 3207 } |
| 3207 | 3208 |
| 3208 | 3209 |
| 3209 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 3210 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
| 3210 DCHECK(ToRegister(instr->context()).is(esi)); | 3211 DCHECK(ToRegister(instr->context()).is(esi)); |
| 3211 DCHECK(ToRegister(instr->object()).is(LoadIC::ReceiverRegister())); | 3212 DCHECK(ToRegister(instr->object()).is(LoadConvention::ReceiverRegister())); |
| 3212 DCHECK(ToRegister(instr->key()).is(LoadIC::NameRegister())); | 3213 DCHECK(ToRegister(instr->key()).is(LoadConvention::NameRegister())); |
| 3213 | 3214 |
| 3214 if (FLAG_vector_ics) { | 3215 if (FLAG_vector_ics) { |
| 3215 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); | 3216 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); |
| 3216 } | 3217 } |
| 3217 | 3218 |
| 3218 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 3219 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
| 3219 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3220 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 3220 } | 3221 } |
| 3221 | 3222 |
| 3222 | 3223 |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4060 kSaveFPRegs, | 4061 kSaveFPRegs, |
| 4061 EMIT_REMEMBERED_SET, | 4062 EMIT_REMEMBERED_SET, |
| 4062 instr->hydrogen()->SmiCheckForWriteBarrier(), | 4063 instr->hydrogen()->SmiCheckForWriteBarrier(), |
| 4063 instr->hydrogen()->PointersToHereCheckForValue()); | 4064 instr->hydrogen()->PointersToHereCheckForValue()); |
| 4064 } | 4065 } |
| 4065 } | 4066 } |
| 4066 | 4067 |
| 4067 | 4068 |
| 4068 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4069 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
| 4069 DCHECK(ToRegister(instr->context()).is(esi)); | 4070 DCHECK(ToRegister(instr->context()).is(esi)); |
| 4070 DCHECK(ToRegister(instr->object()).is(StoreIC::ReceiverRegister())); | 4071 DCHECK(ToRegister(instr->object()).is(StoreConvention::ReceiverRegister())); |
| 4071 DCHECK(ToRegister(instr->value()).is(StoreIC::ValueRegister())); | 4072 DCHECK(ToRegister(instr->value()).is(StoreConvention::ValueRegister())); |
| 4072 | 4073 |
| 4073 __ mov(StoreIC::NameRegister(), instr->name()); | 4074 __ mov(StoreConvention::NameRegister(), instr->name()); |
| 4074 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode()); | 4075 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode()); |
| 4075 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4076 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4076 } | 4077 } |
| 4077 | 4078 |
| 4078 | 4079 |
| 4079 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4080 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 4080 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; | 4081 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; |
| 4081 if (instr->index()->IsConstantOperand()) { | 4082 if (instr->index()->IsConstantOperand()) { |
| 4082 __ cmp(ToOperand(instr->length()), | 4083 __ cmp(ToOperand(instr->length()), |
| 4083 ToImmediate(LConstantOperand::cast(instr->index()), | 4084 ToImmediate(LConstantOperand::cast(instr->index()), |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4242 } else if (instr->hydrogen()->value()->representation().IsDouble()) { | 4243 } else if (instr->hydrogen()->value()->representation().IsDouble()) { |
| 4243 DoStoreKeyedFixedDoubleArray(instr); | 4244 DoStoreKeyedFixedDoubleArray(instr); |
| 4244 } else { | 4245 } else { |
| 4245 DoStoreKeyedFixedArray(instr); | 4246 DoStoreKeyedFixedArray(instr); |
| 4246 } | 4247 } |
| 4247 } | 4248 } |
| 4248 | 4249 |
| 4249 | 4250 |
| 4250 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4251 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
| 4251 DCHECK(ToRegister(instr->context()).is(esi)); | 4252 DCHECK(ToRegister(instr->context()).is(esi)); |
| 4252 DCHECK(ToRegister(instr->object()).is(KeyedStoreIC::ReceiverRegister())); | 4253 DCHECK(ToRegister(instr->object()).is(StoreConvention::ReceiverRegister())); |
| 4253 DCHECK(ToRegister(instr->key()).is(KeyedStoreIC::NameRegister())); | 4254 DCHECK(ToRegister(instr->key()).is(StoreConvention::NameRegister())); |
| 4254 DCHECK(ToRegister(instr->value()).is(KeyedStoreIC::ValueRegister())); | 4255 DCHECK(ToRegister(instr->value()).is(StoreConvention::ValueRegister())); |
| 4255 | 4256 |
| 4256 Handle<Code> ic = instr->strict_mode() == STRICT | 4257 Handle<Code> ic = instr->strict_mode() == STRICT |
| 4257 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 4258 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
| 4258 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 4259 : isolate()->builtins()->KeyedStoreIC_Initialize(); |
| 4259 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4260 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4260 } | 4261 } |
| 4261 | 4262 |
| 4262 | 4263 |
| 4263 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) { | 4264 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) { |
| 4264 Register object = ToRegister(instr->object()); | 4265 Register object = ToRegister(instr->object()); |
| (...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5668 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5669 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5669 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5670 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5670 } | 5671 } |
| 5671 | 5672 |
| 5672 | 5673 |
| 5673 #undef __ | 5674 #undef __ |
| 5674 | 5675 |
| 5675 } } // namespace v8::internal | 5676 } } // namespace v8::internal |
| 5676 | 5677 |
| 5677 #endif // V8_TARGET_ARCH_IA32 | 5678 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |