| 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 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
| 6 #include "src/compilation-info.h" | 6 #include "src/compilation-info.h" |
| 7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
| 8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
| 9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
| 10 #include "src/compiler/osr.h" | 10 #include "src/compiler/osr.h" |
| (...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 i.InputInt32(instr_->InputCount() - 1)); | 1754 i.InputInt32(instr_->InputCount() - 1)); |
| 1755 bool old_has_frame = __ has_frame(); | 1755 bool old_has_frame = __ has_frame(); |
| 1756 if (frame_elided_) { | 1756 if (frame_elided_) { |
| 1757 __ set_has_frame(true); | 1757 __ set_has_frame(true); |
| 1758 __ EnterFrame(StackFrame::WASM_COMPILED); | 1758 __ EnterFrame(StackFrame::WASM_COMPILED); |
| 1759 } | 1759 } |
| 1760 GenerateCallToTrap(trap_id); | 1760 GenerateCallToTrap(trap_id); |
| 1761 if (frame_elided_) { | 1761 if (frame_elided_) { |
| 1762 __ set_has_frame(old_has_frame); | 1762 __ set_has_frame(old_has_frame); |
| 1763 } | 1763 } |
| 1764 if (FLAG_debug_code) { | |
| 1765 __ stop(GetBailoutReason(kUnexpectedReturnFromWasmTrap)); | |
| 1766 } | |
| 1767 } | 1764 } |
| 1768 | 1765 |
| 1769 private: | 1766 private: |
| 1770 void GenerateCallToTrap(Runtime::FunctionId trap_id) { | 1767 void GenerateCallToTrap(Runtime::FunctionId trap_id) { |
| 1771 if (trap_id == Runtime::kNumFunctions) { | 1768 if (trap_id == Runtime::kNumFunctions) { |
| 1772 // We cannot test calls to the runtime in cctest/test-run-wasm. | 1769 // We cannot test calls to the runtime in cctest/test-run-wasm. |
| 1773 // Therefore we emit a call to C here instead of a call to the runtime. | 1770 // Therefore we emit a call to C here instead of a call to the runtime. |
| 1774 // We use the context register as the scratch register, because we do | 1771 // We use the context register as the scratch register, because we do |
| 1775 // not have a context here. | 1772 // not have a context here. |
| 1776 __ PrepareCallCFunction(0, 0, cp); | 1773 __ PrepareCallCFunction(0, 0, cp); |
| 1777 __ CallCFunction( | 1774 __ CallCFunction( |
| 1778 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), | 1775 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), |
| 1779 0); | 1776 0); |
| 1777 __ LeaveFrame(StackFrame::WASM_COMPILED); |
| 1778 __ Ret(); |
| 1780 } else { | 1779 } else { |
| 1781 __ Move(cp, Smi::kZero); | 1780 __ Move(cp, Smi::kZero); |
| 1782 gen_->AssembleSourcePosition(instr_); | 1781 gen_->AssembleSourcePosition(instr_); |
| 1783 __ CallRuntime(trap_id); | 1782 __ CallRuntime(trap_id); |
| 1783 ReferenceMap* reference_map = |
| 1784 new (gen_->zone()) ReferenceMap(gen_->zone()); |
| 1785 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, |
| 1786 Safepoint::kNoLazyDeopt); |
| 1787 if (FLAG_debug_code) { |
| 1788 __ stop(GetBailoutReason(kUnexpectedReturnFromWasmTrap)); |
| 1789 } |
| 1784 } | 1790 } |
| 1785 ReferenceMap* reference_map = | |
| 1786 new (gen_->zone()) ReferenceMap(gen_->zone()); | |
| 1787 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, | |
| 1788 Safepoint::kNoLazyDeopt); | |
| 1789 } | 1791 } |
| 1790 | 1792 |
| 1791 bool frame_elided_; | 1793 bool frame_elided_; |
| 1792 Instruction* instr_; | 1794 Instruction* instr_; |
| 1793 CodeGenerator* gen_; | 1795 CodeGenerator* gen_; |
| 1794 }; | 1796 }; |
| 1795 bool frame_elided = !frame_access_state()->has_frame(); | 1797 bool frame_elided = !frame_access_state()->has_frame(); |
| 1796 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); | 1798 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); |
| 1797 Label* tlabel = ool->entry(); | 1799 Label* tlabel = ool->entry(); |
| 1798 AssembleBranchToLabels(this, masm(), instr, condition, tlabel, nullptr, true); | 1800 AssembleBranchToLabels(this, masm(), instr, condition, tlabel, nullptr, true); |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2373 padding_size -= v8::internal::Assembler::kInstrSize; | 2375 padding_size -= v8::internal::Assembler::kInstrSize; |
| 2374 } | 2376 } |
| 2375 } | 2377 } |
| 2376 } | 2378 } |
| 2377 | 2379 |
| 2378 #undef __ | 2380 #undef __ |
| 2379 | 2381 |
| 2380 } // namespace compiler | 2382 } // namespace compiler |
| 2381 } // namespace internal | 2383 } // namespace internal |
| 2382 } // namespace v8 | 2384 } // namespace v8 |
| OLD | NEW |