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 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 } | 1639 } |
1640 | 1640 |
1641 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { | 1641 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { |
1642 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); | 1642 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); |
1643 } | 1643 } |
1644 | 1644 |
1645 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { | 1645 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { |
1646 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); | 1646 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); |
1647 } | 1647 } |
1648 | 1648 |
| 1649 void Builtins::Generate_NotifyBuiltinContinuation(MacroAssembler* masm) { |
| 1650 { |
| 1651 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1652 // Preserve possible return result from lazy deopt. |
| 1653 __ Push(v0); |
| 1654 // Pass the function and deoptimization type to the runtime system. |
| 1655 __ CallRuntime(Runtime::kNotifyStubFailure, false); |
| 1656 __ Pop(v0); |
| 1657 } |
| 1658 |
| 1659 __ Addu(sp, sp, Operand(kPointerSize)); // Ignore state |
| 1660 __ Jump(ra); // Jump to the ContinueToBuiltin stub |
| 1661 } |
| 1662 |
| 1663 namespace { |
| 1664 void Generate_ContinueToBuiltinHelper(MacroAssembler* masm, |
| 1665 bool java_script_builtin, |
| 1666 bool with_result) { |
| 1667 const RegisterConfiguration* config(RegisterConfiguration::Turbofan()); |
| 1668 int allocatable_register_count = config->num_allocatable_general_registers(); |
| 1669 if (with_result) { |
| 1670 // Overwrite the hole inserted by the deoptimizer with the return value from |
| 1671 // the LAZY deopt point. |
| 1672 __ sw(v0, |
| 1673 MemOperand( |
| 1674 sp, config->num_allocatable_general_registers() * kPointerSize + |
| 1675 BuiltinContinuationFrameConstants::kFixedFrameSize)); |
| 1676 } |
| 1677 for (int i = allocatable_register_count - 1; i >= 0; --i) { |
| 1678 int code = config->GetAllocatableGeneralCode(i); |
| 1679 __ Pop(Register::from_code(code)); |
| 1680 if (java_script_builtin && code == kJavaScriptCallArgCountRegister.code()) { |
| 1681 __ SmiUntag(Register::from_code(code)); |
| 1682 } |
| 1683 } |
| 1684 __ lw(fp, MemOperand( |
| 1685 sp, BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp)); |
| 1686 __ Pop(t0); |
| 1687 __ Addu(sp, sp, |
| 1688 Operand(BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp)); |
| 1689 __ Pop(ra); |
| 1690 __ Addu(t0, t0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1691 __ Jump(t0); |
| 1692 } |
| 1693 } // namespace |
| 1694 |
| 1695 void Builtins::Generate_ContinueToCodeStubBuiltin(MacroAssembler* masm) { |
| 1696 Generate_ContinueToBuiltinHelper(masm, false, false); |
| 1697 } |
| 1698 |
| 1699 void Builtins::Generate_ContinueToCodeStubBuiltinWithResult( |
| 1700 MacroAssembler* masm) { |
| 1701 Generate_ContinueToBuiltinHelper(masm, false, true); |
| 1702 } |
| 1703 |
| 1704 void Builtins::Generate_ContinueToJavaScriptBuiltin(MacroAssembler* masm) { |
| 1705 Generate_ContinueToBuiltinHelper(masm, true, false); |
| 1706 } |
| 1707 |
| 1708 void Builtins::Generate_ContinueToJavaScriptBuiltinWithResult( |
| 1709 MacroAssembler* masm) { |
| 1710 Generate_ContinueToBuiltinHelper(masm, true, true); |
| 1711 } |
| 1712 |
1649 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, | 1713 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
1650 Deoptimizer::BailoutType type) { | 1714 Deoptimizer::BailoutType type) { |
1651 { | 1715 { |
1652 FrameScope scope(masm, StackFrame::INTERNAL); | 1716 FrameScope scope(masm, StackFrame::INTERNAL); |
1653 // Pass the function and deoptimization type to the runtime system. | 1717 // Pass the function and deoptimization type to the runtime system. |
1654 __ li(a0, Operand(Smi::FromInt(static_cast<int>(type)))); | 1718 __ li(a0, Operand(Smi::FromInt(static_cast<int>(type)))); |
1655 __ push(a0); | 1719 __ push(a0); |
1656 __ CallRuntime(Runtime::kNotifyDeoptimized); | 1720 __ CallRuntime(Runtime::kNotifyDeoptimized); |
1657 } | 1721 } |
1658 | 1722 |
(...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3112 // Now jump to the instructions of the returned code object. | 3176 // Now jump to the instructions of the returned code object. |
3113 __ Jump(at, v0, Code::kHeaderSize - kHeapObjectTag); | 3177 __ Jump(at, v0, Code::kHeaderSize - kHeapObjectTag); |
3114 } | 3178 } |
3115 | 3179 |
3116 #undef __ | 3180 #undef __ |
3117 | 3181 |
3118 } // namespace internal | 3182 } // namespace internal |
3119 } // namespace v8 | 3183 } // namespace v8 |
3120 | 3184 |
3121 #endif // V8_TARGET_ARCH_MIPS | 3185 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |