[wasm] Rename kWasmStmt -> kWasmVoid

This is a more canonical type name, and is in line with {kVoidCode}.

Change-Id: Iaae9524b6fb6ecaafd63ce81cf30e3d01ca3e525
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2775565
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73557}
This commit is contained in:
Manos Koukoutos 2021-03-22 06:56:01 +00:00 committed by Commit Bot
parent 83eb068316
commit a51056f5c4
104 changed files with 362 additions and 362 deletions

View File

@ -2350,7 +2350,7 @@ Node* WasmGraphBuilder::Throw(uint32_t exception_index,
break; break;
case wasm::kI8: case wasm::kI8:
case wasm::kI16: case wasm::kI16:
case wasm::kStmt: case wasm::kVoid:
case wasm::kBottom: case wasm::kBottom:
UNREACHABLE(); UNREACHABLE();
} }
@ -2481,7 +2481,7 @@ Node* WasmGraphBuilder::GetExceptionValues(Node* except_obj,
break; break;
case wasm::kI8: case wasm::kI8:
case wasm::kI16: case wasm::kI16:
case wasm::kStmt: case wasm::kVoid:
case wasm::kBottom: case wasm::kBottom:
UNREACHABLE(); UNREACHABLE();
} }
@ -6241,7 +6241,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
UNIMPLEMENTED(); UNIMPLEMENTED();
case wasm::kI8: case wasm::kI8:
case wasm::kI16: case wasm::kI16:
case wasm::kStmt: case wasm::kVoid:
case wasm::kBottom: case wasm::kBottom:
UNREACHABLE(); UNREACHABLE();
} }
@ -6389,7 +6389,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
case wasm::kI8: case wasm::kI8:
case wasm::kI16: case wasm::kI16:
case wasm::kBottom: case wasm::kBottom:
case wasm::kStmt: case wasm::kVoid:
UNREACHABLE(); UNREACHABLE();
break; break;
} }
@ -6444,7 +6444,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
case wasm::kI8: case wasm::kI8:
case wasm::kI16: case wasm::kI16:
case wasm::kBottom: case wasm::kBottom:
case wasm::kStmt: case wasm::kVoid:
UNREACHABLE(); UNREACHABLE();
break; break;
} }
@ -6612,7 +6612,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
case wasm::kI8: case wasm::kI8:
case wasm::kI16: case wasm::kI16:
case wasm::kBottom: case wasm::kBottom:
case wasm::kStmt: case wasm::kVoid:
return false; return false;
case wasm::kI32: case wasm::kI32:
case wasm::kF32: case wasm::kF32:
@ -6661,7 +6661,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
case wasm::kI8: case wasm::kI8:
case wasm::kI16: case wasm::kI16:
case wasm::kBottom: case wasm::kBottom:
case wasm::kStmt: case wasm::kVoid:
UNREACHABLE(); UNREACHABLE();
break; break;
} }

View File

@ -535,9 +535,9 @@ class WasmGraphBuilder {
const Operator* GetSafeLoadOperator(int offset, wasm::ValueType type); const Operator* GetSafeLoadOperator(int offset, wasm::ValueType type);
const Operator* GetSafeStoreOperator(int offset, wasm::ValueType type); const Operator* GetSafeStoreOperator(int offset, wasm::ValueType type);
Node* BuildChangeEndiannessStore(Node* node, MachineRepresentation rep, Node* BuildChangeEndiannessStore(Node* node, MachineRepresentation rep,
wasm::ValueType wasmtype = wasm::kWasmStmt); wasm::ValueType wasmtype = wasm::kWasmVoid);
Node* BuildChangeEndiannessLoad(Node* node, MachineType type, Node* BuildChangeEndiannessLoad(Node* node, MachineType type,
wasm::ValueType wasmtype = wasm::kWasmStmt); wasm::ValueType wasmtype = wasm::kWasmVoid);
Node* MaskShiftCount32(Node* node); Node* MaskShiftCount32(Node* node);
Node* MaskShiftCount64(Node* node); Node* MaskShiftCount64(Node* node);

View File

@ -1035,7 +1035,7 @@ Handle<WasmValueObject> WasmValueObject::New(
StaticCharVector("(unimplemented)")); StaticCharVector("(unimplemented)"));
break; break;
} }
case wasm::kStmt: case wasm::kVoid:
case wasm::kBottom: case wasm::kBottom:
UNREACHABLE(); UNREACHABLE();
} }

View File

@ -400,7 +400,7 @@ bool WasmModuleDebug::GetWasmValue(const wasm::WasmValue& wasm_value,
case wasm::kWasmS128.kind(): case wasm::kWasmS128.kind():
return StoreValue(wasm_value.to_s128(), buffer, buffer_size, size); return StoreValue(wasm_value.to_s128(), buffer, buffer_size, size);
case wasm::kWasmStmt.kind(): case wasm::kWasmVoid.kind():
case wasm::kWasmExternRef.kind(): case wasm::kWasmExternRef.kind():
case wasm::kWasmBottom.kind(): case wasm::kWasmBottom.kind():
default: default:

View File

@ -1843,7 +1843,7 @@ void WasmStruct::WasmStructPrint(std::ostream& os) { // NOLINT
case wasm::kRtt: case wasm::kRtt:
case wasm::kRttWithDepth: case wasm::kRttWithDepth:
case wasm::kBottom: case wasm::kBottom:
case wasm::kStmt: case wasm::kVoid:
os << "UNIMPLEMENTED"; // TODO(7748): Implement. os << "UNIMPLEMENTED"; // TODO(7748): Implement.
break; break;
} }
@ -1883,7 +1883,7 @@ void WasmArray::WasmArrayPrint(std::ostream& os) { // NOLINT
case wasm::kRtt: case wasm::kRtt:
case wasm::kRttWithDepth: case wasm::kRttWithDepth:
case wasm::kBottom: case wasm::kBottom:
case wasm::kStmt: case wasm::kVoid:
os << "\n Printing elements of this type is unimplemented, sorry"; os << "\n Printing elements of this type is unimplemented, sorry";
// TODO(7748): Implement. // TODO(7748): Implement.
break; break;

View File

@ -4176,7 +4176,7 @@ void LiftoffAssembler::CallC(const ValueKindSig* sig,
} }
// Load potential output value from the buffer on the stack. // Load potential output value from the buffer on the stack.
if (out_argument_kind != kStmt) { if (out_argument_kind != kVoid) {
switch (out_argument_kind) { switch (out_argument_kind) {
case kI32: case kI32:
ldr(result_reg->gp(), MemOperand(sp)); ldr(result_reg->gp(), MemOperand(sp));

View File

@ -3167,7 +3167,7 @@ void LiftoffAssembler::CallC(const ValueKindSig* sig,
} }
// Load potential output value from the buffer on the stack. // Load potential output value from the buffer on the stack.
if (out_argument_kind != kStmt) { if (out_argument_kind != kVoid) {
Peek(liftoff::GetRegFromType(*next_result_reg, out_argument_kind), 0); Peek(liftoff::GetRegFromType(*next_result_reg, out_argument_kind), 0);
} }

View File

@ -4857,7 +4857,7 @@ void LiftoffAssembler::CallC(const ValueKindSig* sig,
} }
// Load potential output value from the buffer on the stack. // Load potential output value from the buffer on the stack.
if (out_argument_kind != kStmt) { if (out_argument_kind != kVoid) {
liftoff::Load(this, *next_result_reg, esp, 0, out_argument_kind); liftoff::Load(this, *next_result_reg, esp, 0, out_argument_kind);
} }

View File

@ -1395,7 +1395,7 @@ class LiftoffAssembler : public TurboAssembler {
inline void DropStackSlotsAndRet(uint32_t num_stack_slots); inline void DropStackSlotsAndRet(uint32_t num_stack_slots);
// Execute a C call. Arguments are pushed to the stack and a pointer to this // Execute a C call. Arguments are pushed to the stack and a pointer to this
// region is passed to the C function. If {out_argument_kind != kStmt}, // region is passed to the C function. If {out_argument_kind != kVoid},
// this is the return value of the C function, stored in {rets[0]}. Further // this is the return value of the C function, stored in {rets[0]}. Further
// outputs (specified in {sig->returns()}) are read from the buffer and stored // outputs (specified in {sig->returns()}) are read from the buffer and stored
// in the remaining {rets} registers. // in the remaining {rets} registers.

View File

@ -544,7 +544,7 @@ class LiftoffCompiler {
bailout_reason = kRefTypes; bailout_reason = kRefTypes;
break; break;
case kBottom: case kBottom:
case kStmt: case kVoid:
UNREACHABLE(); UNREACHABLE();
} }
EmbeddedVector<char, 128> buffer; EmbeddedVector<char, 128> buffer;
@ -1345,7 +1345,7 @@ class LiftoffCompiler {
param_bytes += element_size_bytes(param_kind); param_bytes += element_size_bytes(param_kind);
} }
int out_arg_bytes = int out_arg_bytes =
out_argument_kind == kStmt ? 0 : element_size_bytes(out_argument_kind); out_argument_kind == kVoid ? 0 : element_size_bytes(out_argument_kind);
int stack_bytes = std::max(param_bytes, out_arg_bytes); int stack_bytes = std::max(param_bytes, out_arg_bytes);
__ CallC(sig, arg_regs, result_regs, out_argument_kind, stack_bytes, __ CallC(sig, arg_regs, result_regs, out_argument_kind, stack_bytes,
ext_ref); ext_ref);
@ -1564,7 +1564,7 @@ class LiftoffCompiler {
[=](LiftoffRegister dst, LiftoffRegister src) { [=](LiftoffRegister dst, LiftoffRegister src) {
if (__ emit_i32_popcnt(dst.gp(), src.gp())) return; if (__ emit_i32_popcnt(dst.gp(), src.gp())) return;
auto sig = MakeSig::Returns(kI32).Params(kI32); auto sig = MakeSig::Returns(kI32).Params(kI32);
GenerateCCall(&dst, &sig, kStmt, &src, GenerateCCall(&dst, &sig, kVoid, &src,
ExternalReference::wasm_word32_popcnt()); ExternalReference::wasm_word32_popcnt());
}); });
case kExprI64Popcnt: case kExprI64Popcnt:
@ -1574,7 +1574,7 @@ class LiftoffCompiler {
// The c function returns i32. We will zero-extend later. // The c function returns i32. We will zero-extend later.
auto sig = MakeSig::Returns(kI32).Params(kI64); auto sig = MakeSig::Returns(kI32).Params(kI64);
LiftoffRegister c_call_dst = kNeedI64RegPair ? dst.low() : dst; LiftoffRegister c_call_dst = kNeedI64RegPair ? dst.low() : dst;
GenerateCCall(&c_call_dst, &sig, kStmt, &src, GenerateCCall(&c_call_dst, &sig, kVoid, &src,
ExternalReference::wasm_word64_popcnt()); ExternalReference::wasm_word64_popcnt());
// Now zero-extend the result to i64. // Now zero-extend the result to i64.
__ emit_type_conversion(kExprI64UConvertI32, dst, c_call_dst, __ emit_type_conversion(kExprI64UConvertI32, dst, c_call_dst,
@ -1704,7 +1704,7 @@ class LiftoffCompiler {
ValueKind sig_kinds[] = {k##kind, k##kind, k##kind}; \ ValueKind sig_kinds[] = {k##kind, k##kind, k##kind}; \
const bool out_via_stack = k##kind == kI64; \ const bool out_via_stack = k##kind == kI64; \
ValueKindSig sig(out_via_stack ? 0 : 1, 2, sig_kinds); \ ValueKindSig sig(out_via_stack ? 0 : 1, 2, sig_kinds); \
ValueKind out_arg_kind = out_via_stack ? kI64 : kStmt; \ ValueKind out_arg_kind = out_via_stack ? kI64 : kVoid; \
GenerateCCall(&dst, &sig, out_arg_kind, args, ext_ref); \ GenerateCCall(&dst, &sig, out_arg_kind, args, ext_ref); \
}); });
switch (opcode) { switch (opcode) {
@ -3989,7 +3989,7 @@ class LiftoffCompiler {
} }
case wasm::kI8: case wasm::kI8:
case wasm::kI16: case wasm::kI16:
case wasm::kStmt: case wasm::kVoid:
case wasm::kBottom: case wasm::kBottom:
UNREACHABLE(); UNREACHABLE();
} }
@ -4046,7 +4046,7 @@ class LiftoffCompiler {
} }
case wasm::kI8: case wasm::kI8:
case wasm::kI16: case wasm::kI16:
case wasm::kStmt: case wasm::kVoid:
case wasm::kBottom: case wasm::kBottom:
UNREACHABLE(); UNREACHABLE();
} }
@ -4603,7 +4603,7 @@ class LiftoffCompiler {
// We don't need the instance anymore after the call. We can use the // We don't need the instance anymore after the call. We can use the
// register for the result. // register for the result.
LiftoffRegister result(instance); LiftoffRegister result(instance);
GenerateCCall(&result, &sig, kStmt, args, ext_ref); GenerateCCall(&result, &sig, kVoid, args, ext_ref);
Label* trap_label = Label* trap_label =
AddOutOfLineTrap(decoder, WasmCode::kThrowWasmTrapMemOutOfBounds); AddOutOfLineTrap(decoder, WasmCode::kThrowWasmTrapMemOutOfBounds);
__ emit_cond_jump(kEqual, trap_label, kI32, result.gp()); __ emit_cond_jump(kEqual, trap_label, kI32, result.gp());
@ -4644,7 +4644,7 @@ class LiftoffCompiler {
// We don't need the instance anymore after the call. We can use the // We don't need the instance anymore after the call. We can use the
// register for the result. // register for the result.
LiftoffRegister result(instance); LiftoffRegister result(instance);
GenerateCCall(&result, &sig, kStmt, args, ext_ref); GenerateCCall(&result, &sig, kVoid, args, ext_ref);
Label* trap_label = Label* trap_label =
AddOutOfLineTrap(decoder, WasmCode::kThrowWasmTrapMemOutOfBounds); AddOutOfLineTrap(decoder, WasmCode::kThrowWasmTrapMemOutOfBounds);
__ emit_cond_jump(kEqual, trap_label, kI32, result.gp()); __ emit_cond_jump(kEqual, trap_label, kI32, result.gp());
@ -4665,7 +4665,7 @@ class LiftoffCompiler {
// We don't need the instance anymore after the call. We can use the // We don't need the instance anymore after the call. We can use the
// register for the result. // register for the result.
LiftoffRegister result(instance); LiftoffRegister result(instance);
GenerateCCall(&result, &sig, kStmt, args, ext_ref); GenerateCCall(&result, &sig, kVoid, args, ext_ref);
Label* trap_label = Label* trap_label =
AddOutOfLineTrap(decoder, WasmCode::kThrowWasmTrapMemOutOfBounds); AddOutOfLineTrap(decoder, WasmCode::kThrowWasmTrapMemOutOfBounds);
__ emit_cond_jump(kEqual, trap_label, kI32, result.gp()); __ emit_cond_jump(kEqual, trap_label, kI32, result.gp());
@ -6013,7 +6013,7 @@ class LiftoffCompiler {
return LoadNullValue(reg.gp(), pinned); return LoadNullValue(reg.gp(), pinned);
case kRtt: case kRtt:
case kRttWithDepth: case kRttWithDepth:
case kStmt: case kVoid:
case kBottom: case kBottom:
case kRef: case kRef:
UNREACHABLE(); UNREACHABLE();

View File

@ -2948,7 +2948,7 @@ void LiftoffAssembler::CallC(const ValueKindSig* sig,
} }
// Load potential output value from the buffer on the stack. // Load potential output value from the buffer on the stack.
if (out_argument_kind != kStmt) { if (out_argument_kind != kVoid) {
liftoff::Load(this, *next_result_reg, sp, 0, out_argument_kind); liftoff::Load(this, *next_result_reg, sp, 0, out_argument_kind);
} }

View File

@ -3116,7 +3116,7 @@ void LiftoffAssembler::CallC(const ValueKindSig* sig,
} }
// Load potential output value from the buffer on the stack. // Load potential output value from the buffer on the stack.
if (out_argument_kind != kStmt) { if (out_argument_kind != kVoid) {
liftoff::Load(this, *next_result_reg, MemOperand(sp, 0), out_argument_kind); liftoff::Load(this, *next_result_reg, MemOperand(sp, 0), out_argument_kind);
} }

View File

@ -2523,7 +2523,7 @@ void LiftoffAssembler::CallC(const ValueKindSig* sig,
} }
// Load potential output value from the buffer on the stack. // Load potential output value from the buffer on the stack.
if (out_argument_kind != kStmt) { if (out_argument_kind != kVoid) {
liftoff::Load(this, *next_result_reg, MemOperand(sp, 0), out_argument_kind); liftoff::Load(this, *next_result_reg, MemOperand(sp, 0), out_argument_kind);
} }

View File

@ -2804,7 +2804,7 @@ void LiftoffAssembler::CallC(const ValueKindSig* sig,
} }
// Load potential output value from the buffer on the stack. // Load potential output value from the buffer on the stack.
if (out_argument_kind != kStmt) { if (out_argument_kind != kVoid) {
switch (out_argument_kind) { switch (out_argument_kind) {
case kI32: case kI32:
LoadS32(result_reg->gp(), MemOperand(sp)); LoadS32(result_reg->gp(), MemOperand(sp));

View File

@ -4363,7 +4363,7 @@ void LiftoffAssembler::CallC(const ValueKindSig* sig,
} }
// Load potential output value from the buffer on the stack. // Load potential output value from the buffer on the stack.
if (out_argument_kind != kStmt) { if (out_argument_kind != kVoid) {
liftoff::Load(this, *next_result_reg, Operand(rsp, 0), out_argument_kind); liftoff::Load(this, *next_result_reg, Operand(rsp, 0), out_argument_kind);
} }

View File

@ -1212,7 +1212,7 @@ namespace {
class SignatureHelper : public i::AllStatic { class SignatureHelper : public i::AllStatic {
public: public:
// Use an invalid type as a marker separating params and results. // Use an invalid type as a marker separating params and results.
static constexpr i::wasm::ValueType kMarker = i::wasm::kWasmStmt; static constexpr i::wasm::ValueType kMarker = i::wasm::kWasmVoid;
static i::Handle<i::PodArray<i::wasm::ValueType>> Serialize( static i::Handle<i::PodArray<i::wasm::ValueType>> Serialize(
i::Isolate* isolate, FuncType* type) { i::Isolate* isolate, FuncType* type) {
@ -1427,7 +1427,7 @@ void PushArgs(const i::wasm::FunctionSig* sig, const Val args[],
UNIMPLEMENTED(); UNIMPLEMENTED();
case i::wasm::kI8: case i::wasm::kI8:
case i::wasm::kI16: case i::wasm::kI16:
case i::wasm::kStmt: case i::wasm::kVoid:
case i::wasm::kBottom: case i::wasm::kBottom:
UNREACHABLE(); UNREACHABLE();
break; break;
@ -1468,7 +1468,7 @@ void PopArgs(const i::wasm::FunctionSig* sig, Val results[],
UNIMPLEMENTED(); UNIMPLEMENTED();
case i::wasm::kI8: case i::wasm::kI8:
case i::wasm::kI16: case i::wasm::kI16:
case i::wasm::kStmt: case i::wasm::kVoid:
case i::wasm::kBottom: case i::wasm::kBottom:
UNREACHABLE(); UNREACHABLE();
break; break;
@ -1733,7 +1733,7 @@ auto Global::get() const -> Val {
UNIMPLEMENTED(); UNIMPLEMENTED();
case i::wasm::kI8: case i::wasm::kI8:
case i::wasm::kI16: case i::wasm::kI16:
case i::wasm::kStmt: case i::wasm::kVoid:
case i::wasm::kBottom: case i::wasm::kBottom:
UNREACHABLE(); UNREACHABLE();
} }

View File

@ -484,7 +484,7 @@ struct ImmF64Immediate {
template <Decoder::ValidateFlag validate> template <Decoder::ValidateFlag validate>
struct GlobalIndexImmediate { struct GlobalIndexImmediate {
uint32_t index; uint32_t index;
ValueType type = kWasmStmt; ValueType type = kWasmVoid;
const WasmGlobal* global = nullptr; const WasmGlobal* global = nullptr;
uint32_t length; uint32_t length;
@ -518,7 +518,7 @@ struct SelectTypeImmediate {
template <Decoder::ValidateFlag validate> template <Decoder::ValidateFlag validate>
struct BlockTypeImmediate { struct BlockTypeImmediate {
uint32_t length = 1; uint32_t length = 1;
ValueType type = kWasmStmt; ValueType type = kWasmVoid;
uint32_t sig_index = 0; uint32_t sig_index = 0;
const FunctionSig* sig = nullptr; const FunctionSig* sig = nullptr;
@ -556,7 +556,7 @@ struct BlockTypeImmediate {
return static_cast<uint32_t>(sig->parameter_count()); return static_cast<uint32_t>(sig->parameter_count());
} }
uint32_t out_arity() const { uint32_t out_arity() const {
if (type == kWasmStmt) return 0; if (type == kWasmVoid) return 0;
if (type != kWasmBottom) return 1; if (type != kWasmBottom) return 1;
return static_cast<uint32_t>(sig->return_count()); return static_cast<uint32_t>(sig->return_count());
} }
@ -566,7 +566,7 @@ struct BlockTypeImmediate {
} }
ValueType out_type(uint32_t index) { ValueType out_type(uint32_t index) {
if (type == kWasmBottom) return sig->GetReturn(index); if (type == kWasmBottom) return sig->GetReturn(index);
DCHECK_NE(kWasmStmt, type); DCHECK_NE(kWasmVoid, type);
DCHECK_EQ(0, index); DCHECK_EQ(0, index);
return type; return type;
} }
@ -914,7 +914,7 @@ struct PcForErrors<Decoder::kFullValidation> {
// An entry on the value stack. // An entry on the value stack.
template <Decoder::ValidateFlag validate> template <Decoder::ValidateFlag validate>
struct ValueBase : public PcForErrors<validate> { struct ValueBase : public PcForErrors<validate> {
ValueType type = kWasmStmt; ValueType type = kWasmVoid;
ValueBase(const byte* pc, ValueType type) ValueBase(const byte* pc, ValueType type)
: PcForErrors<validate>(pc), type(type) {} : PcForErrors<validate>(pc), type(type) {}
@ -3628,7 +3628,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
ValueType GetReturnType(const FunctionSig* sig) { ValueType GetReturnType(const FunctionSig* sig) {
DCHECK_GE(1, sig->return_count()); DCHECK_GE(1, sig->return_count());
return sig->return_count() == 0 ? kWasmStmt : sig->GetReturn(); return sig->return_count() == 0 ? kWasmVoid : sig->GetReturn();
} }
// TODO(jkummerow): Consider refactoring control stack management so // TODO(jkummerow): Consider refactoring control stack management so
@ -4568,7 +4568,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
#define CASE_ATOMIC_STORE_OP(Name, Type) \ #define CASE_ATOMIC_STORE_OP(Name, Type) \
case kExpr##Name: { \ case kExpr##Name: { \
memtype = MachineType::Type(); \ memtype = MachineType::Type(); \
ret_type = kWasmStmt; \ ret_type = kWasmVoid; \
break; /* to generic mem access code below */ \ break; /* to generic mem access code below */ \
} }
ATOMIC_STORE_OP_LIST(CASE_ATOMIC_STORE_OP) ATOMIC_STORE_OP_LIST(CASE_ATOMIC_STORE_OP)
@ -4604,7 +4604,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
// then). // then).
CHECK(!this->module_->is_memory64); CHECK(!this->module_->is_memory64);
ArgVector args = PeekArgs(sig); ArgVector args = PeekArgs(sig);
if (ret_type == kWasmStmt) { if (ret_type == kWasmVoid) {
CALL_INTERFACE_IF_REACHABLE(AtomicOp, opcode, VectorOf(args), imm, CALL_INTERFACE_IF_REACHABLE(AtomicOp, opcode, VectorOf(args), imm,
nullptr); nullptr);
DropArgs(sig); DropArgs(sig);
@ -4756,7 +4756,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
V8_INLINE Value CreateValue(ValueType type) { return Value{this->pc_, type}; } V8_INLINE Value CreateValue(ValueType type) { return Value{this->pc_, type}; }
V8_INLINE void Push(Value value) { V8_INLINE void Push(Value value) {
DCHECK_NE(kWasmStmt, value.type); DCHECK_NE(kWasmVoid, value.type);
// {EnsureStackSpace} should have been called before, either in the central // {EnsureStackSpace} should have been called before, either in the central
// decoding loop, or individually if more than one element is pushed. // decoding loop, or individually if more than one element is pushed.
DCHECK_GT(stack_capacity_end_, stack_end_); DCHECK_GT(stack_capacity_end_, stack_end_);
@ -5072,7 +5072,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
int BuildSimpleOperator(WasmOpcode opcode, const FunctionSig* sig) { int BuildSimpleOperator(WasmOpcode opcode, const FunctionSig* sig) {
DCHECK_GE(1, sig->return_count()); DCHECK_GE(1, sig->return_count());
ValueType ret = sig->return_count() == 0 ? kWasmStmt : sig->GetReturn(0); ValueType ret = sig->return_count() == 0 ? kWasmVoid : sig->GetReturn(0);
if (sig->parameter_count() == 1) { if (sig->parameter_count() == 1) {
return BuildSimpleOperator(opcode, ret, sig->GetParam(0)); return BuildSimpleOperator(opcode, ret, sig->GetParam(0));
} else { } else {
@ -5085,7 +5085,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
int BuildSimpleOperator(WasmOpcode opcode, ValueType return_type, int BuildSimpleOperator(WasmOpcode opcode, ValueType return_type,
ValueType arg_type) { ValueType arg_type) {
Value val = Peek(0, 0, arg_type); Value val = Peek(0, 0, arg_type);
if (return_type == kWasmStmt) { if (return_type == kWasmVoid) {
CALL_INTERFACE_IF_REACHABLE(UnOp, opcode, val, nullptr); CALL_INTERFACE_IF_REACHABLE(UnOp, opcode, val, nullptr);
Drop(val); Drop(val);
} else { } else {
@ -5101,7 +5101,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
ValueType lhs_type, ValueType rhs_type) { ValueType lhs_type, ValueType rhs_type) {
Value rval = Peek(0, 1, rhs_type); Value rval = Peek(0, 1, rhs_type);
Value lval = Peek(1, 0, lhs_type); Value lval = Peek(1, 0, lhs_type);
if (return_type == kWasmStmt) { if (return_type == kWasmVoid) {
CALL_INTERFACE_IF_REACHABLE(BinOp, opcode, lval, rval, nullptr); CALL_INTERFACE_IF_REACHABLE(BinOp, opcode, lval, rval, nullptr);
Drop(2); Drop(2);
} else { } else {

View File

@ -1219,7 +1219,7 @@ class WasmGraphBuildingInterface {
return builder_->RefNull(); return builder_->RefNull();
case kRtt: case kRtt:
case kRttWithDepth: case kRttWithDepth:
case kStmt: case kVoid:
case kBottom: case kBottom:
case kRef: case kRef:
UNREACHABLE(); UNREACHABLE();

View File

@ -647,7 +647,7 @@ class ModuleDecoderImpl : public Decoder {
// ===== Imported global ============================================= // ===== Imported global =============================================
import->index = static_cast<uint32_t>(module_->globals.size()); import->index = static_cast<uint32_t>(module_->globals.size());
module_->globals.push_back( module_->globals.push_back(
{kWasmStmt, false, WasmInitExpr(), {0}, true, false}); {kWasmVoid, false, WasmInitExpr(), {0}, true, false});
WasmGlobal* global = &module_->globals.back(); WasmGlobal* global = &module_->globals.back();
global->type = consume_value_type(); global->type = consume_value_type();
global->mutability = consume_mutability(); global->mutability = consume_mutability();
@ -756,7 +756,7 @@ class ModuleDecoderImpl : public Decoder {
TRACE("DecodeGlobal[%d] module+%d\n", i, static_cast<int>(pc_ - start_)); TRACE("DecodeGlobal[%d] module+%d\n", i, static_cast<int>(pc_ - start_));
// Add an uninitialized global and pass a pointer to it. // Add an uninitialized global and pass a pointer to it.
module_->globals.push_back( module_->globals.push_back(
{kWasmStmt, false, WasmInitExpr(), {0}, false, false}); {kWasmVoid, false, WasmInitExpr(), {0}, false, false});
WasmGlobal* global = &module_->globals.back(); WasmGlobal* global = &module_->globals.back();
global->type = consume_value_type(); global->type = consume_value_type();
global->mutability = consume_mutability(); global->mutability = consume_mutability();
@ -1305,7 +1305,7 @@ class ModuleDecoderImpl : public Decoder {
} }
WasmInitExpr DecodeInitExprForTesting() { WasmInitExpr DecodeInitExprForTesting() {
return consume_init_expr(nullptr, kWasmStmt, 0); return consume_init_expr(nullptr, kWasmVoid, 0);
} }
const std::shared_ptr<WasmModule>& shared_module() const { return module_; } const std::shared_ptr<WasmModule>& shared_module() const { return module_; }
@ -1349,11 +1349,11 @@ class ModuleDecoderImpl : public Decoder {
ValueType TypeOf(const WasmInitExpr& expr) { ValueType TypeOf(const WasmInitExpr& expr) {
switch (expr.kind()) { switch (expr.kind()) {
case WasmInitExpr::kNone: case WasmInitExpr::kNone:
return kWasmStmt; return kWasmVoid;
case WasmInitExpr::kGlobalGet: case WasmInitExpr::kGlobalGet:
return expr.immediate().index < module_->globals.size() return expr.immediate().index < module_->globals.size()
? module_->globals[expr.immediate().index].type ? module_->globals[expr.immediate().index].type
: kWasmStmt; : kWasmVoid;
case WasmInitExpr::kI32Const: case WasmInitExpr::kI32Const:
return kWasmI32; return kWasmI32;
case WasmInitExpr::kI64Const: case WasmInitExpr::kI64Const:
@ -1382,7 +1382,7 @@ class ModuleDecoderImpl : public Decoder {
return ValueType::Rtt(expr.immediate().heap_type, return ValueType::Rtt(expr.immediate().heap_type,
operand_type.depth() + 1); operand_type.depth() + 1);
} else { } else {
return kWasmStmt; return kWasmVoid;
} }
} }
} }
@ -1841,7 +1841,7 @@ class ModuleDecoderImpl : public Decoder {
} }
WasmInitExpr expr = std::move(stack.back()); WasmInitExpr expr = std::move(stack.back());
if (expected != kWasmStmt && !IsSubtypeOf(TypeOf(expr), expected, module)) { if (expected != kWasmVoid && !IsSubtypeOf(TypeOf(expr), expected, module)) {
errorf(pc(), "type error in init expression, expected %s, got %s", errorf(pc(), "type error in init expression, expected %s, got %s",
expected.name().c_str(), TypeOf(expr).name().c_str()); expected.name().c_str(), TypeOf(expr).name().c_str());
} }

View File

@ -923,7 +923,7 @@ void InstanceBuilder::WriteGlobalValue(const WasmGlobal& global,
tagged_globals_->set(global.offset, *value->GetRef()); tagged_globals_->set(global.offset, *value->GetRef());
break; break;
} }
case kStmt: case kVoid:
case kS128: case kS128:
case kBottom: case kBottom:
case kI8: case kI8:

View File

@ -42,7 +42,7 @@ class Simd128;
V(I16, 1, I16, Int16, 'h', "i16") V(I16, 1, I16, Int16, 'h', "i16")
#define FOREACH_VALUE_TYPE(V) \ #define FOREACH_VALUE_TYPE(V) \
V(Stmt, -1, Void, None, 'v', "<stmt>") \ V(Void, -1, Void, None, 'v', "<void>") \
FOREACH_NUMERIC_VALUE_TYPE(V) \ FOREACH_NUMERIC_VALUE_TYPE(V) \
V(Rtt, kTaggedSizeLog2, Rtt, TaggedPointer, 't', "rtt") \ V(Rtt, kTaggedSizeLog2, Rtt, TaggedPointer, 't', "rtt") \
V(RttWithDepth, kTaggedSizeLog2, RttWithDepth, TaggedPointer, 'k', "rtt") \ V(RttWithDepth, kTaggedSizeLog2, RttWithDepth, TaggedPointer, 'k', "rtt") \
@ -262,7 +262,7 @@ constexpr bool is_rtt(ValueKind kind) {
} }
constexpr bool is_defaultable(ValueKind kind) { constexpr bool is_defaultable(ValueKind kind) {
CONSTEXPR_DCHECK(kind != kBottom && kind != kStmt); CONSTEXPR_DCHECK(kind != kBottom && kind != kVoid);
return kind != kRef && !is_rtt(kind); return kind != kRef && !is_rtt(kind);
} }
@ -275,7 +275,7 @@ constexpr bool is_defaultable(ValueKind kind) {
class ValueType { class ValueType {
public: public:
/******************************* Constructors *******************************/ /******************************* Constructors *******************************/
constexpr ValueType() : bit_field_(KindField::encode(kStmt)) {} constexpr ValueType() : bit_field_(KindField::encode(kVoid)) {}
static constexpr ValueType Primitive(ValueKind kind) { static constexpr ValueType Primitive(ValueKind kind) {
CONSTEXPR_DCHECK(kind == kBottom || kind <= kI16); CONSTEXPR_DCHECK(kind == kBottom || kind <= kI16);
return ValueType(KindField::encode(kind)); return ValueType(KindField::encode(kind));
@ -450,7 +450,7 @@ class ValueType {
default: default:
return kRefCode; return kRefCode;
} }
case kStmt: case kVoid:
return kVoidCode; return kVoidCode;
case kRtt: case kRtt:
return kRttCode; return kRttCode;
@ -555,7 +555,7 @@ constexpr ValueType kWasmF64 = ValueType::Primitive(kF64);
constexpr ValueType kWasmS128 = ValueType::Primitive(kS128); constexpr ValueType kWasmS128 = ValueType::Primitive(kS128);
constexpr ValueType kWasmI8 = ValueType::Primitive(kI8); constexpr ValueType kWasmI8 = ValueType::Primitive(kI8);
constexpr ValueType kWasmI16 = ValueType::Primitive(kI16); constexpr ValueType kWasmI16 = ValueType::Primitive(kI16);
constexpr ValueType kWasmStmt = ValueType::Primitive(kStmt); constexpr ValueType kWasmVoid = ValueType::Primitive(kVoid);
constexpr ValueType kWasmBottom = ValueType::Primitive(kBottom); constexpr ValueType kWasmBottom = ValueType::Primitive(kBottom);
// Established reference-type proposal shorthands. // Established reference-type proposal shorthands.
constexpr ValueType kWasmFuncRef = ValueType::Ref(HeapType::kFunc, kNullable); constexpr ValueType kWasmFuncRef = ValueType::Ref(HeapType::kFunc, kNullable);

View File

@ -642,7 +642,7 @@ class DebugInfoImpl {
} }
case kI8: case kI8:
case kI16: case kI16:
case kStmt: case kVoid:
case kBottom: case kBottom:
UNREACHABLE(); UNREACHABLE();
} }

View File

@ -1199,7 +1199,7 @@ void WebAssemblyMemory(const v8::FunctionCallbackInfo<v8::Value>& args) {
// Determines the type encoded in a value type property (e.g. type reflection). // Determines the type encoded in a value type property (e.g. type reflection).
// Returns false if there was an exception, true upon success. On success the // Returns false if there was an exception, true upon success. On success the
// outgoing {type} is set accordingly, or set to {wasm::kWasmStmt} in case the // outgoing {type} is set accordingly, or set to {wasm::kWasmVoid} in case the
// type could not be properly recognized. // type could not be properly recognized.
bool GetValueType(Isolate* isolate, MaybeLocal<Value> maybe, bool GetValueType(Isolate* isolate, MaybeLocal<Value> maybe,
Local<Context> context, i::wasm::ValueType* type, Local<Context> context, i::wasm::ValueType* type,
@ -1228,7 +1228,7 @@ bool GetValueType(Isolate* isolate, MaybeLocal<Value> maybe,
*type = i::wasm::kWasmEqRef; *type = i::wasm::kWasmEqRef;
} else { } else {
// Unrecognized type. // Unrecognized type.
*type = i::wasm::kWasmStmt; *type = i::wasm::kWasmVoid;
} }
return true; return true;
} }
@ -1273,7 +1273,7 @@ void WebAssemblyGlobal(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::MaybeLocal<v8::Value> maybe = v8::MaybeLocal<v8::Value> maybe =
descriptor->Get(context, v8_str(isolate, "value")); descriptor->Get(context, v8_str(isolate, "value"));
if (!GetValueType(isolate, maybe, context, &type, enabled_features)) return; if (!GetValueType(isolate, maybe, context, &type, enabled_features)) return;
if (type == i::wasm::kWasmStmt) { if (type == i::wasm::kWasmVoid) {
thrower.TypeError( thrower.TypeError(
"Descriptor property 'value' must be a WebAssembly type"); "Descriptor property 'value' must be a WebAssembly type");
return; return;
@ -1386,7 +1386,7 @@ void WebAssemblyGlobal(const v8::FunctionCallbackInfo<v8::Value>& args) {
UNIMPLEMENTED(); UNIMPLEMENTED();
case i::wasm::kI8: case i::wasm::kI8:
case i::wasm::kI16: case i::wasm::kI16:
case i::wasm::kStmt: case i::wasm::kVoid:
case i::wasm::kS128: case i::wasm::kS128:
case i::wasm::kBottom: case i::wasm::kBottom:
UNREACHABLE(); UNREACHABLE();
@ -1489,7 +1489,7 @@ void WebAssemblyFunction(const v8::FunctionCallbackInfo<v8::Value>& args) {
i::wasm::ValueType type; i::wasm::ValueType type;
MaybeLocal<Value> maybe = parameters->Get(context, i); MaybeLocal<Value> maybe = parameters->Get(context, i);
if (!GetValueType(isolate, maybe, context, &type, enabled_features)) return; if (!GetValueType(isolate, maybe, context, &type, enabled_features)) return;
if (type == i::wasm::kWasmStmt) { if (type == i::wasm::kWasmVoid) {
thrower.TypeError( thrower.TypeError(
"Argument 0 parameter type at index #%u must be a value type", i); "Argument 0 parameter type at index #%u must be a value type", i);
return; return;
@ -1500,7 +1500,7 @@ void WebAssemblyFunction(const v8::FunctionCallbackInfo<v8::Value>& args) {
i::wasm::ValueType type; i::wasm::ValueType type;
MaybeLocal<Value> maybe = results->Get(context, i); MaybeLocal<Value> maybe = results->Get(context, i);
if (!GetValueType(isolate, maybe, context, &type, enabled_features)) return; if (!GetValueType(isolate, maybe, context, &type, enabled_features)) return;
if (type == i::wasm::kWasmStmt) { if (type == i::wasm::kWasmVoid) {
thrower.TypeError( thrower.TypeError(
"Argument 0 result type at index #%u must be a value type", i); "Argument 0 result type at index #%u must be a value type", i);
return; return;
@ -1863,7 +1863,7 @@ void WebAssemblyGlobalGetValueCommon(
case i::wasm::kI8: case i::wasm::kI8:
case i::wasm::kI16: case i::wasm::kI16:
case i::wasm::kBottom: case i::wasm::kBottom:
case i::wasm::kStmt: case i::wasm::kVoid:
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -1960,7 +1960,7 @@ void WebAssemblyGlobalSetValue(
case i::wasm::kI8: case i::wasm::kI8:
case i::wasm::kI16: case i::wasm::kI16:
case i::wasm::kBottom: case i::wasm::kBottom:
case i::wasm::kStmt: case i::wasm::kVoid:
UNREACHABLE(); UNREACHABLE();
} }
} }

View File

@ -503,7 +503,7 @@ void WriteInitializerExpression(ZoneBuffer* buffer, const WasmInitExpr& init,
break; break;
case kI8: case kI8:
case kI16: case kI16:
case kStmt: case kVoid:
case kS128: case kS128:
case kBottom: case kBottom:
case kRef: case kRef:

View File

@ -365,7 +365,7 @@ struct WasmTable {
module->has_signature(heap_type.ref_index())); module->has_signature(heap_type.ref_index()));
} }
ValueType type = kWasmStmt; // table type. ValueType type = kWasmVoid; // table type.
uint32_t initial_size = 0; // initial table size. uint32_t initial_size = 0; // initial table size.
uint32_t maximum_size = 0; // maximum table size. uint32_t maximum_size = 0; // maximum table size.
bool has_maximum_size = false; // true if there is a maximum size. bool has_maximum_size = false; // true if there is a maximum size.

View File

@ -612,7 +612,7 @@ void WasmTableObject::UpdateDispatchTables(
int total_count = serialized_sig.length() - 1; int total_count = serialized_sig.length() - 1;
std::unique_ptr<wasm::ValueType[]> reps(new wasm::ValueType[total_count]); std::unique_ptr<wasm::ValueType[]> reps(new wasm::ValueType[total_count]);
int result_count; int result_count;
static const wasm::ValueType kMarker = wasm::kWasmStmt; static const wasm::ValueType kMarker = wasm::kWasmVoid;
for (int i = 0, j = 0; i <= total_count; i++) { for (int i = 0, j = 0; i <= total_count; i++) {
if (serialized_sig.get(i) == kMarker) { if (serialized_sig.get(i) == kMarker) {
result_count = i; result_count = i;
@ -1641,7 +1641,7 @@ wasm::WasmValue WasmStruct::GetFieldValue(uint32_t index) {
case wasm::kRttWithDepth: case wasm::kRttWithDepth:
// TODO(7748): Expose RTTs to DevTools. // TODO(7748): Expose RTTs to DevTools.
UNIMPLEMENTED(); UNIMPLEMENTED();
case wasm::kStmt: case wasm::kVoid:
case wasm::kBottom: case wasm::kBottom:
UNREACHABLE(); UNREACHABLE();
} }
@ -1671,7 +1671,7 @@ wasm::WasmValue WasmArray::GetElement(uint32_t index) {
case wasm::kRttWithDepth: case wasm::kRttWithDepth:
// TODO(7748): Expose RTTs to DevTools. // TODO(7748): Expose RTTs to DevTools.
UNIMPLEMENTED(); UNIMPLEMENTED();
case wasm::kStmt: case wasm::kVoid:
case wasm::kBottom: case wasm::kBottom:
UNREACHABLE(); UNREACHABLE();
} }
@ -1733,7 +1733,7 @@ bool WasmCapiFunction::MatchesSignature(const wasm::FunctionSig* sig) const {
return false; return false;
} }
} }
if (serialized_sig.get(serialized_index) != wasm::kWasmStmt) return false; if (serialized_sig.get(serialized_index) != wasm::kWasmVoid) return false;
serialized_index++; serialized_index++;
for (int i = 0; i < param_count; i++, serialized_index++) { for (int i = 0; i < param_count; i++, serialized_index++) {
if (sig->GetParam(i) != serialized_sig.get(serialized_index)) return false; if (sig->GetParam(i) != serialized_sig.get(serialized_index)) return false;
@ -1830,7 +1830,7 @@ uint32_t WasmExceptionPackage::GetEncodedSize(
break; break;
case wasm::kRtt: case wasm::kRtt:
case wasm::kRttWithDepth: case wasm::kRttWithDepth:
case wasm::kStmt: case wasm::kVoid:
case wasm::kBottom: case wasm::kBottom:
case wasm::kI8: case wasm::kI8:
case wasm::kI16: case wasm::kI16:

View File

@ -575,7 +575,7 @@ enum WasmOpcodeSig : byte {
#undef DECLARE_SIG_ENUM #undef DECLARE_SIG_ENUM
#define DECLARE_SIG(name, ...) \ #define DECLARE_SIG(name, ...) \
constexpr ValueType kTypes_##name[] = {__VA_ARGS__}; \ constexpr ValueType kTypes_##name[] = {__VA_ARGS__}; \
constexpr int kReturnsCount_##name = kTypes_##name[0] == kWasmStmt ? 0 : 1; \ constexpr int kReturnsCount_##name = kTypes_##name[0] == kWasmVoid ? 0 : 1; \
constexpr FunctionSig kSig_##name( \ constexpr FunctionSig kSig_##name( \
kReturnsCount_##name, static_cast<int>(arraysize(kTypes_##name)) - 1, \ kReturnsCount_##name, static_cast<int>(arraysize(kTypes_##name)) - 1, \
kTypes_##name + (1 - kReturnsCount_##name)); kTypes_##name + (1 - kReturnsCount_##name));

View File

@ -708,7 +708,7 @@ bool V8_EXPORT_PRIVATE IsJSCompatibleSignature(const FunctionSig* sig,
// All signatures. // All signatures.
#define FOREACH_SIGNATURE(V) \ #define FOREACH_SIGNATURE(V) \
FOREACH_SIMD_SIGNATURE(V) \ FOREACH_SIMD_SIGNATURE(V) \
V(v_v, kWasmStmt) \ V(v_v, kWasmVoid) \
V(i_ii, kWasmI32, kWasmI32, kWasmI32) \ V(i_ii, kWasmI32, kWasmI32, kWasmI32) \
V(i_i, kWasmI32, kWasmI32) \ V(i_i, kWasmI32, kWasmI32) \
V(i_v, kWasmI32) \ V(i_v, kWasmI32) \
@ -733,15 +733,15 @@ bool V8_EXPORT_PRIVATE IsJSCompatibleSignature(const FunctionSig* sig,
V(d_f, kWasmF64, kWasmF32) \ V(d_f, kWasmF64, kWasmF32) \
V(d_i, kWasmF64, kWasmI32) \ V(d_i, kWasmF64, kWasmI32) \
V(d_l, kWasmF64, kWasmI64) \ V(d_l, kWasmF64, kWasmI64) \
V(v_i, kWasmStmt, kWasmI32) \ V(v_i, kWasmVoid, kWasmI32) \
V(v_ii, kWasmStmt, kWasmI32, kWasmI32) \ V(v_ii, kWasmVoid, kWasmI32, kWasmI32) \
V(v_id, kWasmStmt, kWasmI32, kWasmF64) \ V(v_id, kWasmVoid, kWasmI32, kWasmF64) \
V(d_id, kWasmF64, kWasmI32, kWasmF64) \ V(d_id, kWasmF64, kWasmI32, kWasmF64) \
V(v_if, kWasmStmt, kWasmI32, kWasmF32) \ V(v_if, kWasmVoid, kWasmI32, kWasmF32) \
V(f_if, kWasmF32, kWasmI32, kWasmF32) \ V(f_if, kWasmF32, kWasmI32, kWasmF32) \
V(v_il, kWasmStmt, kWasmI32, kWasmI64) \ V(v_il, kWasmVoid, kWasmI32, kWasmI64) \
V(l_il, kWasmI64, kWasmI32, kWasmI64) \ V(l_il, kWasmI64, kWasmI32, kWasmI64) \
V(v_iii, kWasmStmt, kWasmI32, kWasmI32, kWasmI32) \ V(v_iii, kWasmVoid, kWasmI32, kWasmI32, kWasmI32) \
V(i_iii, kWasmI32, kWasmI32, kWasmI32, kWasmI32) \ V(i_iii, kWasmI32, kWasmI32, kWasmI32, kWasmI32) \
V(l_ill, kWasmI64, kWasmI32, kWasmI64, kWasmI64) \ V(l_ill, kWasmI64, kWasmI32, kWasmI64, kWasmI64) \
V(i_iil, kWasmI32, kWasmI32, kWasmI32, kWasmI64) \ V(i_iil, kWasmI32, kWasmI32, kWasmI32, kWasmI64) \
@ -759,7 +759,7 @@ bool V8_EXPORT_PRIVATE IsJSCompatibleSignature(const FunctionSig* sig,
V(s_l, kWasmS128, kWasmI64) \ V(s_l, kWasmS128, kWasmI64) \
V(s_si, kWasmS128, kWasmS128, kWasmI32) \ V(s_si, kWasmS128, kWasmS128, kWasmI32) \
V(i_s, kWasmI32, kWasmS128) \ V(i_s, kWasmI32, kWasmS128) \
V(v_is, kWasmStmt, kWasmI32, kWasmS128) \ V(v_is, kWasmVoid, kWasmI32, kWasmS128) \
V(s_sss, kWasmS128, kWasmS128, kWasmS128, kWasmS128) \ V(s_sss, kWasmS128, kWasmS128, kWasmS128, kWasmS128) \
V(s_is, kWasmS128, kWasmI32, kWasmS128) V(s_is, kWasmS128, kWasmI32, kWasmS128)

View File

@ -281,7 +281,7 @@ V8_NOINLINE V8_EXPORT_PRIVATE bool IsSubtypeOfImpl(
case kS128: case kS128:
case kI8: case kI8:
case kI16: case kI16:
case kStmt: case kVoid:
case kBottom: case kBottom:
return subtype == supertype; return subtype == supertype;
case kRtt: case kRtt:

View File

@ -88,7 +88,7 @@ ASSERT_TRIVIALLY_COPYABLE(Handle<Object>);
// A wasm value with type information. // A wasm value with type information.
class WasmValue { class WasmValue {
public: public:
WasmValue() : type_(kWasmStmt), bit_pattern_{} {} WasmValue() : type_(kWasmVoid), bit_pattern_{} {}
#define DEFINE_TYPE_SPECIFIC_METHODS(name, localtype, ctype) \ #define DEFINE_TYPE_SPECIFIC_METHODS(name, localtype, ctype) \
explicit WasmValue(ctype v) : type_(localtype), bit_pattern_{} { \ explicit WasmValue(ctype v) : type_(localtype), bit_pattern_{} { \

View File

@ -1491,7 +1491,7 @@ static void CompileCallIndirectMany(TestExecutionTier tier, ValueType param) {
TestSignatures sigs; TestSignatures sigs;
for (byte num_params = 0; num_params < 40; num_params++) { for (byte num_params = 0; num_params < 40; num_params++) {
WasmRunner<void> r(tier); WasmRunner<void> r(tier);
FunctionSig* sig = sigs.many(r.zone(), kWasmStmt, param, num_params); FunctionSig* sig = sigs.many(r.zone(), kWasmVoid, param, num_params);
r.builder().AddSignature(sig); r.builder().AddSignature(sig);
r.builder().AddSignature(sig); r.builder().AddSignature(sig);

View File

@ -3382,7 +3382,7 @@ static void CompileCallIndirectMany(TestExecutionTier tier, ValueType param) {
TestSignatures sigs; TestSignatures sigs;
for (byte num_params = 0; num_params < 40; ++num_params) { for (byte num_params = 0; num_params < 40; ++num_params) {
WasmRunner<void> r(tier); WasmRunner<void> r(tier);
FunctionSig* sig = sigs.many(r.zone(), kWasmStmt, param, num_params); FunctionSig* sig = sigs.many(r.zone(), kWasmVoid, param, num_params);
r.builder().AddSignature(sig); r.builder().AddSignature(sig);
r.builder().AddSignature(sig); r.builder().AddSignature(sig);

View File

@ -393,7 +393,7 @@ ZoneBuffer GetModuleWithInvalidSection(Zone* zone) {
TestSignatures sigs; TestSignatures sigs;
WasmModuleBuilder builder(zone); WasmModuleBuilder builder(zone);
// Add an invalid global to the module. The decoder will fail there. // Add an invalid global to the module. The decoder will fail there.
builder.AddGlobal(kWasmStmt, true, WasmInitExpr::GlobalGet(12)); builder.AddGlobal(kWasmVoid, true, WasmInitExpr::GlobalGet(12));
{ {
WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii()); WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii());
uint8_t code[] = {kExprLocalGet, 0, kExprEnd}; uint8_t code[] = {kExprLocalGet, 0, kExprEnd};

View File

@ -121,8 +121,8 @@ class TestSignatures {
FunctionSig* iii_v() { return &sig_iii_v; } FunctionSig* iii_v() { return &sig_iii_v; }
FunctionSig* many(Zone* zone, ValueType ret, ValueType param, int count) { FunctionSig* many(Zone* zone, ValueType ret, ValueType param, int count) {
FunctionSig::Builder builder(zone, ret == kWasmStmt ? 0 : 1, count); FunctionSig::Builder builder(zone, ret == kWasmVoid ? 0 : 1, count);
if (ret != kWasmStmt) builder.AddReturn(ret); if (ret != kWasmVoid) builder.AddReturn(ret);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
builder.AddParam(param); builder.AddParam(param);
} }

View File

@ -1438,7 +1438,7 @@ class WasmInterpreterInternals {
case kRef: // TODO(7748): Implement. case kRef: // TODO(7748): Implement.
case kRtt: case kRtt:
case kRttWithDepth: case kRttWithDepth:
case kStmt: case kVoid:
case kBottom: case kBottom:
case kI8: case kI8:
case kI16: case kI16:
@ -3204,7 +3204,7 @@ class WasmInterpreterInternals {
case kRttWithDepth: case kRttWithDepth:
case kI8: case kI8:
case kI16: case kI16:
case kStmt: case kVoid:
case kBottom: case kBottom:
UNREACHABLE(); UNREACHABLE();
} }
@ -3322,7 +3322,7 @@ class WasmInterpreterInternals {
case kRttWithDepth: case kRttWithDepth:
case kI8: case kI8:
case kI16: case kI16:
case kStmt: case kVoid:
case kBottom: case kBottom:
UNREACHABLE(); UNREACHABLE();
} }
@ -3721,7 +3721,7 @@ class WasmInterpreterInternals {
case kRttWithDepth: case kRttWithDepth:
case kI8: case kI8:
case kI16: case kI16:
case kStmt: case kVoid:
case kBottom: case kBottom:
UNREACHABLE(); UNREACHABLE();
} }
@ -4022,7 +4022,7 @@ class WasmInterpreterInternals {
} }
void Push(WasmValue val) { void Push(WasmValue val) {
DCHECK_NE(kWasmStmt, val.type()); DCHECK_NE(kWasmVoid, val.type());
DCHECK_NE(kWasmI8, val.type()); DCHECK_NE(kWasmI8, val.type());
DCHECK_NE(kWasmI16, val.type()); DCHECK_NE(kWasmI16, val.type());
DCHECK_LE(1, stack_limit_ - sp_); DCHECK_LE(1, stack_limit_ - sp_);
@ -4036,7 +4036,7 @@ class WasmInterpreterInternals {
void Push(WasmValue* vals, size_t arity) { void Push(WasmValue* vals, size_t arity) {
DCHECK_LE(arity, stack_limit_ - sp_); DCHECK_LE(arity, stack_limit_ - sp_);
for (WasmValue *val = vals, *end = vals + arity; val != end; ++val) { for (WasmValue *val = vals, *end = vals + arity; val != end; ++val) {
DCHECK_NE(kWasmStmt, val->type()); DCHECK_NE(kWasmVoid, val->type());
Push(*val); Push(*val);
} }
} }
@ -4113,7 +4113,7 @@ class WasmInterpreterInternals {
PrintF("i32x4:%d,%d,%d,%d", s.val[0], s.val[1], s.val[2], s.val[3]); PrintF("i32x4:%d,%d,%d,%d", s.val[0], s.val[1], s.val[2], s.val[3]);
break; break;
} }
case kStmt: case kVoid:
PrintF("void"); PrintF("void");
break; break;
case kRef: case kRef:

View File

@ -74,7 +74,7 @@ OwnedVector<WasmValue> MakeDefaultInterpreterArguments(Isolate* isolate,
case kRttWithDepth: case kRttWithDepth:
case kI8: case kI8:
case kI16: case kI16:
case kStmt: case kVoid:
case kBottom: case kBottom:
UNREACHABLE(); UNREACHABLE();
} }
@ -109,7 +109,7 @@ OwnedVector<Handle<Object>> MakeDefaultArguments(Isolate* isolate,
case kRttWithDepth: case kRttWithDepth:
case kI8: case kI8:
case kI16: case kI16:
case kStmt: case kVoid:
case kBottom: case kBottom:
UNREACHABLE(); UNREACHABLE();
} }

View File

@ -19,11 +19,11 @@ var func_a_idx =
builder.addFunction('wasm_B', kSig_v_i) builder.addFunction('wasm_B', kSig_v_i)
.addBody([ .addBody([
kExprLoop, kExprLoop,
kWasmStmt, // while kWasmVoid, // while
kExprLocalGet, kExprLocalGet,
0, // - 0, // -
kExprIf, kExprIf,
kWasmStmt, // if <param0> != 0 kWasmVoid, // if <param0> != 0
kExprLocalGet, kExprLocalGet,
0, // - 0, // -
kExprI32Const, kExprI32Const,

View File

@ -122,7 +122,7 @@ class WasmGenerator {
: gen_(gen), emit_end_(emit_end) { : gen_(gen), emit_end_(emit_end) {
gen->blocks_.emplace_back(br_types.begin(), br_types.end()); gen->blocks_.emplace_back(br_types.begin(), br_types.end());
if (param_types.size() == 0 && result_types.size() == 0) { if (param_types.size() == 0 && result_types.size() == 0) {
gen->builder_->EmitWithU8(block_type, kWasmStmt.value_type_code()); gen->builder_->EmitWithU8(block_type, kWasmVoid.value_type_code());
return; return;
} }
if (param_types.size() == 0 && result_types.size() == 1) { if (param_types.size() == 0 && result_types.size() == 1) {
@ -135,11 +135,11 @@ class WasmGenerator {
FunctionSig::Builder builder(zone, result_types.size(), FunctionSig::Builder builder(zone, result_types.size(),
param_types.size()); param_types.size());
for (auto& type : param_types) { for (auto& type : param_types) {
DCHECK_NE(type, kWasmStmt); DCHECK_NE(type, kWasmVoid);
builder.AddParam(type); builder.AddParam(type);
} }
for (auto& type : result_types) { for (auto& type : result_types) {
DCHECK_NE(type, kWasmStmt); DCHECK_NE(type, kWasmVoid);
builder.AddReturn(type); builder.AddReturn(type);
} }
FunctionSig* sig = builder.Build(); FunctionSig* sig = builder.Build();
@ -199,10 +199,10 @@ class WasmGenerator {
template <ValueKind T, IfType type> template <ValueKind T, IfType type>
void if_(DataRange* data) { void if_(DataRange* data) {
static_assert(T == kStmt || type == kIfElse, static_assert(T == kVoid || type == kIfElse,
"if without else cannot produce a value"); "if without else cannot produce a value");
if_({}, if_({},
T == kStmt ? Vector<ValueType>{} : VectorOf({ValueType::Primitive(T)}), T == kVoid ? Vector<ValueType>{} : VectorOf({ValueType::Primitive(T)}),
type, data); type, data);
} }
@ -217,7 +217,7 @@ class WasmGenerator {
uint8_t delegate_target = data->get<uint8_t>() % (try_blocks_.size() + 1); uint8_t delegate_target = data->get<uint8_t>() % (try_blocks_.size() + 1);
bool is_unwind = num_catch == 0 && !has_catch_all && !is_delegate; bool is_unwind = num_catch == 0 && !has_catch_all && !is_delegate;
Vector<const ValueType> return_type_vec = return_type.kind() == kStmt Vector<const ValueType> return_type_vec = return_type.kind() == kVoid
? Vector<ValueType>{} ? Vector<ValueType>{}
: VectorOf(&return_type, 1); : VectorOf(&return_type, 1);
BlockScope block_scope(this, kExprTry, {}, return_type_vec, return_type_vec, BlockScope block_scope(this, kExprTry, {}, return_type_vec, return_type_vec,
@ -305,7 +305,7 @@ class WasmGenerator {
builder_->EmitWithI32V( builder_->EmitWithI32V(
kExprBrIf, static_cast<uint32_t>(blocks_.size()) - 1 - target_block); kExprBrIf, static_cast<uint32_t>(blocks_.size()) - 1 - target_block);
ConsumeAndGenerate(break_types, ConsumeAndGenerate(break_types,
wanted_kind == kStmt wanted_kind == kVoid
? Vector<ValueType>{} ? Vector<ValueType>{}
: VectorOf({ValueType::Primitive(wanted_kind)}), : VectorOf({ValueType::Primitive(wanted_kind)}),
data); data);
@ -536,9 +536,9 @@ class WasmGenerator {
void ConvertOrGenerate(ValueType src, ValueType dst, DataRange* data) { void ConvertOrGenerate(ValueType src, ValueType dst, DataRange* data) {
if (src == dst) return; if (src == dst) return;
if (src == kWasmStmt && dst != kWasmStmt) { if (src == kWasmVoid && dst != kWasmVoid) {
Generate(dst, data); Generate(dst, data);
} else if (dst == kWasmStmt && src != kWasmStmt) { } else if (dst == kWasmVoid && src != kWasmVoid) {
builder_->Emit(kExprDrop); builder_->Emit(kExprDrop);
} else { } else {
Convert(src, dst); Convert(src, dst);
@ -579,12 +579,12 @@ class WasmGenerator {
builder_->EmitByte(0); // Table index. builder_->EmitByte(0); // Table index.
} }
} }
if (sig->return_count() == 0 && wanted_kind != kWasmStmt) { if (sig->return_count() == 0 && wanted_kind != kWasmVoid) {
// The call did not generate a value. Thus just generate it here. // The call did not generate a value. Thus just generate it here.
Generate(wanted_kind, data); Generate(wanted_kind, data);
return; return;
} }
if (wanted_kind == kWasmStmt) { if (wanted_kind == kWasmVoid) {
// The call did generate values, but we did not want one. // The call did generate values, but we did not want one.
for (size_t i = 0; i < sig->return_count(); ++i) { for (size_t i = 0; i < sig->return_count(); ++i) {
builder_->Emit(kExprDrop); builder_->Emit(kExprDrop);
@ -593,16 +593,16 @@ class WasmGenerator {
} }
auto return_types = VectorOf(sig->returns().begin(), sig->return_count()); auto return_types = VectorOf(sig->returns().begin(), sig->return_count());
auto wanted_types = auto wanted_types =
VectorOf(&wanted_kind, wanted_kind == kWasmStmt ? 0 : 1); VectorOf(&wanted_kind, wanted_kind == kWasmVoid ? 0 : 1);
ConsumeAndGenerate(return_types, wanted_types, data); ConsumeAndGenerate(return_types, wanted_types, data);
} }
struct Var { struct Var {
uint32_t index; uint32_t index;
ValueType type = kWasmStmt; ValueType type = kWasmVoid;
Var() = default; Var() = default;
Var(uint32_t index, ValueType type) : index(index), type(type) {} Var(uint32_t index, ValueType type) : index(index), type(type) {}
bool is_valid() const { return type != kWasmStmt; } bool is_valid() const { return type != kWasmVoid; }
}; };
Var GetRandomLocal(DataRange* data) { Var GetRandomLocal(DataRange* data) {
@ -622,24 +622,24 @@ class WasmGenerator {
// If there are no locals and no parameters, just generate any value (if a // If there are no locals and no parameters, just generate any value (if a
// value is needed), or do nothing. // value is needed), or do nothing.
if (!local.is_valid()) { if (!local.is_valid()) {
if (wanted_kind == kStmt) return; if (wanted_kind == kVoid) return;
return Generate<wanted_kind>(data); return Generate<wanted_kind>(data);
} }
if (opcode != kExprLocalGet) Generate(local.type, data); if (opcode != kExprLocalGet) Generate(local.type, data);
builder_->EmitWithU32V(opcode, local.index); builder_->EmitWithU32V(opcode, local.index);
if (wanted_kind != kStmt && local.type.kind() != wanted_kind) { if (wanted_kind != kVoid && local.type.kind() != wanted_kind) {
Convert(local.type, ValueType::Primitive(wanted_kind)); Convert(local.type, ValueType::Primitive(wanted_kind));
} }
} }
template <ValueKind wanted_kind> template <ValueKind wanted_kind>
void get_local(DataRange* data) { void get_local(DataRange* data) {
static_assert(wanted_kind != kStmt, "illegal type"); static_assert(wanted_kind != kVoid, "illegal type");
local_op<wanted_kind>(data, kExprLocalGet); local_op<wanted_kind>(data, kExprLocalGet);
} }
void set_local(DataRange* data) { local_op<kStmt>(data, kExprLocalSet); } void set_local(DataRange* data) { local_op<kVoid>(data, kExprLocalSet); }
template <ValueKind wanted_kind> template <ValueKind wanted_kind>
void tee_local(DataRange* data) { void tee_local(DataRange* data) {
@ -671,12 +671,12 @@ class WasmGenerator {
template <ValueKind wanted_kind> template <ValueKind wanted_kind>
void global_op(DataRange* data) { void global_op(DataRange* data) {
constexpr bool is_set = wanted_kind == kStmt; constexpr bool is_set = wanted_kind == kVoid;
Var global = GetRandomGlobal(data, is_set); Var global = GetRandomGlobal(data, is_set);
// If there are no globals, just generate any value (if a value is needed), // If there are no globals, just generate any value (if a value is needed),
// or do nothing. // or do nothing.
if (!global.is_valid()) { if (!global.is_valid()) {
if (wanted_kind == kStmt) return; if (wanted_kind == kVoid) return;
return Generate<wanted_kind>(data); return Generate<wanted_kind>(data);
} }
@ -690,13 +690,13 @@ class WasmGenerator {
template <ValueKind wanted_kind> template <ValueKind wanted_kind>
void get_global(DataRange* data) { void get_global(DataRange* data) {
static_assert(wanted_kind != kStmt, "illegal type"); static_assert(wanted_kind != kVoid, "illegal type");
global_op<wanted_kind>(data); global_op<wanted_kind>(data);
} }
template <ValueKind select_kind> template <ValueKind select_kind>
void select_with_type(DataRange* data) { void select_with_type(DataRange* data) {
static_assert(select_kind != kStmt, "illegal kind for select"); static_assert(select_kind != kVoid, "illegal kind for select");
Generate<select_kind, select_kind, kI32>(data); Generate<select_kind, select_kind, kI32>(data);
// num_types is always 1. // num_types is always 1.
uint8_t num_types = 1; uint8_t num_types = 1;
@ -704,7 +704,7 @@ class WasmGenerator {
ValueType::Primitive(select_kind).value_type_code()); ValueType::Primitive(select_kind).value_type_code());
} }
void set_global(DataRange* data) { global_op<kStmt>(data); } void set_global(DataRange* data) { global_op<kVoid>(data); }
void throw_or_rethrow(DataRange* data) { void throw_or_rethrow(DataRange* data) {
bool rethrow = data->get<uint8_t>() % 2; bool rethrow = data->get<uint8_t>() % 2;
@ -822,31 +822,31 @@ class WasmGenerator {
}; };
template <> template <>
void WasmGenerator::block<kStmt>(DataRange* data) { void WasmGenerator::block<kVoid>(DataRange* data) {
block({}, {}, data); block({}, {}, data);
} }
template <> template <>
void WasmGenerator::loop<kStmt>(DataRange* data) { void WasmGenerator::loop<kVoid>(DataRange* data) {
loop({}, {}, data); loop({}, {}, data);
} }
template <> template <>
void WasmGenerator::Generate<kStmt>(DataRange* data) { void WasmGenerator::Generate<kVoid>(DataRange* data) {
GeneratorRecursionScope rec_scope(this); GeneratorRecursionScope rec_scope(this);
if (recursion_limit_reached() || data->size() == 0) return; if (recursion_limit_reached() || data->size() == 0) return;
constexpr GenerateFn alternatives[] = { constexpr GenerateFn alternatives[] = {
&WasmGenerator::sequence<kStmt, kStmt>, &WasmGenerator::sequence<kVoid, kVoid>,
&WasmGenerator::sequence<kStmt, kStmt, kStmt, kStmt>, &WasmGenerator::sequence<kVoid, kVoid, kVoid, kVoid>,
&WasmGenerator::sequence<kStmt, kStmt, kStmt, kStmt, kStmt, kStmt, kStmt, &WasmGenerator::sequence<kVoid, kVoid, kVoid, kVoid, kVoid, kVoid, kVoid,
kStmt>, kVoid>,
&WasmGenerator::block<kStmt>, &WasmGenerator::block<kVoid>,
&WasmGenerator::loop<kStmt>, &WasmGenerator::loop<kVoid>,
&WasmGenerator::if_<kStmt, kIf>, &WasmGenerator::if_<kVoid, kIf>,
&WasmGenerator::if_<kStmt, kIfElse>, &WasmGenerator::if_<kVoid, kIfElse>,
&WasmGenerator::br, &WasmGenerator::br,
&WasmGenerator::br_if<kStmt>, &WasmGenerator::br_if<kVoid>,
&WasmGenerator::memop<kExprI32StoreMem, kI32>, &WasmGenerator::memop<kExprI32StoreMem, kI32>,
&WasmGenerator::memop<kExprI32StoreMem8, kI32>, &WasmGenerator::memop<kExprI32StoreMem8, kI32>,
@ -872,13 +872,13 @@ void WasmGenerator::Generate<kStmt>(DataRange* data) {
&WasmGenerator::drop, &WasmGenerator::drop,
&WasmGenerator::call<kStmt>, &WasmGenerator::call<kVoid>,
&WasmGenerator::call_indirect<kStmt>, &WasmGenerator::call_indirect<kVoid>,
&WasmGenerator::set_local, &WasmGenerator::set_local,
&WasmGenerator::set_global, &WasmGenerator::set_global,
&WasmGenerator::throw_or_rethrow, &WasmGenerator::throw_or_rethrow,
&WasmGenerator::try_block<kStmt>}; &WasmGenerator::try_block<kVoid>};
GenerateOneOf(alternatives, data); GenerateOneOf(alternatives, data);
} }
@ -897,9 +897,9 @@ void WasmGenerator::Generate<kI32>(DataRange* data) {
&WasmGenerator::i32_const<3>, &WasmGenerator::i32_const<3>,
&WasmGenerator::i32_const<4>, &WasmGenerator::i32_const<4>,
&WasmGenerator::sequence<kI32, kStmt>, &WasmGenerator::sequence<kI32, kVoid>,
&WasmGenerator::sequence<kStmt, kI32>, &WasmGenerator::sequence<kVoid, kI32>,
&WasmGenerator::sequence<kStmt, kI32, kStmt>, &WasmGenerator::sequence<kVoid, kI32, kVoid>,
&WasmGenerator::op<kExprI32Eqz, kI32>, &WasmGenerator::op<kExprI32Eqz, kI32>,
&WasmGenerator::op<kExprI32Eq, kI32, kI32>, &WasmGenerator::op<kExprI32Eq, kI32, kI32>,
@ -1049,9 +1049,9 @@ void WasmGenerator::Generate<kI64>(DataRange* data) {
&WasmGenerator::i64_const<7>, &WasmGenerator::i64_const<7>,
&WasmGenerator::i64_const<8>, &WasmGenerator::i64_const<8>,
&WasmGenerator::sequence<kI64, kStmt>, &WasmGenerator::sequence<kI64, kVoid>,
&WasmGenerator::sequence<kStmt, kI64>, &WasmGenerator::sequence<kVoid, kI64>,
&WasmGenerator::sequence<kStmt, kI64, kStmt>, &WasmGenerator::sequence<kVoid, kI64, kVoid>,
&WasmGenerator::op<kExprI64Add, kI64, kI64>, &WasmGenerator::op<kExprI64Add, kI64, kI64>,
&WasmGenerator::op<kExprI64Sub, kI64, kI64>, &WasmGenerator::op<kExprI64Sub, kI64, kI64>,
@ -1154,9 +1154,9 @@ void WasmGenerator::Generate<kF32>(DataRange* data) {
} }
constexpr GenerateFn alternatives[] = { constexpr GenerateFn alternatives[] = {
&WasmGenerator::sequence<kF32, kStmt>, &WasmGenerator::sequence<kF32, kVoid>,
&WasmGenerator::sequence<kStmt, kF32>, &WasmGenerator::sequence<kVoid, kF32>,
&WasmGenerator::sequence<kStmt, kF32, kStmt>, &WasmGenerator::sequence<kVoid, kF32, kVoid>,
&WasmGenerator::op<kExprF32Abs, kF32>, &WasmGenerator::op<kExprF32Abs, kF32>,
&WasmGenerator::op<kExprF32Neg, kF32>, &WasmGenerator::op<kExprF32Neg, kF32>,
@ -1211,9 +1211,9 @@ void WasmGenerator::Generate<kF64>(DataRange* data) {
} }
constexpr GenerateFn alternatives[] = { constexpr GenerateFn alternatives[] = {
&WasmGenerator::sequence<kF64, kStmt>, &WasmGenerator::sequence<kF64, kVoid>,
&WasmGenerator::sequence<kStmt, kF64>, &WasmGenerator::sequence<kVoid, kF64>,
&WasmGenerator::sequence<kStmt, kF64, kStmt>, &WasmGenerator::sequence<kVoid, kF64, kVoid>,
&WasmGenerator::op<kExprF64Abs, kF64>, &WasmGenerator::op<kExprF64Abs, kF64>,
&WasmGenerator::op<kExprF64Neg, kF64>, &WasmGenerator::op<kExprF64Neg, kF64>,
@ -1512,8 +1512,8 @@ void WasmGenerator::grow_memory(DataRange* data) {
void WasmGenerator::Generate(ValueType type, DataRange* data) { void WasmGenerator::Generate(ValueType type, DataRange* data) {
switch (type.kind()) { switch (type.kind()) {
case kStmt: case kVoid:
return Generate<kStmt>(data); return Generate<kVoid>(data);
case kI32: case kI32:
return Generate<kI32>(data); return Generate<kI32>(data);
case kI64: case kI64:
@ -1554,7 +1554,7 @@ void WasmGenerator::Generate(Vector<const ValueType> types, DataRange* data) {
} }
if (types.size() == 0) { if (types.size() == 0) {
Generate(kWasmStmt, data); Generate(kWasmVoid, data);
return; return;
} }
if (types.size() == 1) { if (types.size() == 1) {

View File

@ -22,8 +22,8 @@ var func_idx = builder.addFunction('helper', kSig_v_v)
builder.addFunction('main', kSig_v_i) builder.addFunction('main', kSig_v_i)
.addBody([ .addBody([
kExprLocalGet, 0, kExprLocalGet, 0,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprCallFunction, func_idx, kExprCallFunction, func_idx,
kExprEnd, kExprEnd,
kExprEnd kExprEnd

View File

@ -22,7 +22,7 @@ function createModule(...customSections) {
var builder = new WasmModuleBuilder(); var builder = new WasmModuleBuilder();
builder.addFunction('nopFunction', kSig_v_v).addBody([kExprNop]); builder.addFunction('nopFunction', kSig_v_v).addBody([kExprNop]);
builder.addFunction('main', kSig_v_v) builder.addFunction('main', kSig_v_v)
.addBody([kExprBlock, kWasmStmt, kExprI32Const, 2, kExprDrop, kExprEnd]) .addBody([kExprBlock, kWasmVoid, kExprI32Const, 2, kExprDrop, kExprEnd])
.exportAs('main'); .exportAs('main');
for (var { name, value } of customSections) { for (var { name, value } of customSections) {
builder.addCustomSection(name, value); builder.addCustomSection(name, value);

View File

@ -21,8 +21,8 @@ var func_idx = builder.addFunction('helper', kSig_v_v)
builder.addFunction('main', kSig_v_i) builder.addFunction('main', kSig_v_i)
.addBody([ .addBody([
kExprLocalGet, 0, kExprLocalGet, 0,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprCallFunction, func_idx, kExprCallFunction, func_idx,
kExprEnd, kExprEnd,
kExprEnd kExprEnd

View File

@ -17,9 +17,9 @@ const func_a =
const func_b = builder.addFunction('wasm_B', kSig_v_i) const func_b = builder.addFunction('wasm_B', kSig_v_i)
.addBody([ .addBody([
// clang-format off // clang-format off
kExprLoop, kWasmStmt, // while kExprLoop, kWasmVoid, // while
kExprLocalGet, 0, // - kExprLocalGet, 0, // -
kExprIf, kWasmStmt, // if <param0> != 0 kExprIf, kWasmVoid, // if <param0> != 0
kExprLocalGet, 0, // - kExprLocalGet, 0, // -
kExprI32Const, 1, // - kExprI32Const, 1, // -
kExprI32Sub, // - kExprI32Sub, // -

View File

@ -20,7 +20,7 @@ var sig_index = builder.addType(kSig_v_v);
builder.addFunction('main', kSig_v_v) builder.addFunction('main', kSig_v_v)
.addBody([ .addBody([
kExprBlock, kWasmStmt, kExprI32Const, 0, kExprCallIndirect, sig_index, kExprBlock, kWasmVoid, kExprI32Const, 0, kExprCallIndirect, sig_index,
kTableZero, kExprEnd kTableZero, kExprEnd
]) ])
.exportAs('main'); .exportAs('main');

View File

@ -19,7 +19,7 @@ var call_imported_idx = builder.addFunction('call_func', kSig_v_v)
// Open a block in order to make the positions more interesting... // Open a block in order to make the positions more interesting...
builder.addFunction('main', kSig_v_v) builder.addFunction('main', kSig_v_v)
.addBody( .addBody(
[kExprBlock, kWasmStmt, kExprCallFunction, call_imported_idx, kExprEnd]) [kExprBlock, kWasmVoid, kExprCallFunction, call_imported_idx, kExprEnd])
.exportAs('main'); .exportAs('main');
var module_bytes = builder.toArray(); var module_bytes = builder.toArray();

View File

@ -12,7 +12,7 @@ session.setupScriptMap();
var builder = new WasmModuleBuilder(); var builder = new WasmModuleBuilder();
var callee = builder.addFunction('callee', kSig_v_v) var callee = builder.addFunction('callee', kSig_v_v)
.addBody([kExprBlock, kWasmStmt, kExprEnd]) .addBody([kExprBlock, kWasmVoid, kExprEnd])
.index; .index;
var main = builder.addFunction('main', kSig_v_i) var main = builder.addFunction('main', kSig_v_i)

View File

@ -18,9 +18,9 @@ const func_a_idx = func_a.index;
const func_b = builder.addFunction('wasm_B', kSig_v_i) const func_b = builder.addFunction('wasm_B', kSig_v_i)
.addBody([ .addBody([
// clang-format off // clang-format off
kExprLoop, kWasmStmt, // while kExprLoop, kWasmVoid, // while
kExprLocalGet, 0, // - kExprLocalGet, 0, // -
kExprIf, kWasmStmt, // if <param0> != 0 kExprIf, kWasmVoid, // if <param0> != 0
kExprLocalGet, 0, // - kExprLocalGet, 0, // -
kExprI32Const, 1, // - kExprI32Const, 1, // -
kExprI32Sub, // - kExprI32Sub, // -

View File

@ -17,9 +17,9 @@ var func_a_idx =
builder.addFunction('wasm_B', kSig_v_i) builder.addFunction('wasm_B', kSig_v_i)
.addBody([ .addBody([
// clang-format off // clang-format off
kExprLoop, kWasmStmt, // while kExprLoop, kWasmVoid, // while
kExprLocalGet, 0, // - kExprLocalGet, 0, // -
kExprIf, kWasmStmt, // if <param0> != 0 kExprIf, kWasmVoid, // if <param0> != 0
kExprLocalGet, 0, // - kExprLocalGet, 0, // -
kExprI32Const, 1, // - kExprI32Const, 1, // -
kExprI32Sub, // - kExprI32Sub, // -

View File

@ -17,9 +17,9 @@ var func_a_idx =
var func_b = builder.addFunction('wasm_B', kSig_v_i) var func_b = builder.addFunction('wasm_B', kSig_v_i)
.addBody([ .addBody([
// clang-format off // clang-format off
kExprLoop, kWasmStmt, // while kExprLoop, kWasmVoid, // while
kExprLocalGet, 0, // - kExprLocalGet, 0, // -
kExprIf, kWasmStmt, // if <param0> != 0 kExprIf, kWasmVoid, // if <param0> != 0
kExprLocalGet, 0, // - kExprLocalGet, 0, // -
kExprI32Const, 1, // - kExprI32Const, 1, // -
kExprI32Sub, // - kExprI32Sub, // -

View File

@ -10,7 +10,7 @@ let builder = new WasmModuleBuilder();
let except = builder.addException(kSig_v_i); let except = builder.addException(kSig_v_i);
builder.addFunction("rethrow0", kSig_v_v) builder.addFunction("rethrow0", kSig_v_v)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprI32Const, 23, kExprI32Const, 23,
kExprThrow, except, kExprThrow, except,
kExprCatch, except, kExprCatch, except,

View File

@ -14,15 +14,15 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
builder.addFunction("main", kSig_v_l) builder.addFunction("main", kSig_v_l)
.addLocals(kWasmI32, 2) .addLocals(kWasmI32, 2)
.addBody([ .addBody([
kExprLoop, kWasmStmt, kExprLoop, kWasmVoid,
kExprLocalGet, 0x02, kExprLocalGet, 0x02,
kExprLocalTee, 0x01, kExprLocalTee, 0x01,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprElse, kExprElse,
kExprLoop, kWasmStmt, kExprLoop, kWasmVoid,
kExprLoop, kWasmStmt, kExprLoop, kWasmVoid,
kExprLocalGet, 0x01, kExprLocalGet, 0x01,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprElse, kExprElse,
kExprLocalGet, 0x02, kExprLocalGet, 0x02,
kExprBrIf, 0x04, kExprBrIf, 0x04,

View File

@ -23,7 +23,7 @@ kExprEnd, // @3
// signature: d_v // signature: d_v
// body: // body:
kExprBlock, kWasmF64, // @3 f64 kExprBlock, kWasmF64, // @3 f64
kExprBlock, kWasmStmt, // @5 kExprBlock, kWasmVoid, // @5
kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f,
kExprLocalTee, 0x00, kExprLocalTee, 0x00,
kExprLocalTee, 0x01, kExprLocalTee, 0x01,

View File

@ -10,7 +10,7 @@ const NUM_CASES = 3073;
let body = []; let body = [];
// Add one block, so we can jump to this block or to the function end. // Add one block, so we can jump to this block or to the function end.
body.push(kExprBlock); body.push(kExprBlock);
body.push(kWasmStmt); body.push(kWasmVoid);
// Add the big BrTable. // Add the big BrTable.
body.push(kExprLocalGet, 0); body.push(kExprLocalGet, 0);

View File

@ -19,15 +19,15 @@ builder.addFunction(undefined, sig)
kExprLocalGet, 0x1b, // local.get kExprLocalGet, 0x1b, // local.get
kExprLocalSet, 0x1c, // local.set kExprLocalSet, 0x1c, // local.set
kExprI32Const, 0x00, // i32.const kExprI32Const, 0x00, // i32.const
kExprIf, kWasmStmt, // if @11 kExprIf, kWasmVoid, // if @11
kExprGlobalGet, 0x00, // global.get kExprGlobalGet, 0x00, // global.get
kExprLocalSet, 0x1e, // local.set kExprLocalSet, 0x1e, // local.set
kExprBlock, kWasmStmt, // block @19 kExprBlock, kWasmVoid, // block @19
kExprGlobalGet, 0x00, // global.get kExprGlobalGet, 0x00, // global.get
kExprLocalSet, 0x21, // local.set kExprLocalSet, 0x21, // local.set
kExprBlock, kWasmStmt, // block @25 kExprBlock, kWasmVoid, // block @25
kExprBlock, kWasmStmt, // block @27 kExprBlock, kWasmVoid, // block @27
kExprBlock, kWasmStmt, // block @29 kExprBlock, kWasmVoid, // block @29
kExprGlobalGet, 0x00, // global.get kExprGlobalGet, 0x00, // global.get
kExprLocalSet, 0x0a, // local.set kExprLocalSet, 0x0a, // local.set
kExprI32Const, 0x00, // i32.const kExprI32Const, 0x00, // i32.const
@ -42,19 +42,19 @@ kExprIf, kWasmStmt, // if @11
kExprI32Const, 0x01, // i32.const kExprI32Const, 0x01, // i32.const
kExprLocalSet, 0x36, // local.set kExprLocalSet, 0x36, // local.set
kExprI32Const, 0x00, // i32.const kExprI32Const, 0x00, // i32.const
kExprIf, kWasmStmt, // if @56 kExprIf, kWasmVoid, // if @56
kExprEnd, // end @59 kExprEnd, // end @59
kExprLocalGet, 0x00, // local.get kExprLocalGet, 0x00, // local.get
kExprLocalSet, 0x10, // local.set kExprLocalSet, 0x10, // local.set
kExprI32Const, 0x00, // i32.const kExprI32Const, 0x00, // i32.const
kExprI32Eqz, // i32.eqz kExprI32Eqz, // i32.eqz
kExprLocalSet, 0x38, // local.set kExprLocalSet, 0x38, // local.set
kExprBlock, kWasmStmt, // block @69 kExprBlock, kWasmVoid, // block @69
kExprI32Const, 0x7f, // i32.const kExprI32Const, 0x7f, // i32.const
kExprI32Eqz, // i32.eqz kExprI32Eqz, // i32.eqz
kExprLocalSet, 0x39, // local.set kExprLocalSet, 0x39, // local.set
kExprI32Const, 0x01, // i32.const kExprI32Const, 0x01, // i32.const
kExprIf, kWasmStmt, // if @78 kExprIf, kWasmVoid, // if @78
kExprGlobalGet, 0x00, // global.get kExprGlobalGet, 0x00, // global.get
kExprLocalSet, 0x11, // local.set kExprLocalSet, 0x11, // local.set
kExprI32Const, 0x00, // i32.const kExprI32Const, 0x00, // i32.const

View File

@ -25,7 +25,7 @@ builder.addFunction(undefined, sig)
kExprElse, // else @45 kExprElse, // else @45
kExprI32Const, 0x00, // i32.const kExprI32Const, 0x00, // i32.const
kExprEnd, // end @48 kExprEnd, // end @48
kExprIf, kWasmStmt, // if @49 kExprIf, kWasmVoid, // if @49
kExprI32Const, 0x00, // i32.const kExprI32Const, 0x00, // i32.const
kExprI32Const, 0x00, // i32.const kExprI32Const, 0x00, // i32.const
kAtomicPrefix, kExprI32AtomicSub, 0x01, 0x04, // i32.atomic.sub kAtomicPrefix, kExprI32AtomicSub, 0x01, 0x04, // i32.atomic.sub

View File

@ -29,7 +29,7 @@ kExprLocalTee, 0x00, // local.tee
kExprI32Const, 0xff, 0x00, // i32.const kExprI32Const, 0xff, 0x00, // i32.const
kAtomicPrefix, kExprAtomicNotify, 0x02, 0x03, // atomic.notify kAtomicPrefix, kExprAtomicNotify, 0x02, 0x03, // atomic.notify
kExprI32LoadMem16S, 0x00, 0x02, // i32.load16_s kExprI32LoadMem16S, 0x00, 0x02, // i32.load16_s
kExprIf, kWasmStmt, // if @28 kExprIf, kWasmVoid, // if @28
kExprLocalGet, 0x00, // local.get kExprLocalGet, 0x00, // local.get
kExprReturn, // return kExprReturn, // return
kExprElse, // else @33 kExprElse, // else @33

View File

@ -10,9 +10,9 @@ builder.addType(makeSig(
[])); []));
builder.addFunction(undefined, 0 /* sig */).addBody([ builder.addFunction(undefined, 0 /* sig */).addBody([
kExprI32Const, 0, // i32.const kExprI32Const, 0, // i32.const
kExprIf, kWasmStmt, // if @3 kExprIf, kWasmVoid, // if @3
kExprI32Const, 1, // i32.const kExprI32Const, 1, // i32.const
kExprIf, kWasmStmt, // if @7 kExprIf, kWasmVoid, // if @7
kExprNop, // nop kExprNop, // nop
kExprElse, // else @10 kExprElse, // else @10
kExprUnreachable, // unreachable kExprUnreachable, // unreachable

View File

@ -19,11 +19,11 @@ kExprI32Const, 0x10, // i32.const
kExprI32Sub, // i32.sub kExprI32Sub, // i32.sub
kExprLocalTee, 0x02, // local.tee kExprLocalTee, 0x02, // local.tee
kExprGlobalSet, 0x00, // global.set kExprGlobalSet, 0x00, // global.set
kExprBlock, kWasmStmt, // block @12 kExprBlock, kWasmVoid, // block @12
kExprLocalGet, 0x00, // local.get kExprLocalGet, 0x00, // local.get
kExprI32LoadMem, 0x02, 0x00, // i32.load kExprI32LoadMem, 0x02, 0x00, // i32.load
kExprI32Eqz, // i32.eqz kExprI32Eqz, // i32.eqz
kExprIf, kWasmStmt, // if @20 kExprIf, kWasmVoid, // if @20
kExprLocalGet, 0x02, // local.get kExprLocalGet, 0x02, // local.get
kExprI32Const, 0x00, // i32.const kExprI32Const, 0x00, // i32.const
kExprI32StoreMem, 0x02, 0x0c, // i32.store kExprI32StoreMem, 0x02, 0x0c, // i32.store

View File

@ -35,9 +35,9 @@ kExprI32Const, 0x00, // i32.const
kExprI32Const, 0x01, // i32.const kExprI32Const, 0x01, // i32.const
kExprI32Sub, // i32.sub kExprI32Sub, // i32.sub
kExprLocalSet, 0x07, // local.set kExprLocalSet, 0x07, // local.set
kExprBlock, kWasmStmt, // block @45 kExprBlock, kWasmVoid, // block @45
kExprI32Const, 0x00, // i32.const kExprI32Const, 0x00, // i32.const
kExprIf, kWasmStmt, // if @49 kExprIf, kWasmVoid, // if @49
kExprLocalGet, 0x0a, // local.get kExprLocalGet, 0x0a, // local.get
kExprLocalSet, 0x08, // local.set kExprLocalSet, 0x08, // local.set
kExprElse, // else @55 kExprElse, // else @55

View File

@ -21,7 +21,7 @@ kExprI32Const, 0x00, // i32.const
kExprLocalSet, 0x04, // local.set kExprLocalSet, 0x04, // local.set
kExprI32Const, 0x01, // i32.const kExprI32Const, 0x01, // i32.const
kExprLocalSet, 0x05, // local.set kExprLocalSet, 0x05, // local.set
kExprBlock, kWasmStmt, // block @11 kExprBlock, kWasmVoid, // block @11
kExprBr, 0x00, // br depth=0 kExprBr, 0x00, // br depth=0
kExprEnd, // end @15 kExprEnd, // end @15
kExprGlobalGet, 0x01, // global.get kExprGlobalGet, 0x01, // global.get
@ -35,7 +35,7 @@ kExprLocalSet, 0x01, // local.set
kExprI32Const, 0x00, // i32.const kExprI32Const, 0x00, // i32.const
kExprI32Eqz, // i32.eqz kExprI32Eqz, // i32.eqz
kExprLocalSet, 0x07, // local.set kExprLocalSet, 0x07, // local.set
kExprBlock, kWasmStmt, // block @36 kExprBlock, kWasmVoid, // block @36
kExprBr, 0x00, // br depth=0 kExprBr, 0x00, // br depth=0
kExprEnd, // end @40 kExprEnd, // end @40
kExprGlobalGet, 0x01, // global.get kExprGlobalGet, 0x01, // global.get

View File

@ -34,7 +34,7 @@ kExprLocalGet, 0x01, // local.get
kExprLocalGet, 0x01, // local.get kExprLocalGet, 0x01, // local.get
kExprGlobalGet, 0x00, // global.get kExprGlobalGet, 0x00, // global.get
kExprDrop, // drop kExprDrop, // drop
kExprLoop, kWasmStmt, // loop @8 kExprLoop, kWasmVoid, // loop @8
kExprLoop, 0x00, // loop @10 kExprLoop, 0x00, // loop @10
kExprI32Const, 0x01, // i32.const kExprI32Const, 0x01, // i32.const
kExprMemoryGrow, 0x00, // memory.grow kExprMemoryGrow, 0x00, // memory.grow

View File

@ -13,7 +13,7 @@ builder.addFunction(undefined, kSig_i_v)
.addBody([ .addBody([
kExprI64Const, 0x0, // i64.const kExprI64Const, 0x0, // i64.const
kExprI32Const, 0x0, // i32.const kExprI32Const, 0x0, // i32.const
kExprIf, kWasmStmt, // if kExprIf, kWasmVoid, // if
kExprI32Const, 0x0, // i32.const kExprI32Const, 0x0, // i32.const
kExprI32LoadMem, 0x01, 0x23, // i32.load kExprI32LoadMem, 0x01, 0x23, // i32.load
kExprBrTable, 0x01, 0x00, 0x00, // br_table kExprBrTable, 0x01, 0x00, 0x00, // br_table

View File

@ -13,7 +13,7 @@ let exception = builder.addException(kSig_v_v);
builder.addFunction("foo", kSig_v_v) builder.addFunction("foo", kSig_v_v)
.addBody([ .addBody([
kExprTry, kExprTry,
kWasmStmt, kWasmVoid,
kExprCallFunction, imports, kExprCallFunction, imports,
kExprCatch, exception, kExprCatch, exception,
kExprEnd] kExprEnd]

View File

@ -12,7 +12,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
builder.addFunction("f", kSig_v_v) builder.addFunction("f", kSig_v_v)
.addBody([ .addBody([
kExprUnreachable, kExprUnreachable,
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprElse, kExprElse,
kExprCatchAll, kExprCatchAll,
kExprEnd, kExprEnd,

View File

@ -9,7 +9,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
builder.addFunction("main", kSig_i_v) builder.addFunction("main", kSig_i_v)
.addBody([ .addBody([
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprI64Const, 0, kExprI64Const, 0,
// 0x80 ... 0x10 is the LEB encoding of 0x100000000. This is chosen so // 0x80 ... 0x10 is the LEB encoding of 0x100000000. This is chosen so
// that the 64-bit constant has a non-zero top half. In this bug, the // that the 64-bit constant has a non-zero top half. In this bug, the
@ -34,7 +34,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
builder.addFunction("main", kSig_i_v) builder.addFunction("main", kSig_i_v)
.addBody([ .addBody([
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprI64Const, 0, kExprI64Const, 0,
// 0x80 ... 0x10 is the LEB encoding of 0x100000000. This is chosen so // 0x80 ... 0x10 is the LEB encoding of 0x100000000. This is chosen so
// that the 64-bit constant has a non-zero top half. In this bug, the // that the 64-bit constant has a non-zero top half. In this bug, the

View File

@ -16,7 +16,7 @@ builder.addFunction('main', kSig_i_i).addBody([
...wasmI32Const(0x41), ...wasmI32Const(0x41),
kExprLocalSet, 0, kExprLocalSet, 0,
// Enter loop, such that values are spilled to the stack. // Enter loop, such that values are spilled to the stack.
kExprLoop, kWasmStmt, kExprLoop, kWasmVoid,
kExprEnd, kExprEnd,
// Reload value. This must be loaded as 32 bit value. // Reload value. This must be loaded as 32 bit value.
kExprLocalGet, 0, kExprLocalGet, 0,

View File

@ -18,7 +18,7 @@ builder.addFunction(undefined, kSig_i_iii)
kExprLocalSet, 1, // set_local 1 kExprLocalSet, 1, // set_local 1
...wasmI32Const(16), // i32.const 0x1 ...wasmI32Const(16), // i32.const 0x1
kExprLocalSet, 2, // set_local 2 kExprLocalSet, 2, // set_local 2
kExprLoop, kWasmStmt, // loop kExprLoop, kWasmVoid, // loop
kExprEnd, // end kExprEnd, // end
kExprLocalGet, 0, // get_local 0 kExprLocalGet, 0, // get_local 0
kExprLocalGet, 1, // get_local 1 kExprLocalGet, 1, // get_local 1

View File

@ -21,7 +21,7 @@ builder.addFunction('test', kSig_i_iii)
kExprI32Const, 0, // 0, 0 kExprI32Const, 0, // 0, 0
kExprI32Const, 1, // 0, 0, 1 kExprI32Const, 1, // 0, 0, 1
kExprI32Add, // 0, 0 + 1 -> 1 kExprI32Add, // 0, 0 + 1 -> 1
kExprBlock, kWasmStmt, // 0, 1 kExprBlock, kWasmVoid, // 0, 1
kExprBr, 0, // 0, 1 kExprBr, 0, // 0, 1
kExprEnd, // 0, 1 kExprEnd, // 0, 1
kExprI32Add, // 0 + 1 -> 1 kExprI32Add, // 0 + 1 -> 1

View File

@ -8,10 +8,10 @@ const builder = new WasmModuleBuilder();
builder.addFunction('test', kSig_i_i) builder.addFunction('test', kSig_i_i)
.addBody([ .addBody([
kExprLocalGet, 0x00, // get_local 0 kExprLocalGet, 0x00, // get_local 0
kExprBlock, kWasmStmt, // block kExprBlock, kWasmVoid, // block
kExprBr, 0x00, // br depth=0 kExprBr, 0x00, // br depth=0
kExprEnd, // end kExprEnd, // end
kExprBlock, kWasmStmt, // block kExprBlock, kWasmVoid, // block
kExprBr, 0x00, // br depth=0 kExprBr, 0x00, // br depth=0
kExprEnd, // end kExprEnd, // end
kExprBr, 0x00, // br depth=0 kExprBr, 0x00, // br depth=0

View File

@ -10,7 +10,7 @@ builder.addFunction('test', kSig_i_i)
// body: // body:
kExprLocalGet, 0, // get_local 0 kExprLocalGet, 0, // get_local 0
kExprLocalGet, 0, // get_local 0 kExprLocalGet, 0, // get_local 0
kExprLoop, kWasmStmt, // loop kExprLoop, kWasmVoid, // loop
kExprBr, 0, // br depth=0 kExprBr, 0, // br depth=0
kExprEnd, // end kExprEnd, // end
kExprUnreachable, // unreachable kExprUnreachable, // unreachable

View File

@ -23,7 +23,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
kExprF32Eq, kExprF32Eq,
kExprI32LoadMem, 0x01, 0xef, 0xec, 0x95, 0x93, 0x07, kExprI32LoadMem, 0x01, 0xef, 0xec, 0x95, 0x93, 0x07,
kExprI32Add, kExprI32Add,
kExprIf, kWasmStmt, // @30 kExprIf, kWasmVoid, // @30
kExprEnd, // @32 kExprEnd, // @32
kExprI32Const, 0xc9, 0x93, 0xdf, 0xcc, 0x7c, kExprI32Const, 0xc9, 0x93, 0xdf, 0xcc, 0x7c,
kExprEnd, // @39 kExprEnd, // @39

View File

@ -21,7 +21,7 @@ const sync_address = 12;
// Calling the imported function sets the thread-in-wasm flag of the // Calling the imported function sets the thread-in-wasm flag of the
// main thread. // main thread.
kExprCallFunction, import_id, // -- kExprCallFunction, import_id, // --
kExprLoop, kWasmStmt, // -- kExprLoop, kWasmVoid, // --
kExprI32Const, sync_address, // -- kExprI32Const, sync_address, // --
kExprI32LoadMem, 0, 0, // -- kExprI32LoadMem, 0, 0, // --
kExprI32Eqz, kExprI32Eqz,

View File

@ -10,7 +10,7 @@ builder.addFunction(undefined, makeSig([kWasmI32, kWasmF32], []))
.addBody([ .addBody([
kExprLocalGet, 0, // get_local kExprLocalGet, 0, // get_local
kExprI32Const, 0, // i32.const 0 kExprI32Const, 0, // i32.const 0
kExprIf, kWasmStmt, // if kExprIf, kWasmVoid, // if
kExprUnreachable, // unreachable kExprUnreachable, // unreachable
kExprEnd, // end if kExprEnd, // end if
kExprLocalGet, 4, // get_local kExprLocalGet, 4, // get_local
@ -21,7 +21,7 @@ builder.addFunction(undefined, makeSig([kWasmI32, kWasmF32], []))
kExprLocalTee, 2, // tee_local kExprLocalTee, 2, // tee_local
kExprLocalTee, 8, // tee_local kExprLocalTee, 8, // tee_local
kExprDrop, // drop kExprDrop, // drop
kExprLoop, kWasmStmt, // loop kExprLoop, kWasmVoid, // loop
kExprEnd, // end loop kExprEnd, // end loop
]); ]);
builder.instantiate(); builder.instantiate();

View File

@ -15,7 +15,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
builder.addFunction(undefined, 1 /* sig */) builder.addFunction(undefined, 1 /* sig */)
.addLocals(kWasmI32, 65) .addLocals(kWasmI32, 65)
.addBodyWithEnd([ .addBodyWithEnd([
kExprLoop, kWasmStmt, // @3 kExprLoop, kWasmVoid, // @3
kSimdPrefix, kSimdPrefix,
kExprF32x4Min, kExprF32x4Min,
kExprI64UConvertI32, kExprI64UConvertI32,

View File

@ -6,9 +6,9 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder(); const builder = new WasmModuleBuilder();
builder.addFunction('main', kSig_v_v).addBody([ builder.addFunction('main', kSig_v_v).addBody([
kExprLoop, kWasmStmt, // loop kExprLoop, kWasmVoid, // loop
/**/ kExprBr, 0x01, // br depth=1 /**/ kExprBr, 0x01, // br depth=1
/**/ kExprBlock, kWasmStmt, // block /**/ kExprBlock, kWasmVoid, // block
/**/ /**/ kExprBr, 0x02, // br depth=2 /**/ /**/ kExprBr, 0x02, // br depth=2
/**/ /**/ kExprEnd, // end [block] /**/ /**/ kExprEnd, // end [block]
/**/ kExprEnd // end [loop] /**/ kExprEnd // end [loop]

View File

@ -16,7 +16,7 @@ kExprElse,
kExprEnd, kExprEnd,
kExprLocalTee, 0, kExprLocalTee, 0,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprLoop, kWasmStmt, kExprLoop, kWasmVoid,
kExprI64Const, 0x80, 0x80, 0x80, 0x70, kExprI64Const, 0x80, 0x80, 0x80, 0x70,
kExprLocalSet, 0x01, kExprLocalSet, 0x01,
kExprI32Const, 0x00, kExprI32Const, 0x00,

View File

@ -16,8 +16,8 @@ builder.addFunction(undefined, sig1)
// signature: f_lilfl // signature: f_lilfl
kExprBlock, kWasmF32, // @1 f32 kExprBlock, kWasmF32, // @1 f32
kExprI32Const, 0x00, kExprI32Const, 0x00,
kExprIf, kWasmStmt, // @5 kExprIf, kWasmVoid, // @5
kExprLoop, kWasmStmt, // @7 kExprLoop, kWasmVoid, // @7
kExprBlock, kWasmI32, // @9 i32 kExprBlock, kWasmI32, // @9 i32
kExprF32Const, 0x00, 0x00, 0x80, 0xc1, kExprF32Const, 0x00, 0x00, 0x80, 0xc1,
kExprF32Const, 0x00, 0x00, 0x80, 0x45, kExprF32Const, 0x00, 0x00, 0x80, 0x45,

View File

@ -12,7 +12,7 @@ builder.addFunction(undefined, kSig_i_i)
kExprLocalGet, 0, kExprLocalGet, 0,
// Stack now contains two copies of the first param register. // Stack now contains two copies of the first param register.
// Start a loop to create a merge point (values still in registers). // Start a loop to create a merge point (values still in registers).
kExprLoop, kWasmStmt, kExprLoop, kWasmVoid,
// The call spills all values. // The call spills all values.
kExprCallFunction, 0, kExprCallFunction, 0,
// Break to the loop. Now the spilled values need to be loaded back *into // Break to the loop. Now the spilled values need to be loaded back *into

View File

@ -9,21 +9,21 @@ const sig = builder.addType(makeSig([kWasmI64], [kWasmI64]));
builder.addFunction(undefined, sig) builder.addFunction(undefined, sig)
.addLocals(kWasmI32, 14).addLocals(kWasmI64, 17).addLocals(kWasmF32, 14) .addLocals(kWasmI32, 14).addLocals(kWasmI64, 17).addLocals(kWasmF32, 14)
.addBody([ .addBody([
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprBr, 0x00, kExprBr, 0x00,
kExprEnd, kExprEnd,
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprI32Const, 0x00, kExprI32Const, 0x00,
kExprLocalSet, 0x09, kExprLocalSet, 0x09,
kExprI32Const, 0x00, kExprI32Const, 0x00,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprI32Const, 0x00, kExprI32Const, 0x00,
kExprLocalSet, 0x0a, kExprLocalSet, 0x0a,
kExprBr, 0x00, kExprBr, 0x00,
kExprEnd, kExprEnd,
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprLocalGet, 0x00, kExprLocalGet, 0x00,
kExprLocalSet, 0x12, kExprLocalSet, 0x12,
kExprBr, 0x00, kExprBr, 0x00,

View File

@ -9,8 +9,8 @@ const sig = builder.addType(makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]))
builder.addFunction(undefined, sig) builder.addFunction(undefined, sig)
.addBody([ .addBody([
kExprLocalGet, 2, kExprLocalGet, 2,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprBlock, kWasmStmt kExprBlock, kWasmVoid
]); ]);
builder.addExport('main', 0); builder.addExport('main', 0);
assertThrows(() => builder.instantiate(), WebAssembly.CompileError); assertThrows(() => builder.instantiate(), WebAssembly.CompileError);

View File

@ -27,12 +27,12 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
builder.addMemory(12, 12, false); builder.addMemory(12, 12, false);
builder.addFunction("foo", kSig_v_iii) builder.addFunction("foo", kSig_v_iii)
.addBody([].concat([ .addBody([].concat([
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprLocalGet, 0x2, kExprLocalGet, 0x2,
kExprI32Const, 0x01, kExprI32Const, 0x01,
kExprI32And, kExprI32And,
// Generate a test branch (which has 32k limited reach). // Generate a test branch (which has 32k limited reach).
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprLocalGet, 0x0, kExprLocalGet, 0x0,
kExprI32Const, 0x01, kExprI32Const, 0x01,
kExprI32And, kExprI32And,

View File

@ -15,7 +15,7 @@ const NUM_CASES = 0xfffd;
let cases = new Array(NUM_CASES).fill(0); let cases = new Array(NUM_CASES).fill(0);
builder.addFunction('main', kSig_v_i) builder.addFunction('main', kSig_v_i)
.addBody([].concat([ .addBody([].concat([
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprBrTable], wasmSignedLeb(NUM_CASES), kExprBrTable], wasmSignedLeb(NUM_CASES),
cases, [0, cases, [0,

View File

@ -16,7 +16,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
]).exportFunc(); ]).exportFunc();
builder.addFunction("main", kSig_i_i) builder.addFunction("main", kSig_i_i)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprCallFunction, f.index, kExprCallFunction, f.index,
kExprCallFunction, f.index, kExprCallFunction, f.index,

View File

@ -264,7 +264,7 @@ function generateFunctionBodyForSequence(sequence) {
kExprLocalGet, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2, kExprLocalGet, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2,
0, 0,
// Spin until zero. // Spin until zero.
kExprLoop, kWasmStmt, kExprLocalGet, 2, kAtomicPrefix, kExprLoop, kWasmVoid, kExprLocalGet, 2, kAtomicPrefix,
kExprI32AtomicLoad, 2, 0, kExprI32Const, 0, kExprI32GtU, kExprBrIf, 0, kExprI32AtomicLoad, 2, 0, kExprI32Const, 0, kExprI32GtU, kExprBrIf, 0,
kExprEnd); kExprEnd);
} }

View File

@ -399,7 +399,7 @@ function TestStore(func, buffer, value, size) {
builder.addImportedMemory("m", "imported_mem", 16, 128, "shared"); builder.addImportedMemory("m", "imported_mem", 16, 128, "shared");
builder.addFunction("main", kSig_i_v) builder.addFunction("main", kSig_i_v)
.addBody([ .addBody([
kExprLoop, kWasmStmt, kExprLoop, kWasmVoid,
kExprI32Const, 16, kExprI32Const, 16,
kExprI32Const, 20, kExprI32Const, 20,
kAtomicPrefix, kAtomicPrefix,
@ -442,7 +442,7 @@ function CmpExchgLoop(opcode, alignment) {
builder.addFunction("main", makeSig([kWasmI32], [])) builder.addFunction("main", makeSig([kWasmI32], []))
.addLocals(kWasmI64, 2) .addLocals(kWasmI64, 2)
.addBody([ .addBody([
kExprLoop, kWasmStmt, kExprLoop, kWasmVoid,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprLocalGet, 1, kExprLocalGet, 1,
kExprLocalGet, 2, kExprLocalGet, 2,

View File

@ -302,7 +302,7 @@ function generateFunctionBodyForSequence(sequence) {
kExprLocalGet, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2, kExprLocalGet, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2,
0, 0,
// Spin until zero. // Spin until zero.
kExprLoop, kWasmStmt, kExprLocalGet, 2, kAtomicPrefix, kExprLoop, kWasmVoid, kExprLocalGet, 2, kAtomicPrefix,
kExprI32AtomicLoad, 2, 0, kExprI32Const, 0, kExprI32GtU, kExprBrIf, 0, kExprI32AtomicLoad, 2, 0, kExprI32Const, 0, kExprI32GtU, kExprBrIf, 0,
kExprEnd); kExprEnd);
} }

View File

@ -43,20 +43,20 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName,
kExprI32Mul, kExprI32Mul,
kExprLocalSet, kArgSeqenceLength, kExprLocalSet, kArgSeqenceLength,
// Outer block so we have something to jump for return. // Outer block so we have something to jump for return.
...[kExprBlock, kWasmStmt, ...[kExprBlock, kWasmVoid,
// Set counter to 0. // Set counter to 0.
kExprI32Const, 0, kExprI32Const, 0,
kExprLocalSet, kLocalCurrentOffset, kExprLocalSet, kLocalCurrentOffset,
// Outer loop until maxcount. // Outer loop until maxcount.
...[kExprLoop, kWasmStmt, ...[kExprLoop, kWasmVoid,
// Find the next value to wait for. // Find the next value to wait for.
...[kExprLoop, kWasmStmt, ...[kExprLoop, kWasmVoid,
// Check end of sequence. // Check end of sequence.
kExprLocalGet, kLocalCurrentOffset, kExprLocalGet, kLocalCurrentOffset,
kExprLocalGet, kArgSeqenceLength, kExprLocalGet, kArgSeqenceLength,
kExprI32Eq, kExprI32Eq,
kExprBrIf, 2, // return kExprBrIf, 2, // return
...[kExprBlock, kWasmStmt, ...[kExprBlock, kWasmVoid,
// Load next value. // Load next value.
kExprLocalGet, kArgSequencePtr, kExprLocalGet, kArgSequencePtr,
kExprLocalGet, kLocalCurrentOffset, kExprLocalGet, kLocalCurrentOffset,
@ -95,7 +95,7 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName,
loadMemOpcode, 0, 0, loadMemOpcode, 0, 0,
kExprLocalSet, kLocalNextValue, kExprLocalSet, kLocalNextValue,
// Hammer on memory until value found. // Hammer on memory until value found.
...[kExprLoop, kWasmStmt, ...[kExprLoop, kWasmVoid,
// Load address. // Load address.
kExprLocalGet, kArgMemoryCell, kExprLocalGet, kArgMemoryCell,
// Load expected value. // Load expected value.

View File

@ -46,20 +46,20 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName,
kExprI32Mul, kExprI32Mul,
kExprLocalSet, kArgSeqenceLength, kExprLocalSet, kArgSeqenceLength,
// Outer block so we have something to jump for return. // Outer block so we have something to jump for return.
...[kExprBlock, kWasmStmt, ...[kExprBlock, kWasmVoid,
// Set counter to 0. // Set counter to 0.
kExprI32Const, 0, kExprI32Const, 0,
kExprLocalSet, kLocalCurrentOffset, kExprLocalSet, kLocalCurrentOffset,
// Outer loop until maxcount. // Outer loop until maxcount.
...[kExprLoop, kWasmStmt, ...[kExprLoop, kWasmVoid,
// Find the next value to wait for. // Find the next value to wait for.
...[kExprLoop, kWasmStmt, ...[kExprLoop, kWasmVoid,
// Check end of sequence. // Check end of sequence.
kExprLocalGet, kLocalCurrentOffset, kExprLocalGet, kLocalCurrentOffset,
kExprLocalGet, kArgSeqenceLength, kExprLocalGet, kArgSeqenceLength,
kExprI32Eq, kExprI32Eq,
kExprBrIf, 2, // return kExprBrIf, 2, // return
...[kExprBlock, kWasmStmt, ...[kExprBlock, kWasmVoid,
// Load next value. // Load next value.
kExprLocalGet, kArgSequencePtr, kExprLocalGet, kArgSequencePtr,
kExprLocalGet, kLocalCurrentOffset, kExprLocalGet, kLocalCurrentOffset,
@ -100,7 +100,7 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName,
loadMemOpcode, 0, 0, loadMemOpcode, 0, 0,
kExprLocalSet, kLocalNextValue, kExprLocalSet, kLocalNextValue,
// Hammer on memory until value found. // Hammer on memory until value found.
...[kExprLoop, kWasmStmt, ...[kExprLoop, kWasmVoid,
// Load address. // Load address.
kExprLocalGet, kArgMemoryCell, kExprLocalGet, kArgMemoryCell,
// Load expected value. // Load expected value.

View File

@ -359,13 +359,13 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
print(arguments.callee.name); print(arguments.callee.name);
const builder = new WasmModuleBuilder(); const builder = new WasmModuleBuilder();
builder.addFunction('main', kSig_i_i) builder.addFunction('main', kSig_i_i)
.addBody([kExprBlock, kWasmStmt, .addBody([kExprBlock, kWasmVoid,
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprBrTable, 6, 0, 1, 2, 3, 4, 5, 6, kExprBrTable, 6, 0, 1, 2, 3, 4, 5, 6,
kExprEnd, kExprEnd,

View File

@ -14,7 +14,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
let except = builder.addException(kSig_v_v); let except = builder.addException(kSig_v_v);
builder.addFunction("rethrow0", kSig_v_v) builder.addFunction("rethrow0", kSig_v_v)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprThrow, except, kExprThrow, except,
kExprCatch, except, kExprCatch, except,
kExprRethrow, 0, kExprRethrow, 0,
@ -27,7 +27,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
kExprCatch, except, kExprCatch, except,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Eqz, kExprI32Eqz,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprRethrow, 1, kExprRethrow, 1,
kExprEnd, kExprEnd,
kExprI32Const, 23, kExprI32Const, 23,
@ -47,7 +47,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
let except = builder.addException(kSig_v_v); let except = builder.addException(kSig_v_v);
builder.addFunction("rethrow0", kSig_v_v) builder.addFunction("rethrow0", kSig_v_v)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprThrow, except, kExprThrow, except,
kExprCatchAll, kExprCatchAll,
kExprRethrow, 0, kExprRethrow, 0,
@ -60,7 +60,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
kExprCatchAll, kExprCatchAll,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Eqz, kExprI32Eqz,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprRethrow, 1, kExprRethrow, 1,
kExprEnd, kExprEnd,
kExprI32Const, 23, kExprI32Const, 23,
@ -91,13 +91,13 @@ load("test/mjsunit/wasm/exceptions-utils.js");
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Const, 0, kExprI32Const, 0,
kExprI32Eq, kExprI32Eq,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprRethrow, 1, kExprRethrow, 1,
kExprEnd, kExprEnd,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Const, 1, kExprI32Const, 1,
kExprI32Eq, kExprI32Eq,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprRethrow, 2, kExprRethrow, 2,
kExprEnd, kExprEnd,
kExprI32Const, 23, kExprI32Const, 23,
@ -125,7 +125,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
kExprTry, kWasmI32, kExprTry, kWasmI32,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Eqz, kExprI32Eqz,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprRethrow, 2, kExprRethrow, 2,
kExprEnd, kExprEnd,
kExprI32Const, 42, kExprI32Const, 42,

View File

@ -30,7 +30,7 @@ function NewExportedException() {
]).exportFunc(); ]).exportFunc();
builder.addFunction("catch", kSig_v_v) builder.addFunction("catch", kSig_v_v)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprCallFunction, fun, kExprCallFunction, fun,
kExprCatch, except, kExprCatch, except,
kExprEnd, kExprEnd,
@ -62,7 +62,7 @@ function NewExportedException() {
]).exportFunc(); ]).exportFunc();
builder.addFunction("catch", kSig_v_v) builder.addFunction("catch", kSig_v_v)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprCallFunction, fun, kExprCallFunction, fun,
kExprCatch, except, kExprCatch, except,
kExprEnd, kExprEnd,
@ -97,7 +97,7 @@ function NewExportedException() {
]).exportFunc(); ]).exportFunc();
builder.addFunction("catch", kSig_v_v) builder.addFunction("catch", kSig_v_v)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprCallFunction, fun, kExprCallFunction, fun,
kExprCatch, except1, kExprCatch, except1,
kExprEnd, kExprEnd,
@ -136,7 +136,7 @@ function NewExportedException() {
let except = builder2.addImportedException("m", "ex", kSig_v_v); let except = builder2.addImportedException("m", "ex", kSig_v_v);
builder2.addFunction("catch", kSig_v_v) builder2.addFunction("catch", kSig_v_v)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprCallFunction, fun, kExprCallFunction, fun,
kExprCatch, except, kExprCatch, except,
kExprEnd, kExprEnd,

View File

@ -17,7 +17,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Const, 0, kExprI32Const, 0,
kExprI32Ne, kExprI32Ne,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprThrow, except, kExprThrow, except,
kExprEnd, kExprEnd,
kExprI32Const, 1 kExprI32Const, 1
@ -36,7 +36,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
let except = builder.addException(kSig_v_v); let except = builder.addException(kSig_v_v);
builder.addFunction("catch_empty_try", kSig_v_v) builder.addFunction("catch_empty_try", kSig_v_v)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprCatch, except, kExprCatch, except,
kExprEnd, kExprEnd,
]).exportFunc(); ]).exportFunc();
@ -55,7 +55,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
kExprTry, kWasmI32, kExprTry, kWasmI32,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Eqz, kExprI32Eqz,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprThrow, except, kExprThrow, except,
kExprEnd, kExprEnd,
kExprI32Const, 42, kExprI32Const, 42,
@ -74,14 +74,14 @@ load("test/mjsunit/wasm/exceptions-utils.js");
let builder = new WasmModuleBuilder(); let builder = new WasmModuleBuilder();
builder.addFunction('unreachable_in_try', kSig_v_v) builder.addFunction('unreachable_in_try', kSig_v_v)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprUnreachable, kExprUnreachable,
kExprCatchAll, kExprCatchAll,
kExprEnd kExprEnd
]).exportFunc(); ]).exportFunc();
builder.addFunction('unreachable_in_try_unwind', kSig_v_v) builder.addFunction('unreachable_in_try_unwind', kSig_v_v)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprUnreachable, kExprUnreachable,
kExprUnwind, kExprUnwind,
kExprEnd kExprEnd
@ -229,13 +229,13 @@ load("test/mjsunit/wasm/exceptions-utils.js");
builder.addFunction('test', kSig_v_v) builder.addFunction('test', kSig_v_v)
.addBody([ .addBody([
// Calling "throw" directly should produce the expected exception. // Calling "throw" directly should produce the expected exception.
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprCallFunction, throw_fn.index, kExprCallFunction, throw_fn.index,
kExprCatch, except, kExprCatch, except,
kExprEnd, kExprEnd,
// Calling through JS produces a wrapped exceptions which does not match // Calling through JS produces a wrapped exceptions which does not match
// the catch. // the catch.
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprCallFunction, imp, kExprCallFunction, imp,
kExprCatch, except, kExprCatch, except,
kExprEnd kExprEnd
@ -277,13 +277,13 @@ load("test/mjsunit/wasm/exceptions-utils.js");
kExprTry, kWasmI32, kExprTry, kWasmI32,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Eqz, kExprI32Eqz,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprThrow, except1, kExprThrow, except1,
kExprElse, kExprElse,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Const, 1, kExprI32Const, 1,
kExprI32Eq, kExprI32Eq,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprThrow, except2, kExprThrow, except2,
kExprElse, kExprElse,
kExprThrow, except3, kExprThrow, except3,
@ -317,13 +317,13 @@ load("test/mjsunit/wasm/exceptions-utils.js");
kExprTry, kWasmI32, kExprTry, kWasmI32,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Eqz, kExprI32Eqz,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprThrow, except1, kExprThrow, except1,
kExprElse, kExprElse,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Const, 1, kExprI32Const, 1,
kExprI32Eq, kExprI32Eq,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprThrow, except2, kExprThrow, except2,
kExprElse, kExprElse,
kExprThrow, except3, kExprThrow, except3,
@ -609,7 +609,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Const, 0, kExprI32Const, 0,
kExprI32Ne, kExprI32Ne,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprThrow, except, kExprThrow, except,
kExprUnreachable, kExprUnreachable,
@ -672,7 +672,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Const, 1, kExprI32Const, 1,
kExprI32Eq, kExprI32Eq,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprI32Const, 1, kExprI32Const, 1,
kExprThrow, except, kExprThrow, except,
kExprUnreachable, kExprUnreachable,
@ -688,7 +688,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Const, 2, kExprI32Const, 2,
kExprI32Eq, kExprI32Eq,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprLocalGet, 1, kExprLocalGet, 1,
kExprI32Const, 8, kExprI32Const, 8,
kExprI32Ior, kExprI32Ior,
@ -707,7 +707,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Const, 3, kExprI32Const, 3,
kExprI32Eq, kExprI32Eq,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprLocalGet, 1, kExprLocalGet, 1,
kExprI32Const, /*64=*/ 192, 0, kExprI32Const, /*64=*/ 192, 0,
kExprI32Ior, kExprI32Ior,
@ -766,7 +766,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
builder.addFunction("string_from_js", kSig_v_v) builder.addFunction("string_from_js", kSig_v_v)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprCallFunction, kJSThrowString, kExprCallFunction, kJSThrowString,
kExprCatch, except, kExprCatch, except,
kExprUnreachable, kExprUnreachable,
@ -776,7 +776,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
builder.addFunction("fp_from_js", kSig_v_v) builder.addFunction("fp_from_js", kSig_v_v)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprCallFunction, kJSThrowFP, kExprCallFunction, kJSThrowFP,
kExprCatch, except, kExprCatch, except,
kExprUnreachable, kExprUnreachable,
@ -786,7 +786,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
builder.addFunction("large_from_js", kSig_v_v) builder.addFunction("large_from_js", kSig_v_v)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprCallFunction, kJSThrowLarge, kExprCallFunction, kJSThrowLarge,
kExprCatch, except, kExprCatch, except,
kExprUnreachable, kExprUnreachable,
@ -796,7 +796,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
builder.addFunction("undefined_from_js", kSig_v_v) builder.addFunction("undefined_from_js", kSig_v_v)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprCallFunction, kJSThrowUndefined, kExprCallFunction, kJSThrowUndefined,
kExprCatch, except, kExprCatch, except,
kExprUnreachable, kExprUnreachable,
@ -866,7 +866,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
let throw_if = builder.addFunction('throw', kSig_v_i) let throw_if = builder.addFunction('throw', kSig_v_i)
.addBody([ .addBody([
kExprLocalGet, 0, kExprLocalGet, 0,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprThrow, except, kExprThrow, except,
kExprEnd]).exportFunc(); kExprEnd]).exportFunc();
builder.addFunction('test', kSig_i_i) builder.addFunction('test', kSig_i_i)
@ -924,9 +924,9 @@ load("test/mjsunit/wasm/exceptions-utils.js");
// 2 -> throw except2 // 2 -> throw except2
let throw_fn = builder.addFunction('throw', kSig_v_i) let throw_fn = builder.addFunction('throw', kSig_v_i)
.addBody([ .addBody([
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprBlock, kWasmStmt, kExprBlock, kWasmVoid,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprBrTable, 2, 0, 1, 2, kExprBrTable, 2, 0, 1, 2,
kExprEnd, kExprEnd,
@ -993,7 +993,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
builder.addFunction('test', kSig_i_v) builder.addFunction('test', kSig_i_v)
.addBody([ .addBody([
kExprTry, kWasmI32, kExprTry, kWasmI32,
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprThrow, except1, kExprThrow, except1,
kExprDelegate, 0, kExprDelegate, 0,
kExprI32Const, 1, kExprI32Const, 1,
@ -1013,8 +1013,8 @@ load("test/mjsunit/wasm/exceptions-utils.js");
let except = builder.addException(kSig_v_v); let except = builder.addException(kSig_v_v);
builder.addFunction('test', kSig_v_v) builder.addFunction('test', kSig_v_v)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprThrow, except, kExprThrow, except,
kExprDelegate, 1, kExprDelegate, 1,
kExprCatchAll, kExprCatchAll,
@ -1022,8 +1022,8 @@ load("test/mjsunit/wasm/exceptions-utils.js");
]).exportFunc(); ]).exportFunc();
builder.addFunction('test_unwind', kSig_v_v) builder.addFunction('test_unwind', kSig_v_v)
.addBody([ .addBody([
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprTry, kWasmStmt, kExprTry, kWasmVoid,
kExprThrow, except, kExprThrow, except,
kExprDelegate, 1, kExprDelegate, 1,
kExprUnwind, kExprUnwind,

View File

@ -183,7 +183,7 @@ TestGlobalIndexSpace(kWasmF64, 12345.678);
builder.addFunction("set", kSig_v_ii) builder.addFunction("set", kSig_v_ii)
.addBody([ .addBody([
kExprLocalGet, 0, kExprLocalGet, 0,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprLocalGet, 1, kExprLocalGet, 1,
kExprGlobalSet, g.index, kExprGlobalSet, g.index,
kExprElse, kExprElse,

View File

@ -33,7 +33,7 @@ function generateBuilder() {
builder.addFunction('main', kSig_i_i) builder.addFunction('main', kSig_i_i)
.addBody([ .addBody([
kExprLocalGet, 0, // get condition parameter kExprLocalGet, 0, // get condition parameter
kExprIf, kWasmStmt, // if it's 1 then enter if kExprIf, kWasmVoid, // if it's 1 then enter if
kExprI32Const, deltaPages, // put deltaPages on stack kExprI32Const, deltaPages, // put deltaPages on stack
kExprMemoryGrow, kMemoryZero, // grow memory kExprMemoryGrow, kMemoryZero, // grow memory
kExprDrop, // drop the result of grow kExprDrop, // drop the result of grow
@ -60,7 +60,7 @@ function generateBuilder() {
builder.addFunction('main', kSig_i_i) builder.addFunction('main', kSig_i_i)
.addBody([ .addBody([
kExprLocalGet, 0, // get condition parameter kExprLocalGet, 0, // get condition parameter
kExprIf, kWasmStmt, // if it's 1 then enter if kExprIf, kWasmVoid, // if it's 1 then enter if
kExprI32Const, deltaPages, // put deltaPages on stack kExprI32Const, deltaPages, // put deltaPages on stack
kExprMemoryGrow, kMemoryZero, // grow memory kExprMemoryGrow, kMemoryZero, // grow memory
kExprDrop, // drop the result of grow kExprDrop, // drop the result of grow
@ -95,7 +95,7 @@ function generateBuilder() {
builder.addFunction('main', kSig_i_i) builder.addFunction('main', kSig_i_i)
.addBody([ .addBody([
kExprLocalGet, 0, // get condition parameter kExprLocalGet, 0, // get condition parameter
kExprIf, kWasmStmt, // if it's 1 then enter if kExprIf, kWasmVoid, // if it's 1 then enter if
kExprI32Const, index, // put index on stack kExprI32Const, index, // put index on stack
kExprI32Const, newValue, // put the value on stack kExprI32Const, newValue, // put the value on stack
kExprI32StoreMem, 0, 0, // store kExprI32StoreMem, 0, 0, // store
@ -128,7 +128,7 @@ function generateBuilder() {
builder.addFunction('main', kSig_i_i) builder.addFunction('main', kSig_i_i)
.addBody([ .addBody([
kExprLocalGet, 0, // get condition parameter kExprLocalGet, 0, // get condition parameter
kExprIf, kWasmStmt, // if it's 1 then enter if kExprIf, kWasmVoid, // if it's 1 then enter if
kExprI32Const, deltaPagesIf, // put deltaPagesIf on stack kExprI32Const, deltaPagesIf, // put deltaPagesIf on stack
kExprMemoryGrow, kMemoryZero, // grow memory kExprMemoryGrow, kMemoryZero, // grow memory
kExprDrop, // drop the result of grow kExprDrop, // drop the result of grow
@ -160,7 +160,7 @@ function generateBuilder() {
builder.addFunction('main', kSig_i_ii) builder.addFunction('main', kSig_i_ii)
.addBody([ .addBody([
kExprLocalGet, 0, // get condition parameter kExprLocalGet, 0, // get condition parameter
kExprIf, kWasmStmt, // if it's 1 then enter if kExprIf, kWasmVoid, // if it's 1 then enter if
kExprI32Const, deltaPages, // put deltaPages on stack kExprI32Const, deltaPages, // put deltaPages on stack
kExprMemoryGrow, kMemoryZero, // grow memory kExprMemoryGrow, kMemoryZero, // grow memory
kExprDrop, // drop the result of grow kExprDrop, // drop the result of grow
@ -192,7 +192,7 @@ function generateBuilder() {
builder.addFunction('main', kSig_i_ii) builder.addFunction('main', kSig_i_ii)
.addBody([ .addBody([
kExprLocalGet, 0, // get condition parameter kExprLocalGet, 0, // get condition parameter
kExprIf, kWasmStmt, // if it's 1 then enter if kExprIf, kWasmVoid, // if it's 1 then enter if
kExprI32Const, deltaPages, // put deltaPages on stack kExprI32Const, deltaPages, // put deltaPages on stack
kExprMemoryGrow, kMemoryZero, // grow memory kExprMemoryGrow, kMemoryZero, // grow memory
kExprDrop, // drop the result of grow kExprDrop, // drop the result of grow
@ -227,7 +227,7 @@ function generateBuilder() {
builder.addFunction('main', kSig_i_ii) builder.addFunction('main', kSig_i_ii)
.addBody([ .addBody([
kExprLocalGet, 0, // get condition parameter kExprLocalGet, 0, // get condition parameter
kExprIf, kWasmStmt, // if it's 1 then enter if kExprIf, kWasmVoid, // if it's 1 then enter if
kExprLocalGet, 1, // get index parameter kExprLocalGet, 1, // get index parameter
kExprI32Const, value, // put the value on stack kExprI32Const, value, // put the value on stack
kExprI32StoreMem, 0, 0, // store kExprI32StoreMem, 0, 0, // store
@ -264,7 +264,7 @@ function generateBuilder() {
builder.addFunction('main', kSig_i_ii) builder.addFunction('main', kSig_i_ii)
.addBody([ .addBody([
kExprLocalGet, 0, // get condition parameter kExprLocalGet, 0, // get condition parameter
kExprIf, kWasmStmt, // if it's 1 then enter if kExprIf, kWasmVoid, // if it's 1 then enter if
kExprI32Const, deltaPagesIf, // put deltaPagesIf on stack kExprI32Const, deltaPagesIf, // put deltaPagesIf on stack
kExprMemoryGrow, kMemoryZero, // grow memory kExprMemoryGrow, kMemoryZero, // grow memory
kExprDrop, // drop the result of grow kExprDrop, // drop the result of grow

View File

@ -124,9 +124,9 @@ print('=== grow_memory in direct calls ===');
builder.addFunction('main', kSig_i_ii) builder.addFunction('main', kSig_i_ii)
.addBody([ .addBody([
// clang-format off // clang-format off
kExprLoop, kWasmStmt, // while kExprLoop, kWasmVoid, // while
kExprLocalGet, 0, // - kExprLocalGet, 0, // -
kExprIf, kWasmStmt, // if <param0> != 0 kExprIf, kWasmVoid, // if <param0> != 0
// Grow memory. // Grow memory.
kExprLocalGet, 1, // get number of new pages kExprLocalGet, 1, // get number of new pages
kExprCallFunction, kGrowFunction, // call the grow function kExprCallFunction, kGrowFunction, // call the grow function
@ -174,9 +174,9 @@ print('=== grow_memory in direct calls ===');
builder.addFunction('main', kSig_i_iii) builder.addFunction('main', kSig_i_iii)
.addBody([ .addBody([
// clang-format off // clang-format off
kExprLoop, kWasmStmt, // while kExprLoop, kWasmVoid, // while
kExprLocalGet, 0, // - kExprLocalGet, 0, // -
kExprIf, kWasmStmt, // if <param0> != 0 kExprIf, kWasmVoid, // if <param0> != 0
// Grow memory. // Grow memory.
kExprLocalGet, 1, // get number of new pages kExprLocalGet, 1, // get number of new pages
kExprCallFunction, kGrowFunction, // call the grow function kExprCallFunction, kGrowFunction, // call the grow function
@ -338,9 +338,9 @@ print('\n=== grow_memory in indirect calls ===');
builder.addFunction('main', kSig_i_iii) builder.addFunction('main', kSig_i_iii)
.addBody([ .addBody([
// clang-format off // clang-format off
kExprLoop, kWasmStmt, // while kExprLoop, kWasmVoid, // while
kExprLocalGet, 1, // - kExprLocalGet, 1, // -
kExprIf, kWasmStmt, // if <param1> != 0 kExprIf, kWasmVoid, // if <param1> != 0
// Grow memory. // Grow memory.
kExprLocalGet, 2, // get number of new pages kExprLocalGet, 2, // get number of new pages
kExprLocalGet, 0, // get index of the function kExprLocalGet, 0, // get index of the function
@ -393,9 +393,9 @@ print('\n=== grow_memory in indirect calls ===');
'main', makeSig([kWasmI32, kWasmI32, kWasmI32, kWasmI32], [kWasmI32])) 'main', makeSig([kWasmI32, kWasmI32, kWasmI32, kWasmI32], [kWasmI32]))
.addBody([ .addBody([
// clang-format off // clang-format off
kExprLoop, kWasmStmt, // while kExprLoop, kWasmVoid, // while
kExprLocalGet, 1, // - kExprLocalGet, 1, // -
kExprIf, kWasmStmt, // if <param1> != 0 kExprIf, kWasmVoid, // if <param1> != 0
// Grow memory. // Grow memory.
kExprLocalGet, 2, // get number of new pages kExprLocalGet, 2, // get number of new pages
kExprLocalGet, 0, // get index of the function kExprLocalGet, 0, // get index of the function

View File

@ -30,9 +30,9 @@ function generateBuilder() {
builder.addFunction('main', kSig_i_i) builder.addFunction('main', kSig_i_i)
.addBody([ .addBody([
// clang-format off // clang-format off
kExprLoop, kWasmStmt, // while kExprLoop, kWasmVoid, // while
kExprLocalGet, 0, // - kExprLocalGet, 0, // -
kExprIf, kWasmStmt, // if <param0> != 0 kExprIf, kWasmVoid, // if <param0> != 0
// Grow memory. // Grow memory.
kExprI32Const, deltaPages, // - kExprI32Const, deltaPages, // -
kExprMemoryGrow, kMemoryZero, // grow memory kExprMemoryGrow, kMemoryZero, // grow memory
@ -82,9 +82,9 @@ function generateBuilder() {
kExprI32Const, deltaPagesOut, // - kExprI32Const, deltaPagesOut, // -
kExprMemoryGrow, kMemoryZero, // grow memory kExprMemoryGrow, kMemoryZero, // grow memory
kExprDrop, // drop the result of grow kExprDrop, // drop the result of grow
kExprLoop, kWasmStmt, // while kExprLoop, kWasmVoid, // while
kExprLocalGet, 0, // - kExprLocalGet, 0, // -
kExprIf, kWasmStmt, // if <param0> != 0 kExprIf, kWasmVoid, // if <param0> != 0
// Grow memory. // Grow memory.
kExprI32Const, deltaPagesIn, // - kExprI32Const, deltaPagesIn, // -
kExprMemoryGrow, kMemoryZero, // grow memory kExprMemoryGrow, kMemoryZero, // grow memory
@ -131,9 +131,9 @@ function generateBuilder() {
builder.addFunction('main', kSig_i_ii) builder.addFunction('main', kSig_i_ii)
.addBody([ .addBody([
// clang-format off // clang-format off
kExprLoop, kWasmStmt, // while kExprLoop, kWasmVoid, // while
kExprLocalGet, 0, // - kExprLocalGet, 0, // -
kExprIf, kWasmStmt, // if <param0> != 0 kExprIf, kWasmVoid, // if <param0> != 0
// Grow memory. // Grow memory.
kExprI32Const, deltaPages, // - kExprI32Const, deltaPages, // -
kExprMemoryGrow, kMemoryZero, // grow memory kExprMemoryGrow, kMemoryZero, // grow memory
@ -202,9 +202,9 @@ function generateBuilder() {
kExprI32Add, // increase value on stack kExprI32Add, // increase value on stack
kExprI32StoreMem, 0, 0, // store new value kExprI32StoreMem, 0, 0, // store new value
// Start loop. // Start loop.
kExprLoop, kWasmStmt, // while kExprLoop, kWasmVoid, // while
kExprLocalGet, 0, // - kExprLocalGet, 0, // -
kExprIf, kWasmStmt, // if <param0> != 0 kExprIf, kWasmVoid, // if <param0> != 0
// Grow memory. // Grow memory.
kExprI32Const, deltaPagesIn, // - kExprI32Const, deltaPagesIn, // -
kExprMemoryGrow, kMemoryZero, // grow memory kExprMemoryGrow, kMemoryZero, // grow memory

View File

@ -11,7 +11,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
var builder = new WasmModuleBuilder(); var builder = new WasmModuleBuilder();
builder.addFunction("main", kSig_v_i) builder.addFunction("main", kSig_v_i)
.addBody([ .addBody([
kExprLoop, kWasmStmt, kExprLoop, kWasmVoid,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Const, 1, kExprI32Const, 1,
kExprI32Sub, kExprI32Sub,
@ -32,7 +32,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
var builder = new WasmModuleBuilder(); var builder = new WasmModuleBuilder();
builder.addFunction("main", kSig_v_i) builder.addFunction("main", kSig_v_i)
.addBody([ .addBody([
kExprLoop, kWasmStmt, kExprLoop, kWasmVoid,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Const, 1, kExprI32Const, 1,
kExprI32Sub, kExprI32Sub,
@ -55,7 +55,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
builder.addMemory(1, undefined, false); builder.addMemory(1, undefined, false);
builder.addFunction("main", kSig_v_i) builder.addFunction("main", kSig_v_i)
.addBody([ .addBody([
kExprLoop, kWasmStmt, kExprLoop, kWasmVoid,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Const, 1, kExprI32Const, 1,
kExprI32Sub, kExprI32Sub,

View File

@ -17,10 +17,10 @@ load("test/mjsunit/wasm/exceptions-utils.js");
builder.addFunction("main", kSig_i_i) builder.addFunction("main", kSig_i_i)
.addBody([ .addBody([
...wasmI32Const(1), ...wasmI32Const(1),
kExprLet, kWasmStmt, 1, 1, kWasmI32, kExprLet, kWasmVoid, 1, 1, kWasmI32,
kExprLoop, kWasmStmt, kExprLoop, kWasmVoid,
...wasmI32Const(10), ...wasmI32Const(10),
kExprLet, kWasmStmt, 1, 1, kWasmI32, kExprLet, kWasmVoid, 1, 1, kWasmI32,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprLocalGet, 1, kExprLocalGet, 1,
kExprI32Sub, kExprI32Sub,
@ -47,9 +47,9 @@ load("test/mjsunit/wasm/exceptions-utils.js");
builder.addFunction("main", kSig_i_i) builder.addFunction("main", kSig_i_i)
.addBody([ .addBody([
kExprLoop, kWasmStmt, kExprLoop, kWasmVoid,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprReturnCall, callee.index, kExprReturnCall, callee.index,
kExprElse, kExprElse,
@ -86,16 +86,16 @@ load("test/mjsunit/wasm/exceptions-utils.js");
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Const, 0, kExprI32Const, 0,
kExprI32Eq, kExprI32Eq,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprLoop, kWasmStmt, kExprLoop, kWasmVoid,
kExprRethrow, 2, kExprRethrow, 2,
kExprEnd, kExprEnd,
kExprEnd, kExprEnd,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Const, 1, kExprI32Const, 1,
kExprI32Eq, kExprI32Eq,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprLoop, kWasmStmt, kExprLoop, kWasmVoid,
kExprRethrow, 3, kExprRethrow, 3,
kExprEnd, kExprEnd,
kExprEnd, kExprEnd,
@ -119,11 +119,11 @@ load("test/mjsunit/wasm/exceptions-utils.js");
let except1 = builder.addException(kSig_v_v); let except1 = builder.addException(kSig_v_v);
builder.addFunction("throw", kSig_i_i) builder.addFunction("throw", kSig_i_i)
.addBody([ .addBody([
kExprLoop, kWasmStmt, kExprLoop, kWasmVoid,
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Const, 10, kExprI32Const, 10,
kExprI32GtS, kExprI32GtS,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprThrow, except1, kExprThrow, except1,
kExprElse, kExprElse,
kExprLocalGet, 0, kExprLocalGet, 0,
@ -152,7 +152,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
kExprLocalGet, 0, kExprLocalGet, 0,
kExprI32Const, 10, kExprI32Const, 10,
kExprI32GtS, kExprI32GtS,
kExprIf, kWasmStmt, kExprIf, kWasmVoid,
kExprThrow, except1, kExprThrow, except1,
kExprElse, kExprElse,
kExprLocalGet, 0, kExprLocalGet, 0,

View File

@ -17,12 +17,12 @@ function genModule(memory) {
.addBody([ .addBody([
// main body: while(i) { if(mem[i]) return -1; i -= 4; } return 0; // main body: while(i) { if(mem[i]) return -1; i -= 4; } return 0;
// TODO(titzer): this manual bytecode has a copy of test-run-wasm.cc // TODO(titzer): this manual bytecode has a copy of test-run-wasm.cc
/**/ kExprLoop, kWasmStmt, // -- /**/ kExprLoop, kWasmVoid, // --
/* */ kExprLocalGet, 0, // -- /* */ kExprLocalGet, 0, // --
/* */ kExprIf, kWasmStmt, // -- /* */ kExprIf, kWasmVoid, // --
/* */ kExprLocalGet, 0, // -- /* */ kExprLocalGet, 0, // --
/* */ kExprI32LoadMem, 0, 0, // -- /* */ kExprI32LoadMem, 0, 0, // --
/* */ kExprIf, kWasmStmt, // -- /* */ kExprIf, kWasmVoid, // --
/* */ kExprI32Const, 127, // -- /* */ kExprI32Const, 127, // --
/* */ kExprReturn, // -- /* */ kExprReturn, // --
/* */ kExprEnd, // -- /* */ kExprEnd, // --

View File

@ -32,7 +32,7 @@ while (true) {
// Each function f<n> with argument {i} then calls f<n/10> with argument // Each function f<n> with argument {i} then calls f<n/10> with argument
// {i + 1} and returns whatever that function returns. // {i + 1} and returns whatever that function returns.
const body_template = [ const body_template = [
kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmStmt, // if (i == 0) kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmVoid, // if (i == 0)
kExprLocalGet, 0 // get i kExprLocalGet, 0 // get i
]; ];
for (let i = 0; i < 1000; ++i) body_template.push(kExprI32LoadMem, 0, 0); for (let i = 0; i < 1000; ++i) body_template.push(kExprI32LoadMem, 0, 0);

View File

@ -390,7 +390,7 @@ function testErrorPosition(bytes, pos, message) {
1, // number of types 1, // number of types
kWasmFunctionTypeForm, // type kWasmFunctionTypeForm, // type
1, // number of parameter 1, // number of parameter
kWasmStmt, // invalid type kWasmVoid, // invalid type
0 // number of returns 0 // number of returns
]); ]);

Some files were not shown because too many files have changed in this diff Show More