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/signature.h" | 7 #include "src/signature.h" |
7 | 8 |
8 namespace v8 { | 9 namespace v8 { |
9 namespace internal { | 10 namespace internal { |
10 namespace wasm { | 11 namespace wasm { |
11 | 12 |
12 typedef Signature<LocalType> FunctionSig; | 13 typedef Signature<LocalType> FunctionSig; |
13 | 14 |
14 const char* WasmOpcodes::OpcodeName(WasmOpcode opcode) { | 15 const char* WasmOpcodes::OpcodeName(WasmOpcode opcode) { |
15 switch (opcode) { | 16 switch (opcode) { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 case kExprI64UConvertF64: | 139 case kExprI64UConvertF64: |
139 | 140 |
140 return false; | 141 return false; |
141 default: | 142 default: |
142 return true; | 143 return true; |
143 } | 144 } |
144 #else | 145 #else |
145 return true; | 146 return true; |
146 #endif | 147 #endif |
147 } | 148 } |
| 149 |
| 150 int WasmOpcodes::TrapReasonToMessageId(TrapReason reason) { |
| 151 switch (reason) { |
| 152 #define TRAPREASON_TO_MESSAGE(name) \ |
| 153 case k##name: \ |
| 154 return MessageTemplate::kWasm##name; |
| 155 FOREACH_WASM_TRAPREASON(TRAPREASON_TO_MESSAGE) |
| 156 #undef TRAPREASON_TO_MESSAGE |
| 157 default: |
| 158 return MessageTemplate::kNone; |
| 159 } |
| 160 } |
| 161 |
| 162 const char* WasmOpcodes::TrapReasonMessage(TrapReason reason) { |
| 163 return MessageTemplate::TemplateString(TrapReasonToMessageId(reason)); |
| 164 } |
148 } // namespace wasm | 165 } // namespace wasm |
149 } // namespace internal | 166 } // namespace internal |
150 } // namespace v8 | 167 } // namespace v8 |
OLD | NEW |