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/wasm-compiler.h" | 5 #include "src/compiler/wasm-compiler.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
10 | 10 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 trap_id = wasm::WasmOpcodes::TrapReasonToFunctionId(reason); | 174 trap_id = wasm::WasmOpcodes::TrapReasonToFunctionId(reason); |
175 } else { | 175 } else { |
176 // We use Runtime::kNumFunctions as a marker to tell the code generator | 176 // We use Runtime::kNumFunctions as a marker to tell the code generator |
177 // to generate a call to a testing c-function instead of a runtime | 177 // to generate a call to a testing c-function instead of a runtime |
178 // function. This code should only be called from a cctest. | 178 // function. This code should only be called from a cctest. |
179 trap_id = Runtime::kNumFunctions; | 179 trap_id = Runtime::kNumFunctions; |
180 } | 180 } |
181 return trap_id; | 181 return trap_id; |
182 } | 182 } |
183 | 183 |
184 #if V8_TARGET_ARCH_X64 | 184 #if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM |
185 #define WASM_TRAP_IF_SUPPORTED | 185 #define WASM_TRAP_IF_SUPPORTED |
186 #endif | 186 #endif |
187 | 187 |
188 // Add a trap if {cond} is true. | 188 // Add a trap if {cond} is true. |
189 void AddTrapIfTrue(wasm::TrapReason reason, Node* cond, | 189 void AddTrapIfTrue(wasm::TrapReason reason, Node* cond, |
190 wasm::WasmCodePosition position) { | 190 wasm::WasmCodePosition position) { |
191 #ifdef WASM_TRAP_IF_SUPPORTED | 191 #ifdef WASM_TRAP_IF_SUPPORTED |
192 if (FLAG_wasm_trap_if) { | 192 if (FLAG_wasm_trap_if) { |
193 int32_t trap_id = GetFunctionIdForTrap(reason); | 193 int32_t trap_id = GetFunctionIdForTrap(reason); |
194 Node* node = graph()->NewNode(common()->TrapIf(trap_id), cond, | 194 Node* node = graph()->NewNode(common()->TrapIf(trap_id), cond, |
(...skipping 3457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3652 Smi::FromInt(instruction.instr_offset)); | 3652 Smi::FromInt(instruction.instr_offset)); |
3653 fn_protected->set(Code::kTrapDataSize * i + Code::kTrapLandingOffset, | 3653 fn_protected->set(Code::kTrapDataSize * i + Code::kTrapLandingOffset, |
3654 Smi::FromInt(instruction.landing_offset)); | 3654 Smi::FromInt(instruction.landing_offset)); |
3655 } | 3655 } |
3656 return fn_protected; | 3656 return fn_protected; |
3657 } | 3657 } |
3658 | 3658 |
3659 } // namespace compiler | 3659 } // namespace compiler |
3660 } // namespace internal | 3660 } // namespace internal |
3661 } // namespace v8 | 3661 } // namespace v8 |
OLD | NEW |