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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 __ bind(&to_string); | 179 __ bind(&to_string); |
180 { | 180 { |
181 ToStringStub stub(masm->isolate()); | 181 ToStringStub stub(masm->isolate()); |
182 __ TailCallStub(&stub); | 182 __ TailCallStub(&stub); |
183 } | 183 } |
184 | 184 |
185 // 3b. Convert symbol in r0 to a string. | 185 // 3b. Convert symbol in r0 to a string. |
186 __ bind(&symbol_descriptive_string); | 186 __ bind(&symbol_descriptive_string); |
187 { | 187 { |
188 __ Push(r0); | 188 __ Push(r0); |
189 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1, 1); | 189 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1); |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 | 193 |
194 // static | 194 // static |
195 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { | 195 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { |
196 // ----------- S t a t e ------------- | 196 // ----------- S t a t e ------------- |
197 // -- r0 : number of arguments | 197 // -- r0 : number of arguments |
198 // -- r1 : constructor function | 198 // -- r1 : constructor function |
199 // -- r3 : new target | 199 // -- r3 : new target |
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 __ bind(&set_global_proxy); | 1315 __ bind(&set_global_proxy); |
1316 __ LoadGlobalProxy(r2); | 1316 __ LoadGlobalProxy(r2); |
1317 __ str(r2, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 1317 __ str(r2, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
1318 __ b(&valid_receiver); | 1318 __ b(&valid_receiver); |
1319 | 1319 |
1320 // Compatible receiver check failed: throw an Illegal Invocation exception. | 1320 // Compatible receiver check failed: throw an Illegal Invocation exception. |
1321 __ bind(&receiver_check_failed); | 1321 __ bind(&receiver_check_failed); |
1322 // Drop the arguments (including the receiver) | 1322 // Drop the arguments (including the receiver) |
1323 __ add(r0, r0, Operand(1)); | 1323 __ add(r0, r0, Operand(1)); |
1324 __ add(sp, sp, Operand(r0, LSL, kPointerSizeLog2)); | 1324 __ add(sp, sp, Operand(r0, LSL, kPointerSizeLog2)); |
1325 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0, 1); | 1325 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0); |
1326 } | 1326 } |
1327 | 1327 |
1328 | 1328 |
1329 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1329 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
1330 // Lookup the function in the JavaScript frame. | 1330 // Lookup the function in the JavaScript frame. |
1331 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1331 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1332 { | 1332 { |
1333 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1333 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
1334 // Pass function as argument. | 1334 // Pass function as argument. |
1335 __ push(r0); | 1335 __ push(r0); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 __ bind(&no_arguments); | 1441 __ bind(&no_arguments); |
1442 { | 1442 { |
1443 __ mov(r0, Operand(0)); | 1443 __ mov(r0, Operand(0)); |
1444 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1444 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1445 } | 1445 } |
1446 | 1446 |
1447 // 4c. The receiver is not callable, throw an appropriate TypeError. | 1447 // 4c. The receiver is not callable, throw an appropriate TypeError. |
1448 __ bind(&receiver_not_callable); | 1448 __ bind(&receiver_not_callable); |
1449 { | 1449 { |
1450 __ str(r1, MemOperand(sp, 0)); | 1450 __ str(r1, MemOperand(sp, 0)); |
1451 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1); | 1451 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1); |
1452 } | 1452 } |
1453 } | 1453 } |
1454 | 1454 |
1455 | 1455 |
1456 // static | 1456 // static |
1457 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { | 1457 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { |
1458 // 1. Make sure we have at least one argument. | 1458 // 1. Make sure we have at least one argument. |
1459 // r0: actual number of arguments | 1459 // r0: actual number of arguments |
1460 { | 1460 { |
1461 Label done; | 1461 Label done; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 | 1540 |
1541 // 3a. Apply the target to the given argumentsList (passing undefined for | 1541 // 3a. Apply the target to the given argumentsList (passing undefined for |
1542 // new.target). | 1542 // new.target). |
1543 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex); | 1543 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex); |
1544 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); | 1544 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); |
1545 | 1545 |
1546 // 3b. The target is not callable, throw an appropriate TypeError. | 1546 // 3b. The target is not callable, throw an appropriate TypeError. |
1547 __ bind(&target_not_callable); | 1547 __ bind(&target_not_callable); |
1548 { | 1548 { |
1549 __ str(r1, MemOperand(sp, 0)); | 1549 __ str(r1, MemOperand(sp, 0)); |
1550 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1); | 1550 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1); |
1551 } | 1551 } |
1552 } | 1552 } |
1553 | 1553 |
1554 | 1554 |
1555 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { | 1555 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { |
1556 // ----------- S t a t e ------------- | 1556 // ----------- S t a t e ------------- |
1557 // -- r0 : argc | 1557 // -- r0 : argc |
1558 // -- sp[0] : new.target (optional) | 1558 // -- sp[0] : new.target (optional) |
1559 // -- sp[4] : argumentsList | 1559 // -- sp[4] : argumentsList |
1560 // -- sp[8] : target | 1560 // -- sp[8] : target |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 __ tst(r4, Operand(1 << Map::kIsConstructor)); | 1603 __ tst(r4, Operand(1 << Map::kIsConstructor)); |
1604 __ b(eq, &new_target_not_constructor); | 1604 __ b(eq, &new_target_not_constructor); |
1605 | 1605 |
1606 // 4a. Construct the target with the given new.target and argumentsList. | 1606 // 4a. Construct the target with the given new.target and argumentsList. |
1607 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); | 1607 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); |
1608 | 1608 |
1609 // 4b. The target is not a constructor, throw an appropriate TypeError. | 1609 // 4b. The target is not a constructor, throw an appropriate TypeError. |
1610 __ bind(&target_not_constructor); | 1610 __ bind(&target_not_constructor); |
1611 { | 1611 { |
1612 __ str(r1, MemOperand(sp, 0)); | 1612 __ str(r1, MemOperand(sp, 0)); |
1613 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1, 1); | 1613 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1); |
1614 } | 1614 } |
1615 | 1615 |
1616 // 4c. The new.target is not a constructor, throw an appropriate TypeError. | 1616 // 4c. The new.target is not a constructor, throw an appropriate TypeError. |
1617 __ bind(&new_target_not_constructor); | 1617 __ bind(&new_target_not_constructor); |
1618 { | 1618 { |
1619 __ str(r3, MemOperand(sp, 0)); | 1619 __ str(r3, MemOperand(sp, 0)); |
1620 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1, 1); | 1620 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1); |
1621 } | 1621 } |
1622 } | 1622 } |
1623 | 1623 |
1624 | 1624 |
1625 static void ArgumentAdaptorStackCheck(MacroAssembler* masm, | 1625 static void ArgumentAdaptorStackCheck(MacroAssembler* masm, |
1626 Label* stack_overflow) { | 1626 Label* stack_overflow) { |
1627 // ----------- S t a t e ------------- | 1627 // ----------- S t a t e ------------- |
1628 // -- r0 : actual number of arguments | 1628 // -- r0 : actual number of arguments |
1629 // -- r1 : function (passed through to callee) | 1629 // -- r1 : function (passed through to callee) |
1630 // -- r2 : expected number of arguments | 1630 // -- r2 : expected number of arguments |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1749 // Check the stack for overflow. We are not trying to catch interruptions | 1749 // Check the stack for overflow. We are not trying to catch interruptions |
1750 // (i.e. debug break and preemption) here, so check the "real stack limit". | 1750 // (i.e. debug break and preemption) here, so check the "real stack limit". |
1751 Label done; | 1751 Label done; |
1752 __ LoadRoot(ip, Heap::kRealStackLimitRootIndex); | 1752 __ LoadRoot(ip, Heap::kRealStackLimitRootIndex); |
1753 // Make ip the space we have left. The stack might already be overflowed | 1753 // Make ip the space we have left. The stack might already be overflowed |
1754 // here which will cause ip to become negative. | 1754 // here which will cause ip to become negative. |
1755 __ sub(ip, sp, ip); | 1755 __ sub(ip, sp, ip); |
1756 // Check if the arguments will overflow the stack. | 1756 // Check if the arguments will overflow the stack. |
1757 __ cmp(ip, Operand(r2, LSL, kPointerSizeLog2)); | 1757 __ cmp(ip, Operand(r2, LSL, kPointerSizeLog2)); |
1758 __ b(gt, &done); // Signed comparison. | 1758 __ b(gt, &done); // Signed comparison. |
1759 __ TailCallRuntime(Runtime::kThrowStackOverflow, 1, 1); | 1759 __ TailCallRuntime(Runtime::kThrowStackOverflow, 1); |
1760 __ bind(&done); | 1760 __ bind(&done); |
1761 } | 1761 } |
1762 | 1762 |
1763 // ----------- S t a t e ------------- | 1763 // ----------- S t a t e ------------- |
1764 // -- r1 : target | 1764 // -- r1 : target |
1765 // -- r0 : args (a FixedArray built from argumentsList) | 1765 // -- r0 : args (a FixedArray built from argumentsList) |
1766 // -- r2 : len (number of elements to push from args) | 1766 // -- r2 : len (number of elements to push from args) |
1767 // -- r3 : new.target (checked to be constructor or undefined) | 1767 // -- r3 : new.target (checked to be constructor or undefined) |
1768 // -- sp[0] : thisArgument | 1768 // -- sp[0] : thisArgument |
1769 // ----------------------------------- | 1769 // ----------------------------------- |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2318 } | 2318 } |
2319 } | 2319 } |
2320 | 2320 |
2321 | 2321 |
2322 #undef __ | 2322 #undef __ |
2323 | 2323 |
2324 } // namespace internal | 2324 } // namespace internal |
2325 } // namespace v8 | 2325 } // namespace v8 |
2326 | 2326 |
2327 #endif // V8_TARGET_ARCH_ARM | 2327 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |