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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 __ bind(&to_string); | 188 __ bind(&to_string); |
189 { | 189 { |
190 ToStringStub stub(masm->isolate()); | 190 ToStringStub stub(masm->isolate()); |
191 __ TailCallStub(&stub); | 191 __ TailCallStub(&stub); |
192 } | 192 } |
193 | 193 |
194 // 3b. Convert symbol in a0 to a string. | 194 // 3b. Convert symbol in a0 to a string. |
195 __ bind(&symbol_descriptive_string); | 195 __ bind(&symbol_descriptive_string); |
196 { | 196 { |
197 __ Push(a0); | 197 __ Push(a0); |
198 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1, 1); | 198 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1); |
199 } | 199 } |
200 } | 200 } |
201 | 201 |
202 | 202 |
203 // static | 203 // static |
204 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { | 204 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { |
205 // ----------- S t a t e ------------- | 205 // ----------- S t a t e ------------- |
206 // -- a0 : number of arguments | 206 // -- a0 : number of arguments |
207 // -- a1 : constructor function | 207 // -- a1 : constructor function |
208 // -- a3 : new target | 208 // -- a3 : new target |
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 __ bind(&set_global_proxy); | 1328 __ bind(&set_global_proxy); |
1329 __ LoadGlobalProxy(t0); | 1329 __ LoadGlobalProxy(t0); |
1330 __ sw(t0, MemOperand(t8)); | 1330 __ sw(t0, MemOperand(t8)); |
1331 __ Branch(&valid_receiver); | 1331 __ Branch(&valid_receiver); |
1332 | 1332 |
1333 // Compatible receiver check failed: throw an Illegal Invocation exception. | 1333 // Compatible receiver check failed: throw an Illegal Invocation exception. |
1334 __ bind(&receiver_check_failed); | 1334 __ bind(&receiver_check_failed); |
1335 // Drop the arguments (including the receiver); | 1335 // Drop the arguments (including the receiver); |
1336 __ Addu(t8, t8, Operand(kPointerSize)); | 1336 __ Addu(t8, t8, Operand(kPointerSize)); |
1337 __ addu(sp, t8, zero_reg); | 1337 __ addu(sp, t8, zero_reg); |
1338 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0, 1); | 1338 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0); |
1339 } | 1339 } |
1340 | 1340 |
1341 | 1341 |
1342 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1342 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
1343 // Lookup the function in the JavaScript frame. | 1343 // Lookup the function in the JavaScript frame. |
1344 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1344 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1345 { | 1345 { |
1346 FrameScope scope(masm, StackFrame::INTERNAL); | 1346 FrameScope scope(masm, StackFrame::INTERNAL); |
1347 // Pass function as argument. | 1347 // Pass function as argument. |
1348 __ push(a0); | 1348 __ push(a0); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 __ bind(&no_arguments); | 1450 __ bind(&no_arguments); |
1451 { | 1451 { |
1452 __ mov(a0, zero_reg); | 1452 __ mov(a0, zero_reg); |
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 __ sw(a1, MemOperand(sp)); | 1459 __ sw(a1, MemOperand(sp)); |
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 // a0: actual number of arguments | 1468 // a0: 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(a3, Heap::kUndefinedValueRootIndex); | 1562 __ LoadRoot(a3, 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 __ sw(a1, MemOperand(sp)); | 1568 __ sw(a1, MemOperand(sp)); |
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 // -- a0 : argc | 1576 // -- a0 : 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 __ And(t0, t0, Operand(1 << Map::kIsConstructor)); | 1630 __ And(t0, t0, Operand(1 << Map::kIsConstructor)); |
1631 __ Branch(&new_target_not_constructor, eq, t0, Operand(zero_reg)); | 1631 __ Branch(&new_target_not_constructor, eq, t0, Operand(zero_reg)); |
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 __ sw(a1, MemOperand(sp)); | 1639 __ sw(a1, MemOperand(sp)); |
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 __ sw(a3, MemOperand(sp)); | 1646 __ sw(a3, MemOperand(sp)); |
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 // -- a0 : actual number of arguments | 1655 // -- a0 : actual number of arguments |
1656 // -- a1 : function (passed through to callee) | 1656 // -- a1 : function (passed through to callee) |
1657 // -- a2 : expected number of arguments | 1657 // -- a2 : expected number of arguments |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1774 // Check the stack for overflow. We are not trying to catch interruptions | 1774 // Check the stack for overflow. We are not trying to catch interruptions |
1775 // (i.e. debug break and preemption) here, so check the "real stack limit". | 1775 // (i.e. debug break and preemption) here, so check the "real stack limit". |
1776 Label done; | 1776 Label done; |
1777 __ LoadRoot(t0, Heap::kRealStackLimitRootIndex); | 1777 __ LoadRoot(t0, Heap::kRealStackLimitRootIndex); |
1778 // Make ip the space we have left. The stack might already be overflowed | 1778 // Make ip the space we have left. The stack might already be overflowed |
1779 // here which will cause ip to become negative. | 1779 // here which will cause ip to become negative. |
1780 __ Subu(t0, sp, t0); | 1780 __ Subu(t0, sp, t0); |
1781 // Check if the arguments will overflow the stack. | 1781 // Check if the arguments will overflow the stack. |
1782 __ sll(at, a2, kPointerSizeLog2); | 1782 __ sll(at, a2, kPointerSizeLog2); |
1783 __ Branch(&done, gt, t0, Operand(at)); // Signed comparison. | 1783 __ Branch(&done, gt, t0, Operand(at)); // Signed comparison. |
1784 __ TailCallRuntime(Runtime::kThrowStackOverflow, 1, 1); | 1784 __ TailCallRuntime(Runtime::kThrowStackOverflow, 1); |
1785 __ bind(&done); | 1785 __ bind(&done); |
1786 } | 1786 } |
1787 | 1787 |
1788 // ----------- S t a t e ------------- | 1788 // ----------- S t a t e ------------- |
1789 // -- a1 : target | 1789 // -- a1 : target |
1790 // -- a0 : args (a FixedArray built from argumentsList) | 1790 // -- a0 : args (a FixedArray built from argumentsList) |
1791 // -- a2 : len (number of elements to push from args) | 1791 // -- a2 : len (number of elements to push from args) |
1792 // -- a3 : new.target (checked to be constructor or undefined) | 1792 // -- a3 : new.target (checked to be constructor or undefined) |
1793 // -- sp[0] : thisArgument | 1793 // -- sp[0] : thisArgument |
1794 // ----------------------------------- | 1794 // ----------------------------------- |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2423 } | 2423 } |
2424 } | 2424 } |
2425 | 2425 |
2426 | 2426 |
2427 #undef __ | 2427 #undef __ |
2428 | 2428 |
2429 } // namespace internal | 2429 } // namespace internal |
2430 } // namespace v8 | 2430 } // namespace v8 |
2431 | 2431 |
2432 #endif // V8_TARGET_ARCH_MIPS | 2432 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |