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 | 5 |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #if V8_TARGET_ARCH_MIPS64 | 9 #if V8_TARGET_ARCH_MIPS64 |
10 | 10 |
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 __ ld(a0, MemOperand(fp, kArgumentsOffset)); // Get the args array. | 1433 __ ld(a0, MemOperand(fp, kArgumentsOffset)); // Get the args array. |
1434 __ push(a0); | 1434 __ push(a0); |
1435 | 1435 |
1436 // Returns (in v0) number of arguments to copy to stack as Smi. | 1436 // Returns (in v0) number of arguments to copy to stack as Smi. |
1437 if (targetIsArgument) { | 1437 if (targetIsArgument) { |
1438 __ InvokeBuiltin(Builtins::REFLECT_APPLY_PREPARE, CALL_FUNCTION); | 1438 __ InvokeBuiltin(Builtins::REFLECT_APPLY_PREPARE, CALL_FUNCTION); |
1439 } else { | 1439 } else { |
1440 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); | 1440 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); |
1441 } | 1441 } |
1442 | 1442 |
| 1443 // Returns the result in v0. |
1443 Generate_CheckStackOverflow(masm, kFunctionOffset); | 1444 Generate_CheckStackOverflow(masm, kFunctionOffset); |
1444 | 1445 |
1445 // Push current limit and index. | 1446 // Push current limit and index. |
1446 const int kIndexOffset = | 1447 const int kIndexOffset = |
1447 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); | 1448 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); |
1448 const int kLimitOffset = | 1449 const int kLimitOffset = |
1449 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); | 1450 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); |
1450 __ mov(a1, zero_reg); | 1451 __ mov(a1, zero_reg); |
1451 __ Push(v0, a1); // Limit and initial index. | 1452 __ Push(v0, a1); // Limit and initial index. |
1452 | 1453 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 __ Ret(USE_DELAY_SLOT); | 1538 __ Ret(USE_DELAY_SLOT); |
1538 __ Daddu(sp, sp, Operand(kStackSize * kPointerSize)); // In delay slot. | 1539 __ Daddu(sp, sp, Operand(kStackSize * kPointerSize)); // In delay slot. |
1539 } | 1540 } |
1540 | 1541 |
1541 | 1542 |
1542 static void Generate_ConstructHelper(MacroAssembler* masm) { | 1543 static void Generate_ConstructHelper(MacroAssembler* masm) { |
1543 const int kFormalParameters = 3; | 1544 const int kFormalParameters = 3; |
1544 const int kStackSize = kFormalParameters + 1; | 1545 const int kStackSize = kFormalParameters + 1; |
1545 | 1546 |
1546 { | 1547 { |
1547 FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); | 1548 FrameScope frame_scope(masm, StackFrame::INTERNAL); |
1548 const int kNewTargetOffset = kFPOnStackSize + kPCOnStackSize; | 1549 const int kNewTargetOffset = kFPOnStackSize + kPCOnStackSize; |
1549 const int kArgumentsOffset = kNewTargetOffset + kPointerSize; | 1550 const int kArgumentsOffset = kNewTargetOffset + kPointerSize; |
1550 const int kFunctionOffset = kArgumentsOffset + kPointerSize; | 1551 const int kFunctionOffset = kArgumentsOffset + kPointerSize; |
1551 | 1552 |
1552 // If newTarget is not supplied, set it to constructor | 1553 // If newTarget is not supplied, set it to constructor |
1553 Label validate_arguments; | 1554 Label validate_arguments; |
1554 __ ld(a0, MemOperand(fp, kNewTargetOffset)); | 1555 __ ld(a0, MemOperand(fp, kNewTargetOffset)); |
1555 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 1556 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
1556 __ Branch(&validate_arguments, ne, a0, Operand(at)); | 1557 __ Branch(&validate_arguments, ne, a0, Operand(at)); |
1557 __ ld(a0, MemOperand(fp, kFunctionOffset)); | 1558 __ ld(a0, MemOperand(fp, kFunctionOffset)); |
1558 __ sd(a0, MemOperand(fp, kNewTargetOffset)); | 1559 __ sd(a0, MemOperand(fp, kNewTargetOffset)); |
1559 | 1560 |
1560 // Validate arguments | 1561 // Validate arguments |
1561 __ bind(&validate_arguments); | 1562 __ bind(&validate_arguments); |
1562 __ ld(a0, MemOperand(fp, kFunctionOffset)); // get the function | 1563 __ ld(a0, MemOperand(fp, kFunctionOffset)); // get the function |
1563 __ push(a0); | 1564 __ push(a0); |
1564 __ ld(a0, MemOperand(fp, kArgumentsOffset)); // get the args array | 1565 __ ld(a0, MemOperand(fp, kArgumentsOffset)); // get the args array |
1565 __ push(a0); | 1566 __ push(a0); |
1566 __ ld(a0, MemOperand(fp, kNewTargetOffset)); // get the new.target | 1567 __ ld(a0, MemOperand(fp, kNewTargetOffset)); // get the new.target |
1567 __ push(a0); | 1568 __ push(a0); |
| 1569 // Returns argument count in v0. |
1568 __ InvokeBuiltin(Builtins::REFLECT_CONSTRUCT_PREPARE, CALL_FUNCTION); | 1570 __ InvokeBuiltin(Builtins::REFLECT_CONSTRUCT_PREPARE, CALL_FUNCTION); |
1569 | 1571 |
| 1572 // Returns result in v0. |
1570 Generate_CheckStackOverflow(masm, kFunctionOffset); | 1573 Generate_CheckStackOverflow(masm, kFunctionOffset); |
1571 | 1574 |
1572 // Push current limit and index. | 1575 // Push current limit and index. |
1573 const int kIndexOffset = | 1576 const int kIndexOffset = |
1574 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); | 1577 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); |
1575 const int kLimitOffset = | 1578 const int kLimitOffset = |
1576 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); | 1579 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); |
1577 __ push(v0); // limit | 1580 __ push(v0); // limit |
1578 __ mov(a1, zero_reg); // initial index | 1581 __ mov(a1, zero_reg); // initial index |
1579 __ push(a1); | 1582 __ push(a1); |
(...skipping 12 matching lines...) Expand all Loading... |
1592 __ ld(a1, MemOperand(fp, kFunctionOffset)); | 1595 __ ld(a1, MemOperand(fp, kFunctionOffset)); |
1593 | 1596 |
1594 // Call the function. | 1597 // Call the function. |
1595 CallConstructStub stub(masm->isolate(), SUPER_CONSTRUCTOR_CALL); | 1598 CallConstructStub stub(masm->isolate(), SUPER_CONSTRUCTOR_CALL); |
1596 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 1599 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
1597 | 1600 |
1598 __ Drop(1); | 1601 __ Drop(1); |
1599 | 1602 |
1600 // Leave internal frame. | 1603 // Leave internal frame. |
1601 } | 1604 } |
1602 __ Daddu(sp, sp, Operand(kStackSize * kPointerSize)); | 1605 __ jr(ra); |
1603 __ Jump(ra); | 1606 __ Daddu(sp, sp, Operand(kStackSize * kPointerSize)); // In delay slot. |
1604 } | 1607 } |
1605 | 1608 |
1606 | 1609 |
1607 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 1610 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
1608 Generate_ApplyHelper(masm, false); | 1611 Generate_ApplyHelper(masm, false); |
1609 } | 1612 } |
1610 | 1613 |
1611 | 1614 |
1612 void Builtins::Generate_ReflectApply(MacroAssembler* masm) { | 1615 void Builtins::Generate_ReflectApply(MacroAssembler* masm) { |
1613 Generate_ApplyHelper(masm, true); | 1616 Generate_ApplyHelper(masm, true); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 __ break_(0xCC); | 1797 __ break_(0xCC); |
1795 } | 1798 } |
1796 } | 1799 } |
1797 | 1800 |
1798 | 1801 |
1799 #undef __ | 1802 #undef __ |
1800 | 1803 |
1801 } } // namespace v8::internal | 1804 } } // namespace v8::internal |
1802 | 1805 |
1803 #endif // V8_TARGET_ARCH_MIPS64 | 1806 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |