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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 2945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2956 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { | 2956 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { |
2957 Register result = ToRegister(instr->result()); | 2957 Register result = ToRegister(instr->result()); |
2958 __ mov(result, Operand::ForCell(instr->hydrogen()->cell().handle())); | 2958 __ mov(result, Operand::ForCell(instr->hydrogen()->cell().handle())); |
2959 if (instr->hydrogen()->RequiresHoleCheck()) { | 2959 if (instr->hydrogen()->RequiresHoleCheck()) { |
2960 __ cmp(result, factory()->the_hole_value()); | 2960 __ cmp(result, factory()->the_hole_value()); |
2961 DeoptimizeIf(equal, instr->environment()); | 2961 DeoptimizeIf(equal, instr->environment()); |
2962 } | 2962 } |
2963 } | 2963 } |
2964 | 2964 |
2965 | 2965 |
| 2966 template <class T> |
| 2967 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { |
| 2968 DCHECK(FLAG_vector_ics); |
| 2969 Register vector = ToRegister(instr->temp_vector()); |
| 2970 DCHECK(vector.is(LoadIC::VectorRegister())); |
| 2971 __ mov(vector, instr->hydrogen()->feedback_vector()); |
| 2972 // No need to allocate this register. |
| 2973 DCHECK(LoadIC::SlotRegister().is(eax)); |
| 2974 __ mov(LoadIC::SlotRegister(), |
| 2975 Immediate(Smi::FromInt(instr->hydrogen()->slot()))); |
| 2976 } |
| 2977 |
| 2978 |
2966 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 2979 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
2967 DCHECK(ToRegister(instr->context()).is(esi)); | 2980 DCHECK(ToRegister(instr->context()).is(esi)); |
2968 DCHECK(ToRegister(instr->global_object()).is(LoadIC::ReceiverRegister())); | 2981 DCHECK(ToRegister(instr->global_object()).is(LoadIC::ReceiverRegister())); |
2969 DCHECK(ToRegister(instr->result()).is(eax)); | 2982 DCHECK(ToRegister(instr->result()).is(eax)); |
2970 | 2983 |
2971 __ mov(LoadIC::NameRegister(), instr->name()); | 2984 __ mov(LoadIC::NameRegister(), instr->name()); |
2972 if (FLAG_vector_ics) { | 2985 if (FLAG_vector_ics) { |
2973 Register vector = ToRegister(instr->temp_vector()); | 2986 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
2974 DCHECK(vector.is(LoadIC::VectorRegister())); | |
2975 __ mov(vector, instr->hydrogen()->feedback_vector()); | |
2976 // No need to allocate this register. | |
2977 DCHECK(LoadIC::SlotRegister().is(eax)); | |
2978 __ mov(LoadIC::SlotRegister(), | |
2979 Immediate(Smi::FromInt(instr->hydrogen()->slot()))); | |
2980 } | 2987 } |
2981 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 2988 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
2982 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); | 2989 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); |
2983 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2990 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2984 } | 2991 } |
2985 | 2992 |
2986 | 2993 |
2987 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 2994 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
2988 Register value = ToRegister(instr->value()); | 2995 Register value = ToRegister(instr->value()); |
2989 Handle<PropertyCell> cell_handle = instr->hydrogen()->cell().handle(); | 2996 Handle<PropertyCell> cell_handle = instr->hydrogen()->cell().handle(); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3104 } | 3111 } |
3105 | 3112 |
3106 | 3113 |
3107 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 3114 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
3108 DCHECK(ToRegister(instr->context()).is(esi)); | 3115 DCHECK(ToRegister(instr->context()).is(esi)); |
3109 DCHECK(ToRegister(instr->object()).is(LoadIC::ReceiverRegister())); | 3116 DCHECK(ToRegister(instr->object()).is(LoadIC::ReceiverRegister())); |
3110 DCHECK(ToRegister(instr->result()).is(eax)); | 3117 DCHECK(ToRegister(instr->result()).is(eax)); |
3111 | 3118 |
3112 __ mov(LoadIC::NameRegister(), instr->name()); | 3119 __ mov(LoadIC::NameRegister(), instr->name()); |
3113 if (FLAG_vector_ics) { | 3120 if (FLAG_vector_ics) { |
3114 Register vector = ToRegister(instr->temp_vector()); | 3121 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); |
3115 DCHECK(vector.is(LoadIC::VectorRegister())); | |
3116 __ mov(vector, instr->hydrogen()->feedback_vector()); | |
3117 // No need to allocate this register. | |
3118 DCHECK(LoadIC::SlotRegister().is(eax)); | |
3119 __ mov(LoadIC::SlotRegister(), | |
3120 Immediate(Smi::FromInt(instr->hydrogen()->slot()))); | |
3121 } | 3122 } |
3122 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); | 3123 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); |
3123 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3124 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3124 } | 3125 } |
3125 | 3126 |
3126 | 3127 |
3127 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 3128 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
3128 Register function = ToRegister(instr->function()); | 3129 Register function = ToRegister(instr->function()); |
3129 Register temp = ToRegister(instr->temp()); | 3130 Register temp = ToRegister(instr->temp()); |
3130 Register result = ToRegister(instr->result()); | 3131 Register result = ToRegister(instr->result()); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3334 } | 3335 } |
3335 } | 3336 } |
3336 | 3337 |
3337 | 3338 |
3338 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 3339 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
3339 DCHECK(ToRegister(instr->context()).is(esi)); | 3340 DCHECK(ToRegister(instr->context()).is(esi)); |
3340 DCHECK(ToRegister(instr->object()).is(LoadIC::ReceiverRegister())); | 3341 DCHECK(ToRegister(instr->object()).is(LoadIC::ReceiverRegister())); |
3341 DCHECK(ToRegister(instr->key()).is(LoadIC::NameRegister())); | 3342 DCHECK(ToRegister(instr->key()).is(LoadIC::NameRegister())); |
3342 | 3343 |
3343 if (FLAG_vector_ics) { | 3344 if (FLAG_vector_ics) { |
3344 Register vector = ToRegister(instr->temp_vector()); | 3345 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); |
3345 DCHECK(vector.is(LoadIC::VectorRegister())); | |
3346 __ mov(vector, instr->hydrogen()->feedback_vector()); | |
3347 // No need to allocate this register. | |
3348 DCHECK(LoadIC::SlotRegister().is(eax)); | |
3349 __ mov(LoadIC::SlotRegister(), | |
3350 Immediate(Smi::FromInt(instr->hydrogen()->slot()))); | |
3351 } | 3346 } |
3352 | 3347 |
3353 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 3348 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
3354 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3349 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3355 } | 3350 } |
3356 | 3351 |
3357 | 3352 |
3358 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { | 3353 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { |
3359 Register result = ToRegister(instr->result()); | 3354 Register result = ToRegister(instr->result()); |
3360 | 3355 |
(...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5706 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5701 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5707 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5702 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5708 } | 5703 } |
5709 | 5704 |
5710 | 5705 |
5711 #undef __ | 5706 #undef __ |
5712 | 5707 |
5713 } } // namespace v8::internal | 5708 } } // namespace v8::internal |
5714 | 5709 |
5715 #endif // V8_TARGET_ARCH_X87 | 5710 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |