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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 __ bind(&to_string); | 187 __ bind(&to_string); |
188 { | 188 { |
189 ToStringStub stub(masm->isolate()); | 189 ToStringStub stub(masm->isolate()); |
190 __ TailCallStub(&stub); | 190 __ TailCallStub(&stub); |
191 } | 191 } |
192 | 192 |
193 // 3b. Convert symbol in a0 to a string. | 193 // 3b. Convert symbol in a0 to a string. |
194 __ bind(&symbol_descriptive_string); | 194 __ bind(&symbol_descriptive_string); |
195 { | 195 { |
196 __ Push(a0); | 196 __ Push(a0); |
197 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1, 1); | 197 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1); |
198 } | 198 } |
199 } | 199 } |
200 | 200 |
201 | 201 |
202 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { | 202 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { |
203 // ----------- S t a t e ------------- | 203 // ----------- S t a t e ------------- |
204 // -- a0 : number of arguments | 204 // -- a0 : number of arguments |
205 // -- a1 : constructor function | 205 // -- a1 : constructor function |
206 // -- a3 : new target | 206 // -- a3 : new target |
207 // -- ra : return address | 207 // -- ra : return address |
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 __ bind(&set_global_proxy); | 1319 __ bind(&set_global_proxy); |
1320 __ LoadGlobalProxy(t0); | 1320 __ LoadGlobalProxy(t0); |
1321 __ sd(t0, MemOperand(t8)); | 1321 __ sd(t0, MemOperand(t8)); |
1322 __ Branch(&valid_receiver); | 1322 __ Branch(&valid_receiver); |
1323 | 1323 |
1324 // Compatible receiver check failed: throw an Illegal Invocation exception. | 1324 // Compatible receiver check failed: throw an Illegal Invocation exception. |
1325 __ bind(&receiver_check_failed); | 1325 __ bind(&receiver_check_failed); |
1326 // Drop the arguments (including the receiver); | 1326 // Drop the arguments (including the receiver); |
1327 __ Daddu(t8, t8, Operand(kPointerSize)); | 1327 __ Daddu(t8, t8, Operand(kPointerSize)); |
1328 __ daddu(sp, t8, zero_reg); | 1328 __ daddu(sp, t8, zero_reg); |
1329 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0, 1); | 1329 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0); |
1330 } | 1330 } |
1331 | 1331 |
1332 | 1332 |
1333 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1333 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
1334 // Lookup the function in the JavaScript frame. | 1334 // Lookup the function in the JavaScript frame. |
1335 __ ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1335 __ ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1336 { | 1336 { |
1337 FrameScope scope(masm, StackFrame::INTERNAL); | 1337 FrameScope scope(masm, StackFrame::INTERNAL); |
1338 // Pass function as argument. | 1338 // Pass function as argument. |
1339 __ push(a0); | 1339 __ push(a0); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 __ bind(&no_arguments); | 1441 __ bind(&no_arguments); |
1442 { | 1442 { |
1443 __ mov(a0, zero_reg); | 1443 __ mov(a0, zero_reg); |
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 __ sd(a1, MemOperand(sp)); | 1450 __ sd(a1, MemOperand(sp)); |
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 // a0: actual number of arguments | 1459 // a0: actual number of arguments |
1460 { | 1460 { |
1461 Label done; | 1461 Label done; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1550 | 1550 |
1551 // 3a. Apply the target to the given argumentsList (passing undefined for | 1551 // 3a. Apply the target to the given argumentsList (passing undefined for |
1552 // new.target). | 1552 // new.target). |
1553 __ LoadRoot(a3, Heap::kUndefinedValueRootIndex); | 1553 __ LoadRoot(a3, Heap::kUndefinedValueRootIndex); |
1554 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); | 1554 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); |
1555 | 1555 |
1556 // 3b. The target is not callable, throw an appropriate TypeError. | 1556 // 3b. The target is not callable, throw an appropriate TypeError. |
1557 __ bind(&target_not_callable); | 1557 __ bind(&target_not_callable); |
1558 { | 1558 { |
1559 __ sd(a1, MemOperand(sp)); | 1559 __ sd(a1, MemOperand(sp)); |
1560 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1); | 1560 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1); |
1561 } | 1561 } |
1562 } | 1562 } |
1563 | 1563 |
1564 | 1564 |
1565 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { | 1565 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { |
1566 // ----------- S t a t e ------------- | 1566 // ----------- S t a t e ------------- |
1567 // -- a0 : argc | 1567 // -- a0 : argc |
1568 // -- sp[0] : new.target (optional) | 1568 // -- sp[0] : new.target (optional) |
1569 // -- sp[4] : argumentsList | 1569 // -- sp[4] : argumentsList |
1570 // -- sp[8] : target | 1570 // -- sp[8] : target |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 __ And(a4, a4, Operand(1 << Map::kIsConstructor)); | 1621 __ And(a4, a4, Operand(1 << Map::kIsConstructor)); |
1622 __ Branch(&new_target_not_constructor, eq, a4, Operand(zero_reg)); | 1622 __ Branch(&new_target_not_constructor, eq, a4, Operand(zero_reg)); |
1623 | 1623 |
1624 // 4a. Construct the target with the given new.target and argumentsList. | 1624 // 4a. Construct the target with the given new.target and argumentsList. |
1625 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); | 1625 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); |
1626 | 1626 |
1627 // 4b. The target is not a constructor, throw an appropriate TypeError. | 1627 // 4b. The target is not a constructor, throw an appropriate TypeError. |
1628 __ bind(&target_not_constructor); | 1628 __ bind(&target_not_constructor); |
1629 { | 1629 { |
1630 __ sd(a1, MemOperand(sp)); | 1630 __ sd(a1, MemOperand(sp)); |
1631 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1, 1); | 1631 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1); |
1632 } | 1632 } |
1633 | 1633 |
1634 // 4c. The new.target is not a constructor, throw an appropriate TypeError. | 1634 // 4c. The new.target is not a constructor, throw an appropriate TypeError. |
1635 __ bind(&new_target_not_constructor); | 1635 __ bind(&new_target_not_constructor); |
1636 { | 1636 { |
1637 __ sd(a3, MemOperand(sp)); | 1637 __ sd(a3, MemOperand(sp)); |
1638 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1, 1); | 1638 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1); |
1639 } | 1639 } |
1640 } | 1640 } |
1641 | 1641 |
1642 | 1642 |
1643 static void ArgumentAdaptorStackCheck(MacroAssembler* masm, | 1643 static void ArgumentAdaptorStackCheck(MacroAssembler* masm, |
1644 Label* stack_overflow) { | 1644 Label* stack_overflow) { |
1645 // ----------- S t a t e ------------- | 1645 // ----------- S t a t e ------------- |
1646 // -- a0 : actual number of arguments | 1646 // -- a0 : actual number of arguments |
1647 // -- a1 : function (passed through to callee) | 1647 // -- a1 : function (passed through to callee) |
1648 // -- a2 : expected number of arguments | 1648 // -- a2 : expected number of arguments |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 // Check the stack for overflow. We are not trying to catch interruptions | 1766 // Check the stack for overflow. We are not trying to catch interruptions |
1767 // (i.e. debug break and preemption) here, so check the "real stack limit". | 1767 // (i.e. debug break and preemption) here, so check the "real stack limit". |
1768 Label done; | 1768 Label done; |
1769 __ LoadRoot(a4, Heap::kRealStackLimitRootIndex); | 1769 __ LoadRoot(a4, Heap::kRealStackLimitRootIndex); |
1770 // Make ip the space we have left. The stack might already be overflowed | 1770 // Make ip the space we have left. The stack might already be overflowed |
1771 // here which will cause ip to become negative. | 1771 // here which will cause ip to become negative. |
1772 __ Dsubu(a4, sp, a4); | 1772 __ Dsubu(a4, sp, a4); |
1773 // Check if the arguments will overflow the stack. | 1773 // Check if the arguments will overflow the stack. |
1774 __ dsll(at, a2, kPointerSizeLog2); | 1774 __ dsll(at, a2, kPointerSizeLog2); |
1775 __ Branch(&done, gt, a4, Operand(at)); // Signed comparison. | 1775 __ Branch(&done, gt, a4, Operand(at)); // Signed comparison. |
1776 __ TailCallRuntime(Runtime::kThrowStackOverflow, 1, 1); | 1776 __ TailCallRuntime(Runtime::kThrowStackOverflow, 1); |
1777 __ bind(&done); | 1777 __ bind(&done); |
1778 } | 1778 } |
1779 | 1779 |
1780 // ----------- S t a t e ------------- | 1780 // ----------- S t a t e ------------- |
1781 // -- a1 : target | 1781 // -- a1 : target |
1782 // -- a0 : args (a FixedArray built from argumentsList) | 1782 // -- a0 : args (a FixedArray built from argumentsList) |
1783 // -- a2 : len (number of elements to push from args) | 1783 // -- a2 : len (number of elements to push from args) |
1784 // -- a3 : new.target (checked to be constructor or undefined) | 1784 // -- a3 : new.target (checked to be constructor or undefined) |
1785 // -- sp[0] : thisArgument | 1785 // -- sp[0] : thisArgument |
1786 // ----------------------------------- | 1786 // ----------------------------------- |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2413 } | 2413 } |
2414 } | 2414 } |
2415 | 2415 |
2416 | 2416 |
2417 #undef __ | 2417 #undef __ |
2418 | 2418 |
2419 } // namespace internal | 2419 } // namespace internal |
2420 } // namespace v8 | 2420 } // namespace v8 |
2421 | 2421 |
2422 #endif // V8_TARGET_ARCH_MIPS64 | 2422 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |