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 #if V8_TARGET_ARCH_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 __ LoadRoot(ip, Heap::kStackLimitRootIndex); | 540 __ LoadRoot(ip, Heap::kStackLimitRootIndex); |
541 __ cmp(sp, Operand(ip)); | 541 __ cmp(sp, Operand(ip)); |
542 __ b(hs, &ok); | 542 __ b(hs, &ok); |
543 | 543 |
544 GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode); | 544 GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode); |
545 | 545 |
546 __ bind(&ok); | 546 __ bind(&ok); |
547 GenerateTailCallToSharedCode(masm); | 547 GenerateTailCallToSharedCode(masm); |
548 } | 548 } |
549 | 549 |
550 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 550 namespace { |
551 bool is_api_function, | 551 |
552 bool create_implicit_receiver, | 552 void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function, |
553 bool check_derived_construct) { | 553 bool create_implicit_receiver, |
| 554 bool check_derived_construct) { |
554 // ----------- S t a t e ------------- | 555 // ----------- S t a t e ------------- |
555 // -- r0 : number of arguments | 556 // -- r0 : number of arguments |
556 // -- r1 : constructor function | 557 // -- r1 : constructor function |
557 // -- r2 : allocation site or undefined | |
558 // -- r3 : new target | 558 // -- r3 : new target |
559 // -- cp : context | 559 // -- cp : context |
560 // -- lr : return address | 560 // -- lr : return address |
561 // -- sp[...]: constructor arguments | 561 // -- sp[...]: constructor arguments |
562 // ----------------------------------- | 562 // ----------------------------------- |
563 | 563 |
564 Isolate* isolate = masm->isolate(); | 564 Isolate* isolate = masm->isolate(); |
565 | 565 |
566 // Enter a construct frame. | 566 // Enter a construct frame. |
567 { | 567 { |
568 FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT); | 568 FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT); |
569 | 569 |
570 // Preserve the incoming parameters on the stack. | 570 // Preserve the incoming parameters on the stack. |
571 __ AssertUndefinedOrAllocationSite(r2, r4); | |
572 __ Push(cp); | |
573 __ SmiTag(r0); | 571 __ SmiTag(r0); |
574 __ Push(r2, r0); | 572 __ Push(cp, r0); |
575 | 573 |
576 if (create_implicit_receiver) { | 574 if (create_implicit_receiver) { |
577 // Allocate the new receiver object. | 575 // Allocate the new receiver object. |
578 __ Push(r1, r3); | 576 __ Push(r1, r3); |
579 FastNewObjectStub stub(masm->isolate()); | 577 FastNewObjectStub stub(masm->isolate()); |
580 __ CallStub(&stub); | 578 __ CallStub(&stub); |
581 __ mov(r4, r0); | 579 __ mov(r4, r0); |
582 __ Pop(r1, r3); | 580 __ Pop(r1, r3); |
583 | 581 |
584 // ----------- S t a t e ------------- | 582 // ----------- S t a t e ------------- |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 } | 692 } |
695 | 693 |
696 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - 1)); | 694 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - 1)); |
697 __ add(sp, sp, Operand(kPointerSize)); | 695 __ add(sp, sp, Operand(kPointerSize)); |
698 if (create_implicit_receiver) { | 696 if (create_implicit_receiver) { |
699 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, r1, r2); | 697 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, r1, r2); |
700 } | 698 } |
701 __ Jump(lr); | 699 __ Jump(lr); |
702 } | 700 } |
703 | 701 |
| 702 } // namespace |
| 703 |
704 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { | 704 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { |
705 Generate_JSConstructStubHelper(masm, false, true, false); | 705 Generate_JSConstructStubHelper(masm, false, true, false); |
706 } | 706 } |
707 | 707 |
708 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { | 708 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
709 Generate_JSConstructStubHelper(masm, true, false, false); | 709 Generate_JSConstructStubHelper(masm, true, false, false); |
710 } | 710 } |
711 | 711 |
712 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { | 712 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { |
713 Generate_JSConstructStubHelper(masm, false, false, false); | 713 Generate_JSConstructStubHelper(masm, false, false, false); |
(...skipping 2193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2907 __ bkpt(0); | 2907 __ bkpt(0); |
2908 } | 2908 } |
2909 } | 2909 } |
2910 | 2910 |
2911 #undef __ | 2911 #undef __ |
2912 | 2912 |
2913 } // namespace internal | 2913 } // namespace internal |
2914 } // namespace v8 | 2914 } // namespace v8 |
2915 | 2915 |
2916 #endif // V8_TARGET_ARCH_ARM | 2916 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |