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

Side by Side Diff: src/arm/builtins-arm.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 | « no previous file | src/arm/frames-arm.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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/debug.h" 10 #include "src/debug.h"
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 // r2 is an AllocationSite. We are creating a memento from it, so we 617 // r2 is an AllocationSite. We are creating a memento from it, so we
618 // need to increment the memento create count. 618 // need to increment the memento create count.
619 __ ldr(r3, FieldMemOperand(r2, 619 __ ldr(r3, FieldMemOperand(r2,
620 AllocationSite::kPretenureCreateCountOffset)); 620 AllocationSite::kPretenureCreateCountOffset));
621 __ add(r3, r3, Operand(Smi::FromInt(1))); 621 __ add(r3, r3, Operand(Smi::FromInt(1)));
622 __ str(r3, FieldMemOperand(r2, 622 __ str(r3, FieldMemOperand(r2,
623 AllocationSite::kPretenureCreateCountOffset)); 623 AllocationSite::kPretenureCreateCountOffset));
624 __ bind(&count_incremented); 624 __ bind(&count_incremented);
625 } 625 }
626 626
627 __ pop(r1); // Constructor function.
628
627 __ push(r4); 629 __ push(r4);
628 __ push(r4); 630 __ push(r4);
629 631
630 // Reload the number of arguments and the constructor from the stack. 632 // Reload the number of arguments from the stack.
631 // sp[0]: receiver 633 // sp[0]: receiver
632 // sp[1]: receiver 634 // sp[1]: receiver
633 // sp[2]: constructor function 635 // sp[2]: number of arguments (smi-tagged)
634 // sp[3]: number of arguments (smi-tagged) 636 __ ldr(r3, MemOperand(sp, 2 * kPointerSize));
635 __ ldr(r1, MemOperand(sp, 2 * kPointerSize));
636 __ ldr(r3, MemOperand(sp, 3 * kPointerSize));
637 637
638 // Set up pointer to last argument. 638 // Set up pointer to last argument.
639 __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); 639 __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset));
640 640
641 // Set up number of arguments for function call below 641 // Set up number of arguments for function call below
642 __ SmiUntag(r0, r3); 642 __ SmiUntag(r0, r3);
643 643
644 // Copy arguments and receiver to the expression stack. 644 // Copy arguments and receiver to the expression stack.
645 // r0: number of arguments 645 // r0: number of arguments
646 // r1: constructor function 646 // r1: constructor function
647 // r2: address of last argument (caller sp) 647 // r2: address of last argument (caller sp)
648 // r3: number of arguments (smi-tagged) 648 // r3: number of arguments (smi-tagged)
649 // sp[0]: receiver 649 // sp[0]: receiver
650 // sp[1]: receiver 650 // sp[1]: receiver
651 // sp[2]: constructor function 651 // sp[2]: number of arguments (smi-tagged)
652 // sp[3]: number of arguments (smi-tagged)
653 Label loop, entry; 652 Label loop, entry;
654 __ b(&entry); 653 __ b(&entry);
655 __ bind(&loop); 654 __ bind(&loop);
656 __ ldr(ip, MemOperand(r2, r3, LSL, kPointerSizeLog2 - 1)); 655 __ ldr(ip, MemOperand(r2, r3, LSL, kPointerSizeLog2 - 1));
657 __ push(ip); 656 __ push(ip);
658 __ bind(&entry); 657 __ bind(&entry);
659 __ sub(r3, r3, Operand(2), SetCC); 658 __ sub(r3, r3, Operand(2), SetCC);
660 __ b(ge, &loop); 659 __ b(ge, &loop);
661 660
662 // Call the function. 661 // Call the function.
(...skipping 10 matching lines...) Expand all
673 } 672 }
674 673
675 // Store offset of return address for deoptimizer. 674 // Store offset of return address for deoptimizer.
676 if (!is_api_function) { 675 if (!is_api_function) {
677 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); 676 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset());
678 } 677 }
679 678
680 // Restore context from the frame. 679 // Restore context from the frame.
681 // r0: result 680 // r0: result
682 // sp[0]: receiver 681 // sp[0]: receiver
683 // sp[1]: constructor function 682 // sp[1]: number of arguments (smi-tagged)
684 // sp[2]: number of arguments (smi-tagged)
685 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 683 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
686 684
687 // If the result is an object (in the ECMA sense), we should get rid 685 // If the result is an object (in the ECMA sense), we should get rid
688 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 686 // of the receiver and use the result; see ECMA-262 section 13.2.2-7
689 // on page 74. 687 // on page 74.
690 Label use_receiver, exit; 688 Label use_receiver, exit;
691 689
692 // If the result is a smi, it is *not* an object in the ECMA sense. 690 // If the result is a smi, it is *not* an object in the ECMA sense.
693 // r0: result 691 // r0: result
694 // sp[0]: receiver (newly allocated object) 692 // sp[0]: receiver (newly allocated object)
695 // sp[1]: constructor function 693 // sp[1]: number of arguments (smi-tagged)
696 // sp[2]: number of arguments (smi-tagged)
697 __ JumpIfSmi(r0, &use_receiver); 694 __ JumpIfSmi(r0, &use_receiver);
698 695
699 // If the type of the result (stored in its map) is less than 696 // If the type of the result (stored in its map) is less than
700 // FIRST_SPEC_OBJECT_TYPE, it is not an object in the ECMA sense. 697 // FIRST_SPEC_OBJECT_TYPE, it is not an object in the ECMA sense.
701 __ CompareObjectType(r0, r1, r3, FIRST_SPEC_OBJECT_TYPE); 698 __ CompareObjectType(r0, r1, r3, FIRST_SPEC_OBJECT_TYPE);
702 __ b(ge, &exit); 699 __ b(ge, &exit);
703 700
704 // Throw away the result of the constructor invocation and use the 701 // Throw away the result of the constructor invocation and use the
705 // on-stack receiver as the result. 702 // on-stack receiver as the result.
706 __ bind(&use_receiver); 703 __ bind(&use_receiver);
707 __ ldr(r0, MemOperand(sp)); 704 __ ldr(r0, MemOperand(sp));
708 705
709 // Remove receiver from the stack, remove caller arguments, and 706 // Remove receiver from the stack, remove caller arguments, and
710 // return. 707 // return.
711 __ bind(&exit); 708 __ bind(&exit);
712 // r0: result 709 // r0: result
713 // sp[0]: receiver (newly allocated object) 710 // sp[0]: receiver (newly allocated object)
714 // sp[1]: constructor function 711 // sp[1]: number of arguments (smi-tagged)
715 // sp[2]: number of arguments (smi-tagged) 712 __ ldr(r1, MemOperand(sp, kPointerSize));
716 __ ldr(r1, MemOperand(sp, 2 * kPointerSize));
717 713
718 // Leave construct frame. 714 // Leave construct frame.
719 } 715 }
720 716
721 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - 1)); 717 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - 1));
722 __ add(sp, sp, Operand(kPointerSize)); 718 __ add(sp, sp, Operand(kPointerSize));
723 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, r1, r2); 719 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, r1, r2);
724 __ Jump(lr); 720 __ Jump(lr);
725 } 721 }
726 722
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 } 1806 }
1811 } 1807 }
1812 1808
1813 1809
1814 #undef __ 1810 #undef __
1815 1811
1816 } // namespace internal 1812 } // namespace internal
1817 } // namespace v8 1813 } // namespace v8
1818 1814
1819 #endif // V8_TARGET_ARCH_ARM 1815 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/frames-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698