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

Side by Side Diff: src/mips/builtins-mips.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, 6 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/ia32/frames-ia32.h ('k') | src/mips/frames-mips.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 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 5
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #if V8_TARGET_ARCH_MIPS 9 #if V8_TARGET_ARCH_MIPS
10 10
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 // a2 is an AllocationSite. We are creating a memento from it, so we 634 // a2 is an AllocationSite. We are creating a memento from it, so we
635 // need to increment the memento create count. 635 // need to increment the memento create count.
636 __ lw(a3, FieldMemOperand(a2, 636 __ lw(a3, FieldMemOperand(a2,
637 AllocationSite::kPretenureCreateCountOffset)); 637 AllocationSite::kPretenureCreateCountOffset));
638 __ Addu(a3, a3, Operand(Smi::FromInt(1))); 638 __ Addu(a3, a3, Operand(Smi::FromInt(1)));
639 __ sw(a3, FieldMemOperand(a2, 639 __ sw(a3, FieldMemOperand(a2,
640 AllocationSite::kPretenureCreateCountOffset)); 640 AllocationSite::kPretenureCreateCountOffset));
641 __ bind(&count_incremented); 641 __ bind(&count_incremented);
642 } 642 }
643 643
644 __ Pop(a1);
645
644 __ Push(t4, t4); 646 __ Push(t4, t4);
645 647
646 // Reload the number of arguments from the stack. 648 // Reload the number of arguments from the stack.
647 // sp[0]: receiver 649 // sp[0]: receiver
648 // sp[1]: receiver 650 // sp[1]: receiver
649 // sp[2]: constructor function 651 // sp[2]: number of arguments (smi-tagged)
650 // sp[3]: number of arguments (smi-tagged) 652 __ lw(a3, MemOperand(sp, 2 * kPointerSize));
651 __ lw(a1, MemOperand(sp, 2 * kPointerSize));
652 __ lw(a3, MemOperand(sp, 3 * kPointerSize));
653 653
654 // Set up pointer to last argument. 654 // Set up pointer to last argument.
655 __ Addu(a2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); 655 __ Addu(a2, fp, Operand(StandardFrameConstants::kCallerSPOffset));
656 656
657 // Set up number of arguments for function call below. 657 // Set up number of arguments for function call below.
658 __ srl(a0, a3, kSmiTagSize); 658 __ srl(a0, a3, kSmiTagSize);
659 659
660 // Copy arguments and receiver to the expression stack. 660 // Copy arguments and receiver to the expression stack.
661 // a0: number of arguments 661 // a0: number of arguments
662 // a1: constructor function 662 // a1: constructor function
663 // a2: address of last argument (caller sp) 663 // a2: address of last argument (caller sp)
664 // a3: number of arguments (smi-tagged) 664 // a3: number of arguments (smi-tagged)
665 // sp[0]: receiver 665 // sp[0]: receiver
666 // sp[1]: receiver 666 // sp[1]: receiver
667 // sp[2]: constructor function 667 // sp[2]: number of arguments (smi-tagged)
668 // sp[3]: number of arguments (smi-tagged)
669 Label loop, entry; 668 Label loop, entry;
670 __ jmp(&entry); 669 __ jmp(&entry);
671 __ bind(&loop); 670 __ bind(&loop);
672 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); 671 __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize);
673 __ Addu(t0, a2, Operand(t0)); 672 __ Addu(t0, a2, Operand(t0));
674 __ lw(t1, MemOperand(t0)); 673 __ lw(t1, MemOperand(t0));
675 __ push(t1); 674 __ push(t1);
676 __ bind(&entry); 675 __ bind(&entry);
677 __ Addu(a3, a3, Operand(-2)); 676 __ Addu(a3, a3, Operand(-2));
678 __ Branch(&loop, greater_equal, a3, Operand(zero_reg)); 677 __ Branch(&loop, greater_equal, a3, Operand(zero_reg));
(...skipping 20 matching lines...) Expand all
699 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 698 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
700 699
701 // If the result is an object (in the ECMA sense), we should get rid 700 // If the result is an object (in the ECMA sense), we should get rid
702 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 701 // of the receiver and use the result; see ECMA-262 section 13.2.2-7
703 // on page 74. 702 // on page 74.
704 Label use_receiver, exit; 703 Label use_receiver, exit;
705 704
706 // If the result is a smi, it is *not* an object in the ECMA sense. 705 // If the result is a smi, it is *not* an object in the ECMA sense.
707 // v0: result 706 // v0: result
708 // sp[0]: receiver (newly allocated object) 707 // sp[0]: receiver (newly allocated object)
709 // sp[1]: constructor function 708 // sp[1]: number of arguments (smi-tagged)
710 // sp[2]: number of arguments (smi-tagged)
711 __ JumpIfSmi(v0, &use_receiver); 709 __ JumpIfSmi(v0, &use_receiver);
712 710
713 // If the type of the result (stored in its map) is less than 711 // If the type of the result (stored in its map) is less than
714 // FIRST_SPEC_OBJECT_TYPE, it is not an object in the ECMA sense. 712 // FIRST_SPEC_OBJECT_TYPE, it is not an object in the ECMA sense.
715 __ GetObjectType(v0, a1, a3); 713 __ GetObjectType(v0, a1, a3);
716 __ Branch(&exit, greater_equal, a3, Operand(FIRST_SPEC_OBJECT_TYPE)); 714 __ Branch(&exit, greater_equal, a3, Operand(FIRST_SPEC_OBJECT_TYPE));
717 715
718 // Throw away the result of the constructor invocation and use the 716 // Throw away the result of the constructor invocation and use the
719 // on-stack receiver as the result. 717 // on-stack receiver as the result.
720 __ bind(&use_receiver); 718 __ bind(&use_receiver);
721 __ lw(v0, MemOperand(sp)); 719 __ lw(v0, MemOperand(sp));
722 720
723 // Remove receiver from the stack, remove caller arguments, and 721 // Remove receiver from the stack, remove caller arguments, and
724 // return. 722 // return.
725 __ bind(&exit); 723 __ bind(&exit);
726 // v0: result 724 // v0: result
727 // sp[0]: receiver (newly allocated object) 725 // sp[0]: receiver (newly allocated object)
728 // sp[1]: constructor function 726 // sp[1]: number of arguments (smi-tagged)
729 // sp[2]: number of arguments (smi-tagged) 727 __ lw(a1, MemOperand(sp, kPointerSize));
730 __ lw(a1, MemOperand(sp, 2 * kPointerSize));
731 728
732 // Leave construct frame. 729 // Leave construct frame.
733 } 730 }
734 731
735 __ sll(t0, a1, kPointerSizeLog2 - 1); 732 __ sll(t0, a1, kPointerSizeLog2 - 1);
736 __ Addu(sp, sp, t0); 733 __ Addu(sp, sp, t0);
737 __ Addu(sp, sp, kPointerSize); 734 __ Addu(sp, sp, kPointerSize);
738 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, a1, a2); 735 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, a1, a2);
739 __ Ret(); 736 __ Ret();
740 } 737 }
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 } 1834 }
1838 } 1835 }
1839 1836
1840 1837
1841 #undef __ 1838 #undef __
1842 1839
1843 } // namespace internal 1840 } // namespace internal
1844 } // namespace v8 1841 } // namespace v8
1845 1842
1846 #endif // V8_TARGET_ARCH_MIPS 1843 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/frames-ia32.h ('k') | src/mips/frames-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698