Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/ppc/builtins-ppc.cc

Issue 1203103003: Unify the stack layout for construct frames (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix deopt case and clean up constants Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips64/frames-mips64.h ('k') | src/ppc/frames-ppc.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 // need to increment the memento create count. 619 // need to increment the memento create count.
620 __ LoadP( 620 __ LoadP(
621 r6, FieldMemOperand(r5, AllocationSite::kPretenureCreateCountOffset)); 621 r6, FieldMemOperand(r5, AllocationSite::kPretenureCreateCountOffset));
622 __ AddSmiLiteral(r6, r6, Smi::FromInt(1), r0); 622 __ AddSmiLiteral(r6, r6, Smi::FromInt(1), r0);
623 __ StoreP( 623 __ StoreP(
624 r6, FieldMemOperand(r5, AllocationSite::kPretenureCreateCountOffset), 624 r6, FieldMemOperand(r5, AllocationSite::kPretenureCreateCountOffset),
625 r0); 625 r0);
626 __ bind(&count_incremented); 626 __ bind(&count_incremented);
627 } 627 }
628 628
629 __ Pop(r4);
630
629 __ Push(r7, r7); 631 __ Push(r7, r7);
630 632
631 // Reload the number of arguments and the constructor from the stack. 633 // Reload the number of arguments and the constructor from the stack.
632 // sp[0]: receiver 634 // sp[0]: receiver
633 // sp[1]: receiver 635 // sp[1]: receiver
634 // sp[2]: constructor function 636 // sp[2]: number of arguments (smi-tagged)
635 // sp[3]: number of arguments (smi-tagged) 637 __ LoadP(r6, MemOperand(sp, 2 * kPointerSize));
636 __ LoadP(r4, MemOperand(sp, 2 * kPointerSize));
637 __ LoadP(r6, MemOperand(sp, 3 * kPointerSize));
638 638
639 // Set up pointer to last argument. 639 // Set up pointer to last argument.
640 __ addi(r5, fp, Operand(StandardFrameConstants::kCallerSPOffset)); 640 __ addi(r5, fp, Operand(StandardFrameConstants::kCallerSPOffset));
641 641
642 // Set up number of arguments for function call below 642 // Set up number of arguments for function call below
643 __ SmiUntag(r3, r6); 643 __ SmiUntag(r3, r6);
644 644
645 // Copy arguments and receiver to the expression stack. 645 // Copy arguments and receiver to the expression stack.
646 // r3: number of arguments 646 // r3: number of arguments
647 // r4: constructor function 647 // r4: constructor function
648 // r5: address of last argument (caller sp) 648 // r5: address of last argument (caller sp)
649 // r6: number of arguments (smi-tagged) 649 // r6: number of arguments (smi-tagged)
650 // sp[0]: receiver 650 // sp[0]: receiver
651 // sp[1]: receiver 651 // sp[1]: receiver
652 // sp[2]: constructor function 652 // sp[2]: number of arguments (smi-tagged)
653 // sp[3]: number of arguments (smi-tagged)
654 Label loop, no_args; 653 Label loop, no_args;
655 __ cmpi(r3, Operand::Zero()); 654 __ cmpi(r3, Operand::Zero());
656 __ beq(&no_args); 655 __ beq(&no_args);
657 __ ShiftLeftImm(ip, r3, Operand(kPointerSizeLog2)); 656 __ ShiftLeftImm(ip, r3, Operand(kPointerSizeLog2));
658 __ mtctr(r3); 657 __ mtctr(r3);
659 __ bind(&loop); 658 __ bind(&loop);
660 __ subi(ip, ip, Operand(kPointerSize)); 659 __ subi(ip, ip, Operand(kPointerSize));
661 __ LoadPX(r0, MemOperand(r5, ip)); 660 __ LoadPX(r0, MemOperand(r5, ip));
662 __ push(r0); 661 __ push(r0);
663 __ bdnz(&loop); 662 __ bdnz(&loop);
(...skipping 12 matching lines...) Expand all
676 } 675 }
677 676
678 // Store offset of return address for deoptimizer. 677 // Store offset of return address for deoptimizer.
679 if (!is_api_function) { 678 if (!is_api_function) {
680 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); 679 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset());
681 } 680 }
682 681
683 // Restore context from the frame. 682 // Restore context from the frame.
684 // r3: result 683 // r3: result
685 // sp[0]: receiver 684 // sp[0]: receiver
686 // sp[1]: constructor function 685 // sp[1]: number of arguments (smi-tagged)
687 // sp[2]: number of arguments (smi-tagged)
688 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 686 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
689 687
690 // If the result is an object (in the ECMA sense), we should get rid 688 // If the result is an object (in the ECMA sense), we should get rid
691 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 689 // of the receiver and use the result; see ECMA-262 section 13.2.2-7
692 // on page 74. 690 // on page 74.
693 Label use_receiver, exit; 691 Label use_receiver, exit;
694 692
695 // If the result is a smi, it is *not* an object in the ECMA sense. 693 // If the result is a smi, it is *not* an object in the ECMA sense.
696 // r3: result 694 // r3: result
697 // sp[0]: receiver (newly allocated object) 695 // sp[0]: receiver (newly allocated object)
698 // sp[1]: constructor function 696 // sp[1]: number of arguments (smi-tagged)
699 // sp[2]: number of arguments (smi-tagged)
700 __ JumpIfSmi(r3, &use_receiver); 697 __ JumpIfSmi(r3, &use_receiver);
701 698
702 // If the type of the result (stored in its map) is less than 699 // If the type of the result (stored in its map) is less than
703 // FIRST_SPEC_OBJECT_TYPE, it is not an object in the ECMA sense. 700 // FIRST_SPEC_OBJECT_TYPE, it is not an object in the ECMA sense.
704 __ CompareObjectType(r3, r4, r6, FIRST_SPEC_OBJECT_TYPE); 701 __ CompareObjectType(r3, r4, r6, FIRST_SPEC_OBJECT_TYPE);
705 __ bge(&exit); 702 __ bge(&exit);
706 703
707 // Throw away the result of the constructor invocation and use the 704 // Throw away the result of the constructor invocation and use the
708 // on-stack receiver as the result. 705 // on-stack receiver as the result.
709 __ bind(&use_receiver); 706 __ bind(&use_receiver);
710 __ LoadP(r3, MemOperand(sp)); 707 __ LoadP(r3, MemOperand(sp));
711 708
712 // Remove receiver from the stack, remove caller arguments, and 709 // Remove receiver from the stack, remove caller arguments, and
713 // return. 710 // return.
714 __ bind(&exit); 711 __ bind(&exit);
715 // r3: result 712 // r3: result
716 // sp[0]: receiver (newly allocated object) 713 // sp[0]: receiver (newly allocated object)
717 // sp[1]: constructor function 714 // sp[1]: number of arguments (smi-tagged)
718 // sp[2]: number of arguments (smi-tagged) 715 __ LoadP(r4, MemOperand(sp, kPointerSize));
719 __ LoadP(r4, MemOperand(sp, 2 * kPointerSize));
720 716
721 // Leave construct frame. 717 // Leave construct frame.
722 } 718 }
723 719
724 __ SmiToPtrArrayOffset(r4, r4); 720 __ SmiToPtrArrayOffset(r4, r4);
725 __ add(sp, sp, r4); 721 __ add(sp, sp, r4);
726 __ addi(sp, sp, Operand(kPointerSize)); 722 __ addi(sp, sp, Operand(kPointerSize));
727 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, r4, r5); 723 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, r4, r5);
728 __ blr(); 724 __ blr();
729 } 725 }
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 __ bkpt(0); 1876 __ bkpt(0);
1881 } 1877 }
1882 } 1878 }
1883 1879
1884 1880
1885 #undef __ 1881 #undef __
1886 } // namespace internal 1882 } // namespace internal
1887 } // namespace v8 1883 } // namespace v8
1888 1884
1889 #endif // V8_TARGET_ARCH_PPC 1885 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/mips64/frames-mips64.h ('k') | src/ppc/frames-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698