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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 __ Bind(&to_string); | 182 __ Bind(&to_string); |
183 { | 183 { |
184 ToStringStub stub(masm->isolate()); | 184 ToStringStub stub(masm->isolate()); |
185 __ TailCallStub(&stub); | 185 __ TailCallStub(&stub); |
186 } | 186 } |
187 | 187 |
188 // 3b. Convert symbol in x0 to a string. | 188 // 3b. Convert symbol in x0 to a string. |
189 __ Bind(&symbol_descriptive_string); | 189 __ Bind(&symbol_descriptive_string); |
190 { | 190 { |
191 __ Push(x0); | 191 __ Push(x0); |
192 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1, 1); | 192 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1); |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
196 | 196 |
197 // static | 197 // static |
198 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { | 198 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { |
199 // ----------- S t a t e ------------- | 199 // ----------- S t a t e ------------- |
200 // -- x0 : number of arguments | 200 // -- x0 : number of arguments |
201 // -- x1 : constructor function | 201 // -- x1 : constructor function |
202 // -- x3 : new target | 202 // -- x3 : new target |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 __ Bind(&set_global_proxy); | 1295 __ Bind(&set_global_proxy); |
1296 __ LoadGlobalProxy(x2); | 1296 __ LoadGlobalProxy(x2); |
1297 __ Str(x2, MemOperand(jssp, x0, LSL, kPointerSizeLog2)); | 1297 __ Str(x2, MemOperand(jssp, x0, LSL, kPointerSizeLog2)); |
1298 __ B(&valid_receiver); | 1298 __ B(&valid_receiver); |
1299 | 1299 |
1300 // Compatible receiver check failed: throw an Illegal Invocation exception. | 1300 // Compatible receiver check failed: throw an Illegal Invocation exception. |
1301 __ Bind(&receiver_check_failed); | 1301 __ Bind(&receiver_check_failed); |
1302 // Drop the arguments (including the receiver) | 1302 // Drop the arguments (including the receiver) |
1303 __ add(x0, x0, Operand(1)); | 1303 __ add(x0, x0, Operand(1)); |
1304 __ Drop(x0); | 1304 __ Drop(x0); |
1305 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0, 1); | 1305 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0); |
1306 } | 1306 } |
1307 | 1307 |
1308 | 1308 |
1309 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1309 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
1310 // Lookup the function in the JavaScript frame. | 1310 // Lookup the function in the JavaScript frame. |
1311 __ Ldr(x0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1311 __ Ldr(x0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1312 { | 1312 { |
1313 FrameScope scope(masm, StackFrame::INTERNAL); | 1313 FrameScope scope(masm, StackFrame::INTERNAL); |
1314 // Pass function as argument. | 1314 // Pass function as argument. |
1315 __ Push(x0); | 1315 __ Push(x0); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 __ Bind(&no_arguments); | 1417 __ Bind(&no_arguments); |
1418 { | 1418 { |
1419 __ Mov(x0, 0); | 1419 __ Mov(x0, 0); |
1420 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1420 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1421 } | 1421 } |
1422 | 1422 |
1423 // 4c. The receiver is not callable, throw an appropriate TypeError. | 1423 // 4c. The receiver is not callable, throw an appropriate TypeError. |
1424 __ Bind(&receiver_not_callable); | 1424 __ Bind(&receiver_not_callable); |
1425 { | 1425 { |
1426 __ Poke(x1, 0); | 1426 __ Poke(x1, 0); |
1427 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1); | 1427 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1); |
1428 } | 1428 } |
1429 } | 1429 } |
1430 | 1430 |
1431 | 1431 |
1432 // static | 1432 // static |
1433 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { | 1433 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { |
1434 Register argc = x0; | 1434 Register argc = x0; |
1435 Register function = x1; | 1435 Register function = x1; |
1436 Register scratch1 = x10; | 1436 Register scratch1 = x10; |
1437 Register scratch2 = x11; | 1437 Register scratch2 = x11; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1524 | 1524 |
1525 // 3a. Apply the target to the given argumentsList (passing undefined for | 1525 // 3a. Apply the target to the given argumentsList (passing undefined for |
1526 // new.target). | 1526 // new.target). |
1527 __ LoadRoot(x3, Heap::kUndefinedValueRootIndex); | 1527 __ LoadRoot(x3, Heap::kUndefinedValueRootIndex); |
1528 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); | 1528 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); |
1529 | 1529 |
1530 // 3b. The target is not callable, throw an appropriate TypeError. | 1530 // 3b. The target is not callable, throw an appropriate TypeError. |
1531 __ Bind(&target_not_callable); | 1531 __ Bind(&target_not_callable); |
1532 { | 1532 { |
1533 __ Poke(x1, 0); | 1533 __ Poke(x1, 0); |
1534 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1); | 1534 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1); |
1535 } | 1535 } |
1536 } | 1536 } |
1537 | 1537 |
1538 | 1538 |
1539 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { | 1539 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { |
1540 // ----------- S t a t e ------------- | 1540 // ----------- S t a t e ------------- |
1541 // -- x0 : argc | 1541 // -- x0 : argc |
1542 // -- sp[0] : new.target (optional) | 1542 // -- sp[0] : new.target (optional) |
1543 // -- sp[8] : argumentsList | 1543 // -- sp[8] : argumentsList |
1544 // -- sp[16] : target | 1544 // -- sp[16] : target |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 __ TestAndBranchIfAllClear(x4, 1 << Map::kIsConstructor, | 1593 __ TestAndBranchIfAllClear(x4, 1 << Map::kIsConstructor, |
1594 &new_target_not_constructor); | 1594 &new_target_not_constructor); |
1595 | 1595 |
1596 // 4a. Construct the target with the given new.target and argumentsList. | 1596 // 4a. Construct the target with the given new.target and argumentsList. |
1597 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); | 1597 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); |
1598 | 1598 |
1599 // 4b. The target is not a constructor, throw an appropriate TypeError. | 1599 // 4b. The target is not a constructor, throw an appropriate TypeError. |
1600 __ Bind(&target_not_constructor); | 1600 __ Bind(&target_not_constructor); |
1601 { | 1601 { |
1602 __ Poke(x1, 0); | 1602 __ Poke(x1, 0); |
1603 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1, 1); | 1603 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1); |
1604 } | 1604 } |
1605 | 1605 |
1606 // 4c. The new.target is not a constructor, throw an appropriate TypeError. | 1606 // 4c. The new.target is not a constructor, throw an appropriate TypeError. |
1607 __ Bind(&new_target_not_constructor); | 1607 __ Bind(&new_target_not_constructor); |
1608 { | 1608 { |
1609 __ Poke(x3, 0); | 1609 __ Poke(x3, 0); |
1610 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1, 1); | 1610 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1); |
1611 } | 1611 } |
1612 } | 1612 } |
1613 | 1613 |
1614 | 1614 |
1615 static void ArgumentAdaptorStackCheck(MacroAssembler* masm, | 1615 static void ArgumentAdaptorStackCheck(MacroAssembler* masm, |
1616 Label* stack_overflow) { | 1616 Label* stack_overflow) { |
1617 // ----------- S t a t e ------------- | 1617 // ----------- S t a t e ------------- |
1618 // -- x0 : actual number of arguments | 1618 // -- x0 : actual number of arguments |
1619 // -- x1 : function (passed through to callee) | 1619 // -- x1 : function (passed through to callee) |
1620 // -- x2 : expected number of arguments | 1620 // -- x2 : expected number of arguments |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 // Check the stack for overflow. We are not trying to catch interruptions | 1737 // Check the stack for overflow. We are not trying to catch interruptions |
1738 // (i.e. debug break and preemption) here, so check the "real stack limit". | 1738 // (i.e. debug break and preemption) here, so check the "real stack limit". |
1739 Label done; | 1739 Label done; |
1740 __ LoadRoot(x10, Heap::kRealStackLimitRootIndex); | 1740 __ LoadRoot(x10, Heap::kRealStackLimitRootIndex); |
1741 // Make x10 the space we have left. The stack might already be overflowed | 1741 // Make x10 the space we have left. The stack might already be overflowed |
1742 // here which will cause x10 to become negative. | 1742 // here which will cause x10 to become negative. |
1743 __ Sub(x10, jssp, x10); | 1743 __ Sub(x10, jssp, x10); |
1744 // Check if the arguments will overflow the stack. | 1744 // Check if the arguments will overflow the stack. |
1745 __ Cmp(x10, Operand(x2, LSL, kPointerSizeLog2)); | 1745 __ Cmp(x10, Operand(x2, LSL, kPointerSizeLog2)); |
1746 __ B(gt, &done); // Signed comparison. | 1746 __ B(gt, &done); // Signed comparison. |
1747 __ TailCallRuntime(Runtime::kThrowStackOverflow, 1, 1); | 1747 __ TailCallRuntime(Runtime::kThrowStackOverflow, 1); |
1748 __ Bind(&done); | 1748 __ Bind(&done); |
1749 } | 1749 } |
1750 | 1750 |
1751 // ----------- S t a t e ------------- | 1751 // ----------- S t a t e ------------- |
1752 // -- x1 : target | 1752 // -- x1 : target |
1753 // -- x0 : args (a FixedArray built from argumentsList) | 1753 // -- x0 : args (a FixedArray built from argumentsList) |
1754 // -- x2 : len (number of elements to push from args) | 1754 // -- x2 : len (number of elements to push from args) |
1755 // -- x3 : new.target (checked to be constructor or undefined) | 1755 // -- x3 : new.target (checked to be constructor or undefined) |
1756 // -- sp[0] : thisArgument | 1756 // -- sp[0] : thisArgument |
1757 // ----------------------------------- | 1757 // ----------------------------------- |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2405 } | 2405 } |
2406 } | 2406 } |
2407 | 2407 |
2408 | 2408 |
2409 #undef __ | 2409 #undef __ |
2410 | 2410 |
2411 } // namespace internal | 2411 } // namespace internal |
2412 } // namespace v8 | 2412 } // namespace v8 |
2413 | 2413 |
2414 #endif // V8_TARGET_ARCH_ARM | 2414 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |