[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:
parent
83eb068316
commit
a51056f5c4
@ -2350,7 +2350,7 @@ Node* WasmGraphBuilder::Throw(uint32_t exception_index,
|
||||
break;
|
||||
case wasm::kI8:
|
||||
case wasm::kI16:
|
||||
case wasm::kStmt:
|
||||
case wasm::kVoid:
|
||||
case wasm::kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -2481,7 +2481,7 @@ Node* WasmGraphBuilder::GetExceptionValues(Node* except_obj,
|
||||
break;
|
||||
case wasm::kI8:
|
||||
case wasm::kI16:
|
||||
case wasm::kStmt:
|
||||
case wasm::kVoid:
|
||||
case wasm::kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -6241,7 +6241,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
|
||||
UNIMPLEMENTED();
|
||||
case wasm::kI8:
|
||||
case wasm::kI16:
|
||||
case wasm::kStmt:
|
||||
case wasm::kVoid:
|
||||
case wasm::kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -6389,7 +6389,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
|
||||
case wasm::kI8:
|
||||
case wasm::kI16:
|
||||
case wasm::kBottom:
|
||||
case wasm::kStmt:
|
||||
case wasm::kVoid:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
@ -6444,7 +6444,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
|
||||
case wasm::kI8:
|
||||
case wasm::kI16:
|
||||
case wasm::kBottom:
|
||||
case wasm::kStmt:
|
||||
case wasm::kVoid:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
@ -6612,7 +6612,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
|
||||
case wasm::kI8:
|
||||
case wasm::kI16:
|
||||
case wasm::kBottom:
|
||||
case wasm::kStmt:
|
||||
case wasm::kVoid:
|
||||
return false;
|
||||
case wasm::kI32:
|
||||
case wasm::kF32:
|
||||
@ -6661,7 +6661,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
|
||||
case wasm::kI8:
|
||||
case wasm::kI16:
|
||||
case wasm::kBottom:
|
||||
case wasm::kStmt:
|
||||
case wasm::kVoid:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
@ -535,9 +535,9 @@ class WasmGraphBuilder {
|
||||
const Operator* GetSafeLoadOperator(int offset, wasm::ValueType type);
|
||||
const Operator* GetSafeStoreOperator(int offset, wasm::ValueType type);
|
||||
Node* BuildChangeEndiannessStore(Node* node, MachineRepresentation rep,
|
||||
wasm::ValueType wasmtype = wasm::kWasmStmt);
|
||||
wasm::ValueType wasmtype = wasm::kWasmVoid);
|
||||
Node* BuildChangeEndiannessLoad(Node* node, MachineType type,
|
||||
wasm::ValueType wasmtype = wasm::kWasmStmt);
|
||||
wasm::ValueType wasmtype = wasm::kWasmVoid);
|
||||
|
||||
Node* MaskShiftCount32(Node* node);
|
||||
Node* MaskShiftCount64(Node* node);
|
||||
|
@ -1035,7 +1035,7 @@ Handle<WasmValueObject> WasmValueObject::New(
|
||||
StaticCharVector("(unimplemented)"));
|
||||
break;
|
||||
}
|
||||
case wasm::kStmt:
|
||||
case wasm::kVoid:
|
||||
case wasm::kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ bool WasmModuleDebug::GetWasmValue(const wasm::WasmValue& wasm_value,
|
||||
case wasm::kWasmS128.kind():
|
||||
return StoreValue(wasm_value.to_s128(), buffer, buffer_size, size);
|
||||
|
||||
case wasm::kWasmStmt.kind():
|
||||
case wasm::kWasmVoid.kind():
|
||||
case wasm::kWasmExternRef.kind():
|
||||
case wasm::kWasmBottom.kind():
|
||||
default:
|
||||
|
@ -1843,7 +1843,7 @@ void WasmStruct::WasmStructPrint(std::ostream& os) { // NOLINT
|
||||
case wasm::kRtt:
|
||||
case wasm::kRttWithDepth:
|
||||
case wasm::kBottom:
|
||||
case wasm::kStmt:
|
||||
case wasm::kVoid:
|
||||
os << "UNIMPLEMENTED"; // TODO(7748): Implement.
|
||||
break;
|
||||
}
|
||||
@ -1883,7 +1883,7 @@ void WasmArray::WasmArrayPrint(std::ostream& os) { // NOLINT
|
||||
case wasm::kRtt:
|
||||
case wasm::kRttWithDepth:
|
||||
case wasm::kBottom:
|
||||
case wasm::kStmt:
|
||||
case wasm::kVoid:
|
||||
os << "\n Printing elements of this type is unimplemented, sorry";
|
||||
// TODO(7748): Implement.
|
||||
break;
|
||||
|
@ -4176,7 +4176,7 @@ void LiftoffAssembler::CallC(const ValueKindSig* sig,
|
||||
}
|
||||
|
||||
// Load potential output value from the buffer on the stack.
|
||||
if (out_argument_kind != kStmt) {
|
||||
if (out_argument_kind != kVoid) {
|
||||
switch (out_argument_kind) {
|
||||
case kI32:
|
||||
ldr(result_reg->gp(), MemOperand(sp));
|
||||
|
@ -3167,7 +3167,7 @@ void LiftoffAssembler::CallC(const ValueKindSig* sig,
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -4857,7 +4857,7 @@ void LiftoffAssembler::CallC(const ValueKindSig* sig,
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -1395,7 +1395,7 @@ class LiftoffAssembler : public TurboAssembler {
|
||||
inline void DropStackSlotsAndRet(uint32_t num_stack_slots);
|
||||
|
||||
// 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
|
||||
// outputs (specified in {sig->returns()}) are read from the buffer and stored
|
||||
// in the remaining {rets} registers.
|
||||
|
@ -544,7 +544,7 @@ class LiftoffCompiler {
|
||||
bailout_reason = kRefTypes;
|
||||
break;
|
||||
case kBottom:
|
||||
case kStmt:
|
||||
case kVoid:
|
||||
UNREACHABLE();
|
||||
}
|
||||
EmbeddedVector<char, 128> buffer;
|
||||
@ -1345,7 +1345,7 @@ class LiftoffCompiler {
|
||||
param_bytes += element_size_bytes(param_kind);
|
||||
}
|
||||
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);
|
||||
__ CallC(sig, arg_regs, result_regs, out_argument_kind, stack_bytes,
|
||||
ext_ref);
|
||||
@ -1564,7 +1564,7 @@ class LiftoffCompiler {
|
||||
[=](LiftoffRegister dst, LiftoffRegister src) {
|
||||
if (__ emit_i32_popcnt(dst.gp(), src.gp())) return;
|
||||
auto sig = MakeSig::Returns(kI32).Params(kI32);
|
||||
GenerateCCall(&dst, &sig, kStmt, &src,
|
||||
GenerateCCall(&dst, &sig, kVoid, &src,
|
||||
ExternalReference::wasm_word32_popcnt());
|
||||
});
|
||||
case kExprI64Popcnt:
|
||||
@ -1574,7 +1574,7 @@ class LiftoffCompiler {
|
||||
// The c function returns i32. We will zero-extend later.
|
||||
auto sig = MakeSig::Returns(kI32).Params(kI64);
|
||||
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());
|
||||
// Now zero-extend the result to i64.
|
||||
__ emit_type_conversion(kExprI64UConvertI32, dst, c_call_dst,
|
||||
@ -1704,7 +1704,7 @@ class LiftoffCompiler {
|
||||
ValueKind sig_kinds[] = {k##kind, k##kind, k##kind}; \
|
||||
const bool out_via_stack = k##kind == kI64; \
|
||||
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); \
|
||||
});
|
||||
switch (opcode) {
|
||||
@ -3989,7 +3989,7 @@ class LiftoffCompiler {
|
||||
}
|
||||
case wasm::kI8:
|
||||
case wasm::kI16:
|
||||
case wasm::kStmt:
|
||||
case wasm::kVoid:
|
||||
case wasm::kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -4046,7 +4046,7 @@ class LiftoffCompiler {
|
||||
}
|
||||
case wasm::kI8:
|
||||
case wasm::kI16:
|
||||
case wasm::kStmt:
|
||||
case wasm::kVoid:
|
||||
case wasm::kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -4603,7 +4603,7 @@ class LiftoffCompiler {
|
||||
// We don't need the instance anymore after the call. We can use the
|
||||
// register for the result.
|
||||
LiftoffRegister result(instance);
|
||||
GenerateCCall(&result, &sig, kStmt, args, ext_ref);
|
||||
GenerateCCall(&result, &sig, kVoid, args, ext_ref);
|
||||
Label* trap_label =
|
||||
AddOutOfLineTrap(decoder, WasmCode::kThrowWasmTrapMemOutOfBounds);
|
||||
__ 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
|
||||
// register for the result.
|
||||
LiftoffRegister result(instance);
|
||||
GenerateCCall(&result, &sig, kStmt, args, ext_ref);
|
||||
GenerateCCall(&result, &sig, kVoid, args, ext_ref);
|
||||
Label* trap_label =
|
||||
AddOutOfLineTrap(decoder, WasmCode::kThrowWasmTrapMemOutOfBounds);
|
||||
__ 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
|
||||
// register for the result.
|
||||
LiftoffRegister result(instance);
|
||||
GenerateCCall(&result, &sig, kStmt, args, ext_ref);
|
||||
GenerateCCall(&result, &sig, kVoid, args, ext_ref);
|
||||
Label* trap_label =
|
||||
AddOutOfLineTrap(decoder, WasmCode::kThrowWasmTrapMemOutOfBounds);
|
||||
__ emit_cond_jump(kEqual, trap_label, kI32, result.gp());
|
||||
@ -6013,7 +6013,7 @@ class LiftoffCompiler {
|
||||
return LoadNullValue(reg.gp(), pinned);
|
||||
case kRtt:
|
||||
case kRttWithDepth:
|
||||
case kStmt:
|
||||
case kVoid:
|
||||
case kBottom:
|
||||
case kRef:
|
||||
UNREACHABLE();
|
||||
|
@ -2948,7 +2948,7 @@ void LiftoffAssembler::CallC(const ValueKindSig* sig,
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -3116,7 +3116,7 @@ void LiftoffAssembler::CallC(const ValueKindSig* sig,
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -2523,7 +2523,7 @@ void LiftoffAssembler::CallC(const ValueKindSig* sig,
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -2804,7 +2804,7 @@ void LiftoffAssembler::CallC(const ValueKindSig* sig,
|
||||
}
|
||||
|
||||
// Load potential output value from the buffer on the stack.
|
||||
if (out_argument_kind != kStmt) {
|
||||
if (out_argument_kind != kVoid) {
|
||||
switch (out_argument_kind) {
|
||||
case kI32:
|
||||
LoadS32(result_reg->gp(), MemOperand(sp));
|
||||
|
@ -4363,7 +4363,7 @@ void LiftoffAssembler::CallC(const ValueKindSig* sig,
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -1212,7 +1212,7 @@ namespace {
|
||||
class SignatureHelper : public i::AllStatic {
|
||||
public:
|
||||
// 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(
|
||||
i::Isolate* isolate, FuncType* type) {
|
||||
@ -1427,7 +1427,7 @@ void PushArgs(const i::wasm::FunctionSig* sig, const Val args[],
|
||||
UNIMPLEMENTED();
|
||||
case i::wasm::kI8:
|
||||
case i::wasm::kI16:
|
||||
case i::wasm::kStmt:
|
||||
case i::wasm::kVoid:
|
||||
case i::wasm::kBottom:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
@ -1468,7 +1468,7 @@ void PopArgs(const i::wasm::FunctionSig* sig, Val results[],
|
||||
UNIMPLEMENTED();
|
||||
case i::wasm::kI8:
|
||||
case i::wasm::kI16:
|
||||
case i::wasm::kStmt:
|
||||
case i::wasm::kVoid:
|
||||
case i::wasm::kBottom:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
@ -1733,7 +1733,7 @@ auto Global::get() const -> Val {
|
||||
UNIMPLEMENTED();
|
||||
case i::wasm::kI8:
|
||||
case i::wasm::kI16:
|
||||
case i::wasm::kStmt:
|
||||
case i::wasm::kVoid:
|
||||
case i::wasm::kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ struct ImmF64Immediate {
|
||||
template <Decoder::ValidateFlag validate>
|
||||
struct GlobalIndexImmediate {
|
||||
uint32_t index;
|
||||
ValueType type = kWasmStmt;
|
||||
ValueType type = kWasmVoid;
|
||||
const WasmGlobal* global = nullptr;
|
||||
uint32_t length;
|
||||
|
||||
@ -518,7 +518,7 @@ struct SelectTypeImmediate {
|
||||
template <Decoder::ValidateFlag validate>
|
||||
struct BlockTypeImmediate {
|
||||
uint32_t length = 1;
|
||||
ValueType type = kWasmStmt;
|
||||
ValueType type = kWasmVoid;
|
||||
uint32_t sig_index = 0;
|
||||
const FunctionSig* sig = nullptr;
|
||||
|
||||
@ -556,7 +556,7 @@ struct BlockTypeImmediate {
|
||||
return static_cast<uint32_t>(sig->parameter_count());
|
||||
}
|
||||
uint32_t out_arity() const {
|
||||
if (type == kWasmStmt) return 0;
|
||||
if (type == kWasmVoid) return 0;
|
||||
if (type != kWasmBottom) return 1;
|
||||
return static_cast<uint32_t>(sig->return_count());
|
||||
}
|
||||
@ -566,7 +566,7 @@ struct BlockTypeImmediate {
|
||||
}
|
||||
ValueType out_type(uint32_t index) {
|
||||
if (type == kWasmBottom) return sig->GetReturn(index);
|
||||
DCHECK_NE(kWasmStmt, type);
|
||||
DCHECK_NE(kWasmVoid, type);
|
||||
DCHECK_EQ(0, index);
|
||||
return type;
|
||||
}
|
||||
@ -914,7 +914,7 @@ struct PcForErrors<Decoder::kFullValidation> {
|
||||
// An entry on the value stack.
|
||||
template <Decoder::ValidateFlag validate>
|
||||
struct ValueBase : public PcForErrors<validate> {
|
||||
ValueType type = kWasmStmt;
|
||||
ValueType type = kWasmVoid;
|
||||
|
||||
ValueBase(const byte* pc, ValueType type)
|
||||
: PcForErrors<validate>(pc), type(type) {}
|
||||
@ -3628,7 +3628,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
|
||||
|
||||
ValueType GetReturnType(const FunctionSig* sig) {
|
||||
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
|
||||
@ -4568,7 +4568,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
|
||||
#define CASE_ATOMIC_STORE_OP(Name, Type) \
|
||||
case kExpr##Name: { \
|
||||
memtype = MachineType::Type(); \
|
||||
ret_type = kWasmStmt; \
|
||||
ret_type = kWasmVoid; \
|
||||
break; /* to generic mem access code below */ \
|
||||
}
|
||||
ATOMIC_STORE_OP_LIST(CASE_ATOMIC_STORE_OP)
|
||||
@ -4604,7 +4604,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
|
||||
// then).
|
||||
CHECK(!this->module_->is_memory64);
|
||||
ArgVector args = PeekArgs(sig);
|
||||
if (ret_type == kWasmStmt) {
|
||||
if (ret_type == kWasmVoid) {
|
||||
CALL_INTERFACE_IF_REACHABLE(AtomicOp, opcode, VectorOf(args), imm,
|
||||
nullptr);
|
||||
DropArgs(sig);
|
||||
@ -4756,7 +4756,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
|
||||
|
||||
V8_INLINE Value CreateValue(ValueType type) { return Value{this->pc_, type}; }
|
||||
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
|
||||
// decoding loop, or individually if more than one element is pushed.
|
||||
DCHECK_GT(stack_capacity_end_, stack_end_);
|
||||
@ -5072,7 +5072,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
|
||||
|
||||
int BuildSimpleOperator(WasmOpcode opcode, const FunctionSig* sig) {
|
||||
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) {
|
||||
return BuildSimpleOperator(opcode, ret, sig->GetParam(0));
|
||||
} else {
|
||||
@ -5085,7 +5085,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
|
||||
int BuildSimpleOperator(WasmOpcode opcode, ValueType return_type,
|
||||
ValueType 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);
|
||||
Drop(val);
|
||||
} else {
|
||||
@ -5101,7 +5101,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
|
||||
ValueType lhs_type, ValueType rhs_type) {
|
||||
Value rval = Peek(0, 1, rhs_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);
|
||||
Drop(2);
|
||||
} else {
|
||||
|
@ -1219,7 +1219,7 @@ class WasmGraphBuildingInterface {
|
||||
return builder_->RefNull();
|
||||
case kRtt:
|
||||
case kRttWithDepth:
|
||||
case kStmt:
|
||||
case kVoid:
|
||||
case kBottom:
|
||||
case kRef:
|
||||
UNREACHABLE();
|
||||
|
@ -647,7 +647,7 @@ class ModuleDecoderImpl : public Decoder {
|
||||
// ===== Imported global =============================================
|
||||
import->index = static_cast<uint32_t>(module_->globals.size());
|
||||
module_->globals.push_back(
|
||||
{kWasmStmt, false, WasmInitExpr(), {0}, true, false});
|
||||
{kWasmVoid, false, WasmInitExpr(), {0}, true, false});
|
||||
WasmGlobal* global = &module_->globals.back();
|
||||
global->type = consume_value_type();
|
||||
global->mutability = consume_mutability();
|
||||
@ -756,7 +756,7 @@ class ModuleDecoderImpl : public Decoder {
|
||||
TRACE("DecodeGlobal[%d] module+%d\n", i, static_cast<int>(pc_ - start_));
|
||||
// Add an uninitialized global and pass a pointer to it.
|
||||
module_->globals.push_back(
|
||||
{kWasmStmt, false, WasmInitExpr(), {0}, false, false});
|
||||
{kWasmVoid, false, WasmInitExpr(), {0}, false, false});
|
||||
WasmGlobal* global = &module_->globals.back();
|
||||
global->type = consume_value_type();
|
||||
global->mutability = consume_mutability();
|
||||
@ -1305,7 +1305,7 @@ class ModuleDecoderImpl : public Decoder {
|
||||
}
|
||||
|
||||
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_; }
|
||||
@ -1349,11 +1349,11 @@ class ModuleDecoderImpl : public Decoder {
|
||||
ValueType TypeOf(const WasmInitExpr& expr) {
|
||||
switch (expr.kind()) {
|
||||
case WasmInitExpr::kNone:
|
||||
return kWasmStmt;
|
||||
return kWasmVoid;
|
||||
case WasmInitExpr::kGlobalGet:
|
||||
return expr.immediate().index < module_->globals.size()
|
||||
? module_->globals[expr.immediate().index].type
|
||||
: kWasmStmt;
|
||||
: kWasmVoid;
|
||||
case WasmInitExpr::kI32Const:
|
||||
return kWasmI32;
|
||||
case WasmInitExpr::kI64Const:
|
||||
@ -1382,7 +1382,7 @@ class ModuleDecoderImpl : public Decoder {
|
||||
return ValueType::Rtt(expr.immediate().heap_type,
|
||||
operand_type.depth() + 1);
|
||||
} else {
|
||||
return kWasmStmt;
|
||||
return kWasmVoid;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1841,7 +1841,7 @@ class ModuleDecoderImpl : public Decoder {
|
||||
}
|
||||
|
||||
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",
|
||||
expected.name().c_str(), TypeOf(expr).name().c_str());
|
||||
}
|
||||
|
@ -923,7 +923,7 @@ void InstanceBuilder::WriteGlobalValue(const WasmGlobal& global,
|
||||
tagged_globals_->set(global.offset, *value->GetRef());
|
||||
break;
|
||||
}
|
||||
case kStmt:
|
||||
case kVoid:
|
||||
case kS128:
|
||||
case kBottom:
|
||||
case kI8:
|
||||
|
@ -42,7 +42,7 @@ class Simd128;
|
||||
V(I16, 1, I16, Int16, 'h', "i16")
|
||||
|
||||
#define FOREACH_VALUE_TYPE(V) \
|
||||
V(Stmt, -1, Void, None, 'v', "<stmt>") \
|
||||
V(Void, -1, Void, None, 'v', "<void>") \
|
||||
FOREACH_NUMERIC_VALUE_TYPE(V) \
|
||||
V(Rtt, kTaggedSizeLog2, Rtt, TaggedPointer, 't', "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_DCHECK(kind != kBottom && kind != kStmt);
|
||||
CONSTEXPR_DCHECK(kind != kBottom && kind != kVoid);
|
||||
return kind != kRef && !is_rtt(kind);
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ constexpr bool is_defaultable(ValueKind kind) {
|
||||
class ValueType {
|
||||
public:
|
||||
/******************************* Constructors *******************************/
|
||||
constexpr ValueType() : bit_field_(KindField::encode(kStmt)) {}
|
||||
constexpr ValueType() : bit_field_(KindField::encode(kVoid)) {}
|
||||
static constexpr ValueType Primitive(ValueKind kind) {
|
||||
CONSTEXPR_DCHECK(kind == kBottom || kind <= kI16);
|
||||
return ValueType(KindField::encode(kind));
|
||||
@ -450,7 +450,7 @@ class ValueType {
|
||||
default:
|
||||
return kRefCode;
|
||||
}
|
||||
case kStmt:
|
||||
case kVoid:
|
||||
return kVoidCode;
|
||||
case kRtt:
|
||||
return kRttCode;
|
||||
@ -555,7 +555,7 @@ constexpr ValueType kWasmF64 = ValueType::Primitive(kF64);
|
||||
constexpr ValueType kWasmS128 = ValueType::Primitive(kS128);
|
||||
constexpr ValueType kWasmI8 = ValueType::Primitive(kI8);
|
||||
constexpr ValueType kWasmI16 = ValueType::Primitive(kI16);
|
||||
constexpr ValueType kWasmStmt = ValueType::Primitive(kStmt);
|
||||
constexpr ValueType kWasmVoid = ValueType::Primitive(kVoid);
|
||||
constexpr ValueType kWasmBottom = ValueType::Primitive(kBottom);
|
||||
// Established reference-type proposal shorthands.
|
||||
constexpr ValueType kWasmFuncRef = ValueType::Ref(HeapType::kFunc, kNullable);
|
||||
|
@ -642,7 +642,7 @@ class DebugInfoImpl {
|
||||
}
|
||||
case kI8:
|
||||
case kI16:
|
||||
case kStmt:
|
||||
case kVoid:
|
||||
case kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
@ -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).
|
||||
// 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.
|
||||
bool GetValueType(Isolate* isolate, MaybeLocal<Value> maybe,
|
||||
Local<Context> context, i::wasm::ValueType* type,
|
||||
@ -1228,7 +1228,7 @@ bool GetValueType(Isolate* isolate, MaybeLocal<Value> maybe,
|
||||
*type = i::wasm::kWasmEqRef;
|
||||
} else {
|
||||
// Unrecognized type.
|
||||
*type = i::wasm::kWasmStmt;
|
||||
*type = i::wasm::kWasmVoid;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1273,7 +1273,7 @@ void WebAssemblyGlobal(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
v8::MaybeLocal<v8::Value> maybe =
|
||||
descriptor->Get(context, v8_str(isolate, "value"));
|
||||
if (!GetValueType(isolate, maybe, context, &type, enabled_features)) return;
|
||||
if (type == i::wasm::kWasmStmt) {
|
||||
if (type == i::wasm::kWasmVoid) {
|
||||
thrower.TypeError(
|
||||
"Descriptor property 'value' must be a WebAssembly type");
|
||||
return;
|
||||
@ -1386,7 +1386,7 @@ void WebAssemblyGlobal(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
UNIMPLEMENTED();
|
||||
case i::wasm::kI8:
|
||||
case i::wasm::kI16:
|
||||
case i::wasm::kStmt:
|
||||
case i::wasm::kVoid:
|
||||
case i::wasm::kS128:
|
||||
case i::wasm::kBottom:
|
||||
UNREACHABLE();
|
||||
@ -1489,7 +1489,7 @@ void WebAssemblyFunction(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
i::wasm::ValueType type;
|
||||
MaybeLocal<Value> maybe = parameters->Get(context, i);
|
||||
if (!GetValueType(isolate, maybe, context, &type, enabled_features)) return;
|
||||
if (type == i::wasm::kWasmStmt) {
|
||||
if (type == i::wasm::kWasmVoid) {
|
||||
thrower.TypeError(
|
||||
"Argument 0 parameter type at index #%u must be a value type", i);
|
||||
return;
|
||||
@ -1500,7 +1500,7 @@ void WebAssemblyFunction(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
i::wasm::ValueType type;
|
||||
MaybeLocal<Value> maybe = results->Get(context, i);
|
||||
if (!GetValueType(isolate, maybe, context, &type, enabled_features)) return;
|
||||
if (type == i::wasm::kWasmStmt) {
|
||||
if (type == i::wasm::kWasmVoid) {
|
||||
thrower.TypeError(
|
||||
"Argument 0 result type at index #%u must be a value type", i);
|
||||
return;
|
||||
@ -1863,7 +1863,7 @@ void WebAssemblyGlobalGetValueCommon(
|
||||
case i::wasm::kI8:
|
||||
case i::wasm::kI16:
|
||||
case i::wasm::kBottom:
|
||||
case i::wasm::kStmt:
|
||||
case i::wasm::kVoid:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
@ -1960,7 +1960,7 @@ void WebAssemblyGlobalSetValue(
|
||||
case i::wasm::kI8:
|
||||
case i::wasm::kI16:
|
||||
case i::wasm::kBottom:
|
||||
case i::wasm::kStmt:
|
||||
case i::wasm::kVoid:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -503,7 +503,7 @@ void WriteInitializerExpression(ZoneBuffer* buffer, const WasmInitExpr& init,
|
||||
break;
|
||||
case kI8:
|
||||
case kI16:
|
||||
case kStmt:
|
||||
case kVoid:
|
||||
case kS128:
|
||||
case kBottom:
|
||||
case kRef:
|
||||
|
@ -365,7 +365,7 @@ struct WasmTable {
|
||||
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 maximum_size = 0; // maximum table size.
|
||||
bool has_maximum_size = false; // true if there is a maximum size.
|
||||
|
@ -612,7 +612,7 @@ void WasmTableObject::UpdateDispatchTables(
|
||||
int total_count = serialized_sig.length() - 1;
|
||||
std::unique_ptr<wasm::ValueType[]> reps(new wasm::ValueType[total_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++) {
|
||||
if (serialized_sig.get(i) == kMarker) {
|
||||
result_count = i;
|
||||
@ -1641,7 +1641,7 @@ wasm::WasmValue WasmStruct::GetFieldValue(uint32_t index) {
|
||||
case wasm::kRttWithDepth:
|
||||
// TODO(7748): Expose RTTs to DevTools.
|
||||
UNIMPLEMENTED();
|
||||
case wasm::kStmt:
|
||||
case wasm::kVoid:
|
||||
case wasm::kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -1671,7 +1671,7 @@ wasm::WasmValue WasmArray::GetElement(uint32_t index) {
|
||||
case wasm::kRttWithDepth:
|
||||
// TODO(7748): Expose RTTs to DevTools.
|
||||
UNIMPLEMENTED();
|
||||
case wasm::kStmt:
|
||||
case wasm::kVoid:
|
||||
case wasm::kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -1733,7 +1733,7 @@ bool WasmCapiFunction::MatchesSignature(const wasm::FunctionSig* sig) const {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (serialized_sig.get(serialized_index) != wasm::kWasmStmt) return false;
|
||||
if (serialized_sig.get(serialized_index) != wasm::kWasmVoid) return false;
|
||||
serialized_index++;
|
||||
for (int i = 0; i < param_count; i++, serialized_index++) {
|
||||
if (sig->GetParam(i) != serialized_sig.get(serialized_index)) return false;
|
||||
@ -1830,7 +1830,7 @@ uint32_t WasmExceptionPackage::GetEncodedSize(
|
||||
break;
|
||||
case wasm::kRtt:
|
||||
case wasm::kRttWithDepth:
|
||||
case wasm::kStmt:
|
||||
case wasm::kVoid:
|
||||
case wasm::kBottom:
|
||||
case wasm::kI8:
|
||||
case wasm::kI16:
|
||||
|
@ -575,7 +575,7 @@ enum WasmOpcodeSig : byte {
|
||||
#undef DECLARE_SIG_ENUM
|
||||
#define DECLARE_SIG(name, ...) \
|
||||
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( \
|
||||
kReturnsCount_##name, static_cast<int>(arraysize(kTypes_##name)) - 1, \
|
||||
kTypes_##name + (1 - kReturnsCount_##name));
|
||||
|
@ -708,7 +708,7 @@ bool V8_EXPORT_PRIVATE IsJSCompatibleSignature(const FunctionSig* sig,
|
||||
// All signatures.
|
||||
#define FOREACH_SIGNATURE(V) \
|
||||
FOREACH_SIMD_SIGNATURE(V) \
|
||||
V(v_v, kWasmStmt) \
|
||||
V(v_v, kWasmVoid) \
|
||||
V(i_ii, kWasmI32, kWasmI32, kWasmI32) \
|
||||
V(i_i, kWasmI32, kWasmI32) \
|
||||
V(i_v, kWasmI32) \
|
||||
@ -733,15 +733,15 @@ bool V8_EXPORT_PRIVATE IsJSCompatibleSignature(const FunctionSig* sig,
|
||||
V(d_f, kWasmF64, kWasmF32) \
|
||||
V(d_i, kWasmF64, kWasmI32) \
|
||||
V(d_l, kWasmF64, kWasmI64) \
|
||||
V(v_i, kWasmStmt, kWasmI32) \
|
||||
V(v_ii, kWasmStmt, kWasmI32, kWasmI32) \
|
||||
V(v_id, kWasmStmt, kWasmI32, kWasmF64) \
|
||||
V(v_i, kWasmVoid, kWasmI32) \
|
||||
V(v_ii, kWasmVoid, kWasmI32, kWasmI32) \
|
||||
V(v_id, kWasmVoid, 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(v_il, kWasmStmt, kWasmI32, kWasmI64) \
|
||||
V(v_il, kWasmVoid, 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(l_ill, kWasmI64, kWasmI32, kWasmI64, 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_si, kWasmS128, kWasmS128, kWasmI32) \
|
||||
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_is, kWasmS128, kWasmI32, kWasmS128)
|
||||
|
||||
|
@ -281,7 +281,7 @@ V8_NOINLINE V8_EXPORT_PRIVATE bool IsSubtypeOfImpl(
|
||||
case kS128:
|
||||
case kI8:
|
||||
case kI16:
|
||||
case kStmt:
|
||||
case kVoid:
|
||||
case kBottom:
|
||||
return subtype == supertype;
|
||||
case kRtt:
|
||||
|
@ -88,7 +88,7 @@ ASSERT_TRIVIALLY_COPYABLE(Handle<Object>);
|
||||
// A wasm value with type information.
|
||||
class WasmValue {
|
||||
public:
|
||||
WasmValue() : type_(kWasmStmt), bit_pattern_{} {}
|
||||
WasmValue() : type_(kWasmVoid), bit_pattern_{} {}
|
||||
|
||||
#define DEFINE_TYPE_SPECIFIC_METHODS(name, localtype, ctype) \
|
||||
explicit WasmValue(ctype v) : type_(localtype), bit_pattern_{} { \
|
||||
|
@ -1491,7 +1491,7 @@ static void CompileCallIndirectMany(TestExecutionTier tier, ValueType param) {
|
||||
TestSignatures sigs;
|
||||
for (byte num_params = 0; num_params < 40; num_params++) {
|
||||
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);
|
||||
|
@ -3382,7 +3382,7 @@ static void CompileCallIndirectMany(TestExecutionTier tier, ValueType param) {
|
||||
TestSignatures sigs;
|
||||
for (byte num_params = 0; num_params < 40; ++num_params) {
|
||||
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);
|
||||
|
@ -393,7 +393,7 @@ ZoneBuffer GetModuleWithInvalidSection(Zone* zone) {
|
||||
TestSignatures sigs;
|
||||
WasmModuleBuilder builder(zone);
|
||||
// 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());
|
||||
uint8_t code[] = {kExprLocalGet, 0, kExprEnd};
|
||||
|
@ -121,8 +121,8 @@ class TestSignatures {
|
||||
FunctionSig* iii_v() { return &sig_iii_v; }
|
||||
|
||||
FunctionSig* many(Zone* zone, ValueType ret, ValueType param, int count) {
|
||||
FunctionSig::Builder builder(zone, ret == kWasmStmt ? 0 : 1, count);
|
||||
if (ret != kWasmStmt) builder.AddReturn(ret);
|
||||
FunctionSig::Builder builder(zone, ret == kWasmVoid ? 0 : 1, count);
|
||||
if (ret != kWasmVoid) builder.AddReturn(ret);
|
||||
for (int i = 0; i < count; i++) {
|
||||
builder.AddParam(param);
|
||||
}
|
||||
|
@ -1438,7 +1438,7 @@ class WasmInterpreterInternals {
|
||||
case kRef: // TODO(7748): Implement.
|
||||
case kRtt:
|
||||
case kRttWithDepth:
|
||||
case kStmt:
|
||||
case kVoid:
|
||||
case kBottom:
|
||||
case kI8:
|
||||
case kI16:
|
||||
@ -3204,7 +3204,7 @@ class WasmInterpreterInternals {
|
||||
case kRttWithDepth:
|
||||
case kI8:
|
||||
case kI16:
|
||||
case kStmt:
|
||||
case kVoid:
|
||||
case kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -3322,7 +3322,7 @@ class WasmInterpreterInternals {
|
||||
case kRttWithDepth:
|
||||
case kI8:
|
||||
case kI16:
|
||||
case kStmt:
|
||||
case kVoid:
|
||||
case kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -3721,7 +3721,7 @@ class WasmInterpreterInternals {
|
||||
case kRttWithDepth:
|
||||
case kI8:
|
||||
case kI16:
|
||||
case kStmt:
|
||||
case kVoid:
|
||||
case kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -4022,7 +4022,7 @@ class WasmInterpreterInternals {
|
||||
}
|
||||
|
||||
void Push(WasmValue val) {
|
||||
DCHECK_NE(kWasmStmt, val.type());
|
||||
DCHECK_NE(kWasmVoid, val.type());
|
||||
DCHECK_NE(kWasmI8, val.type());
|
||||
DCHECK_NE(kWasmI16, val.type());
|
||||
DCHECK_LE(1, stack_limit_ - sp_);
|
||||
@ -4036,7 +4036,7 @@ class WasmInterpreterInternals {
|
||||
void Push(WasmValue* vals, size_t arity) {
|
||||
DCHECK_LE(arity, stack_limit_ - sp_);
|
||||
for (WasmValue *val = vals, *end = vals + arity; val != end; ++val) {
|
||||
DCHECK_NE(kWasmStmt, val->type());
|
||||
DCHECK_NE(kWasmVoid, val->type());
|
||||
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]);
|
||||
break;
|
||||
}
|
||||
case kStmt:
|
||||
case kVoid:
|
||||
PrintF("void");
|
||||
break;
|
||||
case kRef:
|
||||
|
@ -74,7 +74,7 @@ OwnedVector<WasmValue> MakeDefaultInterpreterArguments(Isolate* isolate,
|
||||
case kRttWithDepth:
|
||||
case kI8:
|
||||
case kI16:
|
||||
case kStmt:
|
||||
case kVoid:
|
||||
case kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -109,7 +109,7 @@ OwnedVector<Handle<Object>> MakeDefaultArguments(Isolate* isolate,
|
||||
case kRttWithDepth:
|
||||
case kI8:
|
||||
case kI16:
|
||||
case kStmt:
|
||||
case kVoid:
|
||||
case kBottom:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
@ -19,11 +19,11 @@ var func_a_idx =
|
||||
builder.addFunction('wasm_B', kSig_v_i)
|
||||
.addBody([
|
||||
kExprLoop,
|
||||
kWasmStmt, // while
|
||||
kWasmVoid, // while
|
||||
kExprLocalGet,
|
||||
0, // -
|
||||
kExprIf,
|
||||
kWasmStmt, // if <param0> != 0
|
||||
kWasmVoid, // if <param0> != 0
|
||||
kExprLocalGet,
|
||||
0, // -
|
||||
kExprI32Const,
|
||||
|
@ -122,7 +122,7 @@ class WasmGenerator {
|
||||
: gen_(gen), emit_end_(emit_end) {
|
||||
gen->blocks_.emplace_back(br_types.begin(), br_types.end());
|
||||
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;
|
||||
}
|
||||
if (param_types.size() == 0 && result_types.size() == 1) {
|
||||
@ -135,11 +135,11 @@ class WasmGenerator {
|
||||
FunctionSig::Builder builder(zone, result_types.size(),
|
||||
param_types.size());
|
||||
for (auto& type : param_types) {
|
||||
DCHECK_NE(type, kWasmStmt);
|
||||
DCHECK_NE(type, kWasmVoid);
|
||||
builder.AddParam(type);
|
||||
}
|
||||
for (auto& type : result_types) {
|
||||
DCHECK_NE(type, kWasmStmt);
|
||||
DCHECK_NE(type, kWasmVoid);
|
||||
builder.AddReturn(type);
|
||||
}
|
||||
FunctionSig* sig = builder.Build();
|
||||
@ -199,10 +199,10 @@ class WasmGenerator {
|
||||
|
||||
template <ValueKind T, IfType type>
|
||||
void if_(DataRange* data) {
|
||||
static_assert(T == kStmt || type == kIfElse,
|
||||
static_assert(T == kVoid || type == kIfElse,
|
||||
"if without else cannot produce a value");
|
||||
if_({},
|
||||
T == kStmt ? Vector<ValueType>{} : VectorOf({ValueType::Primitive(T)}),
|
||||
T == kVoid ? Vector<ValueType>{} : VectorOf({ValueType::Primitive(T)}),
|
||||
type, data);
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ class WasmGenerator {
|
||||
uint8_t delegate_target = data->get<uint8_t>() % (try_blocks_.size() + 1);
|
||||
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>{}
|
||||
: VectorOf(&return_type, 1);
|
||||
BlockScope block_scope(this, kExprTry, {}, return_type_vec, return_type_vec,
|
||||
@ -305,7 +305,7 @@ class WasmGenerator {
|
||||
builder_->EmitWithI32V(
|
||||
kExprBrIf, static_cast<uint32_t>(blocks_.size()) - 1 - target_block);
|
||||
ConsumeAndGenerate(break_types,
|
||||
wanted_kind == kStmt
|
||||
wanted_kind == kVoid
|
||||
? Vector<ValueType>{}
|
||||
: VectorOf({ValueType::Primitive(wanted_kind)}),
|
||||
data);
|
||||
@ -536,9 +536,9 @@ class WasmGenerator {
|
||||
|
||||
void ConvertOrGenerate(ValueType src, ValueType dst, DataRange* data) {
|
||||
if (src == dst) return;
|
||||
if (src == kWasmStmt && dst != kWasmStmt) {
|
||||
if (src == kWasmVoid && dst != kWasmVoid) {
|
||||
Generate(dst, data);
|
||||
} else if (dst == kWasmStmt && src != kWasmStmt) {
|
||||
} else if (dst == kWasmVoid && src != kWasmVoid) {
|
||||
builder_->Emit(kExprDrop);
|
||||
} else {
|
||||
Convert(src, dst);
|
||||
@ -579,12 +579,12 @@ class WasmGenerator {
|
||||
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.
|
||||
Generate(wanted_kind, data);
|
||||
return;
|
||||
}
|
||||
if (wanted_kind == kWasmStmt) {
|
||||
if (wanted_kind == kWasmVoid) {
|
||||
// The call did generate values, but we did not want one.
|
||||
for (size_t i = 0; i < sig->return_count(); ++i) {
|
||||
builder_->Emit(kExprDrop);
|
||||
@ -593,16 +593,16 @@ class WasmGenerator {
|
||||
}
|
||||
auto return_types = VectorOf(sig->returns().begin(), sig->return_count());
|
||||
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);
|
||||
}
|
||||
|
||||
struct Var {
|
||||
uint32_t index;
|
||||
ValueType type = kWasmStmt;
|
||||
ValueType type = kWasmVoid;
|
||||
Var() = default;
|
||||
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) {
|
||||
@ -622,24 +622,24 @@ class WasmGenerator {
|
||||
// If there are no locals and no parameters, just generate any value (if a
|
||||
// value is needed), or do nothing.
|
||||
if (!local.is_valid()) {
|
||||
if (wanted_kind == kStmt) return;
|
||||
if (wanted_kind == kVoid) return;
|
||||
return Generate<wanted_kind>(data);
|
||||
}
|
||||
|
||||
if (opcode != kExprLocalGet) Generate(local.type, data);
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
template <ValueKind wanted_kind>
|
||||
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);
|
||||
}
|
||||
|
||||
void set_local(DataRange* data) { local_op<kStmt>(data, kExprLocalSet); }
|
||||
void set_local(DataRange* data) { local_op<kVoid>(data, kExprLocalSet); }
|
||||
|
||||
template <ValueKind wanted_kind>
|
||||
void tee_local(DataRange* data) {
|
||||
@ -671,12 +671,12 @@ class WasmGenerator {
|
||||
|
||||
template <ValueKind wanted_kind>
|
||||
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);
|
||||
// If there are no globals, just generate any value (if a value is needed),
|
||||
// or do nothing.
|
||||
if (!global.is_valid()) {
|
||||
if (wanted_kind == kStmt) return;
|
||||
if (wanted_kind == kVoid) return;
|
||||
return Generate<wanted_kind>(data);
|
||||
}
|
||||
|
||||
@ -690,13 +690,13 @@ class WasmGenerator {
|
||||
|
||||
template <ValueKind wanted_kind>
|
||||
void get_global(DataRange* data) {
|
||||
static_assert(wanted_kind != kStmt, "illegal type");
|
||||
static_assert(wanted_kind != kVoid, "illegal type");
|
||||
global_op<wanted_kind>(data);
|
||||
}
|
||||
|
||||
template <ValueKind select_kind>
|
||||
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);
|
||||
// num_types is always 1.
|
||||
uint8_t num_types = 1;
|
||||
@ -704,7 +704,7 @@ class WasmGenerator {
|
||||
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) {
|
||||
bool rethrow = data->get<uint8_t>() % 2;
|
||||
@ -822,31 +822,31 @@ class WasmGenerator {
|
||||
};
|
||||
|
||||
template <>
|
||||
void WasmGenerator::block<kStmt>(DataRange* data) {
|
||||
void WasmGenerator::block<kVoid>(DataRange* data) {
|
||||
block({}, {}, data);
|
||||
}
|
||||
|
||||
template <>
|
||||
void WasmGenerator::loop<kStmt>(DataRange* data) {
|
||||
void WasmGenerator::loop<kVoid>(DataRange* data) {
|
||||
loop({}, {}, data);
|
||||
}
|
||||
|
||||
template <>
|
||||
void WasmGenerator::Generate<kStmt>(DataRange* data) {
|
||||
void WasmGenerator::Generate<kVoid>(DataRange* data) {
|
||||
GeneratorRecursionScope rec_scope(this);
|
||||
if (recursion_limit_reached() || data->size() == 0) return;
|
||||
|
||||
constexpr GenerateFn alternatives[] = {
|
||||
&WasmGenerator::sequence<kStmt, kStmt>,
|
||||
&WasmGenerator::sequence<kStmt, kStmt, kStmt, kStmt>,
|
||||
&WasmGenerator::sequence<kStmt, kStmt, kStmt, kStmt, kStmt, kStmt, kStmt,
|
||||
kStmt>,
|
||||
&WasmGenerator::block<kStmt>,
|
||||
&WasmGenerator::loop<kStmt>,
|
||||
&WasmGenerator::if_<kStmt, kIf>,
|
||||
&WasmGenerator::if_<kStmt, kIfElse>,
|
||||
&WasmGenerator::sequence<kVoid, kVoid>,
|
||||
&WasmGenerator::sequence<kVoid, kVoid, kVoid, kVoid>,
|
||||
&WasmGenerator::sequence<kVoid, kVoid, kVoid, kVoid, kVoid, kVoid, kVoid,
|
||||
kVoid>,
|
||||
&WasmGenerator::block<kVoid>,
|
||||
&WasmGenerator::loop<kVoid>,
|
||||
&WasmGenerator::if_<kVoid, kIf>,
|
||||
&WasmGenerator::if_<kVoid, kIfElse>,
|
||||
&WasmGenerator::br,
|
||||
&WasmGenerator::br_if<kStmt>,
|
||||
&WasmGenerator::br_if<kVoid>,
|
||||
|
||||
&WasmGenerator::memop<kExprI32StoreMem, kI32>,
|
||||
&WasmGenerator::memop<kExprI32StoreMem8, kI32>,
|
||||
@ -872,13 +872,13 @@ void WasmGenerator::Generate<kStmt>(DataRange* data) {
|
||||
|
||||
&WasmGenerator::drop,
|
||||
|
||||
&WasmGenerator::call<kStmt>,
|
||||
&WasmGenerator::call_indirect<kStmt>,
|
||||
&WasmGenerator::call<kVoid>,
|
||||
&WasmGenerator::call_indirect<kVoid>,
|
||||
|
||||
&WasmGenerator::set_local,
|
||||
&WasmGenerator::set_global,
|
||||
&WasmGenerator::throw_or_rethrow,
|
||||
&WasmGenerator::try_block<kStmt>};
|
||||
&WasmGenerator::try_block<kVoid>};
|
||||
|
||||
GenerateOneOf(alternatives, data);
|
||||
}
|
||||
@ -897,9 +897,9 @@ void WasmGenerator::Generate<kI32>(DataRange* data) {
|
||||
&WasmGenerator::i32_const<3>,
|
||||
&WasmGenerator::i32_const<4>,
|
||||
|
||||
&WasmGenerator::sequence<kI32, kStmt>,
|
||||
&WasmGenerator::sequence<kStmt, kI32>,
|
||||
&WasmGenerator::sequence<kStmt, kI32, kStmt>,
|
||||
&WasmGenerator::sequence<kI32, kVoid>,
|
||||
&WasmGenerator::sequence<kVoid, kI32>,
|
||||
&WasmGenerator::sequence<kVoid, kI32, kVoid>,
|
||||
|
||||
&WasmGenerator::op<kExprI32Eqz, kI32>,
|
||||
&WasmGenerator::op<kExprI32Eq, kI32, kI32>,
|
||||
@ -1049,9 +1049,9 @@ void WasmGenerator::Generate<kI64>(DataRange* data) {
|
||||
&WasmGenerator::i64_const<7>,
|
||||
&WasmGenerator::i64_const<8>,
|
||||
|
||||
&WasmGenerator::sequence<kI64, kStmt>,
|
||||
&WasmGenerator::sequence<kStmt, kI64>,
|
||||
&WasmGenerator::sequence<kStmt, kI64, kStmt>,
|
||||
&WasmGenerator::sequence<kI64, kVoid>,
|
||||
&WasmGenerator::sequence<kVoid, kI64>,
|
||||
&WasmGenerator::sequence<kVoid, kI64, kVoid>,
|
||||
|
||||
&WasmGenerator::op<kExprI64Add, kI64, kI64>,
|
||||
&WasmGenerator::op<kExprI64Sub, kI64, kI64>,
|
||||
@ -1154,9 +1154,9 @@ void WasmGenerator::Generate<kF32>(DataRange* data) {
|
||||
}
|
||||
|
||||
constexpr GenerateFn alternatives[] = {
|
||||
&WasmGenerator::sequence<kF32, kStmt>,
|
||||
&WasmGenerator::sequence<kStmt, kF32>,
|
||||
&WasmGenerator::sequence<kStmt, kF32, kStmt>,
|
||||
&WasmGenerator::sequence<kF32, kVoid>,
|
||||
&WasmGenerator::sequence<kVoid, kF32>,
|
||||
&WasmGenerator::sequence<kVoid, kF32, kVoid>,
|
||||
|
||||
&WasmGenerator::op<kExprF32Abs, kF32>,
|
||||
&WasmGenerator::op<kExprF32Neg, kF32>,
|
||||
@ -1211,9 +1211,9 @@ void WasmGenerator::Generate<kF64>(DataRange* data) {
|
||||
}
|
||||
|
||||
constexpr GenerateFn alternatives[] = {
|
||||
&WasmGenerator::sequence<kF64, kStmt>,
|
||||
&WasmGenerator::sequence<kStmt, kF64>,
|
||||
&WasmGenerator::sequence<kStmt, kF64, kStmt>,
|
||||
&WasmGenerator::sequence<kF64, kVoid>,
|
||||
&WasmGenerator::sequence<kVoid, kF64>,
|
||||
&WasmGenerator::sequence<kVoid, kF64, kVoid>,
|
||||
|
||||
&WasmGenerator::op<kExprF64Abs, kF64>,
|
||||
&WasmGenerator::op<kExprF64Neg, kF64>,
|
||||
@ -1512,8 +1512,8 @@ void WasmGenerator::grow_memory(DataRange* data) {
|
||||
|
||||
void WasmGenerator::Generate(ValueType type, DataRange* data) {
|
||||
switch (type.kind()) {
|
||||
case kStmt:
|
||||
return Generate<kStmt>(data);
|
||||
case kVoid:
|
||||
return Generate<kVoid>(data);
|
||||
case kI32:
|
||||
return Generate<kI32>(data);
|
||||
case kI64:
|
||||
@ -1554,7 +1554,7 @@ void WasmGenerator::Generate(Vector<const ValueType> types, DataRange* data) {
|
||||
}
|
||||
|
||||
if (types.size() == 0) {
|
||||
Generate(kWasmStmt, data);
|
||||
Generate(kWasmVoid, data);
|
||||
return;
|
||||
}
|
||||
if (types.size() == 1) {
|
||||
|
@ -22,8 +22,8 @@ var func_idx = builder.addFunction('helper', kSig_v_v)
|
||||
builder.addFunction('main', kSig_v_i)
|
||||
.addBody([
|
||||
kExprLocalGet, 0,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprCallFunction, func_idx,
|
||||
kExprEnd,
|
||||
kExprEnd
|
||||
|
@ -22,7 +22,7 @@ function createModule(...customSections) {
|
||||
var builder = new WasmModuleBuilder();
|
||||
builder.addFunction('nopFunction', kSig_v_v).addBody([kExprNop]);
|
||||
builder.addFunction('main', kSig_v_v)
|
||||
.addBody([kExprBlock, kWasmStmt, kExprI32Const, 2, kExprDrop, kExprEnd])
|
||||
.addBody([kExprBlock, kWasmVoid, kExprI32Const, 2, kExprDrop, kExprEnd])
|
||||
.exportAs('main');
|
||||
for (var { name, value } of customSections) {
|
||||
builder.addCustomSection(name, value);
|
||||
|
@ -21,8 +21,8 @@ var func_idx = builder.addFunction('helper', kSig_v_v)
|
||||
builder.addFunction('main', kSig_v_i)
|
||||
.addBody([
|
||||
kExprLocalGet, 0,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprCallFunction, func_idx,
|
||||
kExprEnd,
|
||||
kExprEnd
|
||||
|
@ -17,9 +17,9 @@ const func_a =
|
||||
const func_b = builder.addFunction('wasm_B', kSig_v_i)
|
||||
.addBody([
|
||||
// clang-format off
|
||||
kExprLoop, kWasmStmt, // while
|
||||
kExprLoop, kWasmVoid, // while
|
||||
kExprLocalGet, 0, // -
|
||||
kExprIf, kWasmStmt, // if <param0> != 0
|
||||
kExprIf, kWasmVoid, // if <param0> != 0
|
||||
kExprLocalGet, 0, // -
|
||||
kExprI32Const, 1, // -
|
||||
kExprI32Sub, // -
|
||||
|
@ -20,7 +20,7 @@ var sig_index = builder.addType(kSig_v_v);
|
||||
|
||||
builder.addFunction('main', kSig_v_v)
|
||||
.addBody([
|
||||
kExprBlock, kWasmStmt, kExprI32Const, 0, kExprCallIndirect, sig_index,
|
||||
kExprBlock, kWasmVoid, kExprI32Const, 0, kExprCallIndirect, sig_index,
|
||||
kTableZero, kExprEnd
|
||||
])
|
||||
.exportAs('main');
|
||||
|
@ -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...
|
||||
builder.addFunction('main', kSig_v_v)
|
||||
.addBody(
|
||||
[kExprBlock, kWasmStmt, kExprCallFunction, call_imported_idx, kExprEnd])
|
||||
[kExprBlock, kWasmVoid, kExprCallFunction, call_imported_idx, kExprEnd])
|
||||
.exportAs('main');
|
||||
|
||||
var module_bytes = builder.toArray();
|
||||
|
@ -12,7 +12,7 @@ session.setupScriptMap();
|
||||
var builder = new WasmModuleBuilder();
|
||||
|
||||
var callee = builder.addFunction('callee', kSig_v_v)
|
||||
.addBody([kExprBlock, kWasmStmt, kExprEnd])
|
||||
.addBody([kExprBlock, kWasmVoid, kExprEnd])
|
||||
.index;
|
||||
|
||||
var main = builder.addFunction('main', kSig_v_i)
|
||||
|
@ -18,9 +18,9 @@ const func_a_idx = func_a.index;
|
||||
const func_b = builder.addFunction('wasm_B', kSig_v_i)
|
||||
.addBody([
|
||||
// clang-format off
|
||||
kExprLoop, kWasmStmt, // while
|
||||
kExprLoop, kWasmVoid, // while
|
||||
kExprLocalGet, 0, // -
|
||||
kExprIf, kWasmStmt, // if <param0> != 0
|
||||
kExprIf, kWasmVoid, // if <param0> != 0
|
||||
kExprLocalGet, 0, // -
|
||||
kExprI32Const, 1, // -
|
||||
kExprI32Sub, // -
|
||||
|
@ -17,9 +17,9 @@ var func_a_idx =
|
||||
builder.addFunction('wasm_B', kSig_v_i)
|
||||
.addBody([
|
||||
// clang-format off
|
||||
kExprLoop, kWasmStmt, // while
|
||||
kExprLoop, kWasmVoid, // while
|
||||
kExprLocalGet, 0, // -
|
||||
kExprIf, kWasmStmt, // if <param0> != 0
|
||||
kExprIf, kWasmVoid, // if <param0> != 0
|
||||
kExprLocalGet, 0, // -
|
||||
kExprI32Const, 1, // -
|
||||
kExprI32Sub, // -
|
||||
|
@ -17,9 +17,9 @@ var func_a_idx =
|
||||
var func_b = builder.addFunction('wasm_B', kSig_v_i)
|
||||
.addBody([
|
||||
// clang-format off
|
||||
kExprLoop, kWasmStmt, // while
|
||||
kExprLoop, kWasmVoid, // while
|
||||
kExprLocalGet, 0, // -
|
||||
kExprIf, kWasmStmt, // if <param0> != 0
|
||||
kExprIf, kWasmVoid, // if <param0> != 0
|
||||
kExprLocalGet, 0, // -
|
||||
kExprI32Const, 1, // -
|
||||
kExprI32Sub, // -
|
||||
|
@ -10,7 +10,7 @@ let builder = new WasmModuleBuilder();
|
||||
let except = builder.addException(kSig_v_i);
|
||||
builder.addFunction("rethrow0", kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprI32Const, 23,
|
||||
kExprThrow, except,
|
||||
kExprCatch, except,
|
||||
|
@ -14,15 +14,15 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
builder.addFunction("main", kSig_v_l)
|
||||
.addLocals(kWasmI32, 2)
|
||||
.addBody([
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprLoop, kWasmVoid,
|
||||
kExprLocalGet, 0x02,
|
||||
kExprLocalTee, 0x01,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprElse,
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprLoop, kWasmVoid,
|
||||
kExprLoop, kWasmVoid,
|
||||
kExprLocalGet, 0x01,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprElse,
|
||||
kExprLocalGet, 0x02,
|
||||
kExprBrIf, 0x04,
|
||||
|
@ -23,7 +23,7 @@ kExprEnd, // @3
|
||||
// signature: d_v
|
||||
// body:
|
||||
kExprBlock, kWasmF64, // @3 f64
|
||||
kExprBlock, kWasmStmt, // @5
|
||||
kExprBlock, kWasmVoid, // @5
|
||||
kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f,
|
||||
kExprLocalTee, 0x00,
|
||||
kExprLocalTee, 0x01,
|
||||
|
@ -10,7 +10,7 @@ const NUM_CASES = 3073;
|
||||
let body = [];
|
||||
// Add one block, so we can jump to this block or to the function end.
|
||||
body.push(kExprBlock);
|
||||
body.push(kWasmStmt);
|
||||
body.push(kWasmVoid);
|
||||
|
||||
// Add the big BrTable.
|
||||
body.push(kExprLocalGet, 0);
|
||||
|
@ -19,15 +19,15 @@ builder.addFunction(undefined, sig)
|
||||
kExprLocalGet, 0x1b, // local.get
|
||||
kExprLocalSet, 0x1c, // local.set
|
||||
kExprI32Const, 0x00, // i32.const
|
||||
kExprIf, kWasmStmt, // if @11
|
||||
kExprIf, kWasmVoid, // if @11
|
||||
kExprGlobalGet, 0x00, // global.get
|
||||
kExprLocalSet, 0x1e, // local.set
|
||||
kExprBlock, kWasmStmt, // block @19
|
||||
kExprBlock, kWasmVoid, // block @19
|
||||
kExprGlobalGet, 0x00, // global.get
|
||||
kExprLocalSet, 0x21, // local.set
|
||||
kExprBlock, kWasmStmt, // block @25
|
||||
kExprBlock, kWasmStmt, // block @27
|
||||
kExprBlock, kWasmStmt, // block @29
|
||||
kExprBlock, kWasmVoid, // block @25
|
||||
kExprBlock, kWasmVoid, // block @27
|
||||
kExprBlock, kWasmVoid, // block @29
|
||||
kExprGlobalGet, 0x00, // global.get
|
||||
kExprLocalSet, 0x0a, // local.set
|
||||
kExprI32Const, 0x00, // i32.const
|
||||
@ -42,19 +42,19 @@ kExprIf, kWasmStmt, // if @11
|
||||
kExprI32Const, 0x01, // i32.const
|
||||
kExprLocalSet, 0x36, // local.set
|
||||
kExprI32Const, 0x00, // i32.const
|
||||
kExprIf, kWasmStmt, // if @56
|
||||
kExprIf, kWasmVoid, // if @56
|
||||
kExprEnd, // end @59
|
||||
kExprLocalGet, 0x00, // local.get
|
||||
kExprLocalSet, 0x10, // local.set
|
||||
kExprI32Const, 0x00, // i32.const
|
||||
kExprI32Eqz, // i32.eqz
|
||||
kExprLocalSet, 0x38, // local.set
|
||||
kExprBlock, kWasmStmt, // block @69
|
||||
kExprBlock, kWasmVoid, // block @69
|
||||
kExprI32Const, 0x7f, // i32.const
|
||||
kExprI32Eqz, // i32.eqz
|
||||
kExprLocalSet, 0x39, // local.set
|
||||
kExprI32Const, 0x01, // i32.const
|
||||
kExprIf, kWasmStmt, // if @78
|
||||
kExprIf, kWasmVoid, // if @78
|
||||
kExprGlobalGet, 0x00, // global.get
|
||||
kExprLocalSet, 0x11, // local.set
|
||||
kExprI32Const, 0x00, // i32.const
|
||||
|
@ -25,7 +25,7 @@ builder.addFunction(undefined, sig)
|
||||
kExprElse, // else @45
|
||||
kExprI32Const, 0x00, // i32.const
|
||||
kExprEnd, // end @48
|
||||
kExprIf, kWasmStmt, // if @49
|
||||
kExprIf, kWasmVoid, // if @49
|
||||
kExprI32Const, 0x00, // i32.const
|
||||
kExprI32Const, 0x00, // i32.const
|
||||
kAtomicPrefix, kExprI32AtomicSub, 0x01, 0x04, // i32.atomic.sub
|
||||
|
@ -29,7 +29,7 @@ kExprLocalTee, 0x00, // local.tee
|
||||
kExprI32Const, 0xff, 0x00, // i32.const
|
||||
kAtomicPrefix, kExprAtomicNotify, 0x02, 0x03, // atomic.notify
|
||||
kExprI32LoadMem16S, 0x00, 0x02, // i32.load16_s
|
||||
kExprIf, kWasmStmt, // if @28
|
||||
kExprIf, kWasmVoid, // if @28
|
||||
kExprLocalGet, 0x00, // local.get
|
||||
kExprReturn, // return
|
||||
kExprElse, // else @33
|
||||
|
@ -10,9 +10,9 @@ builder.addType(makeSig(
|
||||
[]));
|
||||
builder.addFunction(undefined, 0 /* sig */).addBody([
|
||||
kExprI32Const, 0, // i32.const
|
||||
kExprIf, kWasmStmt, // if @3
|
||||
kExprIf, kWasmVoid, // if @3
|
||||
kExprI32Const, 1, // i32.const
|
||||
kExprIf, kWasmStmt, // if @7
|
||||
kExprIf, kWasmVoid, // if @7
|
||||
kExprNop, // nop
|
||||
kExprElse, // else @10
|
||||
kExprUnreachable, // unreachable
|
||||
|
@ -19,11 +19,11 @@ kExprI32Const, 0x10, // i32.const
|
||||
kExprI32Sub, // i32.sub
|
||||
kExprLocalTee, 0x02, // local.tee
|
||||
kExprGlobalSet, 0x00, // global.set
|
||||
kExprBlock, kWasmStmt, // block @12
|
||||
kExprBlock, kWasmVoid, // block @12
|
||||
kExprLocalGet, 0x00, // local.get
|
||||
kExprI32LoadMem, 0x02, 0x00, // i32.load
|
||||
kExprI32Eqz, // i32.eqz
|
||||
kExprIf, kWasmStmt, // if @20
|
||||
kExprIf, kWasmVoid, // if @20
|
||||
kExprLocalGet, 0x02, // local.get
|
||||
kExprI32Const, 0x00, // i32.const
|
||||
kExprI32StoreMem, 0x02, 0x0c, // i32.store
|
||||
|
@ -35,9 +35,9 @@ kExprI32Const, 0x00, // i32.const
|
||||
kExprI32Const, 0x01, // i32.const
|
||||
kExprI32Sub, // i32.sub
|
||||
kExprLocalSet, 0x07, // local.set
|
||||
kExprBlock, kWasmStmt, // block @45
|
||||
kExprBlock, kWasmVoid, // block @45
|
||||
kExprI32Const, 0x00, // i32.const
|
||||
kExprIf, kWasmStmt, // if @49
|
||||
kExprIf, kWasmVoid, // if @49
|
||||
kExprLocalGet, 0x0a, // local.get
|
||||
kExprLocalSet, 0x08, // local.set
|
||||
kExprElse, // else @55
|
||||
|
@ -21,7 +21,7 @@ kExprI32Const, 0x00, // i32.const
|
||||
kExprLocalSet, 0x04, // local.set
|
||||
kExprI32Const, 0x01, // i32.const
|
||||
kExprLocalSet, 0x05, // local.set
|
||||
kExprBlock, kWasmStmt, // block @11
|
||||
kExprBlock, kWasmVoid, // block @11
|
||||
kExprBr, 0x00, // br depth=0
|
||||
kExprEnd, // end @15
|
||||
kExprGlobalGet, 0x01, // global.get
|
||||
@ -35,7 +35,7 @@ kExprLocalSet, 0x01, // local.set
|
||||
kExprI32Const, 0x00, // i32.const
|
||||
kExprI32Eqz, // i32.eqz
|
||||
kExprLocalSet, 0x07, // local.set
|
||||
kExprBlock, kWasmStmt, // block @36
|
||||
kExprBlock, kWasmVoid, // block @36
|
||||
kExprBr, 0x00, // br depth=0
|
||||
kExprEnd, // end @40
|
||||
kExprGlobalGet, 0x01, // global.get
|
||||
|
@ -34,7 +34,7 @@ kExprLocalGet, 0x01, // local.get
|
||||
kExprLocalGet, 0x01, // local.get
|
||||
kExprGlobalGet, 0x00, // global.get
|
||||
kExprDrop, // drop
|
||||
kExprLoop, kWasmStmt, // loop @8
|
||||
kExprLoop, kWasmVoid, // loop @8
|
||||
kExprLoop, 0x00, // loop @10
|
||||
kExprI32Const, 0x01, // i32.const
|
||||
kExprMemoryGrow, 0x00, // memory.grow
|
||||
|
@ -13,7 +13,7 @@ builder.addFunction(undefined, kSig_i_v)
|
||||
.addBody([
|
||||
kExprI64Const, 0x0, // i64.const
|
||||
kExprI32Const, 0x0, // i32.const
|
||||
kExprIf, kWasmStmt, // if
|
||||
kExprIf, kWasmVoid, // if
|
||||
kExprI32Const, 0x0, // i32.const
|
||||
kExprI32LoadMem, 0x01, 0x23, // i32.load
|
||||
kExprBrTable, 0x01, 0x00, 0x00, // br_table
|
||||
|
@ -13,7 +13,7 @@ let exception = builder.addException(kSig_v_v);
|
||||
builder.addFunction("foo", kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry,
|
||||
kWasmStmt,
|
||||
kWasmVoid,
|
||||
kExprCallFunction, imports,
|
||||
kExprCatch, exception,
|
||||
kExprEnd]
|
||||
|
@ -12,7 +12,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
builder.addFunction("f", kSig_v_v)
|
||||
.addBody([
|
||||
kExprUnreachable,
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprElse,
|
||||
kExprCatchAll,
|
||||
kExprEnd,
|
||||
|
@ -9,7 +9,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
builder.addFunction("main", kSig_i_v)
|
||||
.addBody([
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprI64Const, 0,
|
||||
// 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
|
||||
@ -34,7 +34,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
builder.addFunction("main", kSig_i_v)
|
||||
.addBody([
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprI64Const, 0,
|
||||
// 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
|
||||
|
@ -16,7 +16,7 @@ builder.addFunction('main', kSig_i_i).addBody([
|
||||
...wasmI32Const(0x41),
|
||||
kExprLocalSet, 0,
|
||||
// Enter loop, such that values are spilled to the stack.
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprLoop, kWasmVoid,
|
||||
kExprEnd,
|
||||
// Reload value. This must be loaded as 32 bit value.
|
||||
kExprLocalGet, 0,
|
||||
|
@ -18,7 +18,7 @@ builder.addFunction(undefined, kSig_i_iii)
|
||||
kExprLocalSet, 1, // set_local 1
|
||||
...wasmI32Const(16), // i32.const 0x1
|
||||
kExprLocalSet, 2, // set_local 2
|
||||
kExprLoop, kWasmStmt, // loop
|
||||
kExprLoop, kWasmVoid, // loop
|
||||
kExprEnd, // end
|
||||
kExprLocalGet, 0, // get_local 0
|
||||
kExprLocalGet, 1, // get_local 1
|
||||
|
@ -21,7 +21,7 @@ builder.addFunction('test', kSig_i_iii)
|
||||
kExprI32Const, 0, // 0, 0
|
||||
kExprI32Const, 1, // 0, 0, 1
|
||||
kExprI32Add, // 0, 0 + 1 -> 1
|
||||
kExprBlock, kWasmStmt, // 0, 1
|
||||
kExprBlock, kWasmVoid, // 0, 1
|
||||
kExprBr, 0, // 0, 1
|
||||
kExprEnd, // 0, 1
|
||||
kExprI32Add, // 0 + 1 -> 1
|
||||
|
@ -8,10 +8,10 @@ const builder = new WasmModuleBuilder();
|
||||
builder.addFunction('test', kSig_i_i)
|
||||
.addBody([
|
||||
kExprLocalGet, 0x00, // get_local 0
|
||||
kExprBlock, kWasmStmt, // block
|
||||
kExprBlock, kWasmVoid, // block
|
||||
kExprBr, 0x00, // br depth=0
|
||||
kExprEnd, // end
|
||||
kExprBlock, kWasmStmt, // block
|
||||
kExprBlock, kWasmVoid, // block
|
||||
kExprBr, 0x00, // br depth=0
|
||||
kExprEnd, // end
|
||||
kExprBr, 0x00, // br depth=0
|
||||
|
@ -10,7 +10,7 @@ builder.addFunction('test', kSig_i_i)
|
||||
// body:
|
||||
kExprLocalGet, 0, // get_local 0
|
||||
kExprLocalGet, 0, // get_local 0
|
||||
kExprLoop, kWasmStmt, // loop
|
||||
kExprLoop, kWasmVoid, // loop
|
||||
kExprBr, 0, // br depth=0
|
||||
kExprEnd, // end
|
||||
kExprUnreachable, // unreachable
|
||||
|
@ -23,7 +23,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
kExprF32Eq,
|
||||
kExprI32LoadMem, 0x01, 0xef, 0xec, 0x95, 0x93, 0x07,
|
||||
kExprI32Add,
|
||||
kExprIf, kWasmStmt, // @30
|
||||
kExprIf, kWasmVoid, // @30
|
||||
kExprEnd, // @32
|
||||
kExprI32Const, 0xc9, 0x93, 0xdf, 0xcc, 0x7c,
|
||||
kExprEnd, // @39
|
||||
|
@ -21,7 +21,7 @@ const sync_address = 12;
|
||||
// Calling the imported function sets the thread-in-wasm flag of the
|
||||
// main thread.
|
||||
kExprCallFunction, import_id, // --
|
||||
kExprLoop, kWasmStmt, // --
|
||||
kExprLoop, kWasmVoid, // --
|
||||
kExprI32Const, sync_address, // --
|
||||
kExprI32LoadMem, 0, 0, // --
|
||||
kExprI32Eqz,
|
||||
|
@ -10,7 +10,7 @@ builder.addFunction(undefined, makeSig([kWasmI32, kWasmF32], []))
|
||||
.addBody([
|
||||
kExprLocalGet, 0, // get_local
|
||||
kExprI32Const, 0, // i32.const 0
|
||||
kExprIf, kWasmStmt, // if
|
||||
kExprIf, kWasmVoid, // if
|
||||
kExprUnreachable, // unreachable
|
||||
kExprEnd, // end if
|
||||
kExprLocalGet, 4, // get_local
|
||||
@ -21,7 +21,7 @@ builder.addFunction(undefined, makeSig([kWasmI32, kWasmF32], []))
|
||||
kExprLocalTee, 2, // tee_local
|
||||
kExprLocalTee, 8, // tee_local
|
||||
kExprDrop, // drop
|
||||
kExprLoop, kWasmStmt, // loop
|
||||
kExprLoop, kWasmVoid, // loop
|
||||
kExprEnd, // end loop
|
||||
]);
|
||||
builder.instantiate();
|
||||
|
@ -15,7 +15,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
builder.addFunction(undefined, 1 /* sig */)
|
||||
.addLocals(kWasmI32, 65)
|
||||
.addBodyWithEnd([
|
||||
kExprLoop, kWasmStmt, // @3
|
||||
kExprLoop, kWasmVoid, // @3
|
||||
kSimdPrefix,
|
||||
kExprF32x4Min,
|
||||
kExprI64UConvertI32,
|
||||
|
@ -6,9 +6,9 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addFunction('main', kSig_v_v).addBody([
|
||||
kExprLoop, kWasmStmt, // loop
|
||||
kExprLoop, kWasmVoid, // loop
|
||||
/**/ kExprBr, 0x01, // br depth=1
|
||||
/**/ kExprBlock, kWasmStmt, // block
|
||||
/**/ kExprBlock, kWasmVoid, // block
|
||||
/**/ /**/ kExprBr, 0x02, // br depth=2
|
||||
/**/ /**/ kExprEnd, // end [block]
|
||||
/**/ kExprEnd // end [loop]
|
||||
|
@ -16,7 +16,7 @@ kExprElse,
|
||||
kExprEnd,
|
||||
kExprLocalTee, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprLoop, kWasmVoid,
|
||||
kExprI64Const, 0x80, 0x80, 0x80, 0x70,
|
||||
kExprLocalSet, 0x01,
|
||||
kExprI32Const, 0x00,
|
||||
|
@ -16,8 +16,8 @@ builder.addFunction(undefined, sig1)
|
||||
// signature: f_lilfl
|
||||
kExprBlock, kWasmF32, // @1 f32
|
||||
kExprI32Const, 0x00,
|
||||
kExprIf, kWasmStmt, // @5
|
||||
kExprLoop, kWasmStmt, // @7
|
||||
kExprIf, kWasmVoid, // @5
|
||||
kExprLoop, kWasmVoid, // @7
|
||||
kExprBlock, kWasmI32, // @9 i32
|
||||
kExprF32Const, 0x00, 0x00, 0x80, 0xc1,
|
||||
kExprF32Const, 0x00, 0x00, 0x80, 0x45,
|
||||
|
@ -12,7 +12,7 @@ builder.addFunction(undefined, kSig_i_i)
|
||||
kExprLocalGet, 0,
|
||||
// Stack now contains two copies of the first param register.
|
||||
// Start a loop to create a merge point (values still in registers).
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprLoop, kWasmVoid,
|
||||
// The call spills all values.
|
||||
kExprCallFunction, 0,
|
||||
// Break to the loop. Now the spilled values need to be loaded back *into
|
||||
|
@ -9,21 +9,21 @@ const sig = builder.addType(makeSig([kWasmI64], [kWasmI64]));
|
||||
builder.addFunction(undefined, sig)
|
||||
.addLocals(kWasmI32, 14).addLocals(kWasmI64, 17).addLocals(kWasmF32, 14)
|
||||
.addBody([
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprBr, 0x00,
|
||||
kExprEnd,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprI32Const, 0x00,
|
||||
kExprLocalSet, 0x09,
|
||||
kExprI32Const, 0x00,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprI32Const, 0x00,
|
||||
kExprLocalSet, 0x0a,
|
||||
kExprBr, 0x00,
|
||||
kExprEnd,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprLocalGet, 0x00,
|
||||
kExprLocalSet, 0x12,
|
||||
kExprBr, 0x00,
|
||||
|
@ -9,8 +9,8 @@ const sig = builder.addType(makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]))
|
||||
builder.addFunction(undefined, sig)
|
||||
.addBody([
|
||||
kExprLocalGet, 2,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprBlock, kWasmStmt
|
||||
kExprIf, kWasmVoid,
|
||||
kExprBlock, kWasmVoid
|
||||
]);
|
||||
builder.addExport('main', 0);
|
||||
assertThrows(() => builder.instantiate(), WebAssembly.CompileError);
|
||||
|
@ -27,12 +27,12 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
builder.addMemory(12, 12, false);
|
||||
builder.addFunction("foo", kSig_v_iii)
|
||||
.addBody([].concat([
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprLocalGet, 0x2,
|
||||
kExprI32Const, 0x01,
|
||||
kExprI32And,
|
||||
// Generate a test branch (which has 32k limited reach).
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprLocalGet, 0x0,
|
||||
kExprI32Const, 0x01,
|
||||
kExprI32And,
|
||||
|
@ -15,7 +15,7 @@ const NUM_CASES = 0xfffd;
|
||||
let cases = new Array(NUM_CASES).fill(0);
|
||||
builder.addFunction('main', kSig_v_i)
|
||||
.addBody([].concat([
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprLocalGet, 0,
|
||||
kExprBrTable], wasmSignedLeb(NUM_CASES),
|
||||
cases, [0,
|
||||
|
@ -16,7 +16,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
]).exportFunc();
|
||||
builder.addFunction("main", kSig_i_i)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, f.index,
|
||||
kExprCallFunction, f.index,
|
||||
|
@ -264,7 +264,7 @@ function generateFunctionBodyForSequence(sequence) {
|
||||
kExprLocalGet, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2,
|
||||
0,
|
||||
// Spin until zero.
|
||||
kExprLoop, kWasmStmt, kExprLocalGet, 2, kAtomicPrefix,
|
||||
kExprLoop, kWasmVoid, kExprLocalGet, 2, kAtomicPrefix,
|
||||
kExprI32AtomicLoad, 2, 0, kExprI32Const, 0, kExprI32GtU, kExprBrIf, 0,
|
||||
kExprEnd);
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ function TestStore(func, buffer, value, size) {
|
||||
builder.addImportedMemory("m", "imported_mem", 16, 128, "shared");
|
||||
builder.addFunction("main", kSig_i_v)
|
||||
.addBody([
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprLoop, kWasmVoid,
|
||||
kExprI32Const, 16,
|
||||
kExprI32Const, 20,
|
||||
kAtomicPrefix,
|
||||
@ -442,7 +442,7 @@ function CmpExchgLoop(opcode, alignment) {
|
||||
builder.addFunction("main", makeSig([kWasmI32], []))
|
||||
.addLocals(kWasmI64, 2)
|
||||
.addBody([
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprLoop, kWasmVoid,
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalGet, 1,
|
||||
kExprLocalGet, 2,
|
||||
|
@ -302,7 +302,7 @@ function generateFunctionBodyForSequence(sequence) {
|
||||
kExprLocalGet, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2,
|
||||
0,
|
||||
// Spin until zero.
|
||||
kExprLoop, kWasmStmt, kExprLocalGet, 2, kAtomicPrefix,
|
||||
kExprLoop, kWasmVoid, kExprLocalGet, 2, kAtomicPrefix,
|
||||
kExprI32AtomicLoad, 2, 0, kExprI32Const, 0, kExprI32GtU, kExprBrIf, 0,
|
||||
kExprEnd);
|
||||
}
|
||||
|
@ -43,20 +43,20 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName,
|
||||
kExprI32Mul,
|
||||
kExprLocalSet, kArgSeqenceLength,
|
||||
// Outer block so we have something to jump for return.
|
||||
...[kExprBlock, kWasmStmt,
|
||||
...[kExprBlock, kWasmVoid,
|
||||
// Set counter to 0.
|
||||
kExprI32Const, 0,
|
||||
kExprLocalSet, kLocalCurrentOffset,
|
||||
// Outer loop until maxcount.
|
||||
...[kExprLoop, kWasmStmt,
|
||||
...[kExprLoop, kWasmVoid,
|
||||
// Find the next value to wait for.
|
||||
...[kExprLoop, kWasmStmt,
|
||||
...[kExprLoop, kWasmVoid,
|
||||
// Check end of sequence.
|
||||
kExprLocalGet, kLocalCurrentOffset,
|
||||
kExprLocalGet, kArgSeqenceLength,
|
||||
kExprI32Eq,
|
||||
kExprBrIf, 2, // return
|
||||
...[kExprBlock, kWasmStmt,
|
||||
...[kExprBlock, kWasmVoid,
|
||||
// Load next value.
|
||||
kExprLocalGet, kArgSequencePtr,
|
||||
kExprLocalGet, kLocalCurrentOffset,
|
||||
@ -95,7 +95,7 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName,
|
||||
loadMemOpcode, 0, 0,
|
||||
kExprLocalSet, kLocalNextValue,
|
||||
// Hammer on memory until value found.
|
||||
...[kExprLoop, kWasmStmt,
|
||||
...[kExprLoop, kWasmVoid,
|
||||
// Load address.
|
||||
kExprLocalGet, kArgMemoryCell,
|
||||
// Load expected value.
|
||||
|
@ -46,20 +46,20 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName,
|
||||
kExprI32Mul,
|
||||
kExprLocalSet, kArgSeqenceLength,
|
||||
// Outer block so we have something to jump for return.
|
||||
...[kExprBlock, kWasmStmt,
|
||||
...[kExprBlock, kWasmVoid,
|
||||
// Set counter to 0.
|
||||
kExprI32Const, 0,
|
||||
kExprLocalSet, kLocalCurrentOffset,
|
||||
// Outer loop until maxcount.
|
||||
...[kExprLoop, kWasmStmt,
|
||||
...[kExprLoop, kWasmVoid,
|
||||
// Find the next value to wait for.
|
||||
...[kExprLoop, kWasmStmt,
|
||||
...[kExprLoop, kWasmVoid,
|
||||
// Check end of sequence.
|
||||
kExprLocalGet, kLocalCurrentOffset,
|
||||
kExprLocalGet, kArgSeqenceLength,
|
||||
kExprI32Eq,
|
||||
kExprBrIf, 2, // return
|
||||
...[kExprBlock, kWasmStmt,
|
||||
...[kExprBlock, kWasmVoid,
|
||||
// Load next value.
|
||||
kExprLocalGet, kArgSequencePtr,
|
||||
kExprLocalGet, kLocalCurrentOffset,
|
||||
@ -100,7 +100,7 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName,
|
||||
loadMemOpcode, 0, 0,
|
||||
kExprLocalSet, kLocalNextValue,
|
||||
// Hammer on memory until value found.
|
||||
...[kExprLoop, kWasmStmt,
|
||||
...[kExprLoop, kWasmVoid,
|
||||
// Load address.
|
||||
kExprLocalGet, kArgMemoryCell,
|
||||
// Load expected value.
|
||||
|
@ -359,13 +359,13 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
print(arguments.callee.name);
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addFunction('main', kSig_i_i)
|
||||
.addBody([kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
.addBody([kExprBlock, kWasmVoid,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprLocalGet, 0,
|
||||
kExprBrTable, 6, 0, 1, 2, 3, 4, 5, 6,
|
||||
kExprEnd,
|
||||
|
@ -14,7 +14,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
let except = builder.addException(kSig_v_v);
|
||||
builder.addFunction("rethrow0", kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprThrow, except,
|
||||
kExprCatch, except,
|
||||
kExprRethrow, 0,
|
||||
@ -27,7 +27,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
kExprCatch, except,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Eqz,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprRethrow, 1,
|
||||
kExprEnd,
|
||||
kExprI32Const, 23,
|
||||
@ -47,7 +47,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
let except = builder.addException(kSig_v_v);
|
||||
builder.addFunction("rethrow0", kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprThrow, except,
|
||||
kExprCatchAll,
|
||||
kExprRethrow, 0,
|
||||
@ -60,7 +60,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
kExprCatchAll,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Eqz,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprRethrow, 1,
|
||||
kExprEnd,
|
||||
kExprI32Const, 23,
|
||||
@ -91,13 +91,13 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 0,
|
||||
kExprI32Eq,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprRethrow, 1,
|
||||
kExprEnd,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 1,
|
||||
kExprI32Eq,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprRethrow, 2,
|
||||
kExprEnd,
|
||||
kExprI32Const, 23,
|
||||
@ -125,7 +125,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
kExprTry, kWasmI32,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Eqz,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprRethrow, 2,
|
||||
kExprEnd,
|
||||
kExprI32Const, 42,
|
||||
|
@ -30,7 +30,7 @@ function NewExportedException() {
|
||||
]).exportFunc();
|
||||
builder.addFunction("catch", kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprCallFunction, fun,
|
||||
kExprCatch, except,
|
||||
kExprEnd,
|
||||
@ -62,7 +62,7 @@ function NewExportedException() {
|
||||
]).exportFunc();
|
||||
builder.addFunction("catch", kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprCallFunction, fun,
|
||||
kExprCatch, except,
|
||||
kExprEnd,
|
||||
@ -97,7 +97,7 @@ function NewExportedException() {
|
||||
]).exportFunc();
|
||||
builder.addFunction("catch", kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprCallFunction, fun,
|
||||
kExprCatch, except1,
|
||||
kExprEnd,
|
||||
@ -136,7 +136,7 @@ function NewExportedException() {
|
||||
let except = builder2.addImportedException("m", "ex", kSig_v_v);
|
||||
builder2.addFunction("catch", kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprCallFunction, fun,
|
||||
kExprCatch, except,
|
||||
kExprEnd,
|
||||
|
@ -17,7 +17,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 0,
|
||||
kExprI32Ne,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprThrow, except,
|
||||
kExprEnd,
|
||||
kExprI32Const, 1
|
||||
@ -36,7 +36,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
let except = builder.addException(kSig_v_v);
|
||||
builder.addFunction("catch_empty_try", kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprCatch, except,
|
||||
kExprEnd,
|
||||
]).exportFunc();
|
||||
@ -55,7 +55,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
kExprTry, kWasmI32,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Eqz,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprThrow, except,
|
||||
kExprEnd,
|
||||
kExprI32Const, 42,
|
||||
@ -74,14 +74,14 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction('unreachable_in_try', kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprUnreachable,
|
||||
kExprCatchAll,
|
||||
kExprEnd
|
||||
]).exportFunc();
|
||||
builder.addFunction('unreachable_in_try_unwind', kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprUnreachable,
|
||||
kExprUnwind,
|
||||
kExprEnd
|
||||
@ -229,13 +229,13 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
builder.addFunction('test', kSig_v_v)
|
||||
.addBody([
|
||||
// Calling "throw" directly should produce the expected exception.
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprCallFunction, throw_fn.index,
|
||||
kExprCatch, except,
|
||||
kExprEnd,
|
||||
// Calling through JS produces a wrapped exceptions which does not match
|
||||
// the catch.
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprCallFunction, imp,
|
||||
kExprCatch, except,
|
||||
kExprEnd
|
||||
@ -277,13 +277,13 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
kExprTry, kWasmI32,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Eqz,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprThrow, except1,
|
||||
kExprElse,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 1,
|
||||
kExprI32Eq,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprThrow, except2,
|
||||
kExprElse,
|
||||
kExprThrow, except3,
|
||||
@ -317,13 +317,13 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
kExprTry, kWasmI32,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Eqz,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprThrow, except1,
|
||||
kExprElse,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 1,
|
||||
kExprI32Eq,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprThrow, except2,
|
||||
kExprElse,
|
||||
kExprThrow, except3,
|
||||
@ -609,7 +609,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 0,
|
||||
kExprI32Ne,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprLocalGet, 0,
|
||||
kExprThrow, except,
|
||||
kExprUnreachable,
|
||||
@ -672,7 +672,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 1,
|
||||
kExprI32Eq,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprI32Const, 1,
|
||||
kExprThrow, except,
|
||||
kExprUnreachable,
|
||||
@ -688,7 +688,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 2,
|
||||
kExprI32Eq,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprLocalGet, 1,
|
||||
kExprI32Const, 8,
|
||||
kExprI32Ior,
|
||||
@ -707,7 +707,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 3,
|
||||
kExprI32Eq,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprLocalGet, 1,
|
||||
kExprI32Const, /*64=*/ 192, 0,
|
||||
kExprI32Ior,
|
||||
@ -766,7 +766,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
|
||||
builder.addFunction("string_from_js", kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprCallFunction, kJSThrowString,
|
||||
kExprCatch, except,
|
||||
kExprUnreachable,
|
||||
@ -776,7 +776,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
|
||||
builder.addFunction("fp_from_js", kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprCallFunction, kJSThrowFP,
|
||||
kExprCatch, except,
|
||||
kExprUnreachable,
|
||||
@ -786,7 +786,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
|
||||
builder.addFunction("large_from_js", kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprCallFunction, kJSThrowLarge,
|
||||
kExprCatch, except,
|
||||
kExprUnreachable,
|
||||
@ -796,7 +796,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
|
||||
builder.addFunction("undefined_from_js", kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprCallFunction, kJSThrowUndefined,
|
||||
kExprCatch, except,
|
||||
kExprUnreachable,
|
||||
@ -866,7 +866,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
let throw_if = builder.addFunction('throw', kSig_v_i)
|
||||
.addBody([
|
||||
kExprLocalGet, 0,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprThrow, except,
|
||||
kExprEnd]).exportFunc();
|
||||
builder.addFunction('test', kSig_i_i)
|
||||
@ -924,9 +924,9 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
// 2 -> throw except2
|
||||
let throw_fn = builder.addFunction('throw', kSig_v_i)
|
||||
.addBody([
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprBlock, kWasmVoid,
|
||||
kExprLocalGet, 0,
|
||||
kExprBrTable, 2, 0, 1, 2,
|
||||
kExprEnd,
|
||||
@ -993,7 +993,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
builder.addFunction('test', kSig_i_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmI32,
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprThrow, except1,
|
||||
kExprDelegate, 0,
|
||||
kExprI32Const, 1,
|
||||
@ -1013,8 +1013,8 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
let except = builder.addException(kSig_v_v);
|
||||
builder.addFunction('test', kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprThrow, except,
|
||||
kExprDelegate, 1,
|
||||
kExprCatchAll,
|
||||
@ -1022,8 +1022,8 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
]).exportFunc();
|
||||
builder.addFunction('test_unwind', kSig_v_v)
|
||||
.addBody([
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmStmt,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprTry, kWasmVoid,
|
||||
kExprThrow, except,
|
||||
kExprDelegate, 1,
|
||||
kExprUnwind,
|
||||
|
@ -183,7 +183,7 @@ TestGlobalIndexSpace(kWasmF64, 12345.678);
|
||||
builder.addFunction("set", kSig_v_ii)
|
||||
.addBody([
|
||||
kExprLocalGet, 0,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprLocalGet, 1,
|
||||
kExprGlobalSet, g.index,
|
||||
kExprElse,
|
||||
|
@ -33,7 +33,7 @@ function generateBuilder() {
|
||||
builder.addFunction('main', kSig_i_i)
|
||||
.addBody([
|
||||
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
|
||||
kExprMemoryGrow, kMemoryZero, // grow memory
|
||||
kExprDrop, // drop the result of grow
|
||||
@ -60,7 +60,7 @@ function generateBuilder() {
|
||||
builder.addFunction('main', kSig_i_i)
|
||||
.addBody([
|
||||
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
|
||||
kExprMemoryGrow, kMemoryZero, // grow memory
|
||||
kExprDrop, // drop the result of grow
|
||||
@ -95,7 +95,7 @@ function generateBuilder() {
|
||||
builder.addFunction('main', kSig_i_i)
|
||||
.addBody([
|
||||
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, newValue, // put the value on stack
|
||||
kExprI32StoreMem, 0, 0, // store
|
||||
@ -128,7 +128,7 @@ function generateBuilder() {
|
||||
builder.addFunction('main', kSig_i_i)
|
||||
.addBody([
|
||||
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
|
||||
kExprMemoryGrow, kMemoryZero, // grow memory
|
||||
kExprDrop, // drop the result of grow
|
||||
@ -160,7 +160,7 @@ function generateBuilder() {
|
||||
builder.addFunction('main', kSig_i_ii)
|
||||
.addBody([
|
||||
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
|
||||
kExprMemoryGrow, kMemoryZero, // grow memory
|
||||
kExprDrop, // drop the result of grow
|
||||
@ -192,7 +192,7 @@ function generateBuilder() {
|
||||
builder.addFunction('main', kSig_i_ii)
|
||||
.addBody([
|
||||
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
|
||||
kExprMemoryGrow, kMemoryZero, // grow memory
|
||||
kExprDrop, // drop the result of grow
|
||||
@ -227,7 +227,7 @@ function generateBuilder() {
|
||||
builder.addFunction('main', kSig_i_ii)
|
||||
.addBody([
|
||||
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
|
||||
kExprI32Const, value, // put the value on stack
|
||||
kExprI32StoreMem, 0, 0, // store
|
||||
@ -264,7 +264,7 @@ function generateBuilder() {
|
||||
builder.addFunction('main', kSig_i_ii)
|
||||
.addBody([
|
||||
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
|
||||
kExprMemoryGrow, kMemoryZero, // grow memory
|
||||
kExprDrop, // drop the result of grow
|
||||
|
@ -124,9 +124,9 @@ print('=== grow_memory in direct calls ===');
|
||||
builder.addFunction('main', kSig_i_ii)
|
||||
.addBody([
|
||||
// clang-format off
|
||||
kExprLoop, kWasmStmt, // while
|
||||
kExprLoop, kWasmVoid, // while
|
||||
kExprLocalGet, 0, // -
|
||||
kExprIf, kWasmStmt, // if <param0> != 0
|
||||
kExprIf, kWasmVoid, // if <param0> != 0
|
||||
// Grow memory.
|
||||
kExprLocalGet, 1, // get number of new pages
|
||||
kExprCallFunction, kGrowFunction, // call the grow function
|
||||
@ -174,9 +174,9 @@ print('=== grow_memory in direct calls ===');
|
||||
builder.addFunction('main', kSig_i_iii)
|
||||
.addBody([
|
||||
// clang-format off
|
||||
kExprLoop, kWasmStmt, // while
|
||||
kExprLoop, kWasmVoid, // while
|
||||
kExprLocalGet, 0, // -
|
||||
kExprIf, kWasmStmt, // if <param0> != 0
|
||||
kExprIf, kWasmVoid, // if <param0> != 0
|
||||
// Grow memory.
|
||||
kExprLocalGet, 1, // get number of new pages
|
||||
kExprCallFunction, kGrowFunction, // call the grow function
|
||||
@ -338,9 +338,9 @@ print('\n=== grow_memory in indirect calls ===');
|
||||
builder.addFunction('main', kSig_i_iii)
|
||||
.addBody([
|
||||
// clang-format off
|
||||
kExprLoop, kWasmStmt, // while
|
||||
kExprLoop, kWasmVoid, // while
|
||||
kExprLocalGet, 1, // -
|
||||
kExprIf, kWasmStmt, // if <param1> != 0
|
||||
kExprIf, kWasmVoid, // if <param1> != 0
|
||||
// Grow memory.
|
||||
kExprLocalGet, 2, // get number of new pages
|
||||
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]))
|
||||
.addBody([
|
||||
// clang-format off
|
||||
kExprLoop, kWasmStmt, // while
|
||||
kExprLoop, kWasmVoid, // while
|
||||
kExprLocalGet, 1, // -
|
||||
kExprIf, kWasmStmt, // if <param1> != 0
|
||||
kExprIf, kWasmVoid, // if <param1> != 0
|
||||
// Grow memory.
|
||||
kExprLocalGet, 2, // get number of new pages
|
||||
kExprLocalGet, 0, // get index of the function
|
||||
|
@ -30,9 +30,9 @@ function generateBuilder() {
|
||||
builder.addFunction('main', kSig_i_i)
|
||||
.addBody([
|
||||
// clang-format off
|
||||
kExprLoop, kWasmStmt, // while
|
||||
kExprLoop, kWasmVoid, // while
|
||||
kExprLocalGet, 0, // -
|
||||
kExprIf, kWasmStmt, // if <param0> != 0
|
||||
kExprIf, kWasmVoid, // if <param0> != 0
|
||||
// Grow memory.
|
||||
kExprI32Const, deltaPages, // -
|
||||
kExprMemoryGrow, kMemoryZero, // grow memory
|
||||
@ -82,9 +82,9 @@ function generateBuilder() {
|
||||
kExprI32Const, deltaPagesOut, // -
|
||||
kExprMemoryGrow, kMemoryZero, // grow memory
|
||||
kExprDrop, // drop the result of grow
|
||||
kExprLoop, kWasmStmt, // while
|
||||
kExprLoop, kWasmVoid, // while
|
||||
kExprLocalGet, 0, // -
|
||||
kExprIf, kWasmStmt, // if <param0> != 0
|
||||
kExprIf, kWasmVoid, // if <param0> != 0
|
||||
// Grow memory.
|
||||
kExprI32Const, deltaPagesIn, // -
|
||||
kExprMemoryGrow, kMemoryZero, // grow memory
|
||||
@ -131,9 +131,9 @@ function generateBuilder() {
|
||||
builder.addFunction('main', kSig_i_ii)
|
||||
.addBody([
|
||||
// clang-format off
|
||||
kExprLoop, kWasmStmt, // while
|
||||
kExprLoop, kWasmVoid, // while
|
||||
kExprLocalGet, 0, // -
|
||||
kExprIf, kWasmStmt, // if <param0> != 0
|
||||
kExprIf, kWasmVoid, // if <param0> != 0
|
||||
// Grow memory.
|
||||
kExprI32Const, deltaPages, // -
|
||||
kExprMemoryGrow, kMemoryZero, // grow memory
|
||||
@ -202,9 +202,9 @@ function generateBuilder() {
|
||||
kExprI32Add, // increase value on stack
|
||||
kExprI32StoreMem, 0, 0, // store new value
|
||||
// Start loop.
|
||||
kExprLoop, kWasmStmt, // while
|
||||
kExprLoop, kWasmVoid, // while
|
||||
kExprLocalGet, 0, // -
|
||||
kExprIf, kWasmStmt, // if <param0> != 0
|
||||
kExprIf, kWasmVoid, // if <param0> != 0
|
||||
// Grow memory.
|
||||
kExprI32Const, deltaPagesIn, // -
|
||||
kExprMemoryGrow, kMemoryZero, // grow memory
|
||||
|
@ -11,7 +11,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
var builder = new WasmModuleBuilder();
|
||||
builder.addFunction("main", kSig_v_i)
|
||||
.addBody([
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprLoop, kWasmVoid,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 1,
|
||||
kExprI32Sub,
|
||||
@ -32,7 +32,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
var builder = new WasmModuleBuilder();
|
||||
builder.addFunction("main", kSig_v_i)
|
||||
.addBody([
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprLoop, kWasmVoid,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 1,
|
||||
kExprI32Sub,
|
||||
@ -55,7 +55,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
builder.addMemory(1, undefined, false);
|
||||
builder.addFunction("main", kSig_v_i)
|
||||
.addBody([
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprLoop, kWasmVoid,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 1,
|
||||
kExprI32Sub,
|
||||
|
@ -17,10 +17,10 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
builder.addFunction("main", kSig_i_i)
|
||||
.addBody([
|
||||
...wasmI32Const(1),
|
||||
kExprLet, kWasmStmt, 1, 1, kWasmI32,
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprLet, kWasmVoid, 1, 1, kWasmI32,
|
||||
kExprLoop, kWasmVoid,
|
||||
...wasmI32Const(10),
|
||||
kExprLet, kWasmStmt, 1, 1, kWasmI32,
|
||||
kExprLet, kWasmVoid, 1, 1, kWasmI32,
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalGet, 1,
|
||||
kExprI32Sub,
|
||||
@ -47,9 +47,9 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
|
||||
builder.addFunction("main", kSig_i_i)
|
||||
.addBody([
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprLoop, kWasmVoid,
|
||||
kExprLocalGet, 0,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprLocalGet, 0,
|
||||
kExprReturnCall, callee.index,
|
||||
kExprElse,
|
||||
@ -86,16 +86,16 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 0,
|
||||
kExprI32Eq,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprLoop, kWasmVoid,
|
||||
kExprRethrow, 2,
|
||||
kExprEnd,
|
||||
kExprEnd,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 1,
|
||||
kExprI32Eq,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprLoop, kWasmVoid,
|
||||
kExprRethrow, 3,
|
||||
kExprEnd,
|
||||
kExprEnd,
|
||||
@ -119,11 +119,11 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
let except1 = builder.addException(kSig_v_v);
|
||||
builder.addFunction("throw", kSig_i_i)
|
||||
.addBody([
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprLoop, kWasmVoid,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 10,
|
||||
kExprI32GtS,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprThrow, except1,
|
||||
kExprElse,
|
||||
kExprLocalGet, 0,
|
||||
@ -152,7 +152,7 @@ load("test/mjsunit/wasm/exceptions-utils.js");
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 10,
|
||||
kExprI32GtS,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprIf, kWasmVoid,
|
||||
kExprThrow, except1,
|
||||
kExprElse,
|
||||
kExprLocalGet, 0,
|
||||
|
@ -17,12 +17,12 @@ function genModule(memory) {
|
||||
.addBody([
|
||||
// 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
|
||||
/**/ kExprLoop, kWasmStmt, // --
|
||||
/**/ kExprLoop, kWasmVoid, // --
|
||||
/* */ kExprLocalGet, 0, // --
|
||||
/* */ kExprIf, kWasmStmt, // --
|
||||
/* */ kExprIf, kWasmVoid, // --
|
||||
/* */ kExprLocalGet, 0, // --
|
||||
/* */ kExprI32LoadMem, 0, 0, // --
|
||||
/* */ kExprIf, kWasmStmt, // --
|
||||
/* */ kExprIf, kWasmVoid, // --
|
||||
/* */ kExprI32Const, 127, // --
|
||||
/* */ kExprReturn, // --
|
||||
/* */ kExprEnd, // --
|
||||
|
@ -32,7 +32,7 @@ while (true) {
|
||||
// Each function f<n> with argument {i} then calls f<n/10> with argument
|
||||
// {i + 1} and returns whatever that function returns.
|
||||
const body_template = [
|
||||
kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmStmt, // if (i == 0)
|
||||
kExprLocalGet, 0, kExprI32Eqz, kExprIf, kWasmVoid, // if (i == 0)
|
||||
kExprLocalGet, 0 // get i
|
||||
];
|
||||
for (let i = 0; i < 1000; ++i) body_template.push(kExprI32LoadMem, 0, 0);
|
||||
|
@ -390,7 +390,7 @@ function testErrorPosition(bytes, pos, message) {
|
||||
1, // number of types
|
||||
kWasmFunctionTypeForm, // type
|
||||
1, // number of parameter
|
||||
kWasmStmt, // invalid type
|
||||
kWasmVoid, // invalid type
|
||||
0 // number of returns
|
||||
]);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user