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/signature.h" | 6 #include "src/signature.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 namespace wasm { | 10 namespace wasm { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 nullptr, FOREACH_SIGNATURE(DECLARE_SIG_ENTRY)}; | 59 nullptr, FOREACH_SIGNATURE(DECLARE_SIG_ENTRY)}; |
60 | 60 |
61 static byte kSimpleExprSigTable[256]; | 61 static byte kSimpleExprSigTable[256]; |
62 | 62 |
63 | 63 |
64 // Initialize the signature table. | 64 // Initialize the signature table. |
65 static void InitSigTable() { | 65 static void InitSigTable() { |
66 #define SET_SIG_TABLE(name, opcode, sig) \ | 66 #define SET_SIG_TABLE(name, opcode, sig) \ |
67 kSimpleExprSigTable[opcode] = static_cast<int>(kSigEnum_##sig) + 1; | 67 kSimpleExprSigTable[opcode] = static_cast<int>(kSigEnum_##sig) + 1; |
68 FOREACH_SIMPLE_OPCODE(SET_SIG_TABLE); | 68 FOREACH_SIMPLE_OPCODE(SET_SIG_TABLE); |
| 69 FOREACH_ASMJS_COMPAT_OPCODE(SET_SIG_TABLE); |
69 #undef SET_SIG_TABLE | 70 #undef SET_SIG_TABLE |
70 } | 71 } |
71 | 72 |
72 | 73 |
73 FunctionSig* WasmOpcodes::Signature(WasmOpcode opcode) { | 74 FunctionSig* WasmOpcodes::Signature(WasmOpcode opcode) { |
74 // TODO(titzer): use LazyInstance to make this thread safe. | 75 // TODO(titzer): use LazyInstance to make this thread safe. |
75 if (kSimpleExprSigTable[kExprI32Add] == 0) InitSigTable(); | 76 if (kSimpleExprSigTable[kExprI32Add] == 0) InitSigTable(); |
76 return const_cast<FunctionSig*>( | 77 return const_cast<FunctionSig*>( |
77 kSimpleExprSigs[kSimpleExprSigTable[static_cast<byte>(opcode)]]); | 78 kSimpleExprSigs[kSimpleExprSigTable[static_cast<byte>(opcode)]]); |
78 } | 79 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 default: | 139 default: |
139 return true; | 140 return true; |
140 } | 141 } |
141 #else | 142 #else |
142 return true; | 143 return true; |
143 #endif | 144 #endif |
144 } | 145 } |
145 } // namespace wasm | 146 } // namespace wasm |
146 } // namespace internal | 147 } // namespace internal |
147 } // namespace v8 | 148 } // namespace v8 |
OLD | NEW |