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) { | 179 Runtime::FunctionId WasmOpcodes::TrapReasonToFunctionId(TrapReason reason) { |
180 switch (reason) { | 180 switch (reason) { |
181 #define TRAPREASON_TO_MESSAGE(name) \ | 181 #define TRAPREASON_TO_MESSAGE(name) \ |
182 case k##name: \ | 182 case k##name: \ |
183 return static_cast<int32_t>(Runtime::kThrowWasm##name); | 183 return Runtime::kThrowWasm##name; |
184 FOREACH_WASM_TRAPREASON(TRAPREASON_TO_MESSAGE) | 184 FOREACH_WASM_TRAPREASON(TRAPREASON_TO_MESSAGE) |
185 #undef TRAPREASON_TO_MESSAGE | 185 #undef TRAPREASON_TO_MESSAGE |
186 default: | 186 default: |
187 UNREACHABLE(); | 187 UNREACHABLE(); |
188 return -1; | 188 return Runtime::kNumFunctions; |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 const char* WasmOpcodes::TrapReasonMessage(TrapReason reason) { | 192 const char* WasmOpcodes::TrapReasonMessage(TrapReason reason) { |
193 return MessageTemplate::TemplateString(TrapReasonToMessageId(reason)); | 193 return MessageTemplate::TemplateString(TrapReasonToMessageId(reason)); |
194 } | 194 } |
195 } // namespace wasm | 195 } // namespace wasm |
196 } // namespace internal | 196 } // namespace internal |
197 } // namespace v8 | 197 } // namespace v8 |
OLD | NEW |