OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 __ bind(&to_string); | 180 __ bind(&to_string); |
181 { | 181 { |
182 ToStringStub stub(masm->isolate()); | 182 ToStringStub stub(masm->isolate()); |
183 __ TailCallStub(&stub); | 183 __ TailCallStub(&stub); |
184 } | 184 } |
185 | 185 |
186 // 3b. Convert symbol in r3 to a string. | 186 // 3b. Convert symbol in r3 to a string. |
187 __ bind(&symbol_descriptive_string); | 187 __ bind(&symbol_descriptive_string); |
188 { | 188 { |
189 __ Push(r3); | 189 __ Push(r3); |
190 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1, 1); | 190 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1); |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
194 | 194 |
195 // static | 195 // static |
196 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { | 196 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { |
197 // ----------- S t a t e ------------- | 197 // ----------- S t a t e ------------- |
198 // -- r3 : number of arguments | 198 // -- r3 : number of arguments |
199 // -- r4 : constructor function | 199 // -- r4 : constructor function |
200 // -- r6 : new target | 200 // -- r6 : new target |
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 __ bind(&set_global_proxy); | 1313 __ bind(&set_global_proxy); |
1314 __ LoadGlobalProxy(r5); | 1314 __ LoadGlobalProxy(r5); |
1315 __ StorePX(r5, MemOperand(sp, r11)); | 1315 __ StorePX(r5, MemOperand(sp, r11)); |
1316 __ b(&valid_receiver); | 1316 __ b(&valid_receiver); |
1317 | 1317 |
1318 // Compatible receiver check failed: throw an Illegal Invocation exception. | 1318 // Compatible receiver check failed: throw an Illegal Invocation exception. |
1319 __ bind(&receiver_check_failed); | 1319 __ bind(&receiver_check_failed); |
1320 // Drop the arguments (including the receiver); | 1320 // Drop the arguments (including the receiver); |
1321 __ addi(r11, r11, Operand(kPointerSize)); | 1321 __ addi(r11, r11, Operand(kPointerSize)); |
1322 __ add(sp, sp, r11); | 1322 __ add(sp, sp, r11); |
1323 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0, 1); | 1323 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0); |
1324 } | 1324 } |
1325 | 1325 |
1326 | 1326 |
1327 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1327 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
1328 // Lookup the function in the JavaScript frame. | 1328 // Lookup the function in the JavaScript frame. |
1329 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1329 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1330 { | 1330 { |
1331 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1331 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
1332 // Pass function as argument. | 1332 // Pass function as argument. |
1333 __ push(r3); | 1333 __ push(r3); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 __ bind(&no_arguments); | 1450 __ bind(&no_arguments); |
1451 { | 1451 { |
1452 __ li(r3, Operand::Zero()); | 1452 __ li(r3, Operand::Zero()); |
1453 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1453 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1454 } | 1454 } |
1455 | 1455 |
1456 // 4c. The receiver is not callable, throw an appropriate TypeError. | 1456 // 4c. The receiver is not callable, throw an appropriate TypeError. |
1457 __ bind(&receiver_not_callable); | 1457 __ bind(&receiver_not_callable); |
1458 { | 1458 { |
1459 __ StoreP(r4, MemOperand(sp, 0)); | 1459 __ StoreP(r4, MemOperand(sp, 0)); |
1460 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1); | 1460 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1); |
1461 } | 1461 } |
1462 } | 1462 } |
1463 | 1463 |
1464 | 1464 |
1465 // static | 1465 // static |
1466 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { | 1466 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { |
1467 // 1. Make sure we have at least one argument. | 1467 // 1. Make sure we have at least one argument. |
1468 // r3: actual number of arguments | 1468 // r3: actual number of arguments |
1469 { | 1469 { |
1470 Label done; | 1470 Label done; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 | 1559 |
1560 // 3a. Apply the target to the given argumentsList (passing undefined for | 1560 // 3a. Apply the target to the given argumentsList (passing undefined for |
1561 // new.target). | 1561 // new.target). |
1562 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); | 1562 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); |
1563 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); | 1563 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); |
1564 | 1564 |
1565 // 3b. The target is not callable, throw an appropriate TypeError. | 1565 // 3b. The target is not callable, throw an appropriate TypeError. |
1566 __ bind(&target_not_callable); | 1566 __ bind(&target_not_callable); |
1567 { | 1567 { |
1568 __ StoreP(r4, MemOperand(sp, 0)); | 1568 __ StoreP(r4, MemOperand(sp, 0)); |
1569 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1); | 1569 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1); |
1570 } | 1570 } |
1571 } | 1571 } |
1572 | 1572 |
1573 | 1573 |
1574 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { | 1574 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { |
1575 // ----------- S t a t e ------------- | 1575 // ----------- S t a t e ------------- |
1576 // -- r3 : argc | 1576 // -- r3 : argc |
1577 // -- sp[0] : new.target (optional) | 1577 // -- sp[0] : new.target (optional) |
1578 // -- sp[4] : argumentsList | 1578 // -- sp[4] : argumentsList |
1579 // -- sp[8] : target | 1579 // -- sp[8] : target |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 __ TestBit(r7, Map::kIsConstructor, r0); | 1630 __ TestBit(r7, Map::kIsConstructor, r0); |
1631 __ beq(&new_target_not_constructor, cr0); | 1631 __ beq(&new_target_not_constructor, cr0); |
1632 | 1632 |
1633 // 4a. Construct the target with the given new.target and argumentsList. | 1633 // 4a. Construct the target with the given new.target and argumentsList. |
1634 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); | 1634 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); |
1635 | 1635 |
1636 // 4b. The target is not a constructor, throw an appropriate TypeError. | 1636 // 4b. The target is not a constructor, throw an appropriate TypeError. |
1637 __ bind(&target_not_constructor); | 1637 __ bind(&target_not_constructor); |
1638 { | 1638 { |
1639 __ StoreP(r4, MemOperand(sp, 0)); | 1639 __ StoreP(r4, MemOperand(sp, 0)); |
1640 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1, 1); | 1640 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1); |
1641 } | 1641 } |
1642 | 1642 |
1643 // 4c. The new.target is not a constructor, throw an appropriate TypeError. | 1643 // 4c. The new.target is not a constructor, throw an appropriate TypeError. |
1644 __ bind(&new_target_not_constructor); | 1644 __ bind(&new_target_not_constructor); |
1645 { | 1645 { |
1646 __ StoreP(r6, MemOperand(sp, 0)); | 1646 __ StoreP(r6, MemOperand(sp, 0)); |
1647 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1, 1); | 1647 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1); |
1648 } | 1648 } |
1649 } | 1649 } |
1650 | 1650 |
1651 | 1651 |
1652 static void ArgumentAdaptorStackCheck(MacroAssembler* masm, | 1652 static void ArgumentAdaptorStackCheck(MacroAssembler* masm, |
1653 Label* stack_overflow) { | 1653 Label* stack_overflow) { |
1654 // ----------- S t a t e ------------- | 1654 // ----------- S t a t e ------------- |
1655 // -- r3 : actual number of arguments | 1655 // -- r3 : actual number of arguments |
1656 // -- r4 : function (passed through to callee) | 1656 // -- r4 : function (passed through to callee) |
1657 // -- r5 : expected number of arguments | 1657 // -- r5 : expected number of arguments |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 // (i.e. debug break and preemption) here, so check the "real stack limit". | 1782 // (i.e. debug break and preemption) here, so check the "real stack limit". |
1783 Label done; | 1783 Label done; |
1784 __ LoadRoot(ip, Heap::kRealStackLimitRootIndex); | 1784 __ LoadRoot(ip, Heap::kRealStackLimitRootIndex); |
1785 // Make ip the space we have left. The stack might already be overflowed | 1785 // Make ip the space we have left. The stack might already be overflowed |
1786 // here which will cause ip to become negative. | 1786 // here which will cause ip to become negative. |
1787 __ sub(ip, sp, ip); | 1787 __ sub(ip, sp, ip); |
1788 // Check if the arguments will overflow the stack. | 1788 // Check if the arguments will overflow the stack. |
1789 __ ShiftLeftImm(r0, r5, Operand(kPointerSizeLog2)); | 1789 __ ShiftLeftImm(r0, r5, Operand(kPointerSizeLog2)); |
1790 __ cmp(ip, r0); // Signed comparison. | 1790 __ cmp(ip, r0); // Signed comparison. |
1791 __ bgt(&done); | 1791 __ bgt(&done); |
1792 __ TailCallRuntime(Runtime::kThrowStackOverflow, 1, 1); | 1792 __ TailCallRuntime(Runtime::kThrowStackOverflow, 1); |
1793 __ bind(&done); | 1793 __ bind(&done); |
1794 } | 1794 } |
1795 | 1795 |
1796 // ----------- S t a t e ------------- | 1796 // ----------- S t a t e ------------- |
1797 // -- r4 : target | 1797 // -- r4 : target |
1798 // -- r3 : args (a FixedArray built from argumentsList) | 1798 // -- r3 : args (a FixedArray built from argumentsList) |
1799 // -- r5 : len (number of elements to push from args) | 1799 // -- r5 : len (number of elements to push from args) |
1800 // -- r6 : new.target (checked to be constructor or undefined) | 1800 // -- r6 : new.target (checked to be constructor or undefined) |
1801 // -- sp[0] : thisArgument | 1801 // -- sp[0] : thisArgument |
1802 // ----------------------------------- | 1802 // ----------------------------------- |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2229 __ bkpt(0); | 2229 __ bkpt(0); |
2230 } | 2230 } |
2231 } | 2231 } |
2232 | 2232 |
2233 | 2233 |
2234 #undef __ | 2234 #undef __ |
2235 } // namespace internal | 2235 } // namespace internal |
2236 } // namespace v8 | 2236 } // namespace v8 |
2237 | 2237 |
2238 #endif // V8_TARGET_ARCH_PPC | 2238 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |