OLD | NEW |
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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1365 __ Mov(x1, 0); // Initial index. | 1365 __ Mov(x1, 0); // Initial index. |
1366 __ Push(argc, x1, function); | 1366 __ Push(argc, x1, function); |
1367 | 1367 |
1368 // Copy all arguments from the array to the stack. | 1368 // Copy all arguments from the array to the stack. |
1369 Generate_PushAppliedArguments(masm, kVectorOffset, kArgumentsOffset, | 1369 Generate_PushAppliedArguments(masm, kVectorOffset, kArgumentsOffset, |
1370 kIndexOffset, kLimitOffset); | 1370 kIndexOffset, kLimitOffset); |
1371 | 1371 |
1372 // Use undefined feedback vector | 1372 // Use undefined feedback vector |
1373 __ LoadRoot(x2, Heap::kUndefinedValueRootIndex); | 1373 __ LoadRoot(x2, Heap::kUndefinedValueRootIndex); |
1374 __ Ldr(x1, MemOperand(fp, kFunctionOffset)); | 1374 __ Ldr(x1, MemOperand(fp, kFunctionOffset)); |
1375 __ Ldr(x4, MemOperand(fp, kNewTargetOffset)); | 1375 __ Ldr(x3, MemOperand(fp, kNewTargetOffset)); |
1376 | 1376 |
1377 // Call the function. | 1377 // Call the function. |
1378 CallConstructStub stub(masm->isolate(), SUPER_CONSTRUCTOR_CALL); | 1378 __ Call(masm->isolate()->builtins()->Construct(), |
1379 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 1379 RelocInfo::CONSTRUCT_CALL); |
1380 | 1380 |
1381 // Leave internal frame. | 1381 // Leave internal frame. |
1382 } | 1382 } |
1383 __ Drop(kStackSize); | 1383 __ Drop(kStackSize); |
1384 __ Ret(); | 1384 __ Ret(); |
1385 } | 1385 } |
1386 | 1386 |
1387 | 1387 |
1388 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 1388 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
1389 ASM_LOCATION("Builtins::Generate_FunctionApply"); | 1389 ASM_LOCATION("Builtins::Generate_FunctionApply"); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1640 | 1640 |
1641 // static | 1641 // static |
1642 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1642 void Builtins::Generate_Construct(MacroAssembler* masm) { |
1643 // ----------- S t a t e ------------- | 1643 // ----------- S t a t e ------------- |
1644 // -- x0 : the number of arguments (not including the receiver) | 1644 // -- x0 : the number of arguments (not including the receiver) |
1645 // -- x1 : the constructor to call (can be any Object) | 1645 // -- x1 : the constructor to call (can be any Object) |
1646 // -- x3 : the new target (either the same as the constructor or | 1646 // -- x3 : the new target (either the same as the constructor or |
1647 // the JSFunction on which new was invoked initially) | 1647 // the JSFunction on which new was invoked initially) |
1648 // ----------------------------------- | 1648 // ----------------------------------- |
1649 | 1649 |
1650 // Check if target has a [[Construct]] internal method. | 1650 // Check if target is a Smi. |
1651 Label non_constructor; | 1651 Label non_constructor; |
1652 __ JumpIfSmi(x1, &non_constructor); | 1652 __ JumpIfSmi(x1, &non_constructor); |
1653 __ Ldr(x4, FieldMemOperand(x1, HeapObject::kMapOffset)); | |
1654 __ Ldrb(x2, FieldMemOperand(x4, Map::kBitFieldOffset)); | |
1655 __ TestAndBranchIfAllClear(x2, 1 << Map::kIsConstructor, &non_constructor); | |
1656 | 1653 |
1657 // Dispatch based on instance type. | 1654 // Dispatch based on instance type. |
1658 __ CompareInstanceType(x4, x5, JS_FUNCTION_TYPE); | 1655 __ CompareObjectType(x1, x4, x5, JS_FUNCTION_TYPE); |
1659 __ Jump(masm->isolate()->builtins()->ConstructFunction(), | 1656 __ Jump(masm->isolate()->builtins()->ConstructFunction(), |
1660 RelocInfo::CODE_TARGET, eq); | 1657 RelocInfo::CODE_TARGET, eq); |
1661 __ Cmp(x5, JS_FUNCTION_PROXY_TYPE); | 1658 __ Cmp(x5, JS_FUNCTION_PROXY_TYPE); |
1662 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, | 1659 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, |
1663 eq); | 1660 eq); |
1664 | 1661 |
| 1662 // Check if target has a [[Construct]] internal method. |
| 1663 __ Ldrb(x2, FieldMemOperand(x4, Map::kBitFieldOffset)); |
| 1664 __ TestAndBranchIfAllClear(x2, 1 << Map::kIsConstructor, &non_constructor); |
| 1665 |
1665 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1666 // Called Construct on an exotic Object with a [[Construct]] internal method. |
1666 { | 1667 { |
1667 // Overwrite the original receiver with the (original) target. | 1668 // Overwrite the original receiver with the (original) target. |
1668 __ Poke(x1, Operand(x0, LSL, kXRegSizeLog2)); | 1669 __ Poke(x1, Operand(x0, LSL, kXRegSizeLog2)); |
1669 // Let the "call_as_constructor_delegate" take care of the rest. | 1670 // Let the "call_as_constructor_delegate" take care of the rest. |
1670 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, x1); | 1671 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, x1); |
1671 __ Jump(masm->isolate()->builtins()->CallFunction(), | 1672 __ Jump(masm->isolate()->builtins()->CallFunction(), |
1672 RelocInfo::CODE_TARGET); | 1673 RelocInfo::CODE_TARGET); |
1673 } | 1674 } |
1674 | 1675 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1921 } | 1922 } |
1922 } | 1923 } |
1923 | 1924 |
1924 | 1925 |
1925 #undef __ | 1926 #undef __ |
1926 | 1927 |
1927 } // namespace internal | 1928 } // namespace internal |
1928 } // namespace v8 | 1929 } // namespace v8 |
1929 | 1930 |
1930 #endif // V8_TARGET_ARCH_ARM | 1931 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |