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/mips/code-stubs-mips.cc

Issue 906813003: MIPS: new classes: implement new.target passing to superclass constructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/mips/builtins-mips.cc ('k') | src/mips/full-codegen-mips.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_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 1578
1579 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, t0, 1579 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, t0,
1580 t1, &miss); 1580 t1, &miss);
1581 __ bind(&miss); 1581 __ bind(&miss);
1582 PropertyAccessCompiler::TailCallBuiltin( 1582 PropertyAccessCompiler::TailCallBuiltin(
1583 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); 1583 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC));
1584 } 1584 }
1585 1585
1586 1586
1587 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 1587 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
1588 CHECK(!has_new_target());
1588 // The displacement is the offset of the last parameter (if any) 1589 // The displacement is the offset of the last parameter (if any)
1589 // relative to the frame pointer. 1590 // relative to the frame pointer.
1590 const int kDisplacement = 1591 const int kDisplacement =
1591 StandardFrameConstants::kCallerSPOffset - kPointerSize; 1592 StandardFrameConstants::kCallerSPOffset - kPointerSize;
1592 DCHECK(a1.is(ArgumentsAccessReadDescriptor::index())); 1593 DCHECK(a1.is(ArgumentsAccessReadDescriptor::index()));
1593 DCHECK(a0.is(ArgumentsAccessReadDescriptor::parameter_count())); 1594 DCHECK(a0.is(ArgumentsAccessReadDescriptor::parameter_count()));
1594 1595
1595 // Check that the key is a smiGenerateReadElement. 1596 // Check that the key is a smiGenerateReadElement.
1596 Label slow; 1597 Label slow;
1597 __ JumpIfNotSmi(a1, &slow); 1598 __ JumpIfNotSmi(a1, &slow);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 __ bind(&slow); 1637 __ bind(&slow);
1637 __ push(a1); 1638 __ push(a1);
1638 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1); 1639 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1);
1639 } 1640 }
1640 1641
1641 1642
1642 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { 1643 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) {
1643 // sp[0] : number of parameters 1644 // sp[0] : number of parameters
1644 // sp[4] : receiver displacement 1645 // sp[4] : receiver displacement
1645 // sp[8] : function 1646 // sp[8] : function
1647
1648 CHECK(!has_new_target());
1649
1646 // Check if the calling frame is an arguments adaptor frame. 1650 // Check if the calling frame is an arguments adaptor frame.
1647 Label runtime; 1651 Label runtime;
1648 __ lw(a3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 1652 __ lw(a3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
1649 __ lw(a2, MemOperand(a3, StandardFrameConstants::kContextOffset)); 1653 __ lw(a2, MemOperand(a3, StandardFrameConstants::kContextOffset));
1650 __ Branch(&runtime, 1654 __ Branch(&runtime,
1651 ne, 1655 ne,
1652 a2, 1656 a2,
1653 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 1657 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
1654 1658
1655 // Patch the arguments.length and the parameters pointer in the current frame. 1659 // Patch the arguments.length and the parameters pointer in the current frame.
(...skipping 11 matching lines...) Expand all
1667 1671
1668 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { 1672 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) {
1669 // Stack layout: 1673 // Stack layout:
1670 // sp[0] : number of parameters (tagged) 1674 // sp[0] : number of parameters (tagged)
1671 // sp[4] : address of receiver argument 1675 // sp[4] : address of receiver argument
1672 // sp[8] : function 1676 // sp[8] : function
1673 // Registers used over whole function: 1677 // Registers used over whole function:
1674 // t2 : allocated object (tagged) 1678 // t2 : allocated object (tagged)
1675 // t5 : mapped parameter count (tagged) 1679 // t5 : mapped parameter count (tagged)
1676 1680
1681 CHECK(!has_new_target());
1682
1677 __ lw(a1, MemOperand(sp, 0 * kPointerSize)); 1683 __ lw(a1, MemOperand(sp, 0 * kPointerSize));
1678 // a1 = parameter count (tagged) 1684 // a1 = parameter count (tagged)
1679 1685
1680 // Check if the calling frame is an arguments adaptor frame. 1686 // Check if the calling frame is an arguments adaptor frame.
1681 Label runtime; 1687 Label runtime;
1682 Label adaptor_frame, try_allocate; 1688 Label adaptor_frame, try_allocate;
1683 __ lw(a3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 1689 __ lw(a3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
1684 __ lw(a2, MemOperand(a3, StandardFrameConstants::kContextOffset)); 1690 __ lw(a2, MemOperand(a3, StandardFrameConstants::kContextOffset));
1685 __ Branch(&adaptor_frame, 1691 __ Branch(&adaptor_frame,
1686 eq, 1692 eq,
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 a3, 1930 a3,
1925 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 1931 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
1926 1932
1927 // Get the length from the frame. 1933 // Get the length from the frame.
1928 __ lw(a1, MemOperand(sp, 0)); 1934 __ lw(a1, MemOperand(sp, 0));
1929 __ Branch(&try_allocate); 1935 __ Branch(&try_allocate);
1930 1936
1931 // Patch the arguments.length and the parameters pointer. 1937 // Patch the arguments.length and the parameters pointer.
1932 __ bind(&adaptor_frame); 1938 __ bind(&adaptor_frame);
1933 __ lw(a1, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset)); 1939 __ lw(a1, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset));
1940 if (has_new_target()) {
1941 // Subtract 1 from smi-tagged arguments count.
1942 __ Subu(a1, a1, Operand(2));
1943 }
1934 __ sw(a1, MemOperand(sp, 0)); 1944 __ sw(a1, MemOperand(sp, 0));
1935 __ sll(at, a1, kPointerSizeLog2 - kSmiTagSize); 1945 __ sll(at, a1, kPointerSizeLog2 - kSmiTagSize);
1936 __ Addu(a3, a2, Operand(at)); 1946 __ Addu(a3, a2, Operand(at));
1937 1947
1938 __ Addu(a3, a3, Operand(StandardFrameConstants::kCallerSPOffset)); 1948 __ Addu(a3, a3, Operand(StandardFrameConstants::kCallerSPOffset));
1939 __ sw(a3, MemOperand(sp, 1 * kPointerSize)); 1949 __ sw(a3, MemOperand(sp, 1 * kPointerSize));
1940 1950
1941 // Try the new space allocation. Start out with computing the size 1951 // Try the new space allocation. Start out with computing the size
1942 // of the arguments object and the elements array in words. 1952 // of the arguments object and the elements array in words.
1943 Label add_arguments_object; 1953 Label add_arguments_object;
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
2698 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); 2708 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex);
2699 __ Branch(&feedback_register_initialized, eq, t1, Operand(at)); 2709 __ Branch(&feedback_register_initialized, eq, t1, Operand(at));
2700 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); 2710 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
2701 __ bind(&feedback_register_initialized); 2711 __ bind(&feedback_register_initialized);
2702 } 2712 }
2703 2713
2704 __ AssertUndefinedOrAllocationSite(a2, t1); 2714 __ AssertUndefinedOrAllocationSite(a2, t1);
2705 } 2715 }
2706 2716
2707 // Pass function as original constructor. 2717 // Pass function as original constructor.
2708 __ mov(a3, a1); 2718 if (IsSuperConstructorCall()) {
2719 __ li(t0, Operand(1 * kPointerSize));
2720 __ sll(at, a0, kPointerSizeLog2);
2721 __ Addu(t0, t0, Operand(at));
2722 __ Addu(at, sp, Operand(t0));
2723 __ lw(a3, MemOperand(at, 0));
2724 } else {
2725 __ mov(a3, a1);
2726 }
2709 2727
2710 // Jump to the function-specific construct stub. 2728 // Jump to the function-specific construct stub.
2711 Register jmp_reg = t0; 2729 Register jmp_reg = t0;
2712 __ lw(jmp_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 2730 __ lw(jmp_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
2713 __ lw(jmp_reg, FieldMemOperand(jmp_reg, 2731 __ lw(jmp_reg, FieldMemOperand(jmp_reg,
2714 SharedFunctionInfo::kConstructStubOffset)); 2732 SharedFunctionInfo::kConstructStubOffset));
2715 __ Addu(at, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); 2733 __ Addu(at, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag));
2716 __ Jump(at); 2734 __ Jump(at);
2717 2735
2718 // a0: number of arguments 2736 // a0: number of arguments
(...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after
5169 kStackUnwindSpace, kInvalidStackOffset, 5187 kStackUnwindSpace, kInvalidStackOffset,
5170 MemOperand(fp, 6 * kPointerSize), NULL); 5188 MemOperand(fp, 6 * kPointerSize), NULL);
5171 } 5189 }
5172 5190
5173 5191
5174 #undef __ 5192 #undef __
5175 5193
5176 } } // namespace v8::internal 5194 } } // namespace v8::internal
5177 5195
5178 #endif // V8_TARGET_ARCH_MIPS 5196 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698