OLD | NEW |
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 #if V8_TARGET_ARCH_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 __ ld(a0, MemOperand(fp, kFunctionOffset)); | 1388 __ ld(a0, MemOperand(fp, kFunctionOffset)); |
1389 __ push(a0); | 1389 __ push(a0); |
1390 | 1390 |
1391 // Copy all arguments from the array to the stack. | 1391 // Copy all arguments from the array to the stack. |
1392 Generate_PushAppliedArguments(masm, kVectorOffset, kArgumentsOffset, | 1392 Generate_PushAppliedArguments(masm, kVectorOffset, kArgumentsOffset, |
1393 kIndexOffset, kLimitOffset); | 1393 kIndexOffset, kLimitOffset); |
1394 | 1394 |
1395 // Use undefined feedback vector | 1395 // Use undefined feedback vector |
1396 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 1396 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
1397 __ ld(a1, MemOperand(fp, kFunctionOffset)); | 1397 __ ld(a1, MemOperand(fp, kFunctionOffset)); |
1398 __ ld(a4, MemOperand(fp, kNewTargetOffset)); | 1398 __ ld(a3, MemOperand(fp, kNewTargetOffset)); |
1399 | 1399 |
1400 // Call the function. | 1400 // Call the function. |
1401 CallConstructStub stub(masm->isolate(), SUPER_CONSTRUCTOR_CALL); | 1401 __ Call(masm->isolate()->builtins()->Construct(), |
1402 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 1402 RelocInfo::CONSTRUCT_CALL); |
1403 | 1403 |
1404 // Leave internal frame. | 1404 // Leave internal frame. |
1405 } | 1405 } |
1406 __ jr(ra); | 1406 __ jr(ra); |
1407 __ Daddu(sp, sp, Operand(kStackSize * kPointerSize)); // In delay slot. | 1407 __ Daddu(sp, sp, Operand(kStackSize * kPointerSize)); // In delay slot. |
1408 } | 1408 } |
1409 | 1409 |
1410 | 1410 |
1411 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 1411 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
1412 Generate_ApplyHelper(masm, false); | 1412 Generate_ApplyHelper(masm, false); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1666 | 1666 |
1667 // static | 1667 // static |
1668 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1668 void Builtins::Generate_Construct(MacroAssembler* masm) { |
1669 // ----------- S t a t e ------------- | 1669 // ----------- S t a t e ------------- |
1670 // -- a0 : the number of arguments (not including the receiver) | 1670 // -- a0 : the number of arguments (not including the receiver) |
1671 // -- a1 : the constructor to call (can be any Object) | 1671 // -- a1 : the constructor to call (can be any Object) |
1672 // -- a3 : the new target (either the same as the constructor or | 1672 // -- a3 : the new target (either the same as the constructor or |
1673 // the JSFunction on which new was invoked initially) | 1673 // the JSFunction on which new was invoked initially) |
1674 // ----------------------------------- | 1674 // ----------------------------------- |
1675 | 1675 |
1676 // Check if target has a [[Construct]] internal method. | 1676 // Check if target is a Smi. |
1677 Label non_constructor; | 1677 Label non_constructor; |
1678 __ JumpIfSmi(a1, &non_constructor); | 1678 __ JumpIfSmi(a1, &non_constructor); |
1679 __ ld(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); | |
1680 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset)); | |
1681 __ And(t2, t2, Operand(1 << Map::kIsCallable)); | |
1682 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); | |
1683 | 1679 |
1684 // Dispatch based on instance type. | 1680 // Dispatch based on instance type. |
| 1681 __ ld(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); |
1685 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset)); | 1682 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset)); |
1686 __ Jump(masm->isolate()->builtins()->ConstructFunction(), | 1683 __ Jump(masm->isolate()->builtins()->ConstructFunction(), |
1687 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); | 1684 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); |
1688 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, | 1685 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, |
1689 eq, t2, Operand(JS_FUNCTION_PROXY_TYPE)); | 1686 eq, t2, Operand(JS_FUNCTION_PROXY_TYPE)); |
1690 | 1687 |
| 1688 // Check if target has a [[Construct]] internal method. |
| 1689 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset)); |
| 1690 __ And(t2, t2, Operand(1 << Map::kIsCallable)); |
| 1691 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); |
| 1692 |
1691 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1693 // Called Construct on an exotic Object with a [[Construct]] internal method. |
1692 { | 1694 { |
1693 // Overwrite the original receiver with the (original) target. | 1695 // Overwrite the original receiver with the (original) target. |
1694 __ dsll(at, a0, kPointerSizeLog2); | 1696 __ dsll(at, a0, kPointerSizeLog2); |
1695 __ daddu(at, sp, at); | 1697 __ daddu(at, sp, at); |
1696 __ sd(a1, MemOperand(at)); | 1698 __ sd(a1, MemOperand(at)); |
1697 // Let the "call_as_constructor_delegate" take care of the rest. | 1699 // Let the "call_as_constructor_delegate" take care of the rest. |
1698 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1); | 1700 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1); |
1699 __ Jump(masm->isolate()->builtins()->CallFunction(), | 1701 __ Jump(masm->isolate()->builtins()->CallFunction(), |
1700 RelocInfo::CODE_TARGET); | 1702 RelocInfo::CODE_TARGET); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1863 } | 1865 } |
1864 } | 1866 } |
1865 | 1867 |
1866 | 1868 |
1867 #undef __ | 1869 #undef __ |
1868 | 1870 |
1869 } // namespace internal | 1871 } // namespace internal |
1870 } // namespace v8 | 1872 } // namespace v8 |
1871 | 1873 |
1872 #endif // V8_TARGET_ARCH_MIPS64 | 1874 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |