diff options
Diffstat (limited to 'deps/v8/src/wasm/wasm-macro-gen.h')
-rw-r--r-- | deps/v8/src/wasm/wasm-macro-gen.h | 62 |
1 files changed, 41 insertions, 21 deletions
diff --git a/deps/v8/src/wasm/wasm-macro-gen.h b/deps/v8/src/wasm/wasm-macro-gen.h index ce2f843e71..1ec9ee80ff 100644 --- a/deps/v8/src/wasm/wasm-macro-gen.h +++ b/deps/v8/src/wasm/wasm-macro-gen.h @@ -59,6 +59,7 @@ // Control. //------------------------------------------------------------------------------ #define WASM_NOP kExprNop +#define WASM_END kExprEnd #define ARITY_0 0 #define ARITY_1 1 @@ -71,13 +72,13 @@ #define WASM_BLOCK(...) kExprBlock, kLocalVoid, __VA_ARGS__, kExprEnd #define WASM_BLOCK_T(t, ...) \ - kExprBlock, static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(t)), \ + kExprBlock, static_cast<byte>(WasmOpcodes::ValueTypeCodeFor(t)), \ __VA_ARGS__, kExprEnd #define WASM_BLOCK_TT(t1, t2, ...) \ kExprBlock, kMultivalBlock, 0, \ - static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(t1)), \ - static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(t2)), __VA_ARGS__, \ + static_cast<byte>(WasmOpcodes::ValueTypeCodeFor(t1)), \ + static_cast<byte>(WasmOpcodes::ValueTypeCodeFor(t2)), __VA_ARGS__, \ kExprEnd #define WASM_BLOCK_I(...) kExprBlock, kLocalI32, __VA_ARGS__, kExprEnd @@ -99,13 +100,13 @@ cond, kExprIf, kLocalVoid, tstmt, kExprElse, fstmt, kExprEnd #define WASM_IF_ELSE_T(t, cond, tstmt, fstmt) \ - cond, kExprIf, static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(t)), tstmt, \ + cond, kExprIf, static_cast<byte>(WasmOpcodes::ValueTypeCodeFor(t)), tstmt, \ kExprElse, fstmt, kExprEnd #define WASM_IF_ELSE_TT(t1, t2, cond, tstmt, fstmt) \ cond, kExprIf, kMultivalBlock, 0, \ - static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(t1)), \ - static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(t2)), tstmt, kExprElse, \ + static_cast<byte>(WasmOpcodes::ValueTypeCodeFor(t1)), \ + static_cast<byte>(WasmOpcodes::ValueTypeCodeFor(t2)), tstmt, kExprElse, \ fstmt, kExprEnd #define WASM_IF_ELSE_I(cond, tstmt, fstmt) \ @@ -140,9 +141,8 @@ // Misc expressions. //------------------------------------------------------------------------------ #define WASM_ID(...) __VA_ARGS__ -#define WASM_ZERO kExprI8Const, 0 -#define WASM_ONE kExprI8Const, 1 -#define WASM_I8(val) kExprI8Const, static_cast<byte>(val) +#define WASM_ZERO kExprI32Const, 0 +#define WASM_ONE kExprI32Const, 1 #define I32V_MIN(length) -(1 << (6 + (7 * ((length) - 1)))) #define I32V_MAX(length) ((1 << (6 + (7 * ((length) - 1)))) - 1) @@ -195,7 +195,7 @@ class LocalDeclEncoder { pos = WriteUint32v(buffer, pos, static_cast<uint32_t>(local_decls.size())); for (size_t i = 0; i < local_decls.size(); ++i) { pos = WriteUint32v(buffer, pos, local_decls[i].first); - buffer[pos++] = WasmOpcodes::LocalTypeCodeFor(local_decls[i].second); + buffer[pos++] = WasmOpcodes::ValueTypeCodeFor(local_decls[i].second); } DCHECK_EQ(Size(), pos); return pos; @@ -203,7 +203,7 @@ class LocalDeclEncoder { // Add locals declarations to this helper. Return the index of the newly added // local(s), with an optional adjustment for the parameters. - uint32_t AddLocals(uint32_t count, LocalType type) { + uint32_t AddLocals(uint32_t count, ValueType type) { uint32_t result = static_cast<uint32_t>(total + (sig ? sig->parameter_count() : 0)); total += count; @@ -211,7 +211,7 @@ class LocalDeclEncoder { count += local_decls.back().first; local_decls.pop_back(); } - local_decls.push_back(std::pair<uint32_t, LocalType>(count, type)); + local_decls.push_back(std::pair<uint32_t, ValueType>(count, type)); return result; } @@ -227,7 +227,7 @@ class LocalDeclEncoder { private: FunctionSig* sig; - ZoneVector<std::pair<uint32_t, LocalType>> local_decls; + ZoneVector<std::pair<uint32_t, ValueType>> local_decls; size_t total; size_t SizeofUint32v(uint32_t val) const { @@ -447,19 +447,22 @@ class LocalDeclEncoder { #define WASM_WHILE(x, y) \ kExprLoop, kLocalVoid, x, kExprIf, kLocalVoid, y, kExprBr, DEPTH_1, \ kExprEnd, kExprEnd -#define WASM_INC_LOCAL(index) \ - kExprGetLocal, static_cast<byte>(index), kExprI8Const, 1, kExprI32Add, \ +#define WASM_INC_LOCAL(index) \ + kExprGetLocal, static_cast<byte>(index), kExprI32Const, 1, kExprI32Add, \ kExprTeeLocal, static_cast<byte>(index) #define WASM_INC_LOCAL_BYV(index, count) \ - kExprGetLocal, static_cast<byte>(index), kExprI8Const, \ + kExprGetLocal, static_cast<byte>(index), kExprI32Const, \ static_cast<byte>(count), kExprI32Add, kExprTeeLocal, \ static_cast<byte>(index) #define WASM_INC_LOCAL_BY(index, count) \ - kExprGetLocal, static_cast<byte>(index), kExprI8Const, \ + kExprGetLocal, static_cast<byte>(index), kExprI32Const, \ static_cast<byte>(count), kExprI32Add, kExprSetLocal, \ static_cast<byte>(index) #define WASM_UNOP(opcode, x) x, static_cast<byte>(opcode) #define WASM_BINOP(opcode, x, y) x, y, static_cast<byte>(opcode) +#define WASM_SIMD_UNOP(opcode, x) x, kSimdPrefix, static_cast<byte>(opcode) +#define WASM_SIMD_BINOP(opcode, x, y) \ + x, y, kSimdPrefix, static_cast<byte>(opcode) //------------------------------------------------------------------------------ // Int32 operations @@ -621,14 +624,31 @@ class LocalDeclEncoder { //------------------------------------------------------------------------------ // Simd Operations. //------------------------------------------------------------------------------ -#define WASM_SIMD_I32x4_SPLAT(x) x, kSimdPrefix, kExprI32x4Splat & 0xff -#define WASM_SIMD_I32x4_EXTRACT_LANE(lane, x) \ - x, kSimdPrefix, kExprI32x4ExtractLane & 0xff, static_cast<byte>(lane) -#define WASM_SIMD_I32x4_ADD(x, y) x, y, kSimdPrefix, kExprI32x4Add & 0xff #define WASM_SIMD_F32x4_SPLAT(x) x, kSimdPrefix, kExprF32x4Splat & 0xff #define WASM_SIMD_F32x4_EXTRACT_LANE(lane, x) \ x, kSimdPrefix, kExprF32x4ExtractLane & 0xff, static_cast<byte>(lane) +#define WASM_SIMD_F32x4_REPLACE_LANE(lane, x, y) \ + x, y, kSimdPrefix, kExprF32x4ReplaceLane & 0xff, static_cast<byte>(lane) +#define WASM_SIMD_F32x4_FROM_I32x4(x) \ + x, kSimdPrefix, kExprF32x4FromInt32x4 & 0xff +#define WASM_SIMD_F32x4_FROM_U32x4(x) \ + x, kSimdPrefix, kExprF32x4FromUint32x4 & 0xff #define WASM_SIMD_F32x4_ADD(x, y) x, y, kSimdPrefix, kExprF32x4Add & 0xff +#define WASM_SIMD_F32x4_SUB(x, y) x, y, kSimdPrefix, kExprF32x4Sub & 0xff + +#define WASM_SIMD_I32x4_SPLAT(x) x, kSimdPrefix, kExprI32x4Splat & 0xff +#define WASM_SIMD_I32x4_EXTRACT_LANE(lane, x) \ + x, kSimdPrefix, kExprI32x4ExtractLane & 0xff, static_cast<byte>(lane) +#define WASM_SIMD_I32x4_REPLACE_LANE(lane, x, y) \ + x, y, kSimdPrefix, kExprI32x4ReplaceLane & 0xff, static_cast<byte>(lane) +#define WASM_SIMD_I32x4_FROM_F32x4(x) \ + x, kSimdPrefix, kExprI32x4FromFloat32x4 & 0xff +#define WASM_SIMD_U32x4_FROM_F32x4(x) \ + x, kSimdPrefix, kExprUi32x4FromFloat32x4 & 0xff +#define WASM_SIMD_S32x4_SELECT(x, y, z) \ + x, y, z, kSimdPrefix, kExprS32x4Select & 0xff +#define WASM_SIMD_I32x4_ADD(x, y) x, y, kSimdPrefix, kExprI32x4Add & 0xff +#define WASM_SIMD_I32x4_SUB(x, y) x, y, kSimdPrefix, kExprI32x4Sub & 0xff #define SIG_ENTRY_v_v kWasmFunctionTypeForm, 0, 0 #define SIZEOF_SIG_ENTRY_v_v 3 |