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 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 __ set_has_frame(old_has_frame); | 1700 __ set_has_frame(old_has_frame); |
1701 } | 1701 } |
1702 if (FLAG_debug_code) { | |
1703 __ ud2(); | |
1704 } | |
1705 } | 1702 } |
1706 | 1703 |
1707 private: | 1704 private: |
1708 void GenerateCallToTrap(Runtime::FunctionId trap_id) { | 1705 void GenerateCallToTrap(Runtime::FunctionId trap_id) { |
1709 if (trap_id == Runtime::kNumFunctions) { | 1706 if (trap_id == Runtime::kNumFunctions) { |
1710 // We cannot test calls to the runtime in cctest/test-run-wasm. | 1707 // We cannot test calls to the runtime in cctest/test-run-wasm. |
1711 // Therefore we emit a call to C here instead of a call to the runtime. | 1708 // Therefore we emit a call to C here instead of a call to the runtime. |
1712 __ PrepareCallCFunction(0, esi); | 1709 __ PrepareCallCFunction(0, esi); |
1713 __ CallCFunction( | 1710 __ CallCFunction( |
1714 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), | 1711 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), |
1715 0); | 1712 0); |
| 1713 __ LeaveFrame(StackFrame::WASM_COMPILED); |
| 1714 __ Ret(); |
1716 } else { | 1715 } else { |
1717 __ Move(esi, Smi::kZero); | 1716 __ Move(esi, Smi::kZero); |
1718 gen_->AssembleSourcePosition(instr_); | 1717 gen_->AssembleSourcePosition(instr_); |
1719 __ CallRuntime(trap_id); | 1718 __ CallRuntime(trap_id); |
| 1719 ReferenceMap* reference_map = |
| 1720 new (gen_->zone()) ReferenceMap(gen_->zone()); |
| 1721 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, |
| 1722 Safepoint::kNoLazyDeopt); |
| 1723 if (FLAG_debug_code) { |
| 1724 __ ud2(); |
| 1725 } |
1720 } | 1726 } |
1721 ReferenceMap* reference_map = | |
1722 new (gen_->zone()) ReferenceMap(gen_->zone()); | |
1723 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, | |
1724 Safepoint::kNoLazyDeopt); | |
1725 } | 1727 } |
1726 | 1728 |
1727 bool frame_elided_; | 1729 bool frame_elided_; |
1728 Instruction* instr_; | 1730 Instruction* instr_; |
1729 CodeGenerator* gen_; | 1731 CodeGenerator* gen_; |
1730 }; | 1732 }; |
1731 bool frame_elided = !frame_access_state()->has_frame(); | 1733 bool frame_elided = !frame_access_state()->has_frame(); |
1732 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); | 1734 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); |
1733 Label* tlabel = ool->entry(); | 1735 Label* tlabel = ool->entry(); |
1734 Label end; | 1736 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; | 2303 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2302 __ Nop(padding_size); | 2304 __ Nop(padding_size); |
2303 } | 2305 } |
2304 } | 2306 } |
2305 | 2307 |
2306 #undef __ | 2308 #undef __ |
2307 | 2309 |
2308 } // namespace compiler | 2310 } // namespace compiler |
2309 } // namespace internal | 2311 } // namespace internal |
2310 } // namespace v8 | 2312 } // namespace v8 |
OLD | NEW |