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

Side by Side Diff: src/arm64/builtins-arm64.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 | « src/arm/full-codegen-arm.cc ('k') | src/arm64/full-codegen-arm64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/debug.h" 10 #include "src/debug.h"
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { 699 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
700 Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new); 700 Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new);
701 } 701 }
702 702
703 703
704 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { 704 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) {
705 Generate_JSConstructStubHelper(masm, true, false); 705 Generate_JSConstructStubHelper(masm, true, false);
706 } 706 }
707 707
708 708
709 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) {
710 // ----------- S t a t e -------------
711 // -- x0 : number of arguments
712 // -- x1 : constructor function
713 // -- x2 : allocation site or undefined
714 // -- x3 : original constructor
715 // -- lr : return address
716 // -- sp[...]: constructor arguments
717 // -----------------------------------
718 ASM_LOCATION("Builtins::Generate_JSConstructStubForDerived");
719
720 // TODO(dslomov): support pretenuring
721 CHECK(!FLAG_pretenuring_call_new);
722
723 {
724 FrameScope frame_scope(masm, StackFrame::CONSTRUCT);
725 __ Mov(x4, x0);
726 __ SmiTag(x4);
727 __ LoadRoot(x10, Heap::kTheHoleValueRootIndex);
728 __ Push(x4, x10);
729 // sp[0]: number of arguments
730 // sp[1]: receiver (the hole)
731
732
733 // Set up pointer to last argument.
734 __ Add(x2, fp, StandardFrameConstants::kCallerSPOffset);
735
736 // Copy arguments and receiver to the expression stack.
737 // Copy 2 values every loop to use ldp/stp.
738 // x0: number of arguments
739 // x1: constructor function
740 // x2: address of last argument (caller sp)
741 // jssp[0]: receiver
742 // jssp[1]: number of arguments (smi-tagged)
743 // Compute the start address of the copy in x4.
744 __ Add(x4, x2, Operand(x0, LSL, kPointerSizeLog2));
745 Label loop, entry, done_copying_arguments;
746 __ B(&entry);
747 __ Bind(&loop);
748 __ Ldp(x10, x11, MemOperand(x4, -2 * kPointerSize, PreIndex));
749 __ Push(x11, x10);
750 __ Bind(&entry);
751 __ Cmp(x4, x2);
752 __ B(gt, &loop);
753 // Because we copied values 2 by 2 we may have copied one extra value.
754 // Drop it if that is the case.
755 __ B(eq, &done_copying_arguments);
756 __ Drop(1);
757 __ Bind(&done_copying_arguments);
758
759 // Call the function.
760 // x0: number of arguments
761 // x1: constructor function
762 ParameterCount actual(x0);
763 __ InvokeFunction(x1, actual, CALL_FUNCTION, NullCallWrapper());
764
765
766 // Restore the context from the frame.
767 // x0: result
768 // jssp[0]: number of arguments (smi-tagged)
769 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
770
771 // Load number of arguments (smi).
772 __ Peek(x1, 0);
773
774 // Leave construct frame
775 }
776
777 __ DropBySMI(x1);
778 __ Drop(1);
779 __ Ret();
780 }
781
782
709 // Input: 783 // Input:
710 // x0: code entry. 784 // x0: code entry.
711 // x1: function. 785 // x1: function.
712 // x2: receiver. 786 // x2: receiver.
713 // x3: argc. 787 // x3: argc.
714 // x4: argv. 788 // x4: argv.
715 // Output: 789 // Output:
716 // x0: result. 790 // x0: result.
717 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, 791 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
718 bool is_construct) { 792 bool is_construct) {
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 __ Unreachable(); 1650 __ Unreachable();
1577 } 1651 }
1578 } 1652 }
1579 1653
1580 1654
1581 #undef __ 1655 #undef __
1582 1656
1583 } } // namespace v8::internal 1657 } } // namespace v8::internal
1584 1658
1585 #endif // V8_TARGET_ARCH_ARM 1659 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698