| 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 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 namespace wasm { | 12 namespace wasm { |
| 13 | 13 |
| 14 typedef Signature<LocalType> FunctionSig; | 14 typedef Signature<ValueType> FunctionSig; |
| 15 | 15 |
| 16 const char* WasmOpcodes::OpcodeName(WasmOpcode opcode) { | 16 const char* WasmOpcodes::OpcodeName(WasmOpcode opcode) { |
| 17 switch (opcode) { | 17 switch (opcode) { |
| 18 #define DECLARE_NAME_CASE(name, opcode, sig) \ | 18 #define DECLARE_NAME_CASE(name, opcode, sig) \ |
| 19 case kExpr##name: \ | 19 case kExpr##name: \ |
| 20 return "Expr" #name; | 20 return "Expr" #name; |
| 21 FOREACH_OPCODE(DECLARE_NAME_CASE) | 21 FOREACH_OPCODE(DECLARE_NAME_CASE) |
| 22 #undef DECLARE_NAME_CASE | 22 #undef DECLARE_NAME_CASE |
| 23 default: | 23 default: |
| 24 break; | 24 break; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 63 } |
| 64 return os; | 64 return os; |
| 65 } | 65 } |
| 66 | 66 |
| 67 #define DECLARE_SIG_ENUM(name, ...) kSigEnum_##name, | 67 #define DECLARE_SIG_ENUM(name, ...) kSigEnum_##name, |
| 68 | 68 |
| 69 enum WasmOpcodeSig { FOREACH_SIGNATURE(DECLARE_SIG_ENUM) }; | 69 enum WasmOpcodeSig { FOREACH_SIGNATURE(DECLARE_SIG_ENUM) }; |
| 70 | 70 |
| 71 // TODO(titzer): not static-initializer safe. Wrap in LazyInstance. | 71 // TODO(titzer): not static-initializer safe. Wrap in LazyInstance. |
| 72 #define DECLARE_SIG(name, ...) \ | 72 #define DECLARE_SIG(name, ...) \ |
| 73 static LocalType kTypes_##name[] = {__VA_ARGS__}; \ | 73 static ValueType kTypes_##name[] = {__VA_ARGS__}; \ |
| 74 static const FunctionSig kSig_##name( \ | 74 static const FunctionSig kSig_##name( \ |
| 75 1, static_cast<int>(arraysize(kTypes_##name)) - 1, kTypes_##name); | 75 1, static_cast<int>(arraysize(kTypes_##name)) - 1, kTypes_##name); |
| 76 | 76 |
| 77 FOREACH_SIGNATURE(DECLARE_SIG) | 77 FOREACH_SIGNATURE(DECLARE_SIG) |
| 78 | 78 |
| 79 #define DECLARE_SIG_ENTRY(name, ...) &kSig_##name, | 79 #define DECLARE_SIG_ENTRY(name, ...) &kSig_##name, |
| 80 | 80 |
| 81 static const FunctionSig* kSimpleExprSigs[] = { | 81 static const FunctionSig* kSimpleExprSigs[] = { |
| 82 nullptr, FOREACH_SIGNATURE(DECLARE_SIG_ENTRY)}; | 82 nullptr, FOREACH_SIGNATURE(DECLARE_SIG_ENTRY)}; |
| 83 | 83 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 return MessageTemplate::kNone; | 175 return MessageTemplate::kNone; |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 | 178 |
| 179 const char* WasmOpcodes::TrapReasonMessage(TrapReason reason) { | 179 const char* WasmOpcodes::TrapReasonMessage(TrapReason reason) { |
| 180 return MessageTemplate::TemplateString(TrapReasonToMessageId(reason)); | 180 return MessageTemplate::TemplateString(TrapReasonToMessageId(reason)); |
| 181 } | 181 } |
| 182 } // namespace wasm | 182 } // namespace wasm |
| 183 } // namespace internal | 183 } // namespace internal |
| 184 } // namespace v8 | 184 } // namespace v8 |
| OLD | NEW |