Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: src/wasm/wasm-opcodes.cc

Issue 1830663002: [wasm] Binary 11: AST changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/wasm/wasm-opcodes.h ('k') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 {
11 namespace wasm { 11 namespace wasm {
12 12
13 typedef Signature<LocalType> FunctionSig; 13 typedef Signature<LocalType> FunctionSig;
14 14
15 const char* WasmOpcodes::OpcodeName(WasmOpcode opcode) { 15 const char* WasmOpcodes::OpcodeName(WasmOpcode opcode) {
16 switch (opcode) { 16 switch (opcode) {
17 #define DECLARE_NAME_CASE(name, opcode, sig) \ 17 #define DECLARE_NAME_CASE(name, opcode, sig) \
18 case kExpr##name: \ 18 case kExpr##name: \
19 return "Expr" #name; 19 return "Expr" #name;
20 FOREACH_OPCODE(DECLARE_NAME_CASE) 20 FOREACH_OPCODE(DECLARE_NAME_CASE)
21 #undef DECLARE_NAME_CASE 21 #undef DECLARE_NAME_CASE
22 default: 22 default:
23 break; 23 break;
24 } 24 }
25 return "Unknown"; 25 return "Unknown";
26 } 26 }
27 27
28 const char* WasmOpcodes::ShortOpcodeName(WasmOpcode opcode) {
29 switch (opcode) {
30 #define DECLARE_NAME_CASE(name, opcode, sig) \
31 case kExpr##name: \
32 return #name;
33 FOREACH_OPCODE(DECLARE_NAME_CASE)
34 #undef DECLARE_NAME_CASE
35 default:
36 break;
37 }
38 return "Unknown";
39 }
28 40
29 std::ostream& operator<<(std::ostream& os, const FunctionSig& sig) { 41 std::ostream& operator<<(std::ostream& os, const FunctionSig& sig) {
30 if (sig.return_count() == 0) os << "v"; 42 if (sig.return_count() == 0) os << "v";
31 for (size_t i = 0; i < sig.return_count(); i++) { 43 for (size_t i = 0; i < sig.return_count(); i++) {
32 os << WasmOpcodes::ShortNameOf(sig.GetReturn(i)); 44 os << WasmOpcodes::ShortNameOf(sig.GetReturn(i));
33 } 45 }
34 os << "_"; 46 os << "_";
35 if (sig.parameter_count() == 0) os << "v"; 47 if (sig.parameter_count() == 0) os << "v";
36 for (size_t i = 0; i < sig.parameter_count(); i++) { 48 for (size_t i = 0; i < sig.parameter_count(); i++) {
37 os << WasmOpcodes::ShortNameOf(sig.GetParam(i)); 49 os << WasmOpcodes::ShortNameOf(sig.GetParam(i));
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return MessageTemplate::kNone; 170 return MessageTemplate::kNone;
159 } 171 }
160 } 172 }
161 173
162 const char* WasmOpcodes::TrapReasonMessage(TrapReason reason) { 174 const char* WasmOpcodes::TrapReasonMessage(TrapReason reason) {
163 return MessageTemplate::TemplateString(TrapReasonToMessageId(reason)); 175 return MessageTemplate::TemplateString(TrapReasonToMessageId(reason));
164 } 176 }
165 } // namespace wasm 177 } // namespace wasm
166 } // namespace internal 178 } // namespace internal
167 } // namespace v8 179 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/wasm-opcodes.h ('k') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698