OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 2263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2274 i.InputInt32(instr_->InputCount() - 1)); | 2274 i.InputInt32(instr_->InputCount() - 1)); |
2275 bool old_has_frame = __ has_frame(); | 2275 bool old_has_frame = __ has_frame(); |
2276 if (frame_elided_) { | 2276 if (frame_elided_) { |
2277 __ set_has_frame(true); | 2277 __ set_has_frame(true); |
2278 __ EnterFrame(StackFrame::WASM_COMPILED); | 2278 __ EnterFrame(StackFrame::WASM_COMPILED); |
2279 } | 2279 } |
2280 GenerateCallToTrap(trap_id); | 2280 GenerateCallToTrap(trap_id); |
2281 if (frame_elided_) { | 2281 if (frame_elided_) { |
2282 __ set_has_frame(old_has_frame); | 2282 __ set_has_frame(old_has_frame); |
2283 } | 2283 } |
2284 if (FLAG_debug_code) { | |
2285 __ stop(GetBailoutReason(kUnexpectedReturnFromWasmTrap)); | |
2286 } | |
2287 } | 2284 } |
2288 | 2285 |
2289 private: | 2286 private: |
2290 void GenerateCallToTrap(Runtime::FunctionId trap_id) { | 2287 void GenerateCallToTrap(Runtime::FunctionId trap_id) { |
2291 if (trap_id == Runtime::kNumFunctions) { | 2288 if (trap_id == Runtime::kNumFunctions) { |
2292 // We cannot test calls to the runtime in cctest/test-run-wasm. | 2289 // We cannot test calls to the runtime in cctest/test-run-wasm. |
2293 // Therefore we emit a call to C here instead of a call to the runtime. | 2290 // Therefore we emit a call to C here instead of a call to the runtime. |
2294 // We use the context register as the scratch register, because we do | 2291 // We use the context register as the scratch register, because we do |
2295 // not have a context here. | 2292 // not have a context here. |
2296 __ PrepareCallCFunction(0, 0, cp); | 2293 __ PrepareCallCFunction(0, 0, cp); |
2297 __ CallCFunction( | 2294 __ CallCFunction( |
2298 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), | 2295 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), |
2299 0); | 2296 0); |
| 2297 __ LeaveFrame(StackFrame::WASM_COMPILED); |
| 2298 __ Ret(); |
2300 } else { | 2299 } else { |
2301 __ Move(cp, Smi::kZero); | 2300 __ Move(cp, Smi::kZero); |
2302 gen_->AssembleSourcePosition(instr_); | 2301 gen_->AssembleSourcePosition(instr_); |
2303 __ CallRuntime(trap_id); | 2302 __ CallRuntime(trap_id); |
| 2303 ReferenceMap* reference_map = |
| 2304 new (gen_->zone()) ReferenceMap(gen_->zone()); |
| 2305 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, |
| 2306 Safepoint::kNoLazyDeopt); |
| 2307 if (FLAG_debug_code) { |
| 2308 __ stop(GetBailoutReason(kUnexpectedReturnFromWasmTrap)); |
| 2309 } |
2304 } | 2310 } |
2305 ReferenceMap* reference_map = | |
2306 new (gen_->zone()) ReferenceMap(gen_->zone()); | |
2307 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, | |
2308 Safepoint::kNoLazyDeopt); | |
2309 } | 2311 } |
2310 | 2312 |
2311 bool frame_elided_; | 2313 bool frame_elided_; |
2312 Instruction* instr_; | 2314 Instruction* instr_; |
2313 CodeGenerator* gen_; | 2315 CodeGenerator* gen_; |
2314 }; | 2316 }; |
2315 bool frame_elided = !frame_access_state()->has_frame(); | 2317 bool frame_elided = !frame_access_state()->has_frame(); |
2316 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); | 2318 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); |
2317 Label* tlabel = ool->entry(); | 2319 Label* tlabel = ool->entry(); |
2318 Label end; | 2320 Label end; |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2758 padding_size -= 2; | 2760 padding_size -= 2; |
2759 } | 2761 } |
2760 } | 2762 } |
2761 } | 2763 } |
2762 | 2764 |
2763 #undef __ | 2765 #undef __ |
2764 | 2766 |
2765 } // namespace compiler | 2767 } // namespace compiler |
2766 } // namespace internal | 2768 } // namespace internal |
2767 } // namespace v8 | 2769 } // namespace v8 |
OLD | NEW |