| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 | 6 |
| 7 #include "src/compilation-info.h" | 7 #include "src/compilation-info.h" |
| 8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
| 9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
| (...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1690 | 1690 |
| 1691 Runtime::FunctionId trap_id = static_cast<Runtime::FunctionId>( | 1691 Runtime::FunctionId trap_id = static_cast<Runtime::FunctionId>( |
| 1692 i.InputInt32(instr_->InputCount() - 1)); | 1692 i.InputInt32(instr_->InputCount() - 1)); |
| 1693 bool old_has_frame = __ has_frame(); | 1693 bool old_has_frame = __ has_frame(); |
| 1694 if (frame_elided_) { | 1694 if (frame_elided_) { |
| 1695 __ set_has_frame(true); | 1695 __ set_has_frame(true); |
| 1696 __ EnterFrame(StackFrame::WASM_COMPILED); | 1696 __ EnterFrame(StackFrame::WASM_COMPILED); |
| 1697 } | 1697 } |
| 1698 GenerateCallToTrap(trap_id); | 1698 GenerateCallToTrap(trap_id); |
| 1699 if (frame_elided_) { | 1699 if (frame_elided_) { |
| 1700 ReferenceMap* reference_map = | |
| 1701 new (gen_->zone()) ReferenceMap(gen_->zone()); | |
| 1702 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, | |
| 1703 Safepoint::kNoLazyDeopt); | |
| 1704 __ set_has_frame(old_has_frame); | 1700 __ set_has_frame(old_has_frame); |
| 1705 } | 1701 } |
| 1706 if (FLAG_debug_code) { | 1702 if (FLAG_debug_code) { |
| 1707 __ ud2(); | 1703 __ ud2(); |
| 1708 } | 1704 } |
| 1709 } | 1705 } |
| 1710 | 1706 |
| 1711 private: | 1707 private: |
| 1712 void GenerateCallToTrap(Runtime::FunctionId trap_id) { | 1708 void GenerateCallToTrap(Runtime::FunctionId trap_id) { |
| 1713 if (trap_id == Runtime::kNumFunctions) { | 1709 if (trap_id == Runtime::kNumFunctions) { |
| 1714 // We cannot test calls to the runtime in cctest/test-run-wasm. | 1710 // We cannot test calls to the runtime in cctest/test-run-wasm. |
| 1715 // Therefore we emit a call to C here instead of a call to the runtime. | 1711 // Therefore we emit a call to C here instead of a call to the runtime. |
| 1716 __ PrepareCallCFunction(0, esi); | 1712 __ PrepareCallCFunction(0, esi); |
| 1717 __ CallCFunction( | 1713 __ CallCFunction( |
| 1718 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), | 1714 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), |
| 1719 0); | 1715 0); |
| 1720 } else { | 1716 } else { |
| 1721 __ Move(esi, isolate()->native_context()); | 1717 __ Move(esi, isolate()->native_context()); |
| 1722 gen_->AssembleSourcePosition(instr_); | 1718 gen_->AssembleSourcePosition(instr_); |
| 1723 __ CallRuntime(trap_id); | 1719 __ CallRuntime(trap_id); |
| 1724 } | 1720 } |
| 1721 ReferenceMap* reference_map = |
| 1722 new (gen_->zone()) ReferenceMap(gen_->zone()); |
| 1723 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, |
| 1724 Safepoint::kNoLazyDeopt); |
| 1725 } | 1725 } |
| 1726 | 1726 |
| 1727 bool frame_elided_; | 1727 bool frame_elided_; |
| 1728 Instruction* instr_; | 1728 Instruction* instr_; |
| 1729 CodeGenerator* gen_; | 1729 CodeGenerator* gen_; |
| 1730 }; | 1730 }; |
| 1731 bool frame_elided = !frame_access_state()->has_frame(); | 1731 bool frame_elided = !frame_access_state()->has_frame(); |
| 1732 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); | 1732 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); |
| 1733 Label* tlabel = ool->entry(); | 1733 Label* tlabel = ool->entry(); |
| 1734 Label end; | 1734 Label end; |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2301 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2301 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
| 2302 __ Nop(padding_size); | 2302 __ Nop(padding_size); |
| 2303 } | 2303 } |
| 2304 } | 2304 } |
| 2305 | 2305 |
| 2306 #undef __ | 2306 #undef __ |
| 2307 | 2307 |
| 2308 } // namespace compiler | 2308 } // namespace compiler |
| 2309 } // namespace internal | 2309 } // namespace internal |
| 2310 } // namespace v8 | 2310 } // namespace v8 |
| OLD | NEW |