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