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

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

Issue 867153003: new classes: special construct stub for derived classs and TDZ for `this`. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: CHECK_OK fixed Created 5 years, 10 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/full-codegen-arm.cc » ('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 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { 734 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
735 Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new); 735 Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new);
736 } 736 }
737 737
738 738
739 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { 739 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) {
740 Generate_JSConstructStubHelper(masm, true, false); 740 Generate_JSConstructStubHelper(masm, true, false);
741 } 741 }
742 742
743 743
744 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) {
745 // ----------- S t a t e -------------
746 // -- r0 : number of arguments
747 // -- r1 : constructor function
748 // -- r2 : allocation site or undefined
749 // -- r3 : original constructor
750 // -- lr : return address
751 // -- sp[...]: constructor arguments
752 // -----------------------------------
753
754 // TODO(dslomov): support pretenuring
755 CHECK(!FLAG_pretenuring_call_new);
756
757 {
758 FrameScope frame_scope(masm, StackFrame::CONSTRUCT);
759
760 __ mov(r4, r0);
761 __ SmiTag(r4);
762 __ push(r4); // Smi-tagged arguments count.
763
764 // receiver is the hole.
765 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
766 __ push(ip);
767
768 // Set up pointer to last argument.
769 __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset));
770
771 // Copy arguments and receiver to the expression stack.
772 // r0: number of arguments
773 // r1: constructor function
774 // r2: address of last argument (caller sp)
775 // r4: number of arguments (smi-tagged)
776 // sp[0]: receiver
777 // sp[1]: number of arguments (smi-tagged)
778 Label loop, entry;
779 __ b(&entry);
780 __ bind(&loop);
781 __ ldr(ip, MemOperand(r2, r4, LSL, kPointerSizeLog2 - 1));
782 __ push(ip);
783 __ bind(&entry);
784 __ sub(r4, r4, Operand(2), SetCC);
785 __ b(ge, &loop);
786
787 // Call the function.
788 // r0: number of arguments
789 // r1: constructor function
790 ParameterCount actual(r0);
791 __ InvokeFunction(r1, actual, CALL_FUNCTION, NullCallWrapper());
792
793 // Restore context from the frame.
794 // r0: result
795 // sp[0]: number of arguments (smi-tagged)
796 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
797 __ ldr(r1, MemOperand(sp, 0));
798
799 // Leave construct frame.
800 }
801
802 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - 1));
803 __ add(sp, sp, Operand(kPointerSize));
804 __ Jump(lr);
805 }
806
807
744 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, 808 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
745 bool is_construct) { 809 bool is_construct) {
746 // Called from Generate_JS_Entry 810 // Called from Generate_JS_Entry
747 // r0: code entry 811 // r0: code entry
748 // r1: function 812 // r1: function
749 // r2: receiver 813 // r2: receiver
750 // r3: argc 814 // r3: argc
751 // r4: argv 815 // r4: argv
752 // r5-r6, r8 (if not FLAG_enable_ool_constant_pool) and cp may be clobbered 816 // r5-r6, r8 (if not FLAG_enable_ool_constant_pool) and cp may be clobbered
753 ProfileEntryHookStub::MaybeCallEntryHook(masm); 817 ProfileEntryHookStub::MaybeCallEntryHook(masm);
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 __ bkpt(0); 1628 __ bkpt(0);
1565 } 1629 }
1566 } 1630 }
1567 1631
1568 1632
1569 #undef __ 1633 #undef __
1570 1634
1571 } } // namespace v8::internal 1635 } } // namespace v8::internal
1572 1636
1573 #endif // V8_TARGET_ARCH_ARM 1637 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698