OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/arm64/lithium-codegen-arm64.h" | 7 #include "src/arm64/lithium-codegen-arm64.h" |
8 #include "src/arm64/lithium-gap-resolver-arm64.h" | 8 #include "src/arm64/lithium-gap-resolver-arm64.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | 2015 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
2016 } else { | 2016 } else { |
2017 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 2017 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
2018 ParameterCount count(arity); | 2018 ParameterCount count(arity); |
2019 ParameterCount expected(formal_parameter_count); | 2019 ParameterCount expected(formal_parameter_count); |
2020 __ InvokeFunction(function_reg, expected, count, CALL_FUNCTION, generator); | 2020 __ InvokeFunction(function_reg, expected, count, CALL_FUNCTION, generator); |
2021 } | 2021 } |
2022 } | 2022 } |
2023 | 2023 |
2024 | 2024 |
2025 void LCodeGen::DoTailCallThroughMegamorphicCache( | |
2026 LTailCallThroughMegamorphicCache* instr) { | |
2027 Register receiver = ToRegister(instr->receiver()); | |
2028 Register name = ToRegister(instr->name()); | |
2029 DCHECK(receiver.is(LoadDescriptor::ReceiverRegister())); | |
2030 DCHECK(name.is(LoadDescriptor::NameRegister())); | |
2031 DCHECK(receiver.is(x1)); | |
2032 DCHECK(name.is(x2)); | |
2033 Register scratch = x4; | |
2034 Register extra = x5; | |
2035 Register extra2 = x6; | |
2036 Register extra3 = x7; | |
2037 | |
2038 // The probe will tail call to a handler if found. | |
2039 isolate()->stub_cache()->GenerateProbe( | |
2040 masm(), Code::LOAD_IC, instr->hydrogen()->flags(), false, receiver, name, | |
2041 scratch, extra, extra2, extra3); | |
2042 | |
2043 // Tail call to miss if we ended up here. | |
2044 LoadIC::GenerateMiss(masm()); | |
2045 } | |
2046 | |
2047 | |
2048 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) { | 2025 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) { |
2049 DCHECK(instr->IsMarkedAsCall()); | 2026 DCHECK(instr->IsMarkedAsCall()); |
2050 DCHECK(ToRegister(instr->result()).Is(x0)); | 2027 DCHECK(ToRegister(instr->result()).Is(x0)); |
2051 | 2028 |
2052 if (instr->hydrogen()->IsTailCall()) { | 2029 if (instr->hydrogen()->IsTailCall()) { |
2053 if (NeedsEagerFrame()) __ LeaveFrame(StackFrame::INTERNAL); | 2030 if (NeedsEagerFrame()) __ LeaveFrame(StackFrame::INTERNAL); |
2054 | 2031 |
2055 if (instr->target()->IsConstantOperand()) { | 2032 if (instr->target()->IsConstantOperand()) { |
2056 LConstantOperand* target = LConstantOperand::cast(instr->target()); | 2033 LConstantOperand* target = LConstantOperand::cast(instr->target()); |
2057 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); | 2034 Handle<Code> code = Handle<Code>::cast(ToHandle(target)); |
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3355 // Get the prototype from the initial map. | 3332 // Get the prototype from the initial map. |
3356 __ Ldr(result, FieldMemOperand(result, Map::kPrototypeOffset)); | 3333 __ Ldr(result, FieldMemOperand(result, Map::kPrototypeOffset)); |
3357 | 3334 |
3358 // All done. | 3335 // All done. |
3359 __ Bind(&done); | 3336 __ Bind(&done); |
3360 } | 3337 } |
3361 | 3338 |
3362 | 3339 |
3363 template <class T> | 3340 template <class T> |
3364 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { | 3341 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { |
3365 DCHECK(FLAG_vector_ics); | |
3366 Register vector_register = ToRegister(instr->temp_vector()); | 3342 Register vector_register = ToRegister(instr->temp_vector()); |
3367 Register slot_register = VectorLoadICDescriptor::SlotRegister(); | 3343 Register slot_register = VectorLoadICDescriptor::SlotRegister(); |
3368 DCHECK(vector_register.is(VectorLoadICDescriptor::VectorRegister())); | 3344 DCHECK(vector_register.is(VectorLoadICDescriptor::VectorRegister())); |
3369 DCHECK(slot_register.is(x0)); | 3345 DCHECK(slot_register.is(x0)); |
3370 | 3346 |
3371 AllowDeferredHandleDereference vector_structure_check; | 3347 AllowDeferredHandleDereference vector_structure_check; |
3372 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); | 3348 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); |
3373 __ Mov(vector_register, vector); | 3349 __ Mov(vector_register, vector); |
3374 // No need to allocate this register. | 3350 // No need to allocate this register. |
3375 FeedbackVectorICSlot slot = instr->hydrogen()->slot(); | 3351 FeedbackVectorICSlot slot = instr->hydrogen()->slot(); |
3376 int index = vector->GetIndex(slot); | 3352 int index = vector->GetIndex(slot); |
3377 __ Mov(slot_register, Smi::FromInt(index)); | 3353 __ Mov(slot_register, Smi::FromInt(index)); |
3378 } | 3354 } |
3379 | 3355 |
3380 | 3356 |
3381 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 3357 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
3382 DCHECK(ToRegister(instr->context()).is(cp)); | 3358 DCHECK(ToRegister(instr->context()).is(cp)); |
3383 DCHECK(ToRegister(instr->global_object()) | 3359 DCHECK(ToRegister(instr->global_object()) |
3384 .is(LoadDescriptor::ReceiverRegister())); | 3360 .is(LoadDescriptor::ReceiverRegister())); |
3385 DCHECK(ToRegister(instr->result()).Is(x0)); | 3361 DCHECK(ToRegister(instr->result()).Is(x0)); |
3386 __ Mov(LoadDescriptor::NameRegister(), Operand(instr->name())); | 3362 __ Mov(LoadDescriptor::NameRegister(), Operand(instr->name())); |
3387 if (FLAG_vector_ics) { | 3363 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
3388 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | |
3389 } | |
3390 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 3364 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
3391 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, | 3365 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, |
3392 PREMONOMORPHIC).code(); | 3366 PREMONOMORPHIC).code(); |
3393 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3367 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3394 } | 3368 } |
3395 | 3369 |
3396 | 3370 |
3397 MemOperand LCodeGen::PrepareKeyedExternalArrayOperand( | 3371 MemOperand LCodeGen::PrepareKeyedExternalArrayOperand( |
3398 Register key, | 3372 Register key, |
3399 Register base, | 3373 Register base, |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3706 __ Load(result, FieldMemOperand(source, offset), access.representation()); | 3680 __ Load(result, FieldMemOperand(source, offset), access.representation()); |
3707 } | 3681 } |
3708 } | 3682 } |
3709 | 3683 |
3710 | 3684 |
3711 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 3685 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
3712 DCHECK(ToRegister(instr->context()).is(cp)); | 3686 DCHECK(ToRegister(instr->context()).is(cp)); |
3713 // LoadIC expects name and receiver in registers. | 3687 // LoadIC expects name and receiver in registers. |
3714 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); | 3688 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); |
3715 __ Mov(LoadDescriptor::NameRegister(), Operand(instr->name())); | 3689 __ Mov(LoadDescriptor::NameRegister(), Operand(instr->name())); |
3716 if (FLAG_vector_ics) { | 3690 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); |
3717 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); | |
3718 } | |
3719 | 3691 |
3720 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode( | 3692 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode( |
3721 isolate(), NOT_CONTEXTUAL, | 3693 isolate(), NOT_CONTEXTUAL, |
3722 instr->hydrogen()->initialization_state()).code(); | 3694 instr->hydrogen()->initialization_state()).code(); |
3723 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3695 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3724 | 3696 |
3725 DCHECK(ToRegister(instr->result()).is(x0)); | 3697 DCHECK(ToRegister(instr->result()).is(x0)); |
3726 } | 3698 } |
3727 | 3699 |
3728 | 3700 |
(...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6135 Handle<ScopeInfo> scope_info = instr->scope_info(); | 6107 Handle<ScopeInfo> scope_info = instr->scope_info(); |
6136 __ Push(scope_info); | 6108 __ Push(scope_info); |
6137 __ Push(ToRegister(instr->function())); | 6109 __ Push(ToRegister(instr->function())); |
6138 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6110 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6139 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6111 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6140 } | 6112 } |
6141 | 6113 |
6142 | 6114 |
6143 | 6115 |
6144 } } // namespace v8::internal | 6116 } } // namespace v8::internal |
OLD | NEW |