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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 Label ok; | 528 Label ok; |
529 __ CompareRoot(masm->StackPointer(), Heap::kStackLimitRootIndex); | 529 __ CompareRoot(masm->StackPointer(), Heap::kStackLimitRootIndex); |
530 __ B(hs, &ok); | 530 __ B(hs, &ok); |
531 | 531 |
532 GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode); | 532 GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode); |
533 | 533 |
534 __ Bind(&ok); | 534 __ Bind(&ok); |
535 GenerateTailCallToSharedCode(masm); | 535 GenerateTailCallToSharedCode(masm); |
536 } | 536 } |
537 | 537 |
538 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 538 namespace { |
539 bool is_api_function, | 539 |
540 bool create_implicit_receiver, | 540 void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function, |
541 bool check_derived_construct) { | 541 bool create_implicit_receiver, |
| 542 bool check_derived_construct) { |
542 // ----------- S t a t e ------------- | 543 // ----------- S t a t e ------------- |
543 // -- x0 : number of arguments | 544 // -- x0 : number of arguments |
544 // -- x1 : constructor function | 545 // -- x1 : constructor function |
545 // -- x2 : allocation site or undefined | |
546 // -- x3 : new target | 546 // -- x3 : new target |
547 // -- lr : return address | 547 // -- lr : return address |
548 // -- cp : context pointer | 548 // -- cp : context pointer |
549 // -- sp[...]: constructor arguments | 549 // -- sp[...]: constructor arguments |
550 // ----------------------------------- | 550 // ----------------------------------- |
551 | 551 |
552 ASM_LOCATION("Builtins::Generate_JSConstructStubHelper"); | 552 ASM_LOCATION("Builtins::Generate_JSConstructStubHelper"); |
553 | 553 |
554 Isolate* isolate = masm->isolate(); | 554 Isolate* isolate = masm->isolate(); |
555 | 555 |
556 // Enter a construct frame. | 556 // Enter a construct frame. |
557 { | 557 { |
558 FrameScope scope(masm, StackFrame::CONSTRUCT); | 558 FrameScope scope(masm, StackFrame::CONSTRUCT); |
559 | 559 |
560 // Preserve the four incoming parameters on the stack. | 560 // Preserve the four incoming parameters on the stack. |
561 Register argc = x0; | 561 Register argc = x0; |
562 Register constructor = x1; | 562 Register constructor = x1; |
563 Register allocation_site = x2; | |
564 Register new_target = x3; | 563 Register new_target = x3; |
565 | 564 |
566 // Preserve the incoming parameters on the stack. | 565 // Preserve the incoming parameters on the stack. |
567 __ AssertUndefinedOrAllocationSite(allocation_site, x10); | |
568 __ Push(cp); | |
569 __ SmiTag(argc); | 566 __ SmiTag(argc); |
570 __ Push(allocation_site, argc); | 567 __ Push(cp, argc); |
571 | 568 |
572 if (create_implicit_receiver) { | 569 if (create_implicit_receiver) { |
573 // Allocate the new receiver object. | 570 // Allocate the new receiver object. |
574 __ Push(constructor, new_target); | 571 __ Push(constructor, new_target); |
575 FastNewObjectStub stub(masm->isolate()); | 572 FastNewObjectStub stub(masm->isolate()); |
576 __ CallStub(&stub); | 573 __ CallStub(&stub); |
577 __ Mov(x4, x0); | 574 __ Mov(x4, x0); |
578 __ Pop(new_target, constructor); | 575 __ Pop(new_target, constructor); |
579 | 576 |
580 // ----------- S t a t e ------------- | 577 // ----------- S t a t e ------------- |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 } | 693 } |
697 | 694 |
698 __ DropBySMI(x1); | 695 __ DropBySMI(x1); |
699 __ Drop(1); | 696 __ Drop(1); |
700 if (create_implicit_receiver) { | 697 if (create_implicit_receiver) { |
701 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, x1, x2); | 698 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, x1, x2); |
702 } | 699 } |
703 __ Ret(); | 700 __ Ret(); |
704 } | 701 } |
705 | 702 |
| 703 } // namespace |
| 704 |
706 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { | 705 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { |
707 Generate_JSConstructStubHelper(masm, false, true, false); | 706 Generate_JSConstructStubHelper(masm, false, true, false); |
708 } | 707 } |
709 | 708 |
710 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { | 709 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
711 Generate_JSConstructStubHelper(masm, true, false, false); | 710 Generate_JSConstructStubHelper(masm, true, false, false); |
712 } | 711 } |
713 | 712 |
714 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { | 713 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { |
715 Generate_JSConstructStubHelper(masm, false, false, false); | 714 Generate_JSConstructStubHelper(masm, false, false, false); |
(...skipping 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3006 __ Unreachable(); | 3005 __ Unreachable(); |
3007 } | 3006 } |
3008 } | 3007 } |
3009 | 3008 |
3010 #undef __ | 3009 #undef __ |
3011 | 3010 |
3012 } // namespace internal | 3011 } // namespace internal |
3013 } // namespace v8 | 3012 } // namespace v8 |
3014 | 3013 |
3015 #endif // V8_TARGET_ARCH_ARM | 3014 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |