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 | 6 |
7 #include <array> | 7 #include <array> |
8 | 8 |
9 #include "src/base/template-utils.h" | 9 #include "src/base/template-utils.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 DCHECK_GT(kSimpleAsmjsExprSigTable.size(), opcode); | 392 DCHECK_GT(kSimpleAsmjsExprSigTable.size(), opcode); |
393 return const_cast<FunctionSig*>( | 393 return const_cast<FunctionSig*>( |
394 kSimpleExprSigs[kSimpleAsmjsExprSigTable[opcode]]); | 394 kSimpleExprSigs[kSimpleAsmjsExprSigTable[opcode]]); |
395 } | 395 } |
396 | 396 |
397 FunctionSig* WasmOpcodes::AtomicSignature(WasmOpcode opcode) { | 397 FunctionSig* WasmOpcodes::AtomicSignature(WasmOpcode opcode) { |
398 return const_cast<FunctionSig*>( | 398 return const_cast<FunctionSig*>( |
399 kSimpleExprSigs[kAtomicExprSigTable[opcode & 0xff]]); | 399 kSimpleExprSigs[kAtomicExprSigTable[opcode & 0xff]]); |
400 } | 400 } |
401 | 401 |
402 // TODO(titzer): pull WASM_64 up to a common header. | |
403 #if !V8_TARGET_ARCH_32_BIT || V8_TARGET_ARCH_X64 | |
404 #define WASM_64 1 | |
405 #else | |
406 #define WASM_64 0 | |
407 #endif | |
408 | |
409 int WasmOpcodes::TrapReasonToMessageId(TrapReason reason) { | 402 int WasmOpcodes::TrapReasonToMessageId(TrapReason reason) { |
410 switch (reason) { | 403 switch (reason) { |
411 #define TRAPREASON_TO_MESSAGE(name) \ | 404 #define TRAPREASON_TO_MESSAGE(name) \ |
412 case k##name: \ | 405 case k##name: \ |
413 return MessageTemplate::kWasm##name; | 406 return MessageTemplate::kWasm##name; |
414 FOREACH_WASM_TRAPREASON(TRAPREASON_TO_MESSAGE) | 407 FOREACH_WASM_TRAPREASON(TRAPREASON_TO_MESSAGE) |
415 #undef TRAPREASON_TO_MESSAGE | 408 #undef TRAPREASON_TO_MESSAGE |
416 default: | 409 default: |
417 return MessageTemplate::kNone; | 410 return MessageTemplate::kNone; |
418 } | 411 } |
419 } | 412 } |
420 | 413 |
421 const char* WasmOpcodes::TrapReasonMessage(TrapReason reason) { | 414 const char* WasmOpcodes::TrapReasonMessage(TrapReason reason) { |
422 return MessageTemplate::TemplateString(TrapReasonToMessageId(reason)); | 415 return MessageTemplate::TemplateString(TrapReasonToMessageId(reason)); |
423 } | 416 } |
424 } // namespace wasm | 417 } // namespace wasm |
425 } // namespace internal | 418 } // namespace internal |
426 } // namespace v8 | 419 } // namespace v8 |
OLD | NEW |