| 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 | 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 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2031 i.InputInt32(instr_->InputCount() - 1)); | 2031 i.InputInt32(instr_->InputCount() - 1)); |
| 2032 bool old_has_frame = __ has_frame(); | 2032 bool old_has_frame = __ has_frame(); |
| 2033 if (frame_elided_) { | 2033 if (frame_elided_) { |
| 2034 __ set_has_frame(true); | 2034 __ set_has_frame(true); |
| 2035 __ EnterFrame(StackFrame::WASM_COMPILED, true); | 2035 __ EnterFrame(StackFrame::WASM_COMPILED, true); |
| 2036 } | 2036 } |
| 2037 GenerateCallToTrap(trap_id); | 2037 GenerateCallToTrap(trap_id); |
| 2038 if (frame_elided_) { | 2038 if (frame_elided_) { |
| 2039 __ set_has_frame(old_has_frame); | 2039 __ set_has_frame(old_has_frame); |
| 2040 } | 2040 } |
| 2041 if (FLAG_debug_code) { | |
| 2042 __ stop(GetBailoutReason(kUnexpectedReturnFromWasmTrap)); | |
| 2043 } | |
| 2044 } | 2041 } |
| 2045 | 2042 |
| 2046 private: | 2043 private: |
| 2047 void GenerateCallToTrap(Runtime::FunctionId trap_id) { | 2044 void GenerateCallToTrap(Runtime::FunctionId trap_id) { |
| 2048 if (trap_id == Runtime::kNumFunctions) { | 2045 if (trap_id == Runtime::kNumFunctions) { |
| 2049 // We cannot test calls to the runtime in cctest/test-run-wasm. | 2046 // We cannot test calls to the runtime in cctest/test-run-wasm. |
| 2050 // Therefore we emit a call to C here instead of a call to the runtime. | 2047 // Therefore we emit a call to C here instead of a call to the runtime. |
| 2051 // We use the context register as the scratch register, because we do | 2048 // We use the context register as the scratch register, because we do |
| 2052 // not have a context here. | 2049 // not have a context here. |
| 2053 __ PrepareCallCFunction(0, 0, cp); | 2050 __ PrepareCallCFunction(0, 0, cp); |
| 2054 __ CallCFunction( | 2051 __ CallCFunction( |
| 2055 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), | 2052 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), |
| 2056 0); | 2053 0); |
| 2054 __ LeaveFrame(StackFrame::WASM_COMPILED); |
| 2055 __ Ret(); |
| 2057 } else { | 2056 } else { |
| 2058 __ Move(cp, Smi::kZero); | 2057 __ Move(cp, Smi::kZero); |
| 2059 gen_->AssembleSourcePosition(instr_); | 2058 gen_->AssembleSourcePosition(instr_); |
| 2060 __ CallRuntime(trap_id); | 2059 __ CallRuntime(trap_id); |
| 2060 ReferenceMap* reference_map = |
| 2061 new (gen_->zone()) ReferenceMap(gen_->zone()); |
| 2062 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, |
| 2063 Safepoint::kNoLazyDeopt); |
| 2064 if (FLAG_debug_code) { |
| 2065 __ stop(GetBailoutReason(kUnexpectedReturnFromWasmTrap)); |
| 2066 } |
| 2061 } | 2067 } |
| 2062 ReferenceMap* reference_map = | |
| 2063 new (gen_->zone()) ReferenceMap(gen_->zone()); | |
| 2064 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, | |
| 2065 Safepoint::kNoLazyDeopt); | |
| 2066 } | 2068 } |
| 2067 | 2069 |
| 2068 bool frame_elided_; | 2070 bool frame_elided_; |
| 2069 Instruction* instr_; | 2071 Instruction* instr_; |
| 2070 CodeGenerator* gen_; | 2072 CodeGenerator* gen_; |
| 2071 }; | 2073 }; |
| 2072 bool frame_elided = !frame_access_state()->has_frame(); | 2074 bool frame_elided = !frame_access_state()->has_frame(); |
| 2073 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); | 2075 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); |
| 2074 Label* tlabel = ool->entry(); | 2076 Label* tlabel = ool->entry(); |
| 2075 Label end; | 2077 Label end; |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2578 padding_size -= v8::internal::Assembler::kInstrSize; | 2580 padding_size -= v8::internal::Assembler::kInstrSize; |
| 2579 } | 2581 } |
| 2580 } | 2582 } |
| 2581 } | 2583 } |
| 2582 | 2584 |
| 2583 #undef __ | 2585 #undef __ |
| 2584 | 2586 |
| 2585 } // namespace compiler | 2587 } // namespace compiler |
| 2586 } // namespace internal | 2588 } // namespace internal |
| 2587 } // namespace v8 | 2589 } // namespace v8 |
| OLD | NEW |