[wasm] Rename {Get,Set,Tee}Local to Local{Get,Set,Tee}
This brings our constants back in line with the changed spec text. We already use kExprTableGet and kExprTableSet, but for locals and globals we still use the old wording. This renaming is mostly mechanical. PS1 was created using: ag -l 'kExpr(Get|Set|Tee)Local' src test | \ xargs -L1 sed -E 's/kExpr(Get|Set|Tee)Local\b/kExprLocal\1/g' -i PS2 contains manual fixes. R=mstarzinger@chromium.org Bug: v8:9810 Change-Id: I1617f1b2a100685a3bf56218e76845a9481959c5 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1847354 Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/master@{#64161}
This commit is contained in:
parent
f1e5488a7f
commit
421fd3929d
@ -1224,7 +1224,7 @@ class LiftoffCompiler {
|
||||
ReturnImpl(decoder);
|
||||
}
|
||||
|
||||
void GetLocal(FullDecoder* decoder, Value* result,
|
||||
void LocalGet(FullDecoder* decoder, Value* result,
|
||||
const LocalIndexImmediate<validate>& imm) {
|
||||
auto& slot = __ cache_state()->stack_state[imm.index];
|
||||
DCHECK_EQ(slot.type(), imm.type);
|
||||
@ -1245,7 +1245,7 @@ class LiftoffCompiler {
|
||||
}
|
||||
}
|
||||
|
||||
void SetLocalFromStackSlot(LiftoffAssembler::VarState* dst_slot,
|
||||
void LocalSetFromStackSlot(LiftoffAssembler::VarState* dst_slot,
|
||||
uint32_t local_index) {
|
||||
auto& state = *__ cache_state();
|
||||
ValueType type = dst_slot->type();
|
||||
@ -1266,7 +1266,7 @@ class LiftoffCompiler {
|
||||
__ cache_state()->inc_used(dst_reg);
|
||||
}
|
||||
|
||||
void SetLocal(uint32_t local_index, bool is_tee) {
|
||||
void LocalSet(uint32_t local_index, bool is_tee) {
|
||||
auto& state = *__ cache_state();
|
||||
auto& source_slot = state.stack_state.back();
|
||||
auto& target_slot = state.stack_state[local_index];
|
||||
@ -1281,20 +1281,20 @@ class LiftoffCompiler {
|
||||
target_slot = source_slot;
|
||||
break;
|
||||
case kStack:
|
||||
SetLocalFromStackSlot(&target_slot, local_index);
|
||||
LocalSetFromStackSlot(&target_slot, local_index);
|
||||
break;
|
||||
}
|
||||
if (!is_tee) __ cache_state()->stack_state.pop_back();
|
||||
}
|
||||
|
||||
void SetLocal(FullDecoder* decoder, const Value& value,
|
||||
void LocalSet(FullDecoder* decoder, const Value& value,
|
||||
const LocalIndexImmediate<validate>& imm) {
|
||||
SetLocal(imm.index, false);
|
||||
LocalSet(imm.index, false);
|
||||
}
|
||||
|
||||
void TeeLocal(FullDecoder* decoder, const Value& value, Value* result,
|
||||
void LocalTee(FullDecoder* decoder, const Value& value, Value* result,
|
||||
const LocalIndexImmediate<validate>& imm) {
|
||||
SetLocal(imm.index, true);
|
||||
LocalSet(imm.index, true);
|
||||
}
|
||||
|
||||
Register GetGlobalBaseAndOffset(const WasmGlobal* global,
|
||||
|
@ -714,9 +714,9 @@ struct ControlBase {
|
||||
F(RefFunc, uint32_t function_index, Value* result) \
|
||||
F(Drop, const Value& value) \
|
||||
F(DoReturn, Vector<Value> values) \
|
||||
F(GetLocal, Value* result, const LocalIndexImmediate<validate>& imm) \
|
||||
F(SetLocal, const Value& value, const LocalIndexImmediate<validate>& imm) \
|
||||
F(TeeLocal, const Value& value, Value* result, \
|
||||
F(LocalGet, Value* result, const LocalIndexImmediate<validate>& imm) \
|
||||
F(LocalSet, const Value& value, const LocalIndexImmediate<validate>& imm) \
|
||||
F(LocalTee, const Value& value, Value* result, \
|
||||
const LocalIndexImmediate<validate>& imm) \
|
||||
F(GetGlobal, Value* result, const GlobalIndexImmediate<validate>& imm) \
|
||||
F(SetGlobal, const Value& value, const GlobalIndexImmediate<validate>& imm) \
|
||||
@ -910,8 +910,8 @@ class WasmDecoder : public Decoder {
|
||||
length = OpcodeLength(decoder, pc);
|
||||
depth++;
|
||||
break;
|
||||
case kExprSetLocal: // fallthru
|
||||
case kExprTeeLocal: {
|
||||
case kExprLocalSet: // fallthru
|
||||
case kExprLocalTee: {
|
||||
LocalIndexImmediate<validate> imm(decoder, pc);
|
||||
if (assigned->length() > 0 &&
|
||||
imm.index < static_cast<uint32_t>(assigned->length())) {
|
||||
@ -1291,9 +1291,9 @@ class WasmDecoder : public Decoder {
|
||||
return 1 + imm.length;
|
||||
}
|
||||
|
||||
case kExprSetLocal:
|
||||
case kExprTeeLocal:
|
||||
case kExprGetLocal: {
|
||||
case kExprLocalGet:
|
||||
case kExprLocalSet:
|
||||
case kExprLocalTee: {
|
||||
LocalIndexImmediate<validate> imm(decoder, pc);
|
||||
return 1 + imm.length;
|
||||
}
|
||||
@ -1458,10 +1458,10 @@ class WasmDecoder : public Decoder {
|
||||
return {2, 0};
|
||||
FOREACH_LOAD_MEM_OPCODE(DECLARE_OPCODE_CASE)
|
||||
case kExprTableGet:
|
||||
case kExprTeeLocal:
|
||||
case kExprLocalTee:
|
||||
case kExprMemoryGrow:
|
||||
return {1, 1};
|
||||
case kExprSetLocal:
|
||||
case kExprLocalSet:
|
||||
case kExprSetGlobal:
|
||||
case kExprDrop:
|
||||
case kExprBrIf:
|
||||
@ -1469,7 +1469,7 @@ class WasmDecoder : public Decoder {
|
||||
case kExprIf:
|
||||
case kExprRethrow:
|
||||
return {1, 0};
|
||||
case kExprGetLocal:
|
||||
case kExprLocalGet:
|
||||
case kExprGetGlobal:
|
||||
case kExprI32Const:
|
||||
case kExprI64Const:
|
||||
@ -2125,28 +2125,28 @@ class WasmFullDecoder : public WasmDecoder<validate> {
|
||||
len = 1 + imm.length;
|
||||
break;
|
||||
}
|
||||
case kExprGetLocal: {
|
||||
case kExprLocalGet: {
|
||||
LocalIndexImmediate<validate> imm(this, this->pc_);
|
||||
if (!this->Validate(this->pc_, imm)) break;
|
||||
auto* value = Push(imm.type);
|
||||
CALL_INTERFACE_IF_REACHABLE(GetLocal, value, imm);
|
||||
CALL_INTERFACE_IF_REACHABLE(LocalGet, value, imm);
|
||||
len = 1 + imm.length;
|
||||
break;
|
||||
}
|
||||
case kExprSetLocal: {
|
||||
case kExprLocalSet: {
|
||||
LocalIndexImmediate<validate> imm(this, this->pc_);
|
||||
if (!this->Validate(this->pc_, imm)) break;
|
||||
auto value = Pop(0, local_type_vec_[imm.index]);
|
||||
CALL_INTERFACE_IF_REACHABLE(SetLocal, value, imm);
|
||||
CALL_INTERFACE_IF_REACHABLE(LocalSet, value, imm);
|
||||
len = 1 + imm.length;
|
||||
break;
|
||||
}
|
||||
case kExprTeeLocal: {
|
||||
case kExprLocalTee: {
|
||||
LocalIndexImmediate<validate> imm(this, this->pc_);
|
||||
if (!this->Validate(this->pc_, imm)) break;
|
||||
auto value = Pop(0, local_type_vec_[imm.index]);
|
||||
auto* result = Push(value.type);
|
||||
CALL_INTERFACE_IF_REACHABLE(TeeLocal, value, result, imm);
|
||||
CALL_INTERFACE_IF_REACHABLE(LocalTee, value, result, imm);
|
||||
len = 1 + imm.length;
|
||||
break;
|
||||
}
|
||||
@ -2447,9 +2447,9 @@ class WasmFullDecoder : public WasmDecoder<validate> {
|
||||
TRACE_PART("[%d]", imm.value);
|
||||
break;
|
||||
}
|
||||
case kExprGetLocal:
|
||||
case kExprSetLocal:
|
||||
case kExprTeeLocal: {
|
||||
case kExprLocalGet:
|
||||
case kExprLocalSet:
|
||||
case kExprLocalTee: {
|
||||
LocalIndexImmediate<Decoder::kNoValidate> imm(this, val.pc);
|
||||
TRACE_PART("[%u]", imm.index);
|
||||
break;
|
||||
|
@ -262,19 +262,19 @@ class WasmGraphBuildingInterface {
|
||||
BUILD(Return, nodes);
|
||||
}
|
||||
|
||||
void GetLocal(FullDecoder* decoder, Value* result,
|
||||
void LocalGet(FullDecoder* decoder, Value* result,
|
||||
const LocalIndexImmediate<validate>& imm) {
|
||||
if (!ssa_env_->locals) return; // unreachable
|
||||
result->node = ssa_env_->locals[imm.index];
|
||||
}
|
||||
|
||||
void SetLocal(FullDecoder* decoder, const Value& value,
|
||||
void LocalSet(FullDecoder* decoder, const Value& value,
|
||||
const LocalIndexImmediate<validate>& imm) {
|
||||
if (!ssa_env_->locals) return; // unreachable
|
||||
ssa_env_->locals[imm.index] = value.node;
|
||||
}
|
||||
|
||||
void TeeLocal(FullDecoder* decoder, const Value& value, Value* result,
|
||||
void LocalTee(FullDecoder* decoder, const Value& value, Value* result,
|
||||
const LocalIndexImmediate<validate>& imm) {
|
||||
result->node = value.node;
|
||||
if (!ssa_env_->locals) return; // unreachable
|
||||
|
@ -3125,14 +3125,14 @@ class ThreadImpl {
|
||||
len = 1 + imm.length;
|
||||
break;
|
||||
}
|
||||
case kExprGetLocal: {
|
||||
case kExprLocalGet: {
|
||||
LocalIndexImmediate<Decoder::kNoValidate> imm(&decoder, code->at(pc));
|
||||
HandleScope handle_scope(isolate_); // Avoid leaking handles.
|
||||
Push(GetStackValue(frames_.back().sp + imm.index));
|
||||
len = 1 + imm.length;
|
||||
break;
|
||||
}
|
||||
case kExprSetLocal: {
|
||||
case kExprLocalSet: {
|
||||
LocalIndexImmediate<Decoder::kNoValidate> imm(&decoder, code->at(pc));
|
||||
HandleScope handle_scope(isolate_); // Avoid leaking handles.
|
||||
WasmValue val = Pop();
|
||||
@ -3140,7 +3140,7 @@ class ThreadImpl {
|
||||
len = 1 + imm.length;
|
||||
break;
|
||||
}
|
||||
case kExprTeeLocal: {
|
||||
case kExprLocalTee: {
|
||||
LocalIndexImmediate<Decoder::kNoValidate> imm(&decoder, code->at(pc));
|
||||
HandleScope handle_scope(isolate_); // Avoid leaking handles.
|
||||
WasmValue val = Pop();
|
||||
|
@ -71,15 +71,15 @@ uint32_t WasmFunctionBuilder::AddLocal(ValueType type) {
|
||||
}
|
||||
|
||||
void WasmFunctionBuilder::EmitGetLocal(uint32_t local_index) {
|
||||
EmitWithU32V(kExprGetLocal, local_index);
|
||||
EmitWithU32V(kExprLocalGet, local_index);
|
||||
}
|
||||
|
||||
void WasmFunctionBuilder::EmitSetLocal(uint32_t local_index) {
|
||||
EmitWithU32V(kExprSetLocal, local_index);
|
||||
EmitWithU32V(kExprLocalSet, local_index);
|
||||
}
|
||||
|
||||
void WasmFunctionBuilder::EmitTeeLocal(uint32_t local_index) {
|
||||
EmitWithU32V(kExprTeeLocal, local_index);
|
||||
EmitWithU32V(kExprLocalTee, local_index);
|
||||
}
|
||||
|
||||
void WasmFunctionBuilder::EmitCode(const byte* code, uint32_t code_size) {
|
||||
|
@ -147,9 +147,9 @@ const char* WasmOpcodes::OpcodeName(WasmOpcode opcode) {
|
||||
CASE_OP(Drop, "drop")
|
||||
CASE_OP(Select, "select")
|
||||
CASE_OP(SelectWithType, "select")
|
||||
CASE_OP(GetLocal, "local.get")
|
||||
CASE_OP(SetLocal, "local.set")
|
||||
CASE_OP(TeeLocal, "local.tee")
|
||||
CASE_OP(LocalGet, "local.get")
|
||||
CASE_OP(LocalSet, "local.set")
|
||||
CASE_OP(LocalTee, "local.tee")
|
||||
CASE_OP(GetGlobal, "global.get")
|
||||
CASE_OP(SetGlobal, "global.set")
|
||||
CASE_OP(TableGet, "table.get")
|
||||
|
@ -48,9 +48,9 @@ bool IsJSCompatibleSignature(const FunctionSig* sig, const WasmFeatures&);
|
||||
V(Drop, 0x1a, _) \
|
||||
V(Select, 0x1b, _) \
|
||||
V(SelectWithType, 0x1c, _) \
|
||||
V(GetLocal, 0x20, _) \
|
||||
V(SetLocal, 0x21, _) \
|
||||
V(TeeLocal, 0x22, _) \
|
||||
V(LocalGet, 0x20, _) \
|
||||
V(LocalSet, 0x21, _) \
|
||||
V(LocalTee, 0x22, _) \
|
||||
V(GetGlobal, 0x23, _) \
|
||||
V(SetGlobal, 0x24, _) \
|
||||
V(TableGet, 0x25, _) \
|
||||
|
@ -154,9 +154,9 @@ void PrintWasmText(const WasmModule* module, const ModuleWireBytes& wire_bytes,
|
||||
os << WasmOpcodes::OpcodeName(opcode) << ' ' << imm.index;
|
||||
break;
|
||||
}
|
||||
case kExprGetLocal:
|
||||
case kExprSetLocal:
|
||||
case kExprTeeLocal: {
|
||||
case kExprLocalGet:
|
||||
case kExprLocalSet:
|
||||
case kExprLocalTee: {
|
||||
LocalIndexImmediate<Decoder::kNoValidate> imm(&i, i.pc());
|
||||
os << WasmOpcodes::OpcodeName(opcode) << ' ' << imm.index;
|
||||
break;
|
||||
|
@ -1502,7 +1502,7 @@ static void CompileCallIndirectMany(ExecutionTier tier, ValueType param) {
|
||||
|
||||
std::vector<byte> code;
|
||||
for (byte p = 0; p < num_params; p++) {
|
||||
ADD_CODE(code, kExprGetLocal, p);
|
||||
ADD_CODE(code, kExprLocalGet, p);
|
||||
}
|
||||
ADD_CODE(code, kExprI32Const, 0);
|
||||
ADD_CODE(code, kExprCallIndirect, 1, TABLE_ZERO);
|
||||
@ -1563,7 +1563,7 @@ static void Run_WasmMixedCall_N(ExecutionTier execution_tier, int start) {
|
||||
|
||||
// Store the result in a local.
|
||||
byte local_index = r.AllocateLocal(ValueTypes::ValueTypeFor(result));
|
||||
ADD_CODE(code, kExprSetLocal, local_index);
|
||||
ADD_CODE(code, kExprLocalSet, local_index);
|
||||
|
||||
// Store the result in memory.
|
||||
ADD_CODE(code,
|
||||
|
@ -278,7 +278,7 @@ TEST(Breakpoint_I32Add) {
|
||||
static const int kNumBreakpoints = 3;
|
||||
byte code[] = {WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))};
|
||||
std::unique_ptr<int[]> offsets =
|
||||
Find(code, sizeof(code), kNumBreakpoints, kExprGetLocal, kExprGetLocal,
|
||||
Find(code, sizeof(code), kNumBreakpoints, kExprLocalGet, kExprLocalGet,
|
||||
kExprI32Add);
|
||||
|
||||
WasmRunner<int32_t, uint32_t, uint32_t> r(ExecutionTier::kInterpreter);
|
||||
|
@ -49,8 +49,8 @@ WASM_EXEC_TEST(Int32Const_many) {
|
||||
WASM_EXEC_TEST(GraphTrimming) {
|
||||
// This WebAssembly code requires graph trimming in the TurboFan compiler.
|
||||
WasmRunner<int32_t, int32_t> r(execution_tier);
|
||||
BUILD(r, kExprGetLocal, 0, kExprGetLocal, 0, kExprGetLocal, 0, kExprI32RemS,
|
||||
kExprI32Eq, kExprGetLocal, 0, kExprI32DivS, kExprUnreachable);
|
||||
BUILD(r, kExprLocalGet, 0, kExprLocalGet, 0, kExprLocalGet, 0, kExprI32RemS,
|
||||
kExprI32Eq, kExprLocalGet, 0, kExprI32DivS, kExprUnreachable);
|
||||
r.Call(1);
|
||||
}
|
||||
|
||||
@ -1810,18 +1810,18 @@ WASM_EXEC_TEST(CheckMachIntsZero) {
|
||||
|
||||
BUILD(r, // --
|
||||
/**/ kExprLoop, kLocalVoid, // --
|
||||
/* */ kExprGetLocal, 0, // --
|
||||
/* */ kExprLocalGet, 0, // --
|
||||
/* */ kExprIf, kLocalVoid, // --
|
||||
/* */ kExprGetLocal, 0, // --
|
||||
/* */ kExprLocalGet, 0, // --
|
||||
/* */ kExprI32LoadMem, 0, 0, // --
|
||||
/* */ kExprIf, kLocalVoid, // --
|
||||
/* */ kExprI32Const, 127, // --
|
||||
/* */ kExprReturn, // --
|
||||
/* */ kExprEnd, // --
|
||||
/* */ kExprGetLocal, 0, // --
|
||||
/* */ kExprLocalGet, 0, // --
|
||||
/* */ kExprI32Const, 4, // --
|
||||
/* */ kExprI32Sub, // --
|
||||
/* */ kExprTeeLocal, 0, // --
|
||||
/* */ kExprLocalTee, 0, // --
|
||||
/* */ kExprBr, DEPTH_0, // --
|
||||
/* */ kExprEnd, // --
|
||||
/**/ kExprEnd, // --
|
||||
@ -2012,16 +2012,16 @@ static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) {
|
||||
FunctionSig* sig = WasmOpcodes::Signature(opcode);
|
||||
|
||||
if (sig->parameter_count() == 1) {
|
||||
byte code[] = {WASM_NO_LOCALS, kExprGetLocal, 0, static_cast<byte>(opcode),
|
||||
byte code[] = {WASM_NO_LOCALS, kExprLocalGet, 0, static_cast<byte>(opcode),
|
||||
WASM_END};
|
||||
TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code,
|
||||
code + arraysize(code));
|
||||
} else {
|
||||
CHECK_EQ(2, sig->parameter_count());
|
||||
byte code[] = {WASM_NO_LOCALS,
|
||||
kExprGetLocal,
|
||||
kExprLocalGet,
|
||||
0,
|
||||
kExprGetLocal,
|
||||
kExprLocalGet,
|
||||
1,
|
||||
static_cast<byte>(opcode),
|
||||
WASM_END};
|
||||
@ -2667,7 +2667,7 @@ static void Run_WasmMixedCall_N(ExecutionTier execution_tier, int start) {
|
||||
|
||||
// Store the result in a local.
|
||||
byte local_index = r.AllocateLocal(ValueTypes::ValueTypeFor(result));
|
||||
ADD_CODE(code, kExprSetLocal, local_index);
|
||||
ADD_CODE(code, kExprLocalSet, local_index);
|
||||
|
||||
// Store the result in memory.
|
||||
ADD_CODE(code,
|
||||
@ -2761,10 +2761,11 @@ void RunMultiReturnSelect(ExecutionTier execution_tier, const T* inputs) {
|
||||
WASM_GET_LOCAL(3)),
|
||||
WASM_DROP);
|
||||
} else {
|
||||
BUILD(r, WASM_CALL_FUNCTION(r1.function_index(), WASM_GET_LOCAL(0),
|
||||
BUILD(r,
|
||||
WASM_CALL_FUNCTION(r1.function_index(), WASM_GET_LOCAL(0),
|
||||
WASM_GET_LOCAL(1), WASM_GET_LOCAL(2),
|
||||
WASM_GET_LOCAL(3)),
|
||||
kExprSetLocal, 0, WASM_DROP, WASM_GET_LOCAL(0));
|
||||
kExprLocalSet, 0, WASM_DROP, WASM_GET_LOCAL(0));
|
||||
}
|
||||
|
||||
T expected = inputs[k == 0 ? i : j];
|
||||
@ -3330,7 +3331,7 @@ static void CompileCallIndirectMany(ExecutionTier tier, ValueType param) {
|
||||
|
||||
std::vector<byte> code;
|
||||
for (byte p = 0; p < num_params; ++p) {
|
||||
ADD_CODE(code, kExprGetLocal, p);
|
||||
ADD_CODE(code, kExprLocalGet, p);
|
||||
}
|
||||
ADD_CODE(code, kExprI32Const, 0);
|
||||
ADD_CODE(code, kExprCallIndirect, 1, TABLE_ZERO);
|
||||
|
@ -194,17 +194,17 @@ ZoneBuffer GetValidModuleBytes(Zone* zone) {
|
||||
WasmModuleBuilder builder(zone);
|
||||
{
|
||||
WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii());
|
||||
uint8_t code[] = {kExprGetLocal, 0, kExprEnd};
|
||||
uint8_t code[] = {kExprLocalGet, 0, kExprEnd};
|
||||
f->EmitCode(code, arraysize(code));
|
||||
}
|
||||
{
|
||||
WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii());
|
||||
uint8_t code[] = {kExprGetLocal, 1, kExprEnd};
|
||||
uint8_t code[] = {kExprLocalGet, 1, kExprEnd};
|
||||
f->EmitCode(code, arraysize(code));
|
||||
}
|
||||
{
|
||||
WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii());
|
||||
uint8_t code[] = {kExprGetLocal, 2, kExprEnd};
|
||||
uint8_t code[] = {kExprLocalGet, 2, kExprEnd};
|
||||
f->EmitCode(code, arraysize(code));
|
||||
}
|
||||
builder.WriteTo(&buffer);
|
||||
@ -317,17 +317,17 @@ ZoneBuffer GetModuleWithInvalidSection(Zone* zone) {
|
||||
WasmInitExpr(WasmInitExpr::kGlobalIndex, 12));
|
||||
{
|
||||
WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii());
|
||||
uint8_t code[] = {kExprGetLocal, 0, kExprEnd};
|
||||
uint8_t code[] = {kExprLocalGet, 0, kExprEnd};
|
||||
f->EmitCode(code, arraysize(code));
|
||||
}
|
||||
{
|
||||
WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii());
|
||||
uint8_t code[] = {kExprGetLocal, 1, kExprEnd};
|
||||
uint8_t code[] = {kExprLocalGet, 1, kExprEnd};
|
||||
f->EmitCode(code, arraysize(code));
|
||||
}
|
||||
{
|
||||
WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii());
|
||||
uint8_t code[] = {kExprGetLocal, 2, kExprEnd};
|
||||
uint8_t code[] = {kExprLocalGet, 2, kExprEnd};
|
||||
f->EmitCode(code, arraysize(code));
|
||||
}
|
||||
builder.WriteTo(&buffer);
|
||||
@ -442,7 +442,7 @@ STREAM_TEST(TestErrorInCodeSectionDetectedByModuleDecoder) {
|
||||
uint8_t code[] = {
|
||||
U32V_1(4), // body size
|
||||
U32V_1(0), // locals count
|
||||
kExprGetLocal, 0, kExprEnd // body
|
||||
kExprLocalGet, 0, kExprEnd // body
|
||||
};
|
||||
|
||||
const uint8_t bytes[] = {
|
||||
@ -481,7 +481,7 @@ STREAM_TEST(TestErrorInCodeSectionDetectedByStreamingDecoder) {
|
||||
uint8_t code[] = {
|
||||
U32V_1(26), // !!! invalid body size !!!
|
||||
U32V_1(0), // locals count
|
||||
kExprGetLocal, 0, kExprEnd // body
|
||||
kExprLocalGet, 0, kExprEnd // body
|
||||
};
|
||||
|
||||
const uint8_t bytes[] = {
|
||||
@ -520,7 +520,7 @@ STREAM_TEST(TestErrorInCodeSectionDetectedByCompiler) {
|
||||
uint8_t code[] = {
|
||||
U32V_1(4), // !!! invalid body size !!!
|
||||
U32V_1(0), // locals count
|
||||
kExprGetLocal, 0, kExprEnd // body
|
||||
kExprLocalGet, 0, kExprEnd // body
|
||||
};
|
||||
|
||||
uint8_t invalid_code[] = {
|
||||
@ -679,7 +679,7 @@ STREAM_TEST(TestAbortAfterFunctionGotCompiled1) {
|
||||
uint8_t code[] = {
|
||||
U32V_1(4), // !!! invalid body size !!!
|
||||
U32V_1(0), // locals count
|
||||
kExprGetLocal, 0, kExprEnd // body
|
||||
kExprLocalGet, 0, kExprEnd // body
|
||||
};
|
||||
|
||||
const uint8_t bytes[] = {
|
||||
@ -713,7 +713,7 @@ STREAM_TEST(TestAbortAfterFunctionGotCompiled2) {
|
||||
uint8_t code[] = {
|
||||
U32V_1(4), // !!! invalid body size !!!
|
||||
U32V_1(0), // locals count
|
||||
kExprGetLocal, 0, kExprEnd // body
|
||||
kExprLocalGet, 0, kExprEnd // body
|
||||
};
|
||||
|
||||
const uint8_t bytes[] = {
|
||||
@ -745,7 +745,7 @@ STREAM_TEST(TestAbortAfterCodeSection1) {
|
||||
uint8_t code[] = {
|
||||
U32V_1(4), // body size
|
||||
U32V_1(0), // locals count
|
||||
kExprGetLocal, 0, kExprEnd // body
|
||||
kExprLocalGet, 0, kExprEnd // body
|
||||
};
|
||||
|
||||
const uint8_t bytes[] = {
|
||||
@ -781,7 +781,7 @@ STREAM_TEST(TestAbortAfterCodeSection2) {
|
||||
uint8_t code[] = {
|
||||
U32V_1(4), // body size
|
||||
U32V_1(0), // locals count
|
||||
kExprGetLocal, 0, kExprEnd // body
|
||||
kExprLocalGet, 0, kExprEnd // body
|
||||
};
|
||||
|
||||
const uint8_t bytes[] = {
|
||||
@ -815,7 +815,7 @@ STREAM_TEST(TestAbortAfterCompilationError1) {
|
||||
uint8_t code[] = {
|
||||
U32V_1(4), // !!! invalid body size !!!
|
||||
U32V_1(0), // locals count
|
||||
kExprGetLocal, 0, kExprEnd // body
|
||||
kExprLocalGet, 0, kExprEnd // body
|
||||
};
|
||||
|
||||
uint8_t invalid_code[] = {
|
||||
@ -857,7 +857,7 @@ STREAM_TEST(TestAbortAfterCompilationError2) {
|
||||
uint8_t code[] = {
|
||||
U32V_1(4), // !!! invalid body size !!!
|
||||
U32V_1(0), // locals count
|
||||
kExprGetLocal, 0, kExprEnd // body
|
||||
kExprLocalGet, 0, kExprEnd // body
|
||||
};
|
||||
|
||||
uint8_t invalid_code[] = {
|
||||
@ -934,7 +934,7 @@ STREAM_TEST(TestModuleWithMultipleFunctions) {
|
||||
uint8_t code[] = {
|
||||
U32V_1(4), // body size
|
||||
U32V_1(0), // locals count
|
||||
kExprGetLocal, 0, kExprEnd // body
|
||||
kExprLocalGet, 0, kExprEnd // body
|
||||
};
|
||||
|
||||
const uint8_t bytes[] = {
|
||||
@ -970,7 +970,7 @@ STREAM_TEST(TestModuleWithDataSection) {
|
||||
uint8_t code[] = {
|
||||
U32V_1(4), // body size
|
||||
U32V_1(0), // locals count
|
||||
kExprGetLocal, 0, kExprEnd // body
|
||||
kExprLocalGet, 0, kExprEnd // body
|
||||
};
|
||||
|
||||
const uint8_t bytes[] = {
|
||||
@ -1016,7 +1016,7 @@ STREAM_TEST(TestModuleWithImportedFunction) {
|
||||
builder.AddImport(ArrayVector("Test"), sigs.i_iii());
|
||||
{
|
||||
WasmFunctionBuilder* f = builder.AddFunction(sigs.i_iii());
|
||||
uint8_t code[] = {kExprGetLocal, 0, kExprEnd};
|
||||
uint8_t code[] = {kExprLocalGet, 0, kExprEnd};
|
||||
f->EmitCode(code, arraysize(code));
|
||||
}
|
||||
builder.WriteTo(&buffer);
|
||||
@ -1047,7 +1047,7 @@ STREAM_TEST(TestModuleWithErrorAfterDataSection) {
|
||||
U32V_1(1), // functions count
|
||||
U32V_1(4), // body size
|
||||
U32V_1(0), // locals count
|
||||
kExprGetLocal, // some code
|
||||
kExprLocalGet, // some code
|
||||
0, // some code
|
||||
kExprEnd, // some code
|
||||
kDataSectionCode, // section code
|
||||
@ -1133,7 +1133,7 @@ STREAM_TEST(TestSetModuleCompiledCallback) {
|
||||
uint8_t code[] = {
|
||||
U32V_1(4), // body size
|
||||
U32V_1(0), // locals count
|
||||
kExprGetLocal, 0, kExprEnd // body
|
||||
kExprLocalGet, 0, kExprEnd // body
|
||||
};
|
||||
|
||||
const uint8_t bytes[] = {
|
||||
|
@ -339,12 +339,12 @@ WASM_COMPILED_EXEC_TEST(WasmStepInAndOut) {
|
||||
Handle<JSFunction> main_fun_wrapper =
|
||||
runner.builder().WrapCode(f2.function_index());
|
||||
|
||||
// Set first breakpoint on the GetLocal (offset 19) before the Call.
|
||||
// Set first breakpoint on the LocalGet (offset 19) before the Call.
|
||||
SetBreakpoint(&runner, f2.function_index(), 19, 19);
|
||||
|
||||
BreakHandler count_breaks(isolate,
|
||||
{
|
||||
{19, BreakHandler::StepIn}, // GetLocal
|
||||
{19, BreakHandler::StepIn}, // LocalGet
|
||||
{21, BreakHandler::StepIn}, // Call
|
||||
{1, BreakHandler::StepOut}, // in f2
|
||||
{23, BreakHandler::Continue} // After Call
|
||||
|
@ -363,9 +363,9 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) {
|
||||
#define WASM_REF_FUNC(val) kExprRefFunc, val
|
||||
#define WASM_REF_IS_NULL(val) val, kExprRefIsNull
|
||||
|
||||
#define WASM_GET_LOCAL(index) kExprGetLocal, static_cast<byte>(index)
|
||||
#define WASM_SET_LOCAL(index, val) val, kExprSetLocal, static_cast<byte>(index)
|
||||
#define WASM_TEE_LOCAL(index, val) val, kExprTeeLocal, static_cast<byte>(index)
|
||||
#define WASM_GET_LOCAL(index) kExprLocalGet, static_cast<byte>(index)
|
||||
#define WASM_SET_LOCAL(index, val) val, kExprLocalSet, static_cast<byte>(index)
|
||||
#define WASM_TEE_LOCAL(index, val) val, kExprLocalTee, static_cast<byte>(index)
|
||||
#define WASM_DROP kExprDrop
|
||||
#define WASM_GET_GLOBAL(index) kExprGetGlobal, static_cast<byte>(index)
|
||||
#define WASM_SET_GLOBAL(index, val) \
|
||||
@ -444,15 +444,15 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) {
|
||||
kExprLoop, kLocalVoid, x, kExprIf, kLocalVoid, y, kExprBr, DEPTH_1, \
|
||||
kExprEnd, kExprEnd
|
||||
#define WASM_INC_LOCAL(index) \
|
||||
kExprGetLocal, static_cast<byte>(index), kExprI32Const, 1, kExprI32Add, \
|
||||
kExprTeeLocal, static_cast<byte>(index)
|
||||
kExprLocalGet, static_cast<byte>(index), kExprI32Const, 1, kExprI32Add, \
|
||||
kExprLocalTee, static_cast<byte>(index)
|
||||
#define WASM_INC_LOCAL_BYV(index, count) \
|
||||
kExprGetLocal, static_cast<byte>(index), kExprI32Const, \
|
||||
static_cast<byte>(count), kExprI32Add, kExprTeeLocal, \
|
||||
kExprLocalGet, static_cast<byte>(index), kExprI32Const, \
|
||||
static_cast<byte>(count), kExprI32Add, kExprLocalTee, \
|
||||
static_cast<byte>(index)
|
||||
#define WASM_INC_LOCAL_BY(index, count) \
|
||||
kExprGetLocal, static_cast<byte>(index), kExprI32Const, \
|
||||
static_cast<byte>(count), kExprI32Add, kExprSetLocal, \
|
||||
kExprLocalGet, static_cast<byte>(index), kExprI32Const, \
|
||||
static_cast<byte>(count), kExprI32Add, kExprLocalSet, \
|
||||
static_cast<byte>(index)
|
||||
#define WASM_UNOP(opcode, x) x, static_cast<byte>(opcode)
|
||||
#define WASM_BINOP(opcode, x, y) x, y, static_cast<byte>(opcode)
|
||||
|
@ -322,7 +322,7 @@ class WasmGenerator {
|
||||
return Generate<wanted_type>(data);
|
||||
}
|
||||
|
||||
if (opcode != kExprGetLocal) Generate(local.type, data);
|
||||
if (opcode != kExprLocalGet) Generate(local.type, data);
|
||||
builder_->EmitWithU32V(opcode, local.index);
|
||||
if (wanted_type != kWasmStmt && local.type != wanted_type) {
|
||||
Convert(local.type, wanted_type);
|
||||
@ -332,14 +332,14 @@ class WasmGenerator {
|
||||
template <ValueType wanted_type>
|
||||
void get_local(DataRange* data) {
|
||||
static_assert(wanted_type != kWasmStmt, "illegal type");
|
||||
local_op<wanted_type>(data, kExprGetLocal);
|
||||
local_op<wanted_type>(data, kExprLocalGet);
|
||||
}
|
||||
|
||||
void set_local(DataRange* data) { local_op<kWasmStmt>(data, kExprSetLocal); }
|
||||
void set_local(DataRange* data) { local_op<kWasmStmt>(data, kExprLocalSet); }
|
||||
|
||||
template <ValueType wanted_type>
|
||||
void tee_local(DataRange* data) {
|
||||
local_op<wanted_type>(data, kExprTeeLocal);
|
||||
local_op<wanted_type>(data, kExprLocalTee);
|
||||
}
|
||||
|
||||
template <size_t num_bytes>
|
||||
|
@ -11,14 +11,14 @@ utils.load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
var builder = new WasmModuleBuilder();
|
||||
builder.addFunction('fib', kSig_i_i)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 2,
|
||||
kExprI32LeS, // i < 2 ?
|
||||
kExprBrIf, 0, // --> return i
|
||||
kExprI32Const, 1, kExprI32Sub, // i - 1
|
||||
kExprCallFunction, 0, // fib(i - 1)
|
||||
kExprGetLocal, 0, kExprI32Const, 2, kExprI32Sub, // i - 2
|
||||
kExprLocalGet, 0, kExprI32Const, 2, kExprI32Sub, // i - 2
|
||||
kExprCallFunction, 0, // fib(i - 2)
|
||||
kExprI32Add
|
||||
])
|
||||
|
@ -16,12 +16,12 @@ var func_idx = builder.addFunction('helper', kSig_v_v)
|
||||
.addBody([
|
||||
kExprNop,
|
||||
kExprI32Const, 12,
|
||||
kExprSetLocal, 0,
|
||||
kExprLocalSet, 0,
|
||||
]).index;
|
||||
|
||||
builder.addFunction('main', kSig_v_i)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprCallFunction, func_idx,
|
||||
|
@ -12,7 +12,7 @@ var builder = new WasmModuleBuilder();
|
||||
builder.addFunction('wasm_func', kSig_i_i)
|
||||
.addBody([
|
||||
// clang-format off
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 1,
|
||||
kExprI32Sub,
|
||||
// clang-format on
|
||||
|
@ -41,18 +41,18 @@ async function instantiateWasm() {
|
||||
['i32Arg', undefined, 'i64_local', 'unicode☼f64'])
|
||||
.addBody([
|
||||
// Set param 0 to 11.
|
||||
kExprI32Const, 11, kExprSetLocal, 0,
|
||||
kExprI32Const, 11, kExprLocalSet, 0,
|
||||
// Set local 1 to 47.
|
||||
kExprI32Const, 47, kExprSetLocal, 1,
|
||||
kExprI32Const, 47, kExprLocalSet, 1,
|
||||
// Set local 2 to 0x7FFFFFFFFFFFFFFF (max i64).
|
||||
kExprI64Const, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0,
|
||||
kExprSetLocal, 2,
|
||||
kExprLocalSet, 2,
|
||||
// Set local 2 to 0x8000000000000000 (min i64).
|
||||
kExprI64Const, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x7f,
|
||||
kExprSetLocal, 2,
|
||||
kExprLocalSet, 2,
|
||||
// Set local 3 to 1/7.
|
||||
kExprI32Const, 1, kExprF64UConvertI32, kExprI32Const, 7,
|
||||
kExprF64UConvertI32, kExprF64Div, kExprSetLocal, 3,
|
||||
kExprF64UConvertI32, kExprF64Div, kExprLocalSet, 3,
|
||||
|
||||
// Set global 0 to 15
|
||||
kExprI32Const, 15, kExprSetGlobal, 0,
|
||||
|
@ -17,12 +17,12 @@ builder.addFunction('wasm_B', kSig_v_i)
|
||||
.addBody([
|
||||
// clang-format off
|
||||
kExprLoop, kWasmStmt, // while
|
||||
kExprGetLocal, 0, // -
|
||||
kExprLocalGet, 0, // -
|
||||
kExprIf, kWasmStmt, // if <param0> != 0
|
||||
kExprGetLocal, 0, // -
|
||||
kExprLocalGet, 0, // -
|
||||
kExprI32Const, 1, // -
|
||||
kExprI32Sub, // -
|
||||
kExprSetLocal, 0, // decrease <param0>
|
||||
kExprLocalSet, 0, // decrease <param0>
|
||||
kExprCallFunction, func_a_idx, // -
|
||||
kExprBr, 1, // continue
|
||||
kExprEnd, // -
|
||||
|
@ -17,12 +17,12 @@ builder.addFunction('wasm_B', kSig_v_i)
|
||||
.addBody([
|
||||
// clang-format off
|
||||
kExprLoop, kWasmStmt, // while
|
||||
kExprGetLocal, 0, // -
|
||||
kExprLocalGet, 0, // -
|
||||
kExprIf, kWasmStmt, // if <param0> != 0
|
||||
kExprGetLocal, 0, // -
|
||||
kExprLocalGet, 0, // -
|
||||
kExprI32Const, 1, // -
|
||||
kExprI32Sub, // -
|
||||
kExprSetLocal, 0, // decrease <param0>
|
||||
kExprLocalSet, 0, // decrease <param0>
|
||||
kExprCallFunction, func_a_idx, // -
|
||||
kExprBr, 1, // continue
|
||||
kExprEnd, // -
|
||||
|
@ -16,12 +16,12 @@ builder.addFunction('wasm_B', kSig_v_i)
|
||||
.addBody([
|
||||
// clang-format off
|
||||
kExprLoop, kWasmStmt, // while
|
||||
kExprGetLocal, 0, // -
|
||||
kExprLocalGet, 0, // -
|
||||
kExprIf, kWasmStmt, // if <param0> != 0
|
||||
kExprGetLocal, 0, // -
|
||||
kExprLocalGet, 0, // -
|
||||
kExprI32Const, 1, // -
|
||||
kExprI32Sub, // -
|
||||
kExprSetLocal, 0, // decrease <param0>
|
||||
kExprLocalSet, 0, // decrease <param0>
|
||||
kExprCallFunction, func_a_idx, // -
|
||||
kExprBr, 1, // continue
|
||||
kExprEnd, // -
|
||||
|
@ -10,19 +10,19 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
var builder = new WasmModuleBuilder();
|
||||
builder.addMemory(1);
|
||||
builder.addFunction('load', kSig_v_i)
|
||||
.addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0, kExprDrop])
|
||||
.addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0, kExprDrop])
|
||||
.exportFunc();
|
||||
builder.addFunction('load8', kSig_v_i)
|
||||
.addBody([kExprGetLocal, 0, kExprI32LoadMem8U, 0, 0, kExprDrop])
|
||||
.addBody([kExprLocalGet, 0, kExprI32LoadMem8U, 0, 0, kExprDrop])
|
||||
.exportFunc();
|
||||
builder.addFunction('loadf', kSig_v_i)
|
||||
.addBody([kExprGetLocal, 0, kExprF32LoadMem, 0, 0, kExprDrop])
|
||||
.addBody([kExprLocalGet, 0, kExprF32LoadMem, 0, 0, kExprDrop])
|
||||
.exportFunc();
|
||||
builder.addFunction('store', kSig_v_ii)
|
||||
.addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0])
|
||||
.addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0])
|
||||
.exportFunc();
|
||||
builder.addFunction('store8', kSig_v_ii)
|
||||
.addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem8, 0, 0])
|
||||
.addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem8, 0, 0])
|
||||
.exportFunc();
|
||||
var module = builder.instantiate();
|
||||
|
||||
|
@ -14,12 +14,12 @@ let kSig_r_i = makeSig([kWasmI32], [kWasmAnyRef]);
|
||||
builder.addFunction("merge", kSig_r_i)
|
||||
.addLocals({anyref_count: 1, anyfunc_count: 1})
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Eqz,
|
||||
kExprIf, kWasmAnyRef,
|
||||
kExprGetLocal, 1,
|
||||
kExprLocalGet, 1,
|
||||
kExprElse,
|
||||
kExprGetLocal, 2,
|
||||
kExprLocalGet, 2,
|
||||
kExprEnd,
|
||||
]).exportFunc();
|
||||
let instance = builder.instantiate();
|
||||
@ -33,12 +33,12 @@ let kSig_r_i = makeSig([kWasmI32], [kWasmAnyRef]);
|
||||
builder.addFunction("merge", kSig_r_i)
|
||||
.addLocals({anyfunc_count: 1})
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Eqz,
|
||||
kExprIf, kWasmAnyRef,
|
||||
kExprRefNull,
|
||||
kExprElse,
|
||||
kExprGetLocal, 1,
|
||||
kExprLocalGet, 1,
|
||||
kExprEnd,
|
||||
]).exportFunc();
|
||||
let instance = builder.instantiate();
|
||||
|
@ -273,19 +273,19 @@ try {
|
||||
function __f_16() {
|
||||
var __v_1 = new WasmModuleBuilder();
|
||||
__v_1.addFunction("grow_memory", kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0, kExprMemoryGrow])
|
||||
.addBody([kExprLocalGet, 0, kExprMemoryGrow])
|
||||
.exportFunc();
|
||||
__v_1.addFunction("load", kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0])
|
||||
.addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0])
|
||||
.exportFunc();
|
||||
__v_1.addFunction("store", kSig_i_ii)
|
||||
.addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, kExprGetLocal, 1])
|
||||
.addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem, 0, 0, kExprLocalGet, 1])
|
||||
.exportFunc();
|
||||
__v_1.addFunction("load16", kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0, kExprI32LoadMem16U, 0, 0])
|
||||
.addBody([kExprLocalGet, 0, kExprI32LoadMem16U, 0, 0])
|
||||
.exportFunc();
|
||||
__v_1.addFunction("store16", kSig_i_ii)
|
||||
.addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem16, 0, 0, kExprGetLocal, 1])
|
||||
.addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem16, 0, 0, kExprLocalGet, 1])
|
||||
.exportFunc();
|
||||
__v_1.__p_1551105852 = __v_1[getRandomProperty(__v_1, 1551105852)];
|
||||
__v_1.__defineGetter__(getRandomProperty(__v_1, 348910887), function() {
|
||||
@ -294,10 +294,10 @@ function __f_16() {
|
||||
return __v_1.__p_1551105852;
|
||||
});
|
||||
__v_1.addFunction("load8", kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0, kExprI32LoadMem8U, 0, 0])
|
||||
.addBody([kExprLocalGet, 0, kExprI32LoadMem8U, 0, 0])
|
||||
.exportFunc();
|
||||
__v_1.addFunction("store8", kSig_i_ii)
|
||||
.addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem8, 0, 0, kExprGetLocal, 1])
|
||||
.addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32StoreMem8, 0, 0, kExprLocalGet, 1])
|
||||
.exportFunc();
|
||||
return __v_1;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ builder.addFunction("regression_648079", kSig_s_v)
|
||||
kExprF32Min,
|
||||
kExprI64GtU,
|
||||
kExprBlock, 01, // @107 i32
|
||||
kExprTeeLocal,
|
||||
kExprLocalTee,
|
||||
kExprBlock, 01, // @111 i32
|
||||
kExprBlock, 01, // @113 i32
|
||||
kExprBlock, 01, // @115 i32
|
||||
@ -169,7 +169,7 @@ builder.addFunction("regression_648079", kSig_s_v)
|
||||
kExprF64Sub,
|
||||
kExprI32Const,
|
||||
kExprUnreachable,
|
||||
kExprGetLocal,
|
||||
kExprLocalGet,
|
||||
kExprI64LoadMem32U,
|
||||
kExprUnreachable,
|
||||
kExprI64RemU,
|
||||
@ -273,7 +273,7 @@ builder.addFunction("regression_648079", kSig_s_v)
|
||||
kExprF64Sub,
|
||||
kExprI32Const,
|
||||
kExprUnreachable,
|
||||
kExprGetLocal,
|
||||
kExprLocalGet,
|
||||
kExprI64LoadMem32U,
|
||||
kExprUnreachable,
|
||||
kExprUnreachable,
|
||||
@ -300,7 +300,7 @@ builder.addFunction("regression_648079", kSig_s_v)
|
||||
kExprF64Sub,
|
||||
kExprI32Const,
|
||||
kExprUnreachable,
|
||||
kExprGetLocal,
|
||||
kExprLocalGet,
|
||||
kExprI64LoadMem32U,
|
||||
kExprF64Min,
|
||||
kExprF64Min,
|
||||
|
@ -9,7 +9,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
builder.addMemory(16, 32, false);
|
||||
builder.addFunction('test', kSig_i_i)
|
||||
.addBodyWithEnd([
|
||||
kExprGetLocal, 0x00,
|
||||
kExprLocalGet, 0x00,
|
||||
kExprI32Const, 0x29,
|
||||
kExprI32Shl,
|
||||
kExprI32Const, 0x18,
|
||||
|
@ -20,7 +20,7 @@ let kExprS128LoadMem = 0xc0;
|
||||
kExprMemoryGrow, 0x00,
|
||||
kExprMemoryGrow, 0x00,
|
||||
kExprMemoryGrow, 0x00,
|
||||
kExprSetLocal, 0x00,
|
||||
kExprLocalSet, 0x00,
|
||||
kExprMemoryGrow, 0x00,
|
||||
kExprMemoryGrow, 0x00,
|
||||
kExprMemoryGrow, 0x00,
|
||||
|
@ -20,7 +20,7 @@ let func1_sig = makeSig(new Array(8).fill(kWasmI32), [kWasmI32]);
|
||||
let imp = builder1.addImport('q', 'gc', kSig_v_v);
|
||||
let func1 = builder1.addFunction('func1', func1_sig)
|
||||
.addBody([
|
||||
kExprGetLocal, 0, // -
|
||||
kExprLocalGet, 0, // -
|
||||
kExprCallFunction, imp
|
||||
])
|
||||
.exportFunc();
|
||||
@ -31,14 +31,14 @@ let builder2 = new WasmModuleBuilder();
|
||||
let func1_imp = builder2.addImport('q', 'func1', func1_sig);
|
||||
let func2 = builder2.addFunction('func2', kSig_i_i)
|
||||
.addBody([
|
||||
kExprGetLocal, 0, // 1
|
||||
kExprGetLocal, 0, // 2
|
||||
kExprGetLocal, 0, // 3
|
||||
kExprGetLocal, 0, // 4
|
||||
kExprGetLocal, 0, // 5
|
||||
kExprGetLocal, 0, // 6
|
||||
kExprGetLocal, 0, // 7
|
||||
kExprGetLocal, 0, // 8
|
||||
kExprLocalGet, 0, // 1
|
||||
kExprLocalGet, 0, // 2
|
||||
kExprLocalGet, 0, // 3
|
||||
kExprLocalGet, 0, // 4
|
||||
kExprLocalGet, 0, // 5
|
||||
kExprLocalGet, 0, // 6
|
||||
kExprLocalGet, 0, // 7
|
||||
kExprLocalGet, 0, // 8
|
||||
kExprCallFunction, func1_imp
|
||||
])
|
||||
.exportFunc();
|
||||
|
@ -9,17 +9,17 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addMemory(16, 32);
|
||||
builder.addFunction('grow', kSig_i_i).addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprMemoryGrow, 0,
|
||||
]).exportFunc();
|
||||
builder.addFunction('main', kSig_i_i).addBody([
|
||||
...wasmI32Const(0x41),
|
||||
kExprSetLocal, 0,
|
||||
kExprLocalSet, 0,
|
||||
// Enter loop, such that values are spilled to the stack.
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprEnd,
|
||||
// Reload value. This must be loaded as 32 bit value.
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32LoadMem, 0, 0,
|
||||
]).exportFunc();
|
||||
const instance = builder.instantiate();
|
||||
|
@ -7,22 +7,22 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addFunction(undefined, kSig_i_iii).addBody([
|
||||
// Return the sum of all arguments.
|
||||
kExprGetLocal, 0, kExprGetLocal, 1, kExprGetLocal, 2, kExprI32Add, kExprI32Add
|
||||
kExprLocalGet, 0, kExprLocalGet, 1, kExprLocalGet, 2, kExprI32Add, kExprI32Add
|
||||
]);
|
||||
const sig = builder.addType(kSig_i_iii);
|
||||
builder.addFunction(undefined, kSig_i_iii)
|
||||
.addBody([
|
||||
...wasmI32Const(1), // i32.const 0x1
|
||||
kExprSetLocal, 0, // set_local 0
|
||||
kExprLocalSet, 0, // set_local 0
|
||||
...wasmI32Const(4), // i32.const 0x1
|
||||
kExprSetLocal, 1, // set_local 1
|
||||
kExprLocalSet, 1, // set_local 1
|
||||
...wasmI32Const(16), // i32.const 0x1
|
||||
kExprSetLocal, 2, // set_local 2
|
||||
kExprLocalSet, 2, // set_local 2
|
||||
kExprLoop, kWasmStmt, // loop
|
||||
kExprEnd, // end
|
||||
kExprGetLocal, 0, // get_local 0
|
||||
kExprGetLocal, 1, // get_local 1
|
||||
kExprGetLocal, 2, // get_local 2
|
||||
kExprLocalGet, 0, // get_local 0
|
||||
kExprLocalGet, 1, // get_local 1
|
||||
kExprLocalGet, 2, // get_local 2
|
||||
kExprI32Const, 0, // i32.const 0 (func index)
|
||||
kExprCallIndirect, sig, 0, // call indirect
|
||||
])
|
||||
|
@ -11,7 +11,7 @@ builder0.setName('module_0');
|
||||
let sig_index = builder0.addType(kSig_i_v);
|
||||
builder0.addFunction('main', kSig_i_i)
|
||||
.addBody([
|
||||
kExprGetLocal, 0, // --
|
||||
kExprLocalGet, 0, // --
|
||||
kExprCallIndirect, sig_index, kTableZero
|
||||
]) // --
|
||||
.exportAs('main');
|
||||
|
@ -6,18 +6,18 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
|
||||
var builder = new WasmModuleBuilder();
|
||||
sig = makeSig([kWasmI32, kWasmI32, kWasmI32, kWasmI32, kWasmI32], [kWasmI32]);
|
||||
builder.addFunction(undefined, sig).addBody([kExprGetLocal, 4]);
|
||||
builder.addFunction(undefined, sig).addBody([kExprLocalGet, 4]);
|
||||
builder.addMemory(16, 32);
|
||||
builder.addFunction('main', sig)
|
||||
.addBody([
|
||||
kExprI32Const, 0, kExprSetLocal, 0,
|
||||
kExprI32Const, 0, kExprLocalSet, 0,
|
||||
// Compute five arguments to the function call.
|
||||
kExprI32Const, 0, kExprI32Const, 0, kExprI32Const, 0, kExprI32Const, 0,
|
||||
kExprGetLocal, 4, kExprI32Const, 1, kExprI32Add,
|
||||
kExprLocalGet, 4, kExprI32Const, 1, kExprI32Add,
|
||||
// Now some intermediate computation to force the arguments to be spilled
|
||||
// to the stack:
|
||||
kExprGetLocal, 0, kExprI32Const, 1, kExprI32Add, kExprGetLocal, 1,
|
||||
kExprGetLocal, 1, kExprI32Add, kExprI32Add, kExprDrop,
|
||||
kExprLocalGet, 0, kExprI32Const, 1, kExprI32Add, kExprLocalGet, 1,
|
||||
kExprLocalGet, 1, kExprI32Add, kExprI32Add, kExprDrop,
|
||||
// Now call the function.
|
||||
kExprCallFunction, 0
|
||||
])
|
||||
|
@ -15,6 +15,6 @@ builder.addFunction(undefined, kSig_v_v).addLocals({i64_count: 1}).addBody([
|
||||
kExprI32Const, 0, // i32.const
|
||||
kExprEnd, // end
|
||||
kExprBrIf, 0, // br_if depth=0
|
||||
kExprSetLocal, 0, // set_local 0
|
||||
kExprLocalSet, 0, // set_local 0
|
||||
]);
|
||||
builder.instantiate();
|
||||
|
@ -13,7 +13,7 @@ builder.addImportedTable("x", "table", 1, 10000000);
|
||||
builder.addFunction("main", kSig_i_i)
|
||||
.addBody([
|
||||
kExprI32Const, 0,
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallIndirect, 0, kTableZero])
|
||||
.exportAs("main");
|
||||
let module = new WebAssembly.Module(builder.toBuffer());
|
||||
|
@ -9,7 +9,7 @@ sig0 = makeSig([], [kWasmI32]);
|
||||
builder.addFunction(undefined, sig0).addLocals({i64_count: 1}).addBody([
|
||||
kExprLoop, kWasmI32, // loop i32
|
||||
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const 0 --> f32:0
|
||||
kExprGetLocal, 0x00, // get_local 0 --> i64:0
|
||||
kExprLocalGet, 0x00, // get_local 0 --> i64:0
|
||||
kExprF32SConvertI64, // f32.sconvert/i64 --> f32:0
|
||||
kExprF32Ge, // f32.ge --> i32:1
|
||||
kExprEnd, // end
|
||||
|
@ -51,7 +51,7 @@ const builder2 = new WasmModuleBuilder();
|
||||
sig0 = makeSig([], [kWasmI32]);
|
||||
builder2.addFunction(undefined, sig0).addLocals({i64_count: 1}).addBody([
|
||||
kExprLoop, kWasmI32, // loop i32
|
||||
kExprGetLocal, 0, // get_local 3
|
||||
kExprLocalGet, 0, // get_local 3
|
||||
kExprF32SConvertI64, // f32.sconvert/i64
|
||||
kExprI32ReinterpretF32, // i32.reinterpret/f32
|
||||
kExprEnd // end
|
||||
|
@ -8,7 +8,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction("main", kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0])
|
||||
.addBody([kExprLocalGet, 0])
|
||||
.addLocals({s128_count: 1});
|
||||
|
||||
assertFalse(WebAssembly.validate(builder.toBuffer()));
|
||||
|
@ -25,7 +25,7 @@ function __f_1() {
|
||||
__v_21 = __f_1(__v_18 = false, __v_25 = kSig_i_i);
|
||||
__v_21.addFunction('plus_one', kSig_i_i)
|
||||
.addBody([
|
||||
kExprGetLocal, 0, // -
|
||||
kExprLocalGet, 0, // -
|
||||
kExprCallFunction, __v_29 ])
|
||||
.exportFunc();
|
||||
__v_32 =
|
||||
|
@ -19,7 +19,7 @@ function __f_15356(__v_50316, __v_50317) {
|
||||
}
|
||||
(function __f_15357() {
|
||||
let __v_50320 = __f_15356(__v_50350 = false, __v_50351 = kSig_i_i);
|
||||
__v_50320.addFunction('plus_one', kSig_i_i).addBody([kExprGetLocal, 0, kExprCallFunction, __v_50315, kExprI32Const, kExprI32Add, kExprReturn]).exportFunc();
|
||||
__v_50320.addFunction('plus_one', kSig_i_i).addBody([kExprLocalGet, 0, kExprCallFunction, __v_50315, kExprI32Const, kExprI32Add, kExprReturn]).exportFunc();
|
||||
let __v_50321 = __f_15356();
|
||||
let __v_50324 = __v_50321.instantiate();
|
||||
let __v_50325 = __v_50320.instantiate({
|
||||
|
@ -24,7 +24,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
(function testAnyRefIsNull() {
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addFunction('main', kSig_i_r)
|
||||
.addBody([kExprGetLocal, 0, kExprRefIsNull])
|
||||
.addBody([kExprLocalGet, 0, kExprRefIsNull])
|
||||
.exportFunc();
|
||||
|
||||
var wire_bytes = builder.toBuffer();
|
||||
|
@ -7,7 +7,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addFunction('test', kSig_i_i)
|
||||
.addBody([
|
||||
kExprGetLocal, 0x00, // get_local 0
|
||||
kExprLocalGet, 0x00, // get_local 0
|
||||
kExprBlock, kWasmStmt, // block
|
||||
kExprBr, 0x00, // br depth=0
|
||||
kExprEnd, // end
|
||||
|
@ -8,8 +8,8 @@ const builder = new WasmModuleBuilder();
|
||||
builder.addFunction('test', kSig_i_i)
|
||||
.addBody([
|
||||
// body:
|
||||
kExprGetLocal, 0, // get_local 0
|
||||
kExprGetLocal, 0, // get_local 0
|
||||
kExprLocalGet, 0, // get_local 0
|
||||
kExprLocalGet, 0, // get_local 0
|
||||
kExprLoop, kWasmStmt, // loop
|
||||
kExprBr, 0, // br depth=0
|
||||
kExprEnd, // end
|
||||
|
@ -10,11 +10,11 @@ const builder = new WasmModuleBuilder();
|
||||
builder.addMemory(8, 16);
|
||||
builder.addFunction(undefined, kSig_i_i).addBody([
|
||||
// wasm to wasm call.
|
||||
kExprGetLocal, 0, kExprCallFunction, 0x1
|
||||
kExprLocalGet, 0, kExprCallFunction, 0x1
|
||||
]);
|
||||
builder.addFunction(undefined, kSig_i_i).addBody([
|
||||
// load from <get_local 0> to create trap code.
|
||||
kExprGetLocal, 0, kExprI32LoadMem, 0,
|
||||
kExprLocalGet, 0, kExprI32LoadMem, 0,
|
||||
// unreachable to create a runtime call.
|
||||
kExprUnreachable
|
||||
]);
|
||||
|
@ -8,10 +8,10 @@ const builder = new WasmModuleBuilder();
|
||||
builder.addFunction(undefined, kSig_v_iii).addBody([
|
||||
kExprI32Const, 0x41, // i32.const 0x41
|
||||
kExprLoop, 0x7c, // loop f64
|
||||
kExprGetLocal, 0x00, // get_local 0
|
||||
kExprGetLocal, 0x01, // get_local 1
|
||||
kExprLocalGet, 0x00, // get_local 0
|
||||
kExprLocalGet, 0x01, // get_local 1
|
||||
kExprBrIf, 0x01, // br_if depth=1
|
||||
kExprGetLocal, 0x00, // get_local 0
|
||||
kExprLocalGet, 0x00, // get_local 0
|
||||
kExprI32Rol, // i32.rol
|
||||
kExprBrIf, 0x00, // br_if depth=0
|
||||
kExprUnreachable, // unreachable
|
||||
|
@ -9,7 +9,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
(function TestPostModule() {
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction("add", kSig_i_ii)
|
||||
.addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add])
|
||||
.addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Add])
|
||||
.exportFunc();
|
||||
|
||||
let module = builder.toModule();
|
||||
|
@ -27,11 +27,11 @@ function varuint32(val) {
|
||||
let body = [];
|
||||
|
||||
for (let i = 0; i < kNumLocals; ++i) {
|
||||
body.push(kExprCallFunction, 0, kExprSetLocal, ...varuint32(i));
|
||||
body.push(kExprCallFunction, 0, kExprLocalSet, ...varuint32(i));
|
||||
}
|
||||
|
||||
for (let i = 0; i < kNumLocals; ++i) {
|
||||
body.push(kExprGetLocal, ...varuint32(i), kExprCallFunction, 1);
|
||||
body.push(kExprLocalGet, ...varuint32(i), kExprCallFunction, 1);
|
||||
}
|
||||
|
||||
let builder = new WasmModuleBuilder();
|
||||
|
@ -10,7 +10,7 @@ let kTableSize = 3;
|
||||
var builder = new WasmModuleBuilder();
|
||||
var sig_index1 = builder.addType(kSig_i_v);
|
||||
builder.addFunction('main', kSig_i_ii).addBody([
|
||||
kExprGetLocal,
|
||||
kExprLocalGet,
|
||||
0,
|
||||
kExprCallIndirect,
|
||||
sig_index1,
|
||||
|
@ -8,7 +8,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
|
||||
const builder1 = new WasmModuleBuilder();
|
||||
builder1.addFunction('mul', kSig_i_ii)
|
||||
.addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Mul])
|
||||
.addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Mul])
|
||||
.exportFunc();
|
||||
const mul = builder1.instantiate().exports.mul;
|
||||
const table = new WebAssembly.Table({
|
||||
|
@ -29,7 +29,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
builder.addTable(kWasmAnyFunc, 4);
|
||||
builder.addFunction("main", kSig_i_i)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallIndirect, 0, kTableZero
|
||||
])
|
||||
.exportFunc();
|
||||
|
@ -14,7 +14,7 @@ let instance;
|
||||
let module = new WasmModuleBuilder();
|
||||
module.addImport('mod', 'func', kSig_v_i);
|
||||
module.addFunction('main', kSig_v_i)
|
||||
.addBody([kExprGetLocal, 0, kExprCallFunction, 0])
|
||||
.addBody([kExprLocalGet, 0, kExprCallFunction, 0])
|
||||
.exportFunc();
|
||||
instance = module.instantiate({
|
||||
mod: {
|
||||
|
@ -171,8 +171,8 @@ function wasmBinop(name, sig) {
|
||||
builder.addImport('Math', name, sig_index);
|
||||
builder.addFunction('main', sig_index)
|
||||
.addBody([
|
||||
kExprGetLocal, 0, // --
|
||||
kExprGetLocal, 1, // --
|
||||
kExprLocalGet, 0, // --
|
||||
kExprLocalGet, 1, // --
|
||||
kExprCallFunction, 0
|
||||
]) // --
|
||||
.exportAs('main');
|
||||
|
@ -9,14 +9,14 @@ builder.addFunction('main', kSig_d_d)
|
||||
.addBody([
|
||||
// Call with param 0 (converted to i64), to fill the stack with non-zero
|
||||
// values.
|
||||
kExprGetLocal, 0, kExprI64SConvertF64, // arg 0
|
||||
kExprGetLocal, 0, kExprI64SConvertF64, // arg 1
|
||||
kExprGetLocal, 0, kExprI64SConvertF64, // arg 2
|
||||
kExprGetLocal, 0, kExprI64SConvertF64, // arg 3
|
||||
kExprGetLocal, 0, kExprI64SConvertF64, // arg 4
|
||||
kExprGetLocal, 0, kExprI64SConvertF64, // arg 5
|
||||
kExprGetLocal, 0, kExprI64SConvertF64, // arg 6
|
||||
kExprGetLocal, 0, kExprI64SConvertF64, // arg 7
|
||||
kExprLocalGet, 0, kExprI64SConvertF64, // arg 0
|
||||
kExprLocalGet, 0, kExprI64SConvertF64, // arg 1
|
||||
kExprLocalGet, 0, kExprI64SConvertF64, // arg 2
|
||||
kExprLocalGet, 0, kExprI64SConvertF64, // arg 3
|
||||
kExprLocalGet, 0, kExprI64SConvertF64, // arg 4
|
||||
kExprLocalGet, 0, kExprI64SConvertF64, // arg 5
|
||||
kExprLocalGet, 0, kExprI64SConvertF64, // arg 6
|
||||
kExprLocalGet, 0, kExprI64SConvertF64, // arg 7
|
||||
kExprCallFunction, 1, // call #1
|
||||
// Now call with 0 constants.
|
||||
// The bug was that they were written out as i32 values, thus the upper 32
|
||||
@ -36,7 +36,7 @@ builder.addFunction('main', kSig_d_d)
|
||||
.exportFunc();
|
||||
builder.addFunction(undefined, makeSig(new Array(8).fill(kWasmI64), [kWasmF64]))
|
||||
.addBody([
|
||||
kExprGetLocal, 7, // get_local 7 (last parameter)
|
||||
kExprLocalGet, 7, // get_local 7 (last parameter)
|
||||
kExprF64SConvertI64, // f64.convert_s/i64
|
||||
]);
|
||||
const instance = builder.instantiate();
|
||||
|
@ -8,18 +8,18 @@ const builder = new WasmModuleBuilder();
|
||||
builder.addFunction(undefined, makeSig([kWasmI32, kWasmF32], []))
|
||||
.addLocals({i32_count: 7})
|
||||
.addBody([
|
||||
kExprGetLocal, 0, // get_local
|
||||
kExprLocalGet, 0, // get_local
|
||||
kExprI32Const, 0, // i32.const 0
|
||||
kExprIf, kWasmStmt, // if
|
||||
kExprUnreachable, // unreachable
|
||||
kExprEnd, // end if
|
||||
kExprGetLocal, 4, // get_local
|
||||
kExprTeeLocal, 8, // tee_local
|
||||
kExprLocalGet, 4, // get_local
|
||||
kExprLocalTee, 8, // tee_local
|
||||
kExprBrIf, 0, // br_if depth=0
|
||||
kExprTeeLocal, 7, // tee_local
|
||||
kExprTeeLocal, 0, // tee_local
|
||||
kExprTeeLocal, 2, // tee_local
|
||||
kExprTeeLocal, 8, // tee_local
|
||||
kExprLocalTee, 7, // tee_local
|
||||
kExprLocalTee, 0, // tee_local
|
||||
kExprLocalTee, 2, // tee_local
|
||||
kExprLocalTee, 8, // tee_local
|
||||
kExprDrop, // drop
|
||||
kExprLoop, kWasmStmt, // loop
|
||||
kExprEnd, // end loop
|
||||
|
@ -10,7 +10,7 @@ const builder = new WasmModuleBuilder();
|
||||
builder.addMemory(1, 1);
|
||||
// First function is Liftoff. The first parameter is used as memory offset.
|
||||
builder.addFunction(undefined, kSig_v_i).addBody([
|
||||
kExprGetLocal, 0, // get_local 0
|
||||
kExprLocalGet, 0, // get_local 0
|
||||
kExprI32Const, 0, // i32.const 0
|
||||
kExprI32StoreMem, 0, 0, // i32.store offset=0
|
||||
]);
|
||||
@ -19,7 +19,7 @@ builder.addFunction(undefined, kSig_v_i).addBody([
|
||||
// is loaded as 64-bit value on x64.
|
||||
builder.addFunction(undefined, makeSig(new Array(6).fill(kWasmI32), []))
|
||||
.addBody([
|
||||
kExprGetLocal, 5, // get_local 5
|
||||
kExprLocalGet, 5, // get_local 5
|
||||
kExprCallFunction, 0 // call 0
|
||||
]);
|
||||
// The third function is Liftoff again. A value is spilled on the stack as i32,
|
||||
@ -27,8 +27,8 @@ builder.addFunction(undefined, makeSig(new Array(6).fill(kWasmI32), []))
|
||||
// copied on the stack, even though just 32-bit were written before. Hence, the
|
||||
// stack slot is not zero-extended.
|
||||
const gen_i32_code = [
|
||||
kExprTeeLocal, 0, // tee_local 0
|
||||
kExprGetLocal, 0, // get_local 0
|
||||
kExprLocalTee, 0, // tee_local 0
|
||||
kExprLocalGet, 0, // get_local 0
|
||||
kExprI32Const, 1, // i32.const 1
|
||||
kExprI32Add // i32.add --> 2nd param
|
||||
];
|
||||
|
@ -8,8 +8,8 @@ const builder = new WasmModuleBuilder();
|
||||
const sig = makeSig([kWasmI32, kWasmI64, kWasmI64], [kWasmI64]);
|
||||
builder.addFunction(undefined, sig)
|
||||
.addBody([
|
||||
kExprGetLocal, 2,
|
||||
kExprGetLocal, 1,
|
||||
kExprLocalGet, 2,
|
||||
kExprLocalGet, 1,
|
||||
kExprI64Shl,
|
||||
]);
|
||||
builder.instantiate();
|
||||
|
@ -12,8 +12,8 @@ builder.addFunction(undefined, 0 /* sig */)
|
||||
.addLocals({i32_count: 504})
|
||||
.addBody([
|
||||
kExprGetGlobal, 0x00,
|
||||
kExprSetLocal, 0x04,
|
||||
kExprGetLocal, 0x04,
|
||||
kExprLocalSet, 0x04,
|
||||
kExprLocalGet, 0x04,
|
||||
kExprI32Const, 0x01,
|
||||
kExprI32Sub,
|
||||
kExprGetGlobal, 0x00,
|
||||
|
@ -14,11 +14,11 @@ kExprIf, kWasmI32,
|
||||
kExprElse,
|
||||
kExprI32Const, 1,
|
||||
kExprEnd,
|
||||
kExprTeeLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalTee, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprI64Const, 0x80, 0x80, 0x80, 0x70,
|
||||
kExprSetLocal, 0x01,
|
||||
kExprLocalSet, 0x01,
|
||||
kExprI32Const, 0x00,
|
||||
kExprIf, kWasmI32,
|
||||
kExprI32Const, 0x00,
|
||||
|
@ -14,7 +14,7 @@ builder.addFunction(undefined, kSig_i_i)
|
||||
kExprElse, // @15
|
||||
kExprI32Const, 1,
|
||||
kExprEnd, // @18
|
||||
kExprTeeLocal, 0,
|
||||
kExprLocalTee, 0,
|
||||
kExprI32Popcnt
|
||||
]);
|
||||
builder.instantiate();
|
||||
|
@ -8,9 +8,9 @@ const builder = new WasmModuleBuilder();
|
||||
builder.addFunction(undefined, kSig_v_v)
|
||||
.addLocals({i32_count: 1}).addLocals({f32_count: 1}).addLocals({f64_count: 1})
|
||||
.addBody([
|
||||
kExprGetLocal, 1,
|
||||
kExprGetLocal, 2,
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 1,
|
||||
kExprLocalGet, 2,
|
||||
kExprLocalGet, 0,
|
||||
kExprIf, kWasmI32,
|
||||
kExprI32Const, 1,
|
||||
kExprElse,
|
||||
|
@ -8,23 +8,23 @@ const builder = new WasmModuleBuilder();
|
||||
builder.addFunction(undefined, kSig_i_i)
|
||||
.addLocals({i32_count: 5})
|
||||
.addBody([
|
||||
kExprGetLocal, 0, // --> 1
|
||||
kExprLocalGet, 0, // --> 1
|
||||
kExprIf, kWasmI32,
|
||||
kExprGetLocal, 0, // --> 1
|
||||
kExprLocalGet, 0, // --> 1
|
||||
kExprElse,
|
||||
kExprUnreachable,
|
||||
kExprEnd,
|
||||
kExprIf, kWasmI32,
|
||||
kExprGetLocal, 0, // --> 1
|
||||
kExprLocalGet, 0, // --> 1
|
||||
kExprElse,
|
||||
kExprUnreachable,
|
||||
kExprEnd,
|
||||
kExprIf, kWasmI32,
|
||||
kExprI32Const, 0,
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Sub, // --> -1
|
||||
kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Sub, // --> 0
|
||||
kExprI32Sub, // --> -1
|
||||
kExprElse,
|
||||
|
@ -8,8 +8,8 @@ const builder = new WasmModuleBuilder();
|
||||
builder.addFunction(undefined, kSig_v_v).addBody([]);
|
||||
builder.addFunction(undefined, kSig_i_i)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
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,
|
||||
|
@ -12,7 +12,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
.addLocals({except_count: 1})
|
||||
.addBody([
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprBrOnExn // Bytecode truncated here.
|
||||
]).exportFunc();
|
||||
fun.body.pop(); // Pop implicitly added kExprEnd from body.
|
||||
|
@ -10,10 +10,10 @@ builder.addFunction(undefined, sig)
|
||||
.addLocals({i64_count: 1})
|
||||
.addBody([
|
||||
kExprLoop, kWasmI32,
|
||||
kExprGetLocal, 1,
|
||||
kExprLocalGet, 1,
|
||||
kExprI64Const, 1,
|
||||
kExprLoop, kWasmI32,
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Const, 1,
|
||||
kExprI32Const, 1,
|
||||
kExprIf, kWasmI32,
|
||||
|
@ -14,30 +14,30 @@ builder.addFunction(undefined, sig)
|
||||
kExprEnd,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprI32Const, 0x00,
|
||||
kExprSetLocal, 0x09,
|
||||
kExprLocalSet, 0x09,
|
||||
kExprI32Const, 0x00,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprI32Const, 0x00,
|
||||
kExprSetLocal, 0x0a,
|
||||
kExprLocalSet, 0x0a,
|
||||
kExprBr, 0x00,
|
||||
kExprEnd,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprGetLocal, 0x00,
|
||||
kExprSetLocal, 0x12,
|
||||
kExprLocalGet, 0x00,
|
||||
kExprLocalSet, 0x12,
|
||||
kExprBr, 0x00,
|
||||
kExprEnd,
|
||||
kExprGetLocal, 0x16,
|
||||
kExprSetLocal, 0x0f,
|
||||
kExprGetLocal, 0x0f,
|
||||
kExprSetLocal, 0x17,
|
||||
kExprGetLocal, 0x0f,
|
||||
kExprSetLocal, 0x18,
|
||||
kExprGetLocal, 0x17,
|
||||
kExprGetLocal, 0x18,
|
||||
kExprLocalGet, 0x16,
|
||||
kExprLocalSet, 0x0f,
|
||||
kExprLocalGet, 0x0f,
|
||||
kExprLocalSet, 0x17,
|
||||
kExprLocalGet, 0x0f,
|
||||
kExprLocalSet, 0x18,
|
||||
kExprLocalGet, 0x17,
|
||||
kExprLocalGet, 0x18,
|
||||
kExprI64ShrS,
|
||||
kExprSetLocal, 0x19,
|
||||
kExprLocalSet, 0x19,
|
||||
kExprUnreachable,
|
||||
kExprEnd,
|
||||
kExprUnreachable,
|
||||
|
@ -8,7 +8,7 @@ const builder = new WasmModuleBuilder();
|
||||
const sig = builder.addType(makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]));
|
||||
builder.addFunction(undefined, sig)
|
||||
.addBody([
|
||||
kExprGetLocal, 2,
|
||||
kExprLocalGet, 2,
|
||||
kExprIf, kWasmStmt,
|
||||
kExprBlock, kWasmStmt
|
||||
]);
|
||||
|
@ -11,8 +11,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
binary.emit_header();
|
||||
binary.emit_bytes([kTypeSectionCode, 4, 1, kWasmFunctionTypeForm, 0, 0]);
|
||||
binary.emit_bytes([kFunctionSectionCode, 2, 1, 0]);
|
||||
binary.emit_bytes([kCodeSectionCode, 6, 1, 4, 0, kExprGetLocal, 0, kExprEnd]);
|
||||
binary.emit_bytes([kCodeSectionCode, 6, 1, 4, 0, kExprGetLocal, 0, kExprEnd]);
|
||||
binary.emit_bytes([kCodeSectionCode, 6, 1, 4, 0, kExprLocalGet, 0, kExprEnd]);
|
||||
binary.emit_bytes([kCodeSectionCode, 6, 1, 4, 0, kExprLocalGet, 0, kExprEnd]);
|
||||
let buffer = binary.trunc_buffer();
|
||||
assertPromiseResult(WebAssembly.compile(buffer), assertUnreachable,
|
||||
e => assertInstanceof(e, WebAssembly.CompileError));
|
||||
|
@ -9,9 +9,9 @@ const memory = new WebAssembly.Memory({initial: 1});
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addImportedMemory("imports", "mem", 1);
|
||||
builder.addFunction("copy", kSig_v_iii)
|
||||
.addBody([kExprGetLocal, 0, // dst
|
||||
kExprGetLocal, 1, // src
|
||||
kExprGetLocal, 2, // size
|
||||
.addBody([kExprLocalGet, 0, // dst
|
||||
kExprLocalGet, 1, // src
|
||||
kExprLocalGet, 2, // size
|
||||
kNumericPrefix, kExprMemoryCopy, 0, 0]).exportAs("copy");
|
||||
let instance = builder.instantiate({imports: {mem: memory}});
|
||||
memory.grow(1);
|
||||
|
@ -9,9 +9,9 @@ const memory = new WebAssembly.Memory({initial: 1});
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addImportedMemory("imports", "mem");
|
||||
builder.addFunction("fill", kSig_v_iii)
|
||||
.addBody([kExprGetLocal, 0, // dst
|
||||
kExprGetLocal, 1, // value
|
||||
kExprGetLocal, 2, // size
|
||||
.addBody([kExprLocalGet, 0, // dst
|
||||
kExprLocalGet, 1, // value
|
||||
kExprLocalGet, 2, // size
|
||||
kNumericPrefix, kExprMemoryFill, 0]).exportAs("fill");
|
||||
let instance = builder.instantiate({imports: {mem: memory}});
|
||||
memory.grow(1);
|
||||
|
@ -28,16 +28,16 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
builder.addFunction("foo", kSig_v_iii)
|
||||
.addBody([].concat([
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprGetLocal, 0x2,
|
||||
kExprLocalGet, 0x2,
|
||||
kExprI32Const, 0x01,
|
||||
kExprI32And,
|
||||
// Generate a test branch (which has 32k limited reach).
|
||||
kExprIf, kWasmStmt,
|
||||
kExprGetLocal, 0x0,
|
||||
kExprLocalGet, 0x0,
|
||||
kExprI32Const, 0x01,
|
||||
kExprI32And,
|
||||
kExprBrIf, 0x1,
|
||||
kExprGetLocal, 0x0,
|
||||
kExprLocalGet, 0x0,
|
||||
// Emit a br_table that is long enough to make the test branch go out of range.
|
||||
], br_table(0x1, 9000, 0x00), [
|
||||
kExprEnd,
|
||||
|
@ -16,7 +16,7 @@ const NUM_CASES = 0xfffd;
|
||||
builder.addFunction('main', kSig_v_i)
|
||||
.addBody([].concat([
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprBrTable], wasmSignedLeb(NUM_CASES),
|
||||
cases, [0,
|
||||
kExprEnd
|
||||
|
@ -20,8 +20,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
let builder = new WasmModuleBuilder();
|
||||
|
||||
builder.addFunction("add", kSig_i_ii)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 1,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 1,
|
||||
kExprI32Add])
|
||||
.exportFunc();
|
||||
|
||||
|
@ -28,7 +28,7 @@ function makeSelect(type, args, which) {
|
||||
var params = [];
|
||||
for (var i = 0; i < args; i++) params.push(type);
|
||||
builder.addFunction("select", makeSig(params, [type]))
|
||||
.addBody([kExprGetLocal, which])
|
||||
.addBody([kExprLocalGet, which])
|
||||
.exportFunc();
|
||||
|
||||
return builder.instantiate().exports.select;
|
||||
|
@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
print(arguments.callee.name);
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addFunction('main', kSig_a_a)
|
||||
.addBody([kExprGetLocal, 0])
|
||||
.addBody([kExprLocalGet, 0])
|
||||
.exportFunc();
|
||||
|
||||
const instance = builder.instantiate();
|
||||
@ -27,7 +27,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
const sig_index = builder.addType(kSig_v_a);
|
||||
const imp_index = builder.addImport('q', 'func', sig_index);
|
||||
builder.addFunction('main', sig_index)
|
||||
.addBody([kExprGetLocal, 0, kExprCallFunction, imp_index])
|
||||
.addBody([kExprLocalGet, 0, kExprCallFunction, imp_index])
|
||||
.exportFunc();
|
||||
|
||||
const main = builder.instantiate({q: {func: checkFunction}}).exports.main;
|
||||
@ -50,28 +50,28 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
builder.addFunction('main', ref_sig)
|
||||
.addLocals({anyfunc_count: 10})
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprSetLocal, 1, // Set local
|
||||
kExprGetLocal, 0,
|
||||
kExprSetLocal, 2, // Set local
|
||||
kExprGetLocal, 0,
|
||||
kExprSetLocal, 3, // Set local
|
||||
kExprGetLocal, 0,
|
||||
kExprSetLocal, 4, // Set local
|
||||
kExprGetLocal, 0,
|
||||
kExprSetLocal, 5, // Set local
|
||||
kExprGetLocal, 0,
|
||||
kExprSetLocal, 6, // Set local
|
||||
kExprGetLocal, 0,
|
||||
kExprSetLocal, 7, // Set local
|
||||
kExprGetLocal, 0,
|
||||
kExprSetLocal, 8, // Set local
|
||||
kExprGetLocal, 0,
|
||||
kExprSetLocal, 9, // Set local
|
||||
kExprGetLocal, 0,
|
||||
kExprSetLocal, 10, // Set local
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalSet, 1, // Set local
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalSet, 2, // Set local
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalSet, 3, // Set local
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalSet, 4, // Set local
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalSet, 5, // Set local
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalSet, 6, // Set local
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalSet, 7, // Set local
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalSet, 8, // Set local
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalSet, 9, // Set local
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalSet, 10, // Set local
|
||||
kExprCallFunction, gc_index, // call gc
|
||||
kExprGetLocal, 9,
|
||||
kExprLocalGet, 9,
|
||||
kExprCallFunction, imp_index // call import
|
||||
])
|
||||
.exportFunc();
|
||||
@ -97,7 +97,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
builder.addFunction('main', ref_sig)
|
||||
.addBody([
|
||||
kExprCallFunction, gc_index, // call gc
|
||||
kExprGetLocal, 0, kExprCallFunction, imp_index // call import
|
||||
kExprLocalGet, 0, kExprCallFunction, imp_index // call import
|
||||
])
|
||||
.exportFunc();
|
||||
|
||||
@ -118,7 +118,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
makeSig([kWasmI32, kWasmAnyFunc, kWasmI32], [kWasmAnyFunc]);
|
||||
const sig_index = builder.addType(kSig_a_iai);
|
||||
builder.addFunction('main', sig_index)
|
||||
.addBody([kExprGetLocal, 1])
|
||||
.addBody([kExprLocalGet, 1])
|
||||
.exportFunc();
|
||||
|
||||
const main = builder.instantiate().exports.main;
|
||||
@ -140,7 +140,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
const sig_index = builder.addType(kSig_a_v);
|
||||
builder.addFunction('main', sig_index)
|
||||
.addLocals({anyfunc_count: 1})
|
||||
.addBody([kExprGetLocal, 0])
|
||||
.addBody([kExprLocalGet, 0])
|
||||
.exportFunc();
|
||||
|
||||
const main = builder.instantiate().exports.main;
|
||||
@ -152,7 +152,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
const builder = new WasmModuleBuilder();
|
||||
const sig_index = builder.addType(kSig_a_a);
|
||||
builder.addFunction('main', sig_index)
|
||||
.addBody([kExprRefNull, kExprSetLocal, 0, kExprGetLocal, 0])
|
||||
.addBody([kExprRefNull, kExprLocalSet, 0, kExprLocalGet, 0])
|
||||
.exportFunc();
|
||||
|
||||
const main = builder.instantiate().exports.main;
|
||||
@ -187,7 +187,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
const sig_index = builder.addType(kSig_r_v);
|
||||
builder.addFunction('main', sig_index)
|
||||
.addLocals({anyfunc_count: 1})
|
||||
.addBody([kExprGetLocal, 0])
|
||||
.addBody([kExprLocalGet, 0])
|
||||
.exportFunc();
|
||||
|
||||
const main = builder.instantiate().exports.main;
|
||||
@ -200,7 +200,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
const sig_index = builder.addType(kSig_r_v);
|
||||
builder.addFunction('main', sig_index)
|
||||
.addLocals({anyfunc_count: 1})
|
||||
.addBody([kExprGetLocal, 0, kExprReturn])
|
||||
.addBody([kExprLocalGet, 0, kExprReturn])
|
||||
.exportFunc();
|
||||
|
||||
const main = builder.instantiate().exports.main;
|
||||
|
@ -32,14 +32,14 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
const g_nullfunc = builder.addGlobal(kWasmAnyFunc, true);
|
||||
builder.addFunction("get_anyref_global", kSig_r_r)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprSetGlobal, g_setref.index,
|
||||
kExprGetGlobal, g_nullref.index
|
||||
])
|
||||
.exportAs("get_anyref_global");
|
||||
builder.addFunction("get_anyfunc_global", kSig_a_a)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprSetGlobal, g_setfunc.index,
|
||||
kExprGetGlobal, g_nullfunc.index
|
||||
])
|
||||
@ -59,7 +59,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
const g = builder.addGlobal(kWasmAnyRef, true);
|
||||
builder.addFunction("main", kSig_r_r)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprSetGlobal, g.index,
|
||||
kExprGetGlobal, g.index
|
||||
])
|
||||
@ -79,7 +79,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
const g = builder.addGlobal(kWasmAnyFunc, true);
|
||||
builder.addFunction("main", kSig_a_a)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprSetGlobal, g.index,
|
||||
kExprGetGlobal, g.index
|
||||
])
|
||||
@ -100,7 +100,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
const g = builder.addGlobal(kWasmAnyRef, true);
|
||||
builder.addFunction("main", kSig_r_r)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprSetGlobal, g.index,
|
||||
kExprCallFunction, gc_index, // call gc
|
||||
kExprGetGlobal, g.index
|
||||
@ -127,7 +127,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
builder.addFunction("set_global", kSig_v_r)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprSetGlobal, g.index
|
||||
])
|
||||
.exportAs("set_global");
|
||||
@ -285,13 +285,13 @@ function dummy_func() {
|
||||
builder.addFunction("main",
|
||||
makeSig([kWasmAnyRef, kWasmAnyFunc, kWasmAnyRef, kWasmAnyFunc], []))
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprSetGlobal, g1.index,
|
||||
kExprGetLocal, 1,
|
||||
kExprLocalGet, 1,
|
||||
kExprSetGlobal, g2.index,
|
||||
kExprGetLocal, 2,
|
||||
kExprLocalGet, 2,
|
||||
kExprSetGlobal, g3.index,
|
||||
kExprGetLocal, 3,
|
||||
kExprLocalGet, 3,
|
||||
kExprSetGlobal, g4.index
|
||||
])
|
||||
.exportAs("main");
|
||||
@ -358,9 +358,9 @@ function dummy_func() {
|
||||
|
||||
builder1.addFunction("set_globals", kSig_v_rr)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprSetGlobal, g2.index,
|
||||
kExprGetLocal, 1,
|
||||
kExprLocalGet, 1,
|
||||
kExprSetGlobal, g3.index,
|
||||
])
|
||||
.exportAs("set_globals");
|
||||
@ -392,9 +392,9 @@ function dummy_func() {
|
||||
|
||||
builder2.addFunction("set_globals", kSig_v_rr)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprSetGlobal, i2,
|
||||
kExprGetLocal, 1,
|
||||
kExprLocalGet, 1,
|
||||
kExprSetGlobal, i3,
|
||||
])
|
||||
.exportAs("set_globals");
|
||||
@ -454,9 +454,9 @@ function dummy_func() {
|
||||
|
||||
builder1.addFunction("set_globals", kSig_v_aa)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprSetGlobal, g2.index,
|
||||
kExprGetLocal, 1,
|
||||
kExprLocalGet, 1,
|
||||
kExprSetGlobal, g3.index,
|
||||
])
|
||||
.exportAs("set_globals");
|
||||
@ -489,9 +489,9 @@ function dummy_func() {
|
||||
|
||||
builder2.addFunction("set_globals", kSig_v_aa)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprSetGlobal, i2,
|
||||
kExprGetLocal, 1,
|
||||
kExprLocalGet, 1,
|
||||
kExprSetGlobal, i3,
|
||||
])
|
||||
.exportAs("set_globals");
|
||||
|
@ -10,7 +10,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
print(arguments.callee.name);
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addFunction('main', kSig_r_r)
|
||||
.addBody([kExprGetLocal, 0])
|
||||
.addBody([kExprLocalGet, 0])
|
||||
.exportFunc();
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
const sig_index = builder.addType(kSig_v_r);
|
||||
const imp_index = builder.addImport("q", "func", sig_index);
|
||||
builder.addFunction('main', sig_index)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprCallFunction, imp_index])
|
||||
.exportFunc();
|
||||
|
||||
@ -55,18 +55,18 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
builder.addFunction('main', ref_sig)
|
||||
.addLocals({anyref_count: 10})
|
||||
.addBody([
|
||||
kExprGetLocal, 0, kExprSetLocal, 1, // Set local
|
||||
kExprGetLocal, 0, kExprSetLocal, 2, // Set local
|
||||
kExprGetLocal, 0, kExprSetLocal, 3, // Set local
|
||||
kExprGetLocal, 0, kExprSetLocal, 4, // Set local
|
||||
kExprGetLocal, 0, kExprSetLocal, 5, // Set local
|
||||
kExprGetLocal, 0, kExprSetLocal, 6, // Set local
|
||||
kExprGetLocal, 0, kExprSetLocal, 7, // Set local
|
||||
kExprGetLocal, 0, kExprSetLocal, 8, // Set local
|
||||
kExprGetLocal, 0, kExprSetLocal, 9, // Set local
|
||||
kExprGetLocal, 0, kExprSetLocal, 10, // Set local
|
||||
kExprLocalGet, 0, kExprLocalSet, 1, // Set local
|
||||
kExprLocalGet, 0, kExprLocalSet, 2, // Set local
|
||||
kExprLocalGet, 0, kExprLocalSet, 3, // Set local
|
||||
kExprLocalGet, 0, kExprLocalSet, 4, // Set local
|
||||
kExprLocalGet, 0, kExprLocalSet, 5, // Set local
|
||||
kExprLocalGet, 0, kExprLocalSet, 6, // Set local
|
||||
kExprLocalGet, 0, kExprLocalSet, 7, // Set local
|
||||
kExprLocalGet, 0, kExprLocalSet, 8, // Set local
|
||||
kExprLocalGet, 0, kExprLocalSet, 9, // Set local
|
||||
kExprLocalGet, 0, kExprLocalSet, 10, // Set local
|
||||
kExprCallFunction, gc_index, // call gc
|
||||
kExprGetLocal, 9, kExprCallFunction, imp_index // call import
|
||||
kExprLocalGet, 9, kExprCallFunction, imp_index // call import
|
||||
])
|
||||
.exportFunc();
|
||||
|
||||
@ -90,7 +90,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
builder.addFunction('main', ref_sig)
|
||||
.addBody([
|
||||
kExprCallFunction, gc_index, // call gc
|
||||
kExprGetLocal, 0, kExprCallFunction, imp_index // call import
|
||||
kExprLocalGet, 0, kExprCallFunction, imp_index // call import
|
||||
])
|
||||
.exportFunc();
|
||||
|
||||
@ -119,7 +119,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
builder.addFunction('main', main_sig)
|
||||
.addBody([
|
||||
kExprCallFunction, gc_index, // call gc
|
||||
kExprGetLocal, index, kExprCallFunction, imp_index // call import
|
||||
kExprLocalGet, index, kExprCallFunction, imp_index // call import
|
||||
])
|
||||
.exportFunc();
|
||||
|
||||
@ -145,7 +145,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
const kSig_r_iri = makeSig([kWasmI32, kWasmAnyRef, kWasmI32], [kWasmAnyRef]);
|
||||
const sig_index = builder.addType(kSig_r_iri);
|
||||
builder.addFunction('main', sig_index)
|
||||
.addBody([kExprGetLocal, 1])
|
||||
.addBody([kExprLocalGet, 1])
|
||||
.exportFunc();
|
||||
|
||||
const instance = builder.instantiate();
|
||||
@ -177,7 +177,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
print(arguments.callee.name);
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addFunction('main', kSig_i_r)
|
||||
.addBody([kExprGetLocal, 0, kExprRefIsNull])
|
||||
.addBody([kExprLocalGet, 0, kExprRefIsNull])
|
||||
.exportFunc();
|
||||
|
||||
const instance = builder.instantiate();
|
||||
@ -208,7 +208,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
print(arguments.callee.name);
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addFunction('main', kSig_r_v)
|
||||
.addBody([kExprGetLocal, 0])
|
||||
.addBody([kExprLocalGet, 0])
|
||||
.addLocals({anyref_count: 1})
|
||||
.exportFunc();
|
||||
|
||||
|
@ -165,15 +165,15 @@ class Operation {
|
||||
// Load address of low 32 bits.
|
||||
kExprI32Const, 0,
|
||||
// Load expected value.
|
||||
kExprGetLocal, 0, kExprI32StoreMem, 2, 0,
|
||||
kExprLocalGet, 0, kExprI32StoreMem, 2, 0,
|
||||
// Load address of high 32 bits.
|
||||
kExprI32Const, 4,
|
||||
// Load expected value.
|
||||
kExprGetLocal, 1, kExprI32StoreMem, 2, 0,
|
||||
kExprLocalGet, 1, kExprI32StoreMem, 2, 0,
|
||||
// Load address of where our window starts.
|
||||
kExprI32Const, 0,
|
||||
// Load input if there is one.
|
||||
...(this.hasInput ? [kExprGetLocal, 2] : []),
|
||||
...(this.hasInput ? [kExprLocalGet, 2] : []),
|
||||
// Perform operation.
|
||||
kAtomicPrefix, ...this.wasmOpcode,
|
||||
// Drop output if it had any.
|
||||
@ -261,19 +261,19 @@ function generateFunctionBodyForSequence(sequence) {
|
||||
if (!kDebug) {
|
||||
body.push(
|
||||
// Decrement the wait count.
|
||||
kExprGetLocal, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2,
|
||||
kExprLocalGet, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2,
|
||||
0,
|
||||
// Spin until zero.
|
||||
kExprLoop, kWasmStmt, kExprGetLocal, 2, kAtomicPrefix,
|
||||
kExprLoop, kWasmStmt, kExprLocalGet, 2, kAtomicPrefix,
|
||||
kExprI32AtomicLoad, 2, 0, kExprI32Const, 0, kExprI32GtU, kExprBrIf, 0,
|
||||
kExprEnd);
|
||||
}
|
||||
for (let operation of sequence) {
|
||||
body.push(
|
||||
// Pre-load address of results sequence pointer for later.
|
||||
kExprGetLocal, 1,
|
||||
kExprLocalGet, 1,
|
||||
// Load address where atomic pointers are stored.
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
// Load the second argument if it had any.
|
||||
...(operation.hasInput ?
|
||||
[kExprI32Const, ...toSLeb128(operation.input)] :
|
||||
@ -285,10 +285,10 @@ function generateFunctionBodyForSequence(sequence) {
|
||||
// Store read intermediate to sequence.
|
||||
kExprI32StoreMem, 2, 0,
|
||||
// Increment result sequence pointer.
|
||||
kExprGetLocal, 1, kExprI32Const, 4, kExprI32Add, kExprSetLocal, 1);
|
||||
kExprLocalGet, 1, kExprI32Const, 4, kExprI32Add, kExprLocalSet, 1);
|
||||
}
|
||||
// Return end of sequence index.
|
||||
body.push(kExprGetLocal, 1, kExprReturn);
|
||||
body.push(kExprLocalGet, 1, kExprReturn);
|
||||
return body;
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@ function GetAtomicBinOpFunction(wasmExpression, alignment, offset) {
|
||||
builder.addImportedMemory("m", "imported_mem", 0, maxSize, "shared");
|
||||
builder.addFunction("main", kSig_i_ii)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprGetLocal, 1,
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalGet, 1,
|
||||
kAtomicPrefix,
|
||||
wasmExpression, alignment, offset])
|
||||
.exportAs("main");
|
||||
@ -43,9 +43,9 @@ function GetAtomicCmpExchangeFunction(wasmExpression, alignment, offset) {
|
||||
builder.addImportedMemory("m", "imported_mem", 0, maxSize, "shared");
|
||||
builder.addFunction("main", kSig_i_iii)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprGetLocal, 1,
|
||||
kExprGetLocal, 2,
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalGet, 1,
|
||||
kExprLocalGet, 2,
|
||||
kAtomicPrefix,
|
||||
wasmExpression, alignment, offset])
|
||||
.exportAs("main");
|
||||
@ -62,7 +62,7 @@ function GetAtomicLoadFunction(wasmExpression, alignment, offset) {
|
||||
builder.addImportedMemory("m", "imported_mem", 0, maxSize, "shared");
|
||||
builder.addFunction("main", kSig_i_i)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kAtomicPrefix,
|
||||
wasmExpression, alignment, offset])
|
||||
.exportAs("main");
|
||||
@ -79,8 +79,8 @@ function GetAtomicStoreFunction(wasmExpression, alignment, offset) {
|
||||
builder.addImportedMemory("m", "imported_mem", 0, maxSize, "shared");
|
||||
builder.addFunction("main", kSig_v_ii)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprGetLocal, 1,
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalGet, 1,
|
||||
kAtomicPrefix,
|
||||
wasmExpression, alignment, offset])
|
||||
.exportAs("main");
|
||||
@ -440,11 +440,11 @@ function CmpExchgLoop(opcode, alignment) {
|
||||
.addLocals({i64_count: 2})
|
||||
.addBody([
|
||||
kExprLoop, kWasmStmt,
|
||||
kExprGetLocal, 0,
|
||||
kExprGetLocal, 1,
|
||||
kExprGetLocal, 2,
|
||||
kExprLocalGet, 0,
|
||||
kExprLocalGet, 1,
|
||||
kExprLocalGet, 2,
|
||||
kAtomicPrefix, opcode, alignment, 0,
|
||||
kExprGetLocal, 1,
|
||||
kExprLocalGet, 1,
|
||||
kExprI64Ne,
|
||||
kExprBrIf, 0,
|
||||
kExprEnd
|
||||
|
@ -191,18 +191,18 @@ class Operation {
|
||||
// Load address of low 32 bits.
|
||||
kExprI32Const, 0,
|
||||
// Load expected value.
|
||||
kExprGetLocal, 0, kExprI32StoreMem, 2, 0,
|
||||
kExprLocalGet, 0, kExprI32StoreMem, 2, 0,
|
||||
// Load address of high 32 bits.
|
||||
kExprI32Const, 4,
|
||||
// Load expected value.
|
||||
kExprGetLocal, 1, kExprI32StoreMem, 2, 0,
|
||||
kExprLocalGet, 1, kExprI32StoreMem, 2, 0,
|
||||
// Load address of where our window starts.
|
||||
kExprI32Const, 0,
|
||||
// Load input if there is one.
|
||||
...(this.hasInput ?
|
||||
[
|
||||
kExprGetLocal, 3, kExprI64UConvertI32, kExprI64Const, 32,
|
||||
kExprI64Shl, kExprGetLocal, 2, kExprI64UConvertI32,
|
||||
kExprLocalGet, 3, kExprI64UConvertI32, kExprI64Const, 32,
|
||||
kExprI64Shl, kExprLocalGet, 2, kExprI64UConvertI32,
|
||||
kExprI64Ior
|
||||
] :
|
||||
[]),
|
||||
@ -299,19 +299,19 @@ function generateFunctionBodyForSequence(sequence) {
|
||||
if (!kDebug) {
|
||||
body.push(
|
||||
// Decrement the wait count.
|
||||
kExprGetLocal, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2,
|
||||
kExprLocalGet, 2, kExprI32Const, 1, kAtomicPrefix, kExprI32AtomicSub, 2,
|
||||
0,
|
||||
// Spin until zero.
|
||||
kExprLoop, kWasmStmt, kExprGetLocal, 2, kAtomicPrefix,
|
||||
kExprLoop, kWasmStmt, kExprLocalGet, 2, kAtomicPrefix,
|
||||
kExprI32AtomicLoad, 2, 0, kExprI32Const, 0, kExprI32GtU, kExprBrIf, 0,
|
||||
kExprEnd);
|
||||
}
|
||||
for (let operation of sequence) {
|
||||
body.push(
|
||||
// Pre-load address of results sequence pointer for later.
|
||||
kExprGetLocal, 1,
|
||||
kExprLocalGet, 1,
|
||||
// Load address where atomic pointers are stored.
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
// Load the second argument if it had any.
|
||||
...(operation.hasInput ?
|
||||
[
|
||||
@ -326,10 +326,10 @@ function generateFunctionBodyForSequence(sequence) {
|
||||
// Store read intermediate to sequence.
|
||||
kExprI64StoreMem, 3, 0,
|
||||
// Increment result sequence pointer.
|
||||
kExprGetLocal, 1, kExprI32Const, 8, kExprI32Add, kExprSetLocal, 1);
|
||||
kExprLocalGet, 1, kExprI32Const, 8, kExprI32Add, kExprLocalSet, 1);
|
||||
}
|
||||
// Return end of sequence index.
|
||||
body.push(kExprGetLocal, 1, kExprReturn);
|
||||
body.push(kExprLocalGet, 1, kExprReturn);
|
||||
return body;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
builder
|
||||
.addFunction("f", kSig_l_l) // i64 -> i64
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
])
|
||||
.exportFunc();
|
||||
|
||||
@ -108,7 +108,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
builder
|
||||
.addFunction("f", kSig_l_ll) // i64 -> i64
|
||||
.addBody([
|
||||
kExprGetLocal, 1,
|
||||
kExprLocalGet, 1,
|
||||
])
|
||||
.exportFunc();
|
||||
|
||||
|
@ -8,9 +8,9 @@ const builder = new WasmModuleBuilder();
|
||||
builder.addMemory(1, undefined, false);
|
||||
builder.addFunction('load', kSig_i_ii)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI64SConvertI32,
|
||||
kExprGetLocal, 1,
|
||||
kExprLocalGet, 1,
|
||||
kExprI64SConvertI32,
|
||||
kExprI64Shl,
|
||||
kExprI32ConvertI64,
|
||||
|
@ -10,7 +10,7 @@ const builder = new WasmModuleBuilder();
|
||||
builder.addMemory(1, undefined, false);
|
||||
builder.addFunction('load', kSig_i_i)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32LoadMem, 0, 100])
|
||||
.exportFunc();
|
||||
|
||||
|
@ -33,9 +33,9 @@ function getMemoryInit(mem, segment_data) {
|
||||
builder.addPassiveDataSegment(segment_data);
|
||||
builder.addFunction('init', kSig_v_iii)
|
||||
.addBody([
|
||||
kExprGetLocal, 0, // Dest.
|
||||
kExprGetLocal, 1, // Source.
|
||||
kExprGetLocal, 2, // Size in bytes.
|
||||
kExprLocalGet, 0, // Dest.
|
||||
kExprLocalGet, 1, // Source.
|
||||
kExprLocalGet, 2, // Size in bytes.
|
||||
kNumericPrefix, kExprMemoryInit,
|
||||
0, // Data segment index.
|
||||
0, // Memory index.
|
||||
@ -102,9 +102,9 @@ function getMemoryCopy(mem) {
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addImportedMemory("", "mem", 0);
|
||||
builder.addFunction("copy", kSig_v_iii).addBody([
|
||||
kExprGetLocal, 0, // Dest.
|
||||
kExprGetLocal, 1, // Source.
|
||||
kExprGetLocal, 2, // Size in bytes.
|
||||
kExprLocalGet, 0, // Dest.
|
||||
kExprLocalGet, 1, // Source.
|
||||
kExprLocalGet, 2, // Size in bytes.
|
||||
kNumericPrefix, kExprMemoryCopy, 0, 0,
|
||||
]).exportAs("copy");
|
||||
return builder.instantiate({'': {mem}}).exports.copy;
|
||||
@ -128,9 +128,9 @@ function getMemoryFill(mem) {
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addImportedMemory("", "mem", 0);
|
||||
builder.addFunction("fill", kSig_v_iii).addBody([
|
||||
kExprGetLocal, 0, // Dest.
|
||||
kExprGetLocal, 1, // Byte value.
|
||||
kExprGetLocal, 2, // Size.
|
||||
kExprLocalGet, 0, // Dest.
|
||||
kExprLocalGet, 1, // Byte value.
|
||||
kExprLocalGet, 2, // Size.
|
||||
kNumericPrefix, kExprMemoryFill, 0,
|
||||
]).exportAs("fill");
|
||||
return builder.instantiate({'': {mem}}).exports.fill;
|
||||
|
@ -49,8 +49,8 @@ function assertFunction(module, func) {
|
||||
builder.addMemory(1, 1, true);
|
||||
builder.addFunction("sub", kSig_i_ii)
|
||||
.addBody([
|
||||
kExprGetLocal, 0, // --
|
||||
kExprGetLocal, 1, // --
|
||||
kExprLocalGet, 0, // --
|
||||
kExprLocalGet, 1, // --
|
||||
kExprI32Sub, // --
|
||||
])
|
||||
.exportFunc()
|
||||
@ -91,8 +91,8 @@ function assertFunction(module, func) {
|
||||
builder.addMemory(kPages, kPages, true);
|
||||
builder.addFunction("flt", kSig_i_dd)
|
||||
.addBody([
|
||||
kExprGetLocal, 0, // --
|
||||
kExprGetLocal, 1, // --
|
||||
kExprLocalGet, 0, // --
|
||||
kExprLocalGet, 1, // --
|
||||
kExprF64Lt // --
|
||||
]) // --
|
||||
.exportFunc();
|
||||
|
@ -9,7 +9,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
// We only have 1 MB code space. This is enough for the code below, but for all
|
||||
// 1000 modules, it requires several GCs to get rid of the old code.
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addFunction('main', kSig_i_i).addBody([kExprGetLocal, 0]);
|
||||
builder.addFunction('main', kSig_i_i).addBody([kExprLocalGet, 0]);
|
||||
const buffer = builder.toBuffer();
|
||||
|
||||
for (let i = 0; i < 1000; ++i) {
|
||||
|
@ -37,42 +37,42 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName,
|
||||
const kLocalNextValue = 7; // the value to write in the update
|
||||
let body = [
|
||||
// Turn sequence length to equivalent in bytes.
|
||||
kExprGetLocal, kArgSeqenceLength,
|
||||
kExprLocalGet, kArgSeqenceLength,
|
||||
kExprI32Const, size / 8,
|
||||
kExprI32Mul,
|
||||
kExprSetLocal, kArgSeqenceLength,
|
||||
kExprLocalSet, kArgSeqenceLength,
|
||||
// Outer block so we have something to jump for return.
|
||||
...[kExprBlock, kWasmStmt,
|
||||
// Set counter to 0.
|
||||
kExprI32Const, 0,
|
||||
kExprSetLocal, kLocalCurrentOffset,
|
||||
kExprLocalSet, kLocalCurrentOffset,
|
||||
// Outer loop until maxcount.
|
||||
...[kExprLoop, kWasmStmt,
|
||||
// Find the next value to wait for.
|
||||
...[kExprLoop, kWasmStmt,
|
||||
// Check end of sequence.
|
||||
kExprGetLocal, kLocalCurrentOffset,
|
||||
kExprGetLocal, kArgSeqenceLength,
|
||||
kExprLocalGet, kLocalCurrentOffset,
|
||||
kExprLocalGet, kArgSeqenceLength,
|
||||
kExprI32Eq,
|
||||
kExprBrIf, 2, // return
|
||||
...[kExprBlock, kWasmStmt,
|
||||
// Load next value.
|
||||
kExprGetLocal, kArgSequencePtr,
|
||||
kExprGetLocal, kLocalCurrentOffset,
|
||||
kExprLocalGet, kArgSequencePtr,
|
||||
kExprLocalGet, kLocalCurrentOffset,
|
||||
kExprI32Add,
|
||||
loadMemOpcode, 0, 0,
|
||||
// Mask off bits.
|
||||
kExprGetLocal, kArgBitMask,
|
||||
kExprLocalGet, kArgBitMask,
|
||||
kExprI32And,
|
||||
// Compare with worker id.
|
||||
kExprGetLocal, kArgWorkerId,
|
||||
kExprLocalGet, kArgWorkerId,
|
||||
kExprI32Eq,
|
||||
kExprBrIf, 0,
|
||||
// Not found, increment position.
|
||||
kExprGetLocal, kLocalCurrentOffset,
|
||||
kExprLocalGet, kLocalCurrentOffset,
|
||||
kExprI32Const, size / 8,
|
||||
kExprI32Add,
|
||||
kExprSetLocal, kLocalCurrentOffset,
|
||||
kExprLocalSet, kLocalCurrentOffset,
|
||||
kExprBr, 1,
|
||||
kExprEnd
|
||||
],
|
||||
@ -80,41 +80,41 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName,
|
||||
kExprEnd
|
||||
],
|
||||
// Load expected value to local.
|
||||
kExprGetLocal, kArgSequencePtr,
|
||||
kExprGetLocal, kLocalCurrentOffset,
|
||||
kExprLocalGet, kArgSequencePtr,
|
||||
kExprLocalGet, kLocalCurrentOffset,
|
||||
kExprI32Add,
|
||||
loadMemOpcode, 0, 0,
|
||||
kExprSetLocal, kLocalExpectedValue,
|
||||
kExprLocalSet, kLocalExpectedValue,
|
||||
// Load value after expected one.
|
||||
kExprGetLocal, kArgSequencePtr,
|
||||
kExprGetLocal, kLocalCurrentOffset,
|
||||
kExprLocalGet, kArgSequencePtr,
|
||||
kExprLocalGet, kLocalCurrentOffset,
|
||||
kExprI32Add,
|
||||
kExprI32Const, size / 8,
|
||||
kExprI32Add,
|
||||
loadMemOpcode, 0, 0,
|
||||
kExprSetLocal, kLocalNextValue,
|
||||
kExprLocalSet, kLocalNextValue,
|
||||
// Hammer on memory until value found.
|
||||
...[kExprLoop, kWasmStmt,
|
||||
// Load address.
|
||||
kExprGetLocal, kArgMemoryCell,
|
||||
kExprLocalGet, kArgMemoryCell,
|
||||
// Load expected value.
|
||||
kExprGetLocal, kLocalExpectedValue,
|
||||
kExprLocalGet, kLocalExpectedValue,
|
||||
// Load updated value.
|
||||
kExprGetLocal, kLocalNextValue,
|
||||
kExprLocalGet, kLocalNextValue,
|
||||
// Try update.
|
||||
kAtomicPrefix, compareExchangeOpcode, 0, 0,
|
||||
// Load expected value.
|
||||
kExprGetLocal, kLocalExpectedValue,
|
||||
kExprLocalGet, kLocalExpectedValue,
|
||||
// Spin if not what expected.
|
||||
kExprI32Ne,
|
||||
kExprBrIf, 0,
|
||||
kExprEnd
|
||||
],
|
||||
// Next iteration of loop.
|
||||
kExprGetLocal, kLocalCurrentOffset,
|
||||
kExprLocalGet, kLocalCurrentOffset,
|
||||
kExprI32Const, size / 8,
|
||||
kExprI32Add,
|
||||
kExprSetLocal, kLocalCurrentOffset,
|
||||
kExprLocalSet, kLocalCurrentOffset,
|
||||
kExprBr, 0,
|
||||
kExprEnd
|
||||
], // outer loop
|
||||
|
@ -40,44 +40,44 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName,
|
||||
const kLocalNextValue = 7; // the value to write in the update
|
||||
let body = [
|
||||
// Turn sequence length to equivalent in bytes.
|
||||
kExprGetLocal, kArgSeqenceLength,
|
||||
kExprLocalGet, kArgSeqenceLength,
|
||||
kExprI32Const, size / 8,
|
||||
kExprI32Mul,
|
||||
kExprSetLocal, kArgSeqenceLength,
|
||||
kExprLocalSet, kArgSeqenceLength,
|
||||
// Outer block so we have something to jump for return.
|
||||
...[kExprBlock, kWasmStmt,
|
||||
// Set counter to 0.
|
||||
kExprI32Const, 0,
|
||||
kExprSetLocal, kLocalCurrentOffset,
|
||||
kExprLocalSet, kLocalCurrentOffset,
|
||||
// Outer loop until maxcount.
|
||||
...[kExprLoop, kWasmStmt,
|
||||
// Find the next value to wait for.
|
||||
...[kExprLoop, kWasmStmt,
|
||||
// Check end of sequence.
|
||||
kExprGetLocal, kLocalCurrentOffset,
|
||||
kExprGetLocal, kArgSeqenceLength,
|
||||
kExprLocalGet, kLocalCurrentOffset,
|
||||
kExprLocalGet, kArgSeqenceLength,
|
||||
kExprI32Eq,
|
||||
kExprBrIf, 2, // return
|
||||
...[kExprBlock, kWasmStmt,
|
||||
// Load next value.
|
||||
kExprGetLocal, kArgSequencePtr,
|
||||
kExprGetLocal, kLocalCurrentOffset,
|
||||
kExprLocalGet, kArgSequencePtr,
|
||||
kExprLocalGet, kLocalCurrentOffset,
|
||||
kExprI32Add,
|
||||
loadMemOpcode, 0, 0,
|
||||
// Mask off bits.
|
||||
kExprGetLocal, kArgBitMask,
|
||||
kExprLocalGet, kArgBitMask,
|
||||
kExprI64UConvertI32,
|
||||
kExprI64And,
|
||||
// Compare with worker id.
|
||||
kExprGetLocal, kArgWorkerId,
|
||||
kExprLocalGet, kArgWorkerId,
|
||||
kExprI64UConvertI32,
|
||||
kExprI64Eq,
|
||||
kExprBrIf, 0,
|
||||
// Not found, increment position.
|
||||
kExprGetLocal, kLocalCurrentOffset,
|
||||
kExprLocalGet, kLocalCurrentOffset,
|
||||
kExprI32Const, size / 8,
|
||||
kExprI32Add,
|
||||
kExprSetLocal, kLocalCurrentOffset,
|
||||
kExprLocalSet, kLocalCurrentOffset,
|
||||
kExprBr, 1,
|
||||
kExprEnd
|
||||
],
|
||||
@ -85,41 +85,41 @@ function makeWorkerCodeForOpcode(compareExchangeOpcode, size, functionName,
|
||||
kExprEnd
|
||||
],
|
||||
// Load expected value to local.
|
||||
kExprGetLocal, kArgSequencePtr,
|
||||
kExprGetLocal, kLocalCurrentOffset,
|
||||
kExprLocalGet, kArgSequencePtr,
|
||||
kExprLocalGet, kLocalCurrentOffset,
|
||||
kExprI32Add,
|
||||
loadMemOpcode, 0, 0,
|
||||
kExprSetLocal, kLocalExpectedValue,
|
||||
kExprLocalSet, kLocalExpectedValue,
|
||||
// Load value after expected one.
|
||||
kExprGetLocal, kArgSequencePtr,
|
||||
kExprGetLocal, kLocalCurrentOffset,
|
||||
kExprLocalGet, kArgSequencePtr,
|
||||
kExprLocalGet, kLocalCurrentOffset,
|
||||
kExprI32Add,
|
||||
kExprI32Const, size / 8,
|
||||
kExprI32Add,
|
||||
loadMemOpcode, 0, 0,
|
||||
kExprSetLocal, kLocalNextValue,
|
||||
kExprLocalSet, kLocalNextValue,
|
||||
// Hammer on memory until value found.
|
||||
...[kExprLoop, kWasmStmt,
|
||||
// Load address.
|
||||
kExprGetLocal, kArgMemoryCell,
|
||||
kExprLocalGet, kArgMemoryCell,
|
||||
// Load expected value.
|
||||
kExprGetLocal, kLocalExpectedValue,
|
||||
kExprLocalGet, kLocalExpectedValue,
|
||||
// Load updated value.
|
||||
kExprGetLocal, kLocalNextValue,
|
||||
kExprLocalGet, kLocalNextValue,
|
||||
// Try update.
|
||||
kAtomicPrefix, compareExchangeOpcode, 0, 0,
|
||||
// Load expected value.
|
||||
kExprGetLocal, kLocalExpectedValue,
|
||||
kExprLocalGet, kLocalExpectedValue,
|
||||
// Spin if not what expected.
|
||||
kExprI64Ne,
|
||||
kExprBrIf, 0,
|
||||
kExprEnd
|
||||
],
|
||||
// Next iteration of loop.
|
||||
kExprGetLocal, kLocalCurrentOffset,
|
||||
kExprLocalGet, kLocalCurrentOffset,
|
||||
kExprI32Const, size / 8,
|
||||
kExprI32Add,
|
||||
kExprSetLocal, kLocalCurrentOffset,
|
||||
kExprLocalSet, kLocalCurrentOffset,
|
||||
kExprBr, 0,
|
||||
kExprEnd
|
||||
], // outer loop
|
||||
|
@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
print(arguments.callee.name);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction('id', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0])
|
||||
.addBody([kExprLocalGet, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierOptimized,
|
||||
kCompilationHintTierBaseline)
|
||||
@ -26,7 +26,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
print(arguments.callee.name);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction('id', kSig_i_l)
|
||||
.addBody([kExprGetLocal, 0])
|
||||
.addBody([kExprLocalGet, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierDefault,
|
||||
kCompilationHintTierDefault)
|
||||
@ -49,7 +49,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
print(arguments.callee.name);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction('id', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0])
|
||||
.addBody([kExprLocalGet, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierDefault,
|
||||
kCompilationHintTierDefault)
|
||||
@ -63,7 +63,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
print(arguments.callee.name);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction('id', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0])
|
||||
.addBody([kExprLocalGet, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyLazyBaselineEagerTopTier,
|
||||
kCompilationHintTierDefault,
|
||||
kCompilationHintTierDefault)
|
||||
|
@ -11,8 +11,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addImport('mod', 'pow', kSig_i_ii);
|
||||
builder.addFunction('upow', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierOptimized,
|
||||
@ -29,20 +29,20 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addImport('mod', 'pow', kSig_i_ii);
|
||||
builder.addFunction('upow', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyDefault,
|
||||
kCompilationHintTierInterpreter,
|
||||
kCompilationHintTierInterpreter)
|
||||
.exportFunc();
|
||||
builder.addFunction('upow2', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 0])
|
||||
builder.addFunction('upow3', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 0])
|
||||
let instance = builder.instantiate({mod: {pow: Math.pow}});
|
||||
assertEquals(27, instance.exports.upow(3))
|
||||
@ -53,16 +53,16 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addImport('mod', 'pow', kSig_i_ii);
|
||||
builder.addFunction('upow2', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 0])
|
||||
builder.addFunction('upow3', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 0])
|
||||
builder.addFunction('upow', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyEager,
|
||||
kCompilationHintTierBaseline,
|
||||
@ -76,8 +76,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
print(arguments.callee.name);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction('sq', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Mul])
|
||||
.setCompilationHint(kCompilationHintStrategyEager,
|
||||
kCompilationHintTierDefault,
|
||||
@ -91,8 +91,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
print(arguments.callee.name);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction('sq', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Mul])
|
||||
.setCompilationHint(kCompilationHintStrategyEager,
|
||||
kCompilationHintTierDefault,
|
||||
@ -104,8 +104,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
print(arguments.callee.name);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction('sq', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Mul])
|
||||
.setCompilationHint(kCompilationHintStrategyEager,
|
||||
kCompilationHintTierOptimized,
|
||||
@ -119,8 +119,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
print(arguments.callee.name);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction('sq', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Mul])
|
||||
.setCompilationHint(kCompilationHintStrategyLazyBaselineEagerTopTier,
|
||||
kCompilationHintTierOptimized,
|
||||
|
@ -9,8 +9,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addImport('mod', 'pow', kSig_i_ii);
|
||||
builder.addFunction('upow', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyDefault,
|
||||
kCompilationHintTierInterpreter,
|
||||
|
@ -19,7 +19,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
builder1.addImport("otherModule", "getX", kSig_i_v);
|
||||
builder1.addFunction("plusX", kSig_i_i)
|
||||
.addBody([kExprCallFunction, 0,
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Add])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierInterpreter,
|
||||
@ -44,7 +44,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
builder1.addImport("otherModule", "getX", kSig_i_v);
|
||||
builder1.addFunction("plusX", kSig_i_i)
|
||||
.addBody([kExprCallFunction, 0,
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32Add])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierInterpreter,
|
||||
@ -64,8 +64,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
let builder = new WasmModuleBuilder();
|
||||
let sig_i_ii = builder.addType(kSig_i_ii);
|
||||
let add = builder.addFunction('add', sig_i_ii)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 1,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 1,
|
||||
kExprI32Add])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierInterpreter,
|
||||
@ -73,9 +73,9 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
builder.appendToTable([add.index]);
|
||||
builder.addFunction('main', kSig_i_iii)
|
||||
.addBody([// Call indirect #0 with args <#1, #2>.
|
||||
kExprGetLocal, 1,
|
||||
kExprGetLocal, 2,
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 1,
|
||||
kExprLocalGet, 2,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallIndirect, sig_i_ii, kTableZero])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierInterpreter,
|
||||
@ -89,8 +89,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
let builder = new WasmModuleBuilder();
|
||||
let sig_i_ii = builder.addType(kSig_i_ii);
|
||||
let add = builder.addFunction('add', sig_i_ii)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 1,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 1,
|
||||
kExprI64Add])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierInterpreter,
|
||||
@ -98,9 +98,9 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
builder.appendToTable([add.index]);
|
||||
builder.addFunction('main', kSig_i_iii)
|
||||
.addBody([// Call indirect #0 with args <#1, #2>.
|
||||
kExprGetLocal, 1,
|
||||
kExprGetLocal, 2,
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 1,
|
||||
kExprLocalGet, 2,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallIndirect, sig_i_ii, kTableZero])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierInterpreter,
|
||||
|
@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
print(arguments.callee.name);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction('id', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprI64Const, 1,
|
||||
kExprI32Mul])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
|
@ -11,12 +11,12 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addImport('mod', 'pow', kSig_i_ii);
|
||||
builder.addFunction('upow', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 0])
|
||||
builder.addFunction('upow2', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierDefault,
|
||||
@ -33,12 +33,12 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addImport('mod', 'pow', kSig_i_ii);
|
||||
builder.addFunction('upow', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 0])
|
||||
builder.addFunction('upow2', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierOptimized,
|
||||
@ -59,12 +59,12 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addImport('mod', 'pow', kSig_f_ff);
|
||||
builder.addFunction('upow', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 0])
|
||||
builder.addFunction('upow2', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierDefault,
|
||||
@ -94,8 +94,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addImport('mod', 'pow', kSig_i_ii);
|
||||
builder.addFunction('upow', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierDefault,
|
||||
@ -112,8 +112,8 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addImport('mod', 'pow', kSig_i_ii);
|
||||
builder.addFunction('upow', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyLazyBaselineEagerTopTier,
|
||||
kCompilationHintTierDefault,
|
||||
|
@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
print(arguments.callee.name);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction('id', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0,
|
||||
.addBody([kExprLocalGet, 0,
|
||||
kExprI64Const, 1,
|
||||
kExprI32Mul])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
|
@ -10,7 +10,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
print(arguments.callee.name);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction('id', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0])
|
||||
.addBody([kExprLocalGet, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierOptimized,
|
||||
kCompilationHintTierBaseline)
|
||||
@ -25,7 +25,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
print(arguments.callee.name);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction('id', kSig_i_l)
|
||||
.addBody([kExprGetLocal, 0])
|
||||
.addBody([kExprLocalGet, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierDefault,
|
||||
kCompilationHintTierDefault)
|
||||
@ -46,7 +46,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
print(arguments.callee.name);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction('id', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0])
|
||||
.addBody([kExprLocalGet, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyLazy,
|
||||
kCompilationHintTierDefault,
|
||||
kCompilationHintTierDefault)
|
||||
@ -58,7 +58,7 @@ load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
print(arguments.callee.name);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addFunction('id', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0])
|
||||
.addBody([kExprLocalGet, 0])
|
||||
.setCompilationHint(kCompilationHintStrategyLazyBaselineEagerTopTier,
|
||||
kCompilationHintTierDefault,
|
||||
kCompilationHintTierDefault)
|
||||
|
@ -17,11 +17,11 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
builder.addFunction("main", kSig_i_i)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprI32LoadMem, 0, 0,
|
||||
kExprI32Const, 1,
|
||||
kExprCallIndirect, signature, kTableZero,
|
||||
kExprGetLocal,0,
|
||||
kExprLocalGet,0,
|
||||
kExprI32LoadMem,0, 0,
|
||||
kExprCallFunction, 0,
|
||||
kExprI32Add
|
||||
@ -31,7 +31,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
// return mem[i] + some_value();
|
||||
builder.addFunction("_wrap_writer", signature)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprCallFunction, 1]);
|
||||
builder.appendToTable([2, 3]);
|
||||
|
||||
@ -180,7 +180,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
builder.addFunction("write", kSig_v_i)
|
||||
.addBody([
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprSetGlobal, 0])
|
||||
.exportFunc();
|
||||
|
||||
@ -213,7 +213,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
builder.addFunction("main", kSig_i_ii)
|
||||
.addBody([
|
||||
kExprGetLocal, 0, // --
|
||||
kExprLocalGet, 0, // --
|
||||
kExprCallIndirect, sig_index1, kTableZero]) // --
|
||||
.exportAs("main");
|
||||
|
||||
@ -234,7 +234,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
builder.addFunction("main", kSig_i_ii)
|
||||
.addBody([
|
||||
kExprGetLocal, 0, // --
|
||||
kExprLocalGet, 0, // --
|
||||
kExprCallIndirect, sig_index2, kTableZero]) // --
|
||||
.exportAs("main");
|
||||
|
||||
@ -293,7 +293,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addMemory(1, 1);
|
||||
builder.addFunction('main', kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0])
|
||||
.addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0])
|
||||
.exportFunc();
|
||||
const wire_bytes = builder.toBuffer();
|
||||
const module = new WebAssembly.Module(wire_bytes);
|
||||
@ -364,7 +364,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprBlock, kWasmStmt,
|
||||
kExprGetLocal, 0,
|
||||
kExprLocalGet, 0,
|
||||
kExprBrTable, 6, 0, 1, 2, 3, 4, 5, 6,
|
||||
kExprEnd,
|
||||
kExprI32Const, 3,
|
||||
|
@ -13,7 +13,7 @@ function SimpleDataSegmentTest(offset) {
|
||||
var builder = new WasmModuleBuilder();
|
||||
builder.addMemory(1, 1, false);
|
||||
builder.addFunction("load", kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0])
|
||||
.addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0])
|
||||
.exportAs("load");
|
||||
builder.addDataSegment(offset, [9, 9, 9, 9]);
|
||||
|
||||
@ -41,7 +41,7 @@ function GlobalImportedInitTest(pad) {
|
||||
while (pad-- > 0) builder.addGlobal(kWasmI32); // pad
|
||||
|
||||
builder.addFunction("load", kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0])
|
||||
.addBody([kExprLocalGet, 0, kExprI32LoadMem, 0, 0])
|
||||
.exportAs("load");
|
||||
builder.addDataSegment(g.index, [5, 5, 5, 5], true);
|
||||
|
||||
|
@ -16,8 +16,8 @@ function makeBinop(opcode) {
|
||||
|
||||
builder.addFunction("main", kSig_i_ii)
|
||||
.addBody([
|
||||
kExprGetLocal, 0, // --
|
||||
kExprGetLocal, 1, // --
|
||||
kExprLocalGet, 0, // --
|
||||
kExprLocalGet, 1, // --
|
||||
opcode, // --
|
||||
])
|
||||
.exportFunc();
|
||||
|
@ -19,14 +19,14 @@ let kMaxMemory = 2 * k1GiB - kPageSize; // TODO(titzer): raise this to 4GiB
|
||||
builder.addImportedMemory("i", "mem");
|
||||
builder.addFunction("load", makeSig([kWasmI32], [type]))
|
||||
.addBody([ // --
|
||||
kExprGetLocal, 0, // --
|
||||
kExprLocalGet, 0, // --
|
||||
load_opcode, 0, 0, // --
|
||||
]) // --
|
||||
.exportFunc();
|
||||
builder.addFunction("store", makeSig([kWasmI32, type], []))
|
||||
.addBody([ // --
|
||||
kExprGetLocal, 0, // --
|
||||
kExprGetLocal, 1, // --
|
||||
kExprLocalGet, 0, // --
|
||||
kExprLocalGet, 1, // --
|
||||
store_opcode, 0, 0, // --
|
||||
]) // --
|
||||
.exportFunc();
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
var module = new WasmModuleBuilder();
|
||||
module.addFunction(undefined, kSig_i_i)
|
||||
.addBody([kExprGetLocal, 0, kExprI32Const, 1, kExprI32Add])
|
||||
.addBody([kExprLocalGet, 0, kExprI32Const, 1, kExprI32Add])
|
||||
.exportAs("increment");
|
||||
|
||||
var buffer = module.toBuffer(true);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user