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/wasm/wasm-opcodes.h" | 5 #include "src/wasm/wasm-opcodes.h" |
6 #include "src/messages.h" | 6 #include "src/messages.h" |
7 #include "src/runtime/runtime.h" | 7 #include "src/runtime/runtime.h" |
8 #include "src/signature.h" | 8 #include "src/signature.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 #define TRAPREASON_TO_MESSAGE(name) \ | 169 #define TRAPREASON_TO_MESSAGE(name) \ |
170 case k##name: \ | 170 case k##name: \ |
171 return MessageTemplate::kWasm##name; | 171 return MessageTemplate::kWasm##name; |
172 FOREACH_WASM_TRAPREASON(TRAPREASON_TO_MESSAGE) | 172 FOREACH_WASM_TRAPREASON(TRAPREASON_TO_MESSAGE) |
173 #undef TRAPREASON_TO_MESSAGE | 173 #undef TRAPREASON_TO_MESSAGE |
174 default: | 174 default: |
175 return MessageTemplate::kNone; | 175 return MessageTemplate::kNone; |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
179 int32_t WasmOpcodes::TrapReasonToFunctionId(TrapReason reason) { | |
180 switch (reason) { | |
181 #define TRAPREASON_TO_MESSAGE(name) \ | |
182 case k##name: \ | |
183 return static_cast<int32_t>(Runtime::kThrowWasm##name); | |
184 FOREACH_WASM_TRAPREASON(TRAPREASON_TO_MESSAGE) | |
185 #undef TRAPREASON_TO_MESSAGE | |
186 default: | |
187 UNREACHABLE(); | |
188 return -1; | |
189 } | |
190 } | |
191 | |
192 const char* WasmOpcodes::TrapReasonMessage(TrapReason reason) { | 179 const char* WasmOpcodes::TrapReasonMessage(TrapReason reason) { |
193 return MessageTemplate::TemplateString(TrapReasonToMessageId(reason)); | 180 return MessageTemplate::TemplateString(TrapReasonToMessageId(reason)); |
194 } | 181 } |
195 } // namespace wasm | 182 } // namespace wasm |
196 } // namespace internal | 183 } // namespace internal |
197 } // namespace v8 | 184 } // namespace v8 |
OLD | NEW |