| 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/signature.h" | 7 #include "src/signature.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 FOREACH_OPCODE(DECLARE_NAME_CASE) | 33 FOREACH_OPCODE(DECLARE_NAME_CASE) |
| 34 #undef DECLARE_NAME_CASE | 34 #undef DECLARE_NAME_CASE |
| 35 default: | 35 default: |
| 36 break; | 36 break; |
| 37 } | 37 } |
| 38 return "Unknown"; | 38 return "Unknown"; |
| 39 } | 39 } |
| 40 | 40 |
| 41 std::ostream& operator<<(std::ostream& os, const FunctionSig& sig) { | 41 std::ostream& operator<<(std::ostream& os, const FunctionSig& sig) { |
| 42 if (sig.return_count() == 0) os << "v"; | 42 if (sig.return_count() == 0) os << "v"; |
| 43 for (size_t i = 0; i < sig.return_count(); i++) { | 43 for (size_t i = 0; i < sig.return_count(); ++i) { |
| 44 os << WasmOpcodes::ShortNameOf(sig.GetReturn(i)); | 44 os << WasmOpcodes::ShortNameOf(sig.GetReturn(i)); |
| 45 } | 45 } |
| 46 os << "_"; | 46 os << "_"; |
| 47 if (sig.parameter_count() == 0) os << "v"; | 47 if (sig.parameter_count() == 0) os << "v"; |
| 48 for (size_t i = 0; i < sig.parameter_count(); i++) { | 48 for (size_t i = 0; i < sig.parameter_count(); ++i) { |
| 49 os << WasmOpcodes::ShortNameOf(sig.GetParam(i)); | 49 os << WasmOpcodes::ShortNameOf(sig.GetParam(i)); |
| 50 } | 50 } |
| 51 return os; | 51 return os; |
| 52 } | 52 } |
| 53 | 53 |
| 54 #define DECLARE_SIG_ENUM(name, ...) kSigEnum_##name, | 54 #define DECLARE_SIG_ENUM(name, ...) kSigEnum_##name, |
| 55 | 55 |
| 56 enum WasmOpcodeSig { FOREACH_SIGNATURE(DECLARE_SIG_ENUM) }; | 56 enum WasmOpcodeSig { FOREACH_SIGNATURE(DECLARE_SIG_ENUM) }; |
| 57 | 57 |
| 58 // TODO(titzer): not static-initializer safe. Wrap in LazyInstance. | 58 // TODO(titzer): not static-initializer safe. Wrap in LazyInstance. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 return MessageTemplate::kNone; | 115 return MessageTemplate::kNone; |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 | 118 |
| 119 const char* WasmOpcodes::TrapReasonMessage(TrapReason reason) { | 119 const char* WasmOpcodes::TrapReasonMessage(TrapReason reason) { |
| 120 return MessageTemplate::TemplateString(TrapReasonToMessageId(reason)); | 120 return MessageTemplate::TemplateString(TrapReasonToMessageId(reason)); |
| 121 } | 121 } |
| 122 } // namespace wasm | 122 } // namespace wasm |
| 123 } // namespace internal | 123 } // namespace internal |
| 124 } // namespace v8 | 124 } // namespace v8 |
| OLD | NEW |