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

Unified Diff: src/wasm/wasm-opcodes.cc

Issue 1991143002: Convert SIMD wasm ops to runtime function calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix bot fails Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-opcodes.h ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-opcodes.cc
diff --git a/src/wasm/wasm-opcodes.cc b/src/wasm/wasm-opcodes.cc
index afb1eff36687a622a4bb62b3a118281d0af8c10a..8f54207661363ca59b2fa41134d500cade481fa1 100644
--- a/src/wasm/wasm-opcodes.cc
+++ b/src/wasm/wasm-opcodes.cc
@@ -68,34 +68,54 @@ FOREACH_SIGNATURE(DECLARE_SIG)
static const FunctionSig* kSimpleExprSigs[] = {
nullptr, FOREACH_SIGNATURE(DECLARE_SIG_ENTRY)};
+#define DECLARE_SIMD_SIG_ENTRY(name, ...) &kSig_##name,
+
+static const FunctionSig* kSimdExprSigs[] = {
+ nullptr, FOREACH_SIMD_SIGNATURE(DECLARE_SIMD_SIG_ENTRY)};
+
static byte kSimpleExprSigTable[256];
+static byte kSimdExprSigTable[256];
// Initialize the signature table.
-static void InitSigTable() {
+static void InitSigTables() {
#define SET_SIG_TABLE(name, opcode, sig) \
kSimpleExprSigTable[opcode] = static_cast<int>(kSigEnum_##sig) + 1;
FOREACH_SIMPLE_OPCODE(SET_SIG_TABLE);
FOREACH_SIMPLE_MEM_OPCODE(SET_SIG_TABLE);
FOREACH_ASMJS_COMPAT_OPCODE(SET_SIG_TABLE);
#undef SET_SIG_TABLE
+ byte simd_index;
+#define SET_SIG_TABLE(name, opcode, sig) \
+ simd_index = opcode & 0xff; \
+ kSimdExprSigTable[simd_index] = static_cast<int>(kSigEnum_##sig) + 1;
+ FOREACH_SIMD_OPCODE(SET_SIG_TABLE)
+#undef SET_SIG_TABLE
}
class SigTable {
public:
SigTable() {
// TODO(ahaas): Move {InitSigTable} into the class.
- InitSigTable();
+ InitSigTables();
}
FunctionSig* Signature(WasmOpcode opcode) const {
return const_cast<FunctionSig*>(
kSimpleExprSigs[kSimpleExprSigTable[static_cast<byte>(opcode)]]);
}
+ FunctionSig* SimdSignature(WasmOpcode opcode) const {
+ return const_cast<FunctionSig*>(
+ kSimdExprSigs[kSimdExprSigTable[static_cast<byte>(opcode & 0xff)]]);
+ }
};
static base::LazyInstance<SigTable>::type sig_table = LAZY_INSTANCE_INITIALIZER;
FunctionSig* WasmOpcodes::Signature(WasmOpcode opcode) {
- return sig_table.Get().Signature(opcode);
+ if (opcode >> 8 == kSimdPrefix) {
+ return sig_table.Get().SimdSignature(opcode);
+ } else {
+ return sig_table.Get().Signature(opcode);
+ }
}
// TODO(titzer): pull WASM_64 up to a common header.
« no previous file with comments | « src/wasm/wasm-opcodes.h ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698