Index: src/wasm/wasm-opcodes.h |
diff --git a/src/wasm/wasm-opcodes.h b/src/wasm/wasm-opcodes.h |
index 764c5030f5f735554273c8f52780c6dfb805990a..bd9154501d0bb4b547bd6e25fef30046c1bc0404 100644 |
--- a/src/wasm/wasm-opcodes.h |
+++ b/src/wasm/wasm-opcodes.h |
@@ -18,7 +18,8 @@ enum LocalTypeCode { |
kLocalI32 = 1, |
kLocalI64 = 2, |
kLocalF32 = 3, |
- kLocalF64 = 4 |
+ kLocalF64 = 4, |
+ kLocalS128 = 5 |
}; |
// Binary encoding of memory types. |
@@ -32,7 +33,8 @@ enum MemTypeCode { |
kMemI64 = 6, |
kMemU64 = 7, |
kMemF32 = 8, |
- kMemF64 = 9 |
+ kMemF64 = 9, |
+ kMemS128 = 10 |
}; |
// We reuse the internal machine type to represent WebAssembly AST types. |
@@ -43,6 +45,7 @@ const LocalType kAstI32 = MachineRepresentation::kWord32; |
const LocalType kAstI64 = MachineRepresentation::kWord64; |
const LocalType kAstF32 = MachineRepresentation::kFloat32; |
const LocalType kAstF64 = MachineRepresentation::kFloat64; |
+const LocalType kAstS128 = MachineRepresentation::kSimd128; |
// We use kTagged here because kNone is already used by kAstStmt. |
const LocalType kAstEnd = MachineRepresentation::kTagged; |
@@ -120,6 +123,7 @@ const WasmCodePosition kNoCodePosition = -1; |
// Expressions with signatures. |
#define FOREACH_SIMPLE_OPCODE(V) \ |
+ FOREACH_SIMD_OPCODE(V) \ |
V(I32Add, 0x40, i_ii) \ |
V(I32Sub, 0x41, i_ii) \ |
V(I32Mul, 0x42, i_ii) \ |
@@ -278,6 +282,11 @@ const WasmCodePosition kNoCodePosition = -1; |
V(I32AsmjsSConvertF64, 0xe2, i_d) \ |
V(I32AsmjsUConvertF64, 0xe3, i_d) |
+// Simd opcodes |
+#define FOREACH_SIMD_OPCODE(V) \ |
+ V(Int32x4Splat, 0xe4, s_i) \ |
+ V(Int32x4ExtractLane, 0xe5, i_si) |
+ |
// All opcodes. |
#define FOREACH_OPCODE(V) \ |
FOREACH_CONTROL_OPCODE(V) \ |
@@ -316,7 +325,9 @@ const WasmCodePosition kNoCodePosition = -1; |
V(d_l, kAstF64, kAstI64) \ |
V(d_id, kAstF64, kAstI32, kAstF64) \ |
V(f_if, kAstF32, kAstI32, kAstF32) \ |
- V(l_il, kAstI64, kAstI32, kAstI64) |
+ V(l_il, kAstI64, kAstI32, kAstI64) \ |
+ V(s_i, kAstS128, kAstI32) \ |
+ V(i_si, kAstI32, kAstS128, kAstI32) |
enum WasmOpcode { |
// Declare expression opcodes. |
@@ -349,6 +360,7 @@ class WasmOpcodes { |
static const char* OpcodeName(WasmOpcode opcode); |
static const char* ShortOpcodeName(WasmOpcode opcode); |
static FunctionSig* Signature(WasmOpcode opcode); |
+ static bool IsSimd(WasmOpcode opcode); |
static int TrapReasonToMessageId(TrapReason reason); |
static const char* TrapReasonMessage(TrapReason reason); |
@@ -369,6 +381,8 @@ class WasmOpcodes { |
return kLocalF64; |
case kAstStmt: |
return kLocalVoid; |
+ case kAstS128: |
+ return kLocalS128; |
default: |
UNREACHABLE(); |
return kLocalVoid; |
@@ -396,6 +410,8 @@ class WasmOpcodes { |
return kMemF32; |
} else if (type == MachineType::Float64()) { |
return kMemF64; |
+ } else if (type == MachineType::Simd128()) { |
+ return kMemS128; |
} else { |
UNREACHABLE(); |
return kMemI32; |
@@ -412,6 +428,8 @@ class WasmOpcodes { |
return MachineType::Float32(); |
case kAstF64: |
return MachineType::Float64(); |
+ case kAstS128: |
+ return MachineType::Simd128(); |
case kAstStmt: |
return MachineType::None(); |
default: |
@@ -441,6 +459,8 @@ class WasmOpcodes { |
return kAstF32; |
} else if (type == MachineType::Float64()) { |
return kAstF64; |
+ } else if (type == MachineType::Simd128()) { |
+ return kAstS128; |
} else { |
UNREACHABLE(); |
return kAstI32; |
@@ -484,6 +504,8 @@ class WasmOpcodes { |
return 'f'; |
case kAstF64: |
return 'd'; |
+ case kAstS128: |
+ return 's'; |
case kAstStmt: |
return 'v'; |
case kAstEnd: |
@@ -504,6 +526,8 @@ class WasmOpcodes { |
return "f32"; |
case kAstF64: |
return "f64"; |
+ case kAstS128: |
+ return "s128"; |
case kAstStmt: |
return "<stmt>"; |
case kAstEnd: |