OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 | 549 |
550 __ bind(&ok); | 550 __ bind(&ok); |
551 GenerateTailCallToSharedCode(masm); | 551 GenerateTailCallToSharedCode(masm); |
552 } | 552 } |
553 | 553 |
554 namespace { | 554 namespace { |
555 | 555 |
556 void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function, | 556 void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function, |
557 bool create_implicit_receiver, | 557 bool create_implicit_receiver, |
558 bool check_derived_construct) { | 558 bool check_derived_construct) { |
| 559 Label post_instantiation_deopt_entry; |
559 // ----------- S t a t e ------------- | 560 // ----------- S t a t e ------------- |
560 // -- r2 : number of arguments | 561 // -- r2 : number of arguments |
561 // -- r3 : constructor function | 562 // -- r3 : constructor function |
562 // -- r5 : new target | 563 // -- r5 : new target |
563 // -- cp : context | 564 // -- cp : context |
564 // -- lr : return address | 565 // -- lr : return address |
565 // -- sp[...]: constructor arguments | 566 // -- sp[...]: constructor arguments |
566 // ----------------------------------- | 567 // ----------------------------------- |
567 | 568 |
568 Isolate* isolate = masm->isolate(); | 569 Isolate* isolate = masm->isolate(); |
(...skipping 30 matching lines...) Expand all Loading... |
599 __ LoadP(r2, MemOperand(sp)); | 600 __ LoadP(r2, MemOperand(sp)); |
600 __ SmiUntag(r2); | 601 __ SmiUntag(r2); |
601 __ LoadAndTestP(r2, r2); | 602 __ LoadAndTestP(r2, r2); |
602 | 603 |
603 // Push the allocated receiver to the stack. We need two copies | 604 // Push the allocated receiver to the stack. We need two copies |
604 // because we may have to return the original one and the calling | 605 // because we may have to return the original one and the calling |
605 // conventions dictate that the called function pops the receiver. | 606 // conventions dictate that the called function pops the receiver. |
606 __ Push(r6, r6); | 607 __ Push(r6, r6); |
607 } | 608 } |
608 | 609 |
| 610 // Deoptimizer re-enters stub code here. |
| 611 __ bind(&post_instantiation_deopt_entry); |
| 612 |
609 // Set up pointer to last argument. | 613 // Set up pointer to last argument. |
610 __ la(r4, MemOperand(fp, StandardFrameConstants::kCallerSPOffset)); | 614 __ la(r4, MemOperand(fp, StandardFrameConstants::kCallerSPOffset)); |
611 | 615 |
612 // Copy arguments and receiver to the expression stack. | 616 // Copy arguments and receiver to the expression stack. |
613 // r2: number of arguments | 617 // r2: number of arguments |
614 // r3: constructor function | 618 // r3: constructor function |
615 // r4: address of last argument (caller sp) | 619 // r4: address of last argument (caller sp) |
616 // r5: new target | 620 // r5: new target |
617 // cr0: condition indicating whether r2 is zero | 621 // cr0: condition indicating whether r2 is zero |
618 // sp[0]: receiver | 622 // sp[0]: receiver |
(...skipping 15 matching lines...) Expand all Loading... |
634 // r2: number of arguments | 638 // r2: number of arguments |
635 // r3: constructor function | 639 // r3: constructor function |
636 // r5: new target | 640 // r5: new target |
637 | 641 |
638 ParameterCount actual(r2); | 642 ParameterCount actual(r2); |
639 __ InvokeFunction(r3, r5, actual, CALL_FUNCTION, | 643 __ InvokeFunction(r3, r5, actual, CALL_FUNCTION, |
640 CheckDebugStepCallWrapper()); | 644 CheckDebugStepCallWrapper()); |
641 | 645 |
642 // Store offset of return address for deoptimizer. | 646 // Store offset of return address for deoptimizer. |
643 if (create_implicit_receiver && !is_api_function) { | 647 if (create_implicit_receiver && !is_api_function) { |
644 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); | 648 masm->isolate()->heap()->SetConstructStubInvokeDeoptPCOffset( |
| 649 masm->pc_offset()); |
645 } | 650 } |
646 | 651 |
647 // Restore context from the frame. | 652 // Restore context from the frame. |
648 // r2: result | 653 // r2: result |
649 // sp[0]: receiver | 654 // sp[0]: receiver |
650 // sp[1]: number of arguments (smi-tagged) | 655 // sp[1]: number of arguments (smi-tagged) |
651 __ LoadP(cp, MemOperand(fp, ConstructFrameConstants::kContextOffset)); | 656 __ LoadP(cp, MemOperand(fp, ConstructFrameConstants::kContextOffset)); |
652 | 657 |
653 if (create_implicit_receiver) { | 658 if (create_implicit_receiver) { |
654 // If the result is an object (in the ECMA sense), we should get rid | 659 // If the result is an object (in the ECMA sense), we should get rid |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 __ bind(&dont_throw); | 705 __ bind(&dont_throw); |
701 } | 706 } |
702 | 707 |
703 __ SmiToPtrArrayOffset(r3, r3); | 708 __ SmiToPtrArrayOffset(r3, r3); |
704 __ AddP(sp, sp, r3); | 709 __ AddP(sp, sp, r3); |
705 __ AddP(sp, sp, Operand(kPointerSize)); | 710 __ AddP(sp, sp, Operand(kPointerSize)); |
706 if (create_implicit_receiver) { | 711 if (create_implicit_receiver) { |
707 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, r3, r4); | 712 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, r3, r4); |
708 } | 713 } |
709 __ Ret(); | 714 __ Ret(); |
| 715 |
| 716 // Store offset of trampoline address for deoptimizer. This is the bailout |
| 717 // point after the receiver instantiation but before the function invocation. |
| 718 // We need to restore some registers in order to continue the above code. |
| 719 if (create_implicit_receiver && !is_api_function) { |
| 720 masm->isolate()->heap()->SetConstructStubCreateDeoptPCOffset( |
| 721 masm->pc_offset()); |
| 722 |
| 723 // ----------- S t a t e ------------- |
| 724 // -- r2 : newly allocated object |
| 725 // -- sp[0] : constructor function |
| 726 // ----------------------------------- |
| 727 |
| 728 __ pop(r3); |
| 729 __ Push(r2, r2); |
| 730 |
| 731 // Retrieve smi-tagged arguments count from the stack. |
| 732 __ LoadP(r2, MemOperand(fp, ConstructFrameConstants::kLengthOffset)); |
| 733 __ SmiUntag(r2); |
| 734 |
| 735 // Retrieve the new target value from the stack. This was placed into the |
| 736 // frame description in place of the receiver by the optimizing compiler. |
| 737 __ la(r5, MemOperand(fp, StandardFrameConstants::kCallerSPOffset)); |
| 738 __ ShiftLeftP(ip, r2, Operand(kPointerSizeLog2)); |
| 739 __ LoadP(r5, MemOperand(r2, ip)); |
| 740 |
| 741 // Continue with constructor function invocation. |
| 742 __ b(&post_instantiation_deopt_entry); |
| 743 } |
710 } | 744 } |
711 | 745 |
712 } // namespace | 746 } // namespace |
713 | 747 |
714 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { | 748 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { |
715 Generate_JSConstructStubHelper(masm, false, true, false); | 749 Generate_JSConstructStubHelper(masm, false, true, false); |
716 } | 750 } |
717 | 751 |
718 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { | 752 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
719 Generate_JSConstructStubHelper(masm, true, false, false); | 753 Generate_JSConstructStubHelper(masm, true, false, false); |
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3211 __ bkpt(0); | 3245 __ bkpt(0); |
3212 } | 3246 } |
3213 } | 3247 } |
3214 | 3248 |
3215 #undef __ | 3249 #undef __ |
3216 | 3250 |
3217 } // namespace internal | 3251 } // namespace internal |
3218 } // namespace v8 | 3252 } // namespace v8 |
3219 | 3253 |
3220 #endif // V8_TARGET_ARCH_S390 | 3254 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |