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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_PPC | 7 #if V8_TARGET_ARCH_PPC |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug.h" | 10 #include "src/debug.h" |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 | 634 |
635 // Restore the parameters. | 635 // Restore the parameters. |
636 if (use_new_target) { | 636 if (use_new_target) { |
637 __ Pop(r4, ip); | 637 __ Pop(r4, ip); |
638 } else { | 638 } else { |
639 __ pop(r4); | 639 __ pop(r4); |
640 } | 640 } |
641 | 641 |
642 // Retrieve smi-tagged arguments count from the stack. | 642 // Retrieve smi-tagged arguments count from the stack. |
643 __ LoadP(r6, MemOperand(sp)); | 643 __ LoadP(r6, MemOperand(sp)); |
644 __ SmiUntag(r3, r6); | |
645 | 644 |
646 // Push new.target onto the construct frame. This is stored just below the | 645 // Push new.target onto the construct frame. This is stored just below the |
647 // receiver on the stack. | 646 // receiver on the stack. |
648 if (use_new_target) { | 647 if (use_new_target) { |
649 __ Push(ip, r7, r7); | 648 __ Push(ip, r7, r7); |
650 } else { | 649 } else { |
651 __ Push(r7, r7); | 650 __ Push(r7, r7); |
652 } | 651 } |
653 | 652 |
654 // Set up pointer to last argument. | 653 // Set up pointer to last argument. |
655 __ addi(r5, fp, Operand(StandardFrameConstants::kCallerSPOffset)); | 654 __ addi(r5, fp, Operand(StandardFrameConstants::kCallerSPOffset)); |
656 | 655 |
657 // Copy arguments and receiver to the expression stack. | 656 // Copy arguments and receiver to the expression stack. |
658 // r3: number of arguments | |
659 // r4: constructor function | 657 // r4: constructor function |
660 // r5: address of last argument (caller sp) | 658 // r5: address of last argument (caller sp) |
661 // r6: number of arguments (smi-tagged) | 659 // r6: number of arguments (smi-tagged) |
662 // sp[0]: receiver | 660 // sp[0]: receiver |
663 // sp[1]: receiver | 661 // sp[1]: receiver |
664 // sp[2]: new.target (if used) | 662 // sp[2]: new.target (if used) |
665 // sp[2/3]: number of arguments (smi-tagged) | 663 // sp[2/3]: number of arguments (smi-tagged) |
666 Label loop, no_args; | 664 Label loop, no_args; |
667 __ cmpi(r3, Operand::Zero()); | 665 __ SmiUntag(r3, r6, SetRC); |
668 __ beq(&no_args); | 666 __ beq(&no_args, cr0); |
669 __ ShiftLeftImm(ip, r3, Operand(kPointerSizeLog2)); | 667 __ ShiftLeftImm(ip, r3, Operand(kPointerSizeLog2)); |
| 668 __ sub(sp, sp, ip); |
670 __ mtctr(r3); | 669 __ mtctr(r3); |
671 __ bind(&loop); | 670 __ bind(&loop); |
672 __ subi(ip, ip, Operand(kPointerSize)); | 671 __ subi(ip, ip, Operand(kPointerSize)); |
673 __ LoadPX(r0, MemOperand(r5, ip)); | 672 __ LoadPX(r0, MemOperand(r5, ip)); |
674 __ push(r0); | 673 __ StorePX(r0, MemOperand(sp, ip)); |
675 __ bdnz(&loop); | 674 __ bdnz(&loop); |
676 __ bind(&no_args); | 675 __ bind(&no_args); |
677 | 676 |
678 // Call the function. | 677 // Call the function. |
679 // r3: number of arguments | 678 // r3: number of arguments |
680 // r4: constructor function | 679 // r4: constructor function |
681 if (is_api_function) { | 680 if (is_api_function) { |
682 __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); | 681 __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); |
683 Handle<Code> code = masm->isolate()->builtins()->HandleApiCallConstruct(); | 682 Handle<Code> code = masm->isolate()->builtins()->HandleApiCallConstruct(); |
684 __ Call(code, RelocInfo::CODE_TARGET); | 683 __ Call(code, RelocInfo::CODE_TARGET); |
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1899 __ bkpt(0); | 1898 __ bkpt(0); |
1900 } | 1899 } |
1901 } | 1900 } |
1902 | 1901 |
1903 | 1902 |
1904 #undef __ | 1903 #undef __ |
1905 } // namespace internal | 1904 } // namespace internal |
1906 } // namespace v8 | 1905 } // namespace v8 |
1907 | 1906 |
1908 #endif // V8_TARGET_ARCH_PPC | 1907 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |