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 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2089 i.InputInt32(instr_->InputCount() - 1)); | 2089 i.InputInt32(instr_->InputCount() - 1)); |
2090 bool old_has_frame = __ has_frame(); | 2090 bool old_has_frame = __ has_frame(); |
2091 if (frame_elided_) { | 2091 if (frame_elided_) { |
2092 __ set_has_frame(true); | 2092 __ set_has_frame(true); |
2093 __ EnterFrame(StackFrame::WASM_COMPILED); | 2093 __ EnterFrame(StackFrame::WASM_COMPILED); |
2094 } | 2094 } |
2095 GenerateCallToTrap(trap_id); | 2095 GenerateCallToTrap(trap_id); |
2096 if (frame_elided_) { | 2096 if (frame_elided_) { |
2097 __ set_has_frame(old_has_frame); | 2097 __ set_has_frame(old_has_frame); |
2098 } | 2098 } |
2099 if (FLAG_debug_code) { | |
2100 __ stop(GetBailoutReason(kUnexpectedReturnFromWasmTrap)); | |
2101 } | |
2102 } | 2099 } |
2103 | 2100 |
2104 private: | 2101 private: |
2105 void GenerateCallToTrap(Runtime::FunctionId trap_id) { | 2102 void GenerateCallToTrap(Runtime::FunctionId trap_id) { |
2106 if (trap_id == Runtime::kNumFunctions) { | 2103 if (trap_id == Runtime::kNumFunctions) { |
2107 // We cannot test calls to the runtime in cctest/test-run-wasm. | 2104 // We cannot test calls to the runtime in cctest/test-run-wasm. |
2108 // Therefore we emit a call to C here instead of a call to the runtime. | 2105 // Therefore we emit a call to C here instead of a call to the runtime. |
2109 // We use the context register as the scratch register, because we do | 2106 // We use the context register as the scratch register, because we do |
2110 // not have a context here. | 2107 // not have a context here. |
2111 __ PrepareCallCFunction(0, 0, cp); | 2108 __ PrepareCallCFunction(0, 0, cp); |
2112 __ CallCFunction( | 2109 __ CallCFunction( |
2113 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), | 2110 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), |
2114 0); | 2111 0); |
| 2112 __ LeaveFrame(StackFrame::WASM_COMPILED); |
| 2113 __ Ret(); |
2115 } else { | 2114 } else { |
2116 __ Move(cp, Smi::kZero); | 2115 __ Move(cp, Smi::kZero); |
2117 gen_->AssembleSourcePosition(instr_); | 2116 gen_->AssembleSourcePosition(instr_); |
2118 __ CallRuntime(trap_id); | 2117 __ CallRuntime(trap_id); |
| 2118 ReferenceMap* reference_map = |
| 2119 new (gen_->zone()) ReferenceMap(gen_->zone()); |
| 2120 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, |
| 2121 Safepoint::kNoLazyDeopt); |
| 2122 if (FLAG_debug_code) { |
| 2123 __ stop(GetBailoutReason(kUnexpectedReturnFromWasmTrap)); |
| 2124 } |
2119 } | 2125 } |
2120 ReferenceMap* reference_map = | |
2121 new (gen_->zone()) ReferenceMap(gen_->zone()); | |
2122 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, | |
2123 Safepoint::kNoLazyDeopt); | |
2124 } | 2126 } |
2125 bool frame_elided_; | 2127 bool frame_elided_; |
2126 Instruction* instr_; | 2128 Instruction* instr_; |
2127 CodeGenerator* gen_; | 2129 CodeGenerator* gen_; |
2128 }; | 2130 }; |
2129 bool frame_elided = !frame_access_state()->has_frame(); | 2131 bool frame_elided = !frame_access_state()->has_frame(); |
2130 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); | 2132 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); |
2131 Label* tlabel = ool->entry(); | 2133 Label* tlabel = ool->entry(); |
2132 AssembleBranchToLabels(this, masm(), instr, condition, tlabel, nullptr, true); | 2134 AssembleBranchToLabels(this, masm(), instr, condition, tlabel, nullptr, true); |
2133 } | 2135 } |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2673 padding_size -= v8::internal::Assembler::kInstrSize; | 2675 padding_size -= v8::internal::Assembler::kInstrSize; |
2674 } | 2676 } |
2675 } | 2677 } |
2676 } | 2678 } |
2677 | 2679 |
2678 #undef __ | 2680 #undef __ |
2679 | 2681 |
2680 } // namespace compiler | 2682 } // namespace compiler |
2681 } // namespace internal | 2683 } // namespace internal |
2682 } // namespace v8 | 2684 } // namespace v8 |
OLD | NEW |