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 2810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2821 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { | 2821 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { |
2822 Register result = ToRegister(instr->result()); | 2822 Register result = ToRegister(instr->result()); |
2823 __ mov(result, Operand::ForCell(instr->hydrogen()->cell().handle())); | 2823 __ mov(result, Operand::ForCell(instr->hydrogen()->cell().handle())); |
2824 if (instr->hydrogen()->RequiresHoleCheck()) { | 2824 if (instr->hydrogen()->RequiresHoleCheck()) { |
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> |
| 2832 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { |
| 2833 DCHECK(FLAG_vector_ics); |
| 2834 Register vector = ToRegister(instr->temp_vector()); |
| 2835 DCHECK(vector.is(LoadIC::VectorRegister())); |
| 2836 __ mov(vector, instr->hydrogen()->feedback_vector()); |
| 2837 // No need to allocate this register. |
| 2838 DCHECK(LoadIC::SlotRegister().is(eax)); |
| 2839 __ mov(LoadIC::SlotRegister(), |
| 2840 Immediate(Smi::FromInt(instr->hydrogen()->slot()))); |
| 2841 } |
| 2842 |
| 2843 |
2831 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 2844 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
2832 DCHECK(ToRegister(instr->context()).is(esi)); | 2845 DCHECK(ToRegister(instr->context()).is(esi)); |
2833 DCHECK(ToRegister(instr->global_object()).is(LoadIC::ReceiverRegister())); | 2846 DCHECK(ToRegister(instr->global_object()).is(LoadIC::ReceiverRegister())); |
2834 DCHECK(ToRegister(instr->result()).is(eax)); | 2847 DCHECK(ToRegister(instr->result()).is(eax)); |
2835 | 2848 |
2836 __ mov(LoadIC::NameRegister(), instr->name()); | 2849 __ mov(LoadIC::NameRegister(), instr->name()); |
2837 if (FLAG_vector_ics) { | 2850 if (FLAG_vector_ics) { |
2838 Register vector = ToRegister(instr->temp_vector()); | 2851 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
2839 DCHECK(vector.is(LoadIC::VectorRegister())); | |
2840 __ mov(vector, instr->hydrogen()->feedback_vector()); | |
2841 // No need to allocate this register. | |
2842 DCHECK(LoadIC::SlotRegister().is(eax)); | |
2843 __ mov(LoadIC::SlotRegister(), | |
2844 Immediate(Smi::FromInt(instr->hydrogen()->slot()))); | |
2845 } | 2852 } |
2846 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 2853 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
2847 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); | 2854 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); |
2848 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2855 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2849 } | 2856 } |
2850 | 2857 |
2851 | 2858 |
2852 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 2859 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
2853 Register value = ToRegister(instr->value()); | 2860 Register value = ToRegister(instr->value()); |
2854 Handle<PropertyCell> cell_handle = instr->hydrogen()->cell().handle(); | 2861 Handle<PropertyCell> cell_handle = instr->hydrogen()->cell().handle(); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2971 } | 2978 } |
2972 | 2979 |
2973 | 2980 |
2974 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 2981 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
2975 DCHECK(ToRegister(instr->context()).is(esi)); | 2982 DCHECK(ToRegister(instr->context()).is(esi)); |
2976 DCHECK(ToRegister(instr->object()).is(LoadIC::ReceiverRegister())); | 2983 DCHECK(ToRegister(instr->object()).is(LoadIC::ReceiverRegister())); |
2977 DCHECK(ToRegister(instr->result()).is(eax)); | 2984 DCHECK(ToRegister(instr->result()).is(eax)); |
2978 | 2985 |
2979 __ mov(LoadIC::NameRegister(), instr->name()); | 2986 __ mov(LoadIC::NameRegister(), instr->name()); |
2980 if (FLAG_vector_ics) { | 2987 if (FLAG_vector_ics) { |
2981 Register vector = ToRegister(instr->temp_vector()); | 2988 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); |
2982 DCHECK(vector.is(LoadIC::VectorRegister())); | |
2983 __ mov(vector, instr->hydrogen()->feedback_vector()); | |
2984 // No need to allocate this register. | |
2985 DCHECK(LoadIC::SlotRegister().is(eax)); | |
2986 __ mov(LoadIC::SlotRegister(), | |
2987 Immediate(Smi::FromInt(instr->hydrogen()->slot()))); | |
2988 } | 2989 } |
2989 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); | 2990 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); |
2990 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2991 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2991 } | 2992 } |
2992 | 2993 |
2993 | 2994 |
2994 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 2995 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
2995 Register function = ToRegister(instr->function()); | 2996 Register function = ToRegister(instr->function()); |
2996 Register temp = ToRegister(instr->temp()); | 2997 Register temp = ToRegister(instr->temp()); |
2997 Register result = ToRegister(instr->result()); | 2998 Register result = ToRegister(instr->result()); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3204 } | 3205 } |
3205 } | 3206 } |
3206 | 3207 |
3207 | 3208 |
3208 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 3209 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
3209 DCHECK(ToRegister(instr->context()).is(esi)); | 3210 DCHECK(ToRegister(instr->context()).is(esi)); |
3210 DCHECK(ToRegister(instr->object()).is(LoadIC::ReceiverRegister())); | 3211 DCHECK(ToRegister(instr->object()).is(LoadIC::ReceiverRegister())); |
3211 DCHECK(ToRegister(instr->key()).is(LoadIC::NameRegister())); | 3212 DCHECK(ToRegister(instr->key()).is(LoadIC::NameRegister())); |
3212 | 3213 |
3213 if (FLAG_vector_ics) { | 3214 if (FLAG_vector_ics) { |
3214 Register vector = ToRegister(instr->temp_vector()); | 3215 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); |
3215 DCHECK(vector.is(LoadIC::VectorRegister())); | |
3216 __ mov(vector, instr->hydrogen()->feedback_vector()); | |
3217 // No need to allocate this register. | |
3218 DCHECK(LoadIC::SlotRegister().is(eax)); | |
3219 __ mov(LoadIC::SlotRegister(), | |
3220 Immediate(Smi::FromInt(instr->hydrogen()->slot()))); | |
3221 } | 3216 } |
3222 | 3217 |
3223 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 3218 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
3224 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3219 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3225 } | 3220 } |
3226 | 3221 |
3227 | 3222 |
3228 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { | 3223 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { |
3229 Register result = ToRegister(instr->result()); | 3224 Register result = ToRegister(instr->result()); |
3230 | 3225 |
(...skipping 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5673 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5668 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5674 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5669 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5675 } | 5670 } |
5676 | 5671 |
5677 | 5672 |
5678 #undef __ | 5673 #undef __ |
5679 | 5674 |
5680 } } // namespace v8::internal | 5675 } } // namespace v8::internal |
5681 | 5676 |
5682 #endif // V8_TARGET_ARCH_IA32 | 5677 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |