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 #include "src/arm/lithium-codegen-arm.h" | 7 #include "src/arm/lithium-codegen-arm.h" |
8 #include "src/arm/lithium-gap-resolver-arm.h" | 8 #include "src/arm/lithium-gap-resolver-arm.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/hydrogen-osr.h" | 10 #include "src/hydrogen-osr.h" |
(...skipping 2976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2987 __ cmp(result, ip); | 2987 __ cmp(result, ip); |
2988 DeoptimizeIf(eq, instr->environment()); | 2988 DeoptimizeIf(eq, instr->environment()); |
2989 } | 2989 } |
2990 } | 2990 } |
2991 | 2991 |
2992 | 2992 |
2993 template <class T> | 2993 template <class T> |
2994 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { | 2994 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { |
2995 DCHECK(FLAG_vector_ics); | 2995 DCHECK(FLAG_vector_ics); |
2996 Register vector = ToRegister(instr->temp_vector()); | 2996 Register vector = ToRegister(instr->temp_vector()); |
2997 DCHECK(vector.is(FullVectorLoadConvention::VectorRegister())); | 2997 DCHECK(vector.is(VectorLoadICDescriptor::VectorRegister())); |
2998 __ Move(vector, instr->hydrogen()->feedback_vector()); | 2998 __ Move(vector, instr->hydrogen()->feedback_vector()); |
2999 // No need to allocate this register. | 2999 // No need to allocate this register. |
3000 DCHECK(FullVectorLoadConvention::SlotRegister().is(r0)); | 3000 DCHECK(VectorLoadICDescriptor::SlotRegister().is(r0)); |
3001 __ mov(FullVectorLoadConvention::SlotRegister(), | 3001 __ mov(VectorLoadICDescriptor::SlotRegister(), |
3002 Operand(Smi::FromInt(instr->hydrogen()->slot()))); | 3002 Operand(Smi::FromInt(instr->hydrogen()->slot()))); |
3003 } | 3003 } |
3004 | 3004 |
3005 | 3005 |
3006 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 3006 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
3007 DCHECK(ToRegister(instr->context()).is(cp)); | 3007 DCHECK(ToRegister(instr->context()).is(cp)); |
3008 DCHECK(ToRegister(instr->global_object()) | 3008 DCHECK(ToRegister(instr->global_object()) |
3009 .is(LoadConvention::ReceiverRegister())); | 3009 .is(LoadDescriptor::ReceiverRegister())); |
3010 DCHECK(ToRegister(instr->result()).is(r0)); | 3010 DCHECK(ToRegister(instr->result()).is(r0)); |
3011 | 3011 |
3012 __ mov(LoadConvention::NameRegister(), Operand(instr->name())); | 3012 __ mov(LoadDescriptor::NameRegister(), Operand(instr->name())); |
3013 if (FLAG_vector_ics) { | 3013 if (FLAG_vector_ics) { |
3014 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 3014 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
3015 } | 3015 } |
3016 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 3016 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
3017 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); | 3017 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); |
3018 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3018 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3019 } | 3019 } |
3020 | 3020 |
3021 | 3021 |
3022 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 3022 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3121 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 3121 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
3122 object = result; | 3122 object = result; |
3123 } | 3123 } |
3124 MemOperand operand = FieldMemOperand(object, offset); | 3124 MemOperand operand = FieldMemOperand(object, offset); |
3125 __ Load(result, operand, access.representation()); | 3125 __ Load(result, operand, access.representation()); |
3126 } | 3126 } |
3127 | 3127 |
3128 | 3128 |
3129 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 3129 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
3130 DCHECK(ToRegister(instr->context()).is(cp)); | 3130 DCHECK(ToRegister(instr->context()).is(cp)); |
3131 DCHECK(ToRegister(instr->object()).is(LoadConvention::ReceiverRegister())); | 3131 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); |
3132 DCHECK(ToRegister(instr->result()).is(r0)); | 3132 DCHECK(ToRegister(instr->result()).is(r0)); |
3133 | 3133 |
3134 // Name is always in r2. | 3134 // Name is always in r2. |
3135 __ mov(LoadConvention::NameRegister(), Operand(instr->name())); | 3135 __ mov(LoadDescriptor::NameRegister(), Operand(instr->name())); |
3136 if (FLAG_vector_ics) { | 3136 if (FLAG_vector_ics) { |
3137 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); | 3137 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); |
3138 } | 3138 } |
3139 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); | 3139 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); |
3140 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 3140 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
3141 } | 3141 } |
3142 | 3142 |
3143 | 3143 |
3144 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 3144 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
3145 Register scratch = scratch0(); | 3145 Register scratch = scratch0(); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3413 } else { | 3413 } else { |
3414 DCHECK_EQ(-1, shift_size); | 3414 DCHECK_EQ(-1, shift_size); |
3415 __ add(scratch0(), base, Operand(key, ASR, 1)); | 3415 __ add(scratch0(), base, Operand(key, ASR, 1)); |
3416 return MemOperand(scratch0(), base_offset); | 3416 return MemOperand(scratch0(), base_offset); |
3417 } | 3417 } |
3418 } | 3418 } |
3419 | 3419 |
3420 | 3420 |
3421 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 3421 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
3422 DCHECK(ToRegister(instr->context()).is(cp)); | 3422 DCHECK(ToRegister(instr->context()).is(cp)); |
3423 DCHECK(ToRegister(instr->object()).is(LoadConvention::ReceiverRegister())); | 3423 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); |
3424 DCHECK(ToRegister(instr->key()).is(LoadConvention::NameRegister())); | 3424 DCHECK(ToRegister(instr->key()).is(LoadDescriptor::NameRegister())); |
3425 | 3425 |
3426 if (FLAG_vector_ics) { | 3426 if (FLAG_vector_ics) { |
3427 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); | 3427 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); |
3428 } | 3428 } |
3429 | 3429 |
3430 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 3430 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
3431 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 3431 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
3432 } | 3432 } |
3433 | 3433 |
3434 | 3434 |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3972 DCHECK(ToRegister(instr->result()).is(r0)); | 3972 DCHECK(ToRegister(instr->result()).is(r0)); |
3973 | 3973 |
3974 LPointerMap* pointers = instr->pointer_map(); | 3974 LPointerMap* pointers = instr->pointer_map(); |
3975 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 3975 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
3976 | 3976 |
3977 if (instr->target()->IsConstantOperand()) { | 3977 if (instr->target()->IsConstantOperand()) { |
3978 LConstantOperand* target = LConstantOperand::cast(instr->target()); | 3978 LConstantOperand* target = LConstantOperand::cast(instr->target()); |
3979 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); | 3979 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); |
3980 generator.BeforeCall(__ CallSize(code, RelocInfo::CODE_TARGET)); | 3980 generator.BeforeCall(__ CallSize(code, RelocInfo::CODE_TARGET)); |
3981 PlatformInterfaceDescriptor* call_descriptor = | 3981 PlatformInterfaceDescriptor* call_descriptor = |
3982 instr->descriptor()->platform_specific_descriptor(); | 3982 instr->descriptor().platform_specific_descriptor(); |
3983 __ Call(code, RelocInfo::CODE_TARGET, TypeFeedbackId::None(), al, | 3983 __ Call(code, RelocInfo::CODE_TARGET, TypeFeedbackId::None(), al, |
3984 call_descriptor->storage_mode()); | 3984 call_descriptor->storage_mode()); |
3985 } else { | 3985 } else { |
3986 DCHECK(instr->target()->IsRegister()); | 3986 DCHECK(instr->target()->IsRegister()); |
3987 Register target = ToRegister(instr->target()); | 3987 Register target = ToRegister(instr->target()); |
3988 generator.BeforeCall(__ CallSize(target)); | 3988 generator.BeforeCall(__ CallSize(target)); |
3989 // Make sure we don't emit any additional entries in the constant pool | 3989 // Make sure we don't emit any additional entries in the constant pool |
3990 // before the call to ensure that the CallCodeSize() calculated the correct | 3990 // before the call to ensure that the CallCodeSize() calculated the correct |
3991 // number of instructions for the constant pool load. | 3991 // number of instructions for the constant pool load. |
3992 { | 3992 { |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4192 EMIT_REMEMBERED_SET, | 4192 EMIT_REMEMBERED_SET, |
4193 instr->hydrogen()->SmiCheckForWriteBarrier(), | 4193 instr->hydrogen()->SmiCheckForWriteBarrier(), |
4194 instr->hydrogen()->PointersToHereCheckForValue()); | 4194 instr->hydrogen()->PointersToHereCheckForValue()); |
4195 } | 4195 } |
4196 } | 4196 } |
4197 } | 4197 } |
4198 | 4198 |
4199 | 4199 |
4200 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4200 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
4201 DCHECK(ToRegister(instr->context()).is(cp)); | 4201 DCHECK(ToRegister(instr->context()).is(cp)); |
4202 DCHECK(ToRegister(instr->object()).is(StoreConvention::ReceiverRegister())); | 4202 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4203 DCHECK(ToRegister(instr->value()).is(StoreConvention::ValueRegister())); | 4203 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4204 | 4204 |
4205 __ mov(StoreConvention::NameRegister(), Operand(instr->name())); | 4205 __ mov(StoreDescriptor::NameRegister(), Operand(instr->name())); |
4206 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode()); | 4206 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode()); |
4207 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 4207 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
4208 } | 4208 } |
4209 | 4209 |
4210 | 4210 |
4211 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4211 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4212 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; | 4212 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; |
4213 if (instr->index()->IsConstantOperand()) { | 4213 if (instr->index()->IsConstantOperand()) { |
4214 Operand index = ToOperand(instr->index()); | 4214 Operand index = ToOperand(instr->index()); |
4215 Register length = ToRegister(instr->length()); | 4215 Register length = ToRegister(instr->length()); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4413 } else if (instr->hydrogen()->value()->representation().IsDouble()) { | 4413 } else if (instr->hydrogen()->value()->representation().IsDouble()) { |
4414 DoStoreKeyedFixedDoubleArray(instr); | 4414 DoStoreKeyedFixedDoubleArray(instr); |
4415 } else { | 4415 } else { |
4416 DoStoreKeyedFixedArray(instr); | 4416 DoStoreKeyedFixedArray(instr); |
4417 } | 4417 } |
4418 } | 4418 } |
4419 | 4419 |
4420 | 4420 |
4421 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4421 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
4422 DCHECK(ToRegister(instr->context()).is(cp)); | 4422 DCHECK(ToRegister(instr->context()).is(cp)); |
4423 DCHECK(ToRegister(instr->object()).is(StoreConvention::ReceiverRegister())); | 4423 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4424 DCHECK(ToRegister(instr->key()).is(StoreConvention::NameRegister())); | 4424 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); |
4425 DCHECK(ToRegister(instr->value()).is(StoreConvention::ValueRegister())); | 4425 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4426 | 4426 |
4427 Handle<Code> ic = instr->strict_mode() == STRICT | 4427 Handle<Code> ic = instr->strict_mode() == STRICT |
4428 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 4428 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
4429 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 4429 : isolate()->builtins()->KeyedStoreIC_Initialize(); |
4430 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 4430 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
4431 } | 4431 } |
4432 | 4432 |
4433 | 4433 |
4434 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { | 4434 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { |
4435 Register object_reg = ToRegister(instr->object()); | 4435 Register object_reg = ToRegister(instr->object()); |
(...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5879 __ Push(scope_info); | 5879 __ Push(scope_info); |
5880 __ push(ToRegister(instr->function())); | 5880 __ push(ToRegister(instr->function())); |
5881 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5881 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5882 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5882 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5883 } | 5883 } |
5884 | 5884 |
5885 | 5885 |
5886 #undef __ | 5886 #undef __ |
5887 | 5887 |
5888 } } // namespace v8::internal | 5888 } } // namespace v8::internal |
OLD | NEW |