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-stubs.h" | 11 #include "src/code-stubs.h" |
11 #include "src/hydrogen-osr.h" | 12 #include "src/hydrogen-osr.h" |
12 #include "src/ic/stub-cache.h" | 13 #include "src/ic/stub-cache.h" |
13 | 14 |
14 namespace v8 { | 15 namespace v8 { |
15 namespace internal { | 16 namespace internal { |
16 | 17 |
17 | 18 |
18 class SafepointGenerator FINAL : public CallWrapper { | 19 class SafepointGenerator FINAL : public CallWrapper { |
19 public: | 20 public: |
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1775 } | 1776 } |
1776 } | 1777 } |
1777 | 1778 |
1778 | 1779 |
1779 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { | 1780 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { |
1780 DCHECK(ToRegister(instr->context()).is(cp)); | 1781 DCHECK(ToRegister(instr->context()).is(cp)); |
1781 DCHECK(ToRegister(instr->left()).is(x1)); | 1782 DCHECK(ToRegister(instr->left()).is(x1)); |
1782 DCHECK(ToRegister(instr->right()).is(x0)); | 1783 DCHECK(ToRegister(instr->right()).is(x0)); |
1783 DCHECK(ToRegister(instr->result()).is(x0)); | 1784 DCHECK(ToRegister(instr->result()).is(x0)); |
1784 | 1785 |
1785 BinaryOpICStub stub(isolate(), instr->op(), NO_OVERWRITE); | 1786 Handle<Code> code = |
1786 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 1787 CodeFactory::BinaryOpIC(isolate(), instr->op(), NO_OVERWRITE).code(); |
| 1788 CallCode(code, RelocInfo::CODE_TARGET, instr); |
1787 } | 1789 } |
1788 | 1790 |
1789 | 1791 |
1790 void LCodeGen::DoBitI(LBitI* instr) { | 1792 void LCodeGen::DoBitI(LBitI* instr) { |
1791 Register result = ToRegister32(instr->result()); | 1793 Register result = ToRegister32(instr->result()); |
1792 Register left = ToRegister32(instr->left()); | 1794 Register left = ToRegister32(instr->left()); |
1793 Operand right = ToShiftedRightOperand32(instr->right(), instr); | 1795 Operand right = ToShiftedRightOperand32(instr->right(), instr); |
1794 | 1796 |
1795 switch (instr->op()) { | 1797 switch (instr->op()) { |
1796 case Token::BIT_AND: __ And(result, left, right); break; | 1798 case Token::BIT_AND: __ And(result, left, right); break; |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2541 } | 2543 } |
2542 | 2544 |
2543 | 2545 |
2544 void LCodeGen::DoCmpT(LCmpT* instr) { | 2546 void LCodeGen::DoCmpT(LCmpT* instr) { |
2545 DCHECK(ToRegister(instr->context()).is(cp)); | 2547 DCHECK(ToRegister(instr->context()).is(cp)); |
2546 Token::Value op = instr->op(); | 2548 Token::Value op = instr->op(); |
2547 Condition cond = TokenToCondition(op, false); | 2549 Condition cond = TokenToCondition(op, false); |
2548 | 2550 |
2549 DCHECK(ToRegister(instr->left()).Is(x1)); | 2551 DCHECK(ToRegister(instr->left()).Is(x1)); |
2550 DCHECK(ToRegister(instr->right()).Is(x0)); | 2552 DCHECK(ToRegister(instr->right()).Is(x0)); |
2551 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); | 2553 Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code(); |
2552 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2554 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2553 // Signal that we don't inline smi code before this stub. | 2555 // Signal that we don't inline smi code before this stub. |
2554 InlineSmiCheckInfo::EmitNotInlined(masm()); | 2556 InlineSmiCheckInfo::EmitNotInlined(masm()); |
2555 | 2557 |
2556 // Return true or false depending on CompareIC result. | 2558 // Return true or false depending on CompareIC result. |
2557 // This instruction is marked as call. We can clobber any register. | 2559 // This instruction is marked as call. We can clobber any register. |
2558 DCHECK(instr->IsMarkedAsCall()); | 2560 DCHECK(instr->IsMarkedAsCall()); |
2559 __ LoadTrueFalseRoots(x1, x2); | 2561 __ LoadTrueFalseRoots(x1, x2); |
2560 __ Cmp(x0, 0); | 2562 __ Cmp(x0, 0); |
2561 __ Csel(ToRegister(instr->result()), x1, x2, cond); | 2563 __ Csel(ToRegister(instr->result()), x1, x2, cond); |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3389 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 3391 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
3390 DCHECK(ToRegister(instr->context()).is(cp)); | 3392 DCHECK(ToRegister(instr->context()).is(cp)); |
3391 DCHECK(ToRegister(instr->global_object()) | 3393 DCHECK(ToRegister(instr->global_object()) |
3392 .is(LoadDescriptor::ReceiverRegister())); | 3394 .is(LoadDescriptor::ReceiverRegister())); |
3393 DCHECK(ToRegister(instr->result()).Is(x0)); | 3395 DCHECK(ToRegister(instr->result()).Is(x0)); |
3394 __ Mov(LoadDescriptor::NameRegister(), Operand(instr->name())); | 3396 __ Mov(LoadDescriptor::NameRegister(), Operand(instr->name())); |
3395 if (FLAG_vector_ics) { | 3397 if (FLAG_vector_ics) { |
3396 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 3398 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
3397 } | 3399 } |
3398 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 3400 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
3399 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); | 3401 Handle<Code> ic = CodeFactory::LoadIC(isolate(), mode).code(); |
3400 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3402 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3401 } | 3403 } |
3402 | 3404 |
3403 | 3405 |
3404 MemOperand LCodeGen::PrepareKeyedExternalArrayOperand( | 3406 MemOperand LCodeGen::PrepareKeyedExternalArrayOperand( |
3405 Register key, | 3407 Register key, |
3406 Register base, | 3408 Register base, |
3407 Register scratch, | 3409 Register scratch, |
3408 bool key_is_smi, | 3410 bool key_is_smi, |
3409 bool key_is_constant, | 3411 bool key_is_constant, |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3644 | 3646 |
3645 | 3647 |
3646 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 3648 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
3647 DCHECK(ToRegister(instr->context()).is(cp)); | 3649 DCHECK(ToRegister(instr->context()).is(cp)); |
3648 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); | 3650 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); |
3649 DCHECK(ToRegister(instr->key()).is(LoadDescriptor::NameRegister())); | 3651 DCHECK(ToRegister(instr->key()).is(LoadDescriptor::NameRegister())); |
3650 if (FLAG_vector_ics) { | 3652 if (FLAG_vector_ics) { |
3651 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); | 3653 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); |
3652 } | 3654 } |
3653 | 3655 |
3654 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 3656 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
3655 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3657 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3656 | 3658 |
3657 DCHECK(ToRegister(instr->result()).Is(x0)); | 3659 DCHECK(ToRegister(instr->result()).Is(x0)); |
3658 } | 3660 } |
3659 | 3661 |
3660 | 3662 |
3661 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 3663 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
3662 HObjectAccess access = instr->hydrogen()->access(); | 3664 HObjectAccess access = instr->hydrogen()->access(); |
3663 int offset = access.offset(); | 3665 int offset = access.offset(); |
3664 Register object = ToRegister(instr->object()); | 3666 Register object = ToRegister(instr->object()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3700 | 3702 |
3701 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 3703 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
3702 DCHECK(ToRegister(instr->context()).is(cp)); | 3704 DCHECK(ToRegister(instr->context()).is(cp)); |
3703 // LoadIC expects name and receiver in registers. | 3705 // LoadIC expects name and receiver in registers. |
3704 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); | 3706 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); |
3705 __ Mov(LoadDescriptor::NameRegister(), Operand(instr->name())); | 3707 __ Mov(LoadDescriptor::NameRegister(), Operand(instr->name())); |
3706 if (FLAG_vector_ics) { | 3708 if (FLAG_vector_ics) { |
3707 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); | 3709 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); |
3708 } | 3710 } |
3709 | 3711 |
3710 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); | 3712 Handle<Code> ic = CodeFactory::LoadIC(isolate(), NOT_CONTEXTUAL).code(); |
3711 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3713 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3712 | 3714 |
3713 DCHECK(ToRegister(instr->result()).is(x0)); | 3715 DCHECK(ToRegister(instr->result()).is(x0)); |
3714 } | 3716 } |
3715 | 3717 |
3716 | 3718 |
3717 void LCodeGen::DoLoadRoot(LLoadRoot* instr) { | 3719 void LCodeGen::DoLoadRoot(LLoadRoot* instr) { |
3718 Register result = ToRegister(instr->result()); | 3720 Register result = ToRegister(instr->result()); |
3719 __ LoadRoot(result, instr->index()); | 3721 __ LoadRoot(result, instr->index()); |
3720 } | 3722 } |
(...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5338 } | 5340 } |
5339 } | 5341 } |
5340 | 5342 |
5341 | 5343 |
5342 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 5344 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
5343 DCHECK(ToRegister(instr->context()).is(cp)); | 5345 DCHECK(ToRegister(instr->context()).is(cp)); |
5344 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 5346 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
5345 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); | 5347 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); |
5346 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 5348 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
5347 | 5349 |
5348 Handle<Code> ic = instr->strict_mode() == STRICT | 5350 Handle<Code> ic = |
5349 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 5351 CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code(); |
5350 : isolate()->builtins()->KeyedStoreIC_Initialize(); | |
5351 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 5352 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
5352 } | 5353 } |
5353 | 5354 |
5354 | 5355 |
5355 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 5356 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
5356 Representation representation = instr->representation(); | 5357 Representation representation = instr->representation(); |
5357 | 5358 |
5358 Register object = ToRegister(instr->object()); | 5359 Register object = ToRegister(instr->object()); |
5359 HObjectAccess access = instr->hydrogen()->access(); | 5360 HObjectAccess access = instr->hydrogen()->access(); |
5360 int offset = access.offset(); | 5361 int offset = access.offset(); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5557 __ SmiTagAndPush(char_code); | 5558 __ SmiTagAndPush(char_code); |
5558 CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr, instr->context()); | 5559 CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr, instr->context()); |
5559 __ StoreToSafepointRegisterSlot(x0, result); | 5560 __ StoreToSafepointRegisterSlot(x0, result); |
5560 } | 5561 } |
5561 | 5562 |
5562 | 5563 |
5563 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { | 5564 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { |
5564 DCHECK(ToRegister(instr->context()).is(cp)); | 5565 DCHECK(ToRegister(instr->context()).is(cp)); |
5565 Token::Value op = instr->op(); | 5566 Token::Value op = instr->op(); |
5566 | 5567 |
5567 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); | 5568 Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code(); |
5568 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 5569 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
5569 InlineSmiCheckInfo::EmitNotInlined(masm()); | 5570 InlineSmiCheckInfo::EmitNotInlined(masm()); |
5570 | 5571 |
5571 Condition condition = TokenToCondition(op, false); | 5572 Condition condition = TokenToCondition(op, false); |
5572 | 5573 |
5573 EmitCompareAndBranch(instr, condition, x0, 0); | 5574 EmitCompareAndBranch(instr, condition, x0, 0); |
5574 } | 5575 } |
5575 | 5576 |
5576 | 5577 |
5577 void LCodeGen::DoSubI(LSubI* instr) { | 5578 void LCodeGen::DoSubI(LSubI* instr) { |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6053 Handle<ScopeInfo> scope_info = instr->scope_info(); | 6054 Handle<ScopeInfo> scope_info = instr->scope_info(); |
6054 __ Push(scope_info); | 6055 __ Push(scope_info); |
6055 __ Push(ToRegister(instr->function())); | 6056 __ Push(ToRegister(instr->function())); |
6056 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6057 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6057 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6058 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6058 } | 6059 } |
6059 | 6060 |
6060 | 6061 |
6061 | 6062 |
6062 } } // namespace v8::internal | 6063 } } // namespace v8::internal |
OLD | NEW |