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 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 } | 1693 } |
1694 | 1694 |
1695 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { | 1695 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { |
1696 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); | 1696 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); |
1697 } | 1697 } |
1698 | 1698 |
1699 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { | 1699 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { |
1700 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); | 1700 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); |
1701 } | 1701 } |
1702 | 1702 |
| 1703 void Builtins::Generate_NotifyBuiltinContinuation(MacroAssembler* masm) { |
| 1704 { |
| 1705 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 1706 // Preserve possible return result from lazy deopt. |
| 1707 __ push(r3); |
| 1708 // Pass the function and deoptimization type to the runtime system. |
| 1709 __ CallRuntime(Runtime::kNotifyStubFailure, false); |
| 1710 __ pop(r3); |
| 1711 } |
| 1712 |
| 1713 __ addi(sp, sp, Operand(kPointerSize)); // Ignore state |
| 1714 __ blr(); // Jump to ContinueToBuiltin stub |
| 1715 } |
| 1716 |
| 1717 namespace { |
| 1718 void Generate_ContinueToBuiltinHelper(MacroAssembler* masm, |
| 1719 bool java_script_builtin, |
| 1720 bool with_result) { |
| 1721 const RegisterConfiguration* config(RegisterConfiguration::Turbofan()); |
| 1722 int allocatable_register_count = config->num_allocatable_general_registers(); |
| 1723 if (with_result) { |
| 1724 // Overwrite the hole inserted by the deoptimizer with the return value from |
| 1725 // the LAZY deopt point. |
| 1726 __ StoreP( |
| 1727 r3, MemOperand( |
| 1728 sp, config->num_allocatable_general_registers() * kPointerSize + |
| 1729 BuiltinContinuationFrameConstants::kFixedFrameSize)); |
| 1730 } |
| 1731 for (int i = allocatable_register_count - 1; i >= 0; --i) { |
| 1732 int code = config->GetAllocatableGeneralCode(i); |
| 1733 __ Pop(Register::from_code(code)); |
| 1734 if (java_script_builtin && code == kJavaScriptCallArgCountRegister.code()) { |
| 1735 __ SmiUntag(Register::from_code(code)); |
| 1736 } |
| 1737 } |
| 1738 __ LoadP( |
| 1739 fp, |
| 1740 MemOperand(sp, BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp)); |
| 1741 __ Pop(ip); |
| 1742 __ addi(sp, sp, |
| 1743 Operand(BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp)); |
| 1744 __ Pop(r0); |
| 1745 __ mtlr(r0); |
| 1746 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1747 __ Jump(ip); |
| 1748 } |
| 1749 } // namespace |
| 1750 |
| 1751 void Builtins::Generate_ContinueToCodeStubBuiltin(MacroAssembler* masm) { |
| 1752 Generate_ContinueToBuiltinHelper(masm, false, false); |
| 1753 } |
| 1754 |
| 1755 void Builtins::Generate_ContinueToCodeStubBuiltinWithResult( |
| 1756 MacroAssembler* masm) { |
| 1757 Generate_ContinueToBuiltinHelper(masm, false, true); |
| 1758 } |
| 1759 |
| 1760 void Builtins::Generate_ContinueToJavaScriptBuiltin(MacroAssembler* masm) { |
| 1761 Generate_ContinueToBuiltinHelper(masm, true, false); |
| 1762 } |
| 1763 |
| 1764 void Builtins::Generate_ContinueToJavaScriptBuiltinWithResult( |
| 1765 MacroAssembler* masm) { |
| 1766 Generate_ContinueToBuiltinHelper(masm, true, true); |
| 1767 } |
| 1768 |
1703 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, | 1769 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
1704 Deoptimizer::BailoutType type) { | 1770 Deoptimizer::BailoutType type) { |
1705 { | 1771 { |
1706 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1772 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
1707 // Pass the function and deoptimization type to the runtime system. | 1773 // Pass the function and deoptimization type to the runtime system. |
1708 __ LoadSmiLiteral(r3, Smi::FromInt(static_cast<int>(type))); | 1774 __ LoadSmiLiteral(r3, Smi::FromInt(static_cast<int>(type))); |
1709 __ push(r3); | 1775 __ push(r3); |
1710 __ CallRuntime(Runtime::kNotifyDeoptimized); | 1776 __ CallRuntime(Runtime::kNotifyDeoptimized); |
1711 } | 1777 } |
1712 | 1778 |
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3180 } | 3246 } |
3181 // Now jump to the instructions of the returned code object. | 3247 // Now jump to the instructions of the returned code object. |
3182 __ Jump(r11); | 3248 __ Jump(r11); |
3183 } | 3249 } |
3184 | 3250 |
3185 #undef __ | 3251 #undef __ |
3186 } // namespace internal | 3252 } // namespace internal |
3187 } // namespace v8 | 3253 } // namespace v8 |
3188 | 3254 |
3189 #endif // V8_TARGET_ARCH_PPC | 3255 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |