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 <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler/code-generator-impl.h" | 10 #include "src/compiler/code-generator-impl.h" |
(...skipping 2309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2320 i.InputInt32(instr_->InputCount() - 1)); | 2320 i.InputInt32(instr_->InputCount() - 1)); |
2321 bool old_has_frame = __ has_frame(); | 2321 bool old_has_frame = __ has_frame(); |
2322 if (frame_elided_) { | 2322 if (frame_elided_) { |
2323 __ set_has_frame(true); | 2323 __ set_has_frame(true); |
2324 __ EnterFrame(StackFrame::WASM_COMPILED); | 2324 __ EnterFrame(StackFrame::WASM_COMPILED); |
2325 } | 2325 } |
2326 GenerateCallToTrap(trap_id); | 2326 GenerateCallToTrap(trap_id); |
2327 if (frame_elided_) { | 2327 if (frame_elided_) { |
2328 __ set_has_frame(old_has_frame); | 2328 __ set_has_frame(old_has_frame); |
2329 } | 2329 } |
2330 if (FLAG_debug_code) { | |
2331 __ ud2(); | |
2332 } | |
2333 } | 2330 } |
2334 | 2331 |
2335 private: | 2332 private: |
2336 void GenerateCallToTrap(Runtime::FunctionId trap_id) { | 2333 void GenerateCallToTrap(Runtime::FunctionId trap_id) { |
2337 if (trap_id == Runtime::kNumFunctions) { | 2334 if (trap_id == Runtime::kNumFunctions) { |
2338 // We cannot test calls to the runtime in cctest/test-run-wasm. | 2335 // We cannot test calls to the runtime in cctest/test-run-wasm. |
2339 // Therefore we emit a call to C here instead of a call to the runtime. | 2336 // Therefore we emit a call to C here instead of a call to the runtime. |
2340 __ PrepareCallCFunction(0); | 2337 __ PrepareCallCFunction(0); |
2341 __ CallCFunction( | 2338 __ CallCFunction( |
2342 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), | 2339 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), |
2343 0); | 2340 0); |
| 2341 __ LeaveFrame(StackFrame::WASM_COMPILED); |
| 2342 __ Ret(); |
2344 } else { | 2343 } else { |
2345 __ Move(rsi, Smi::kZero); | 2344 __ Move(rsi, Smi::kZero); |
2346 gen_->AssembleSourcePosition(instr_); | 2345 gen_->AssembleSourcePosition(instr_); |
2347 __ CallRuntime(trap_id); | 2346 __ CallRuntime(trap_id); |
| 2347 ReferenceMap* reference_map = |
| 2348 new (gen_->zone()) ReferenceMap(gen_->zone()); |
| 2349 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, |
| 2350 Safepoint::kNoLazyDeopt); |
| 2351 if (FLAG_debug_code) { |
| 2352 __ ud2(); |
| 2353 } |
2348 } | 2354 } |
2349 ReferenceMap* reference_map = | |
2350 new (gen_->zone()) ReferenceMap(gen_->zone()); | |
2351 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, | |
2352 Safepoint::kNoLazyDeopt); | |
2353 } | 2355 } |
2354 | 2356 |
2355 bool frame_elided_; | 2357 bool frame_elided_; |
2356 Instruction* instr_; | 2358 Instruction* instr_; |
2357 CodeGenerator* gen_; | 2359 CodeGenerator* gen_; |
2358 }; | 2360 }; |
2359 bool frame_elided = !frame_access_state()->has_frame(); | 2361 bool frame_elided = !frame_access_state()->has_frame(); |
2360 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); | 2362 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); |
2361 Label* tlabel = ool->entry(); | 2363 Label* tlabel = ool->entry(); |
2362 Label end; | 2364 Label end; |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2854 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2856 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2855 __ Nop(padding_size); | 2857 __ Nop(padding_size); |
2856 } | 2858 } |
2857 } | 2859 } |
2858 | 2860 |
2859 #undef __ | 2861 #undef __ |
2860 | 2862 |
2861 } // namespace compiler | 2863 } // namespace compiler |
2862 } // namespace internal | 2864 } // namespace internal |
2863 } // namespace v8 | 2865 } // namespace v8 |
OLD | NEW |