diff --git a/src/wasm/baseline/liftoff-compiler.cc b/src/wasm/baseline/liftoff-compiler.cc index 37627d8471..dc9aebcaad 100644 --- a/src/wasm/baseline/liftoff-compiler.cc +++ b/src/wasm/baseline/liftoff-compiler.cc @@ -347,13 +347,15 @@ class LiftoffCompiler { BindUnboundLabels(decoder); } - void Block(Decoder* decoder, Control* block) { + void NextInstruction(Decoder* decoder, WasmOpcode) { TraceCacheState(decoder); + } + + void Block(Decoder* decoder, Control* block) { block->label_state.stack_base = __ cache_state()->stack_height(); } void Loop(Decoder* decoder, Control* loop) { - TraceCacheState(decoder); loop->label_state.stack_base = __ cache_state()->stack_height(); // Before entering a loop, spill all locals to the stack, in order to free @@ -396,7 +398,6 @@ class LiftoffCompiler { } void FallThruTo(Decoder* decoder, Control* c) { - TraceCacheState(decoder); if (c->end_merge.reached) { __ MergeFullStackWith(c->label_state); } else if (c->is_onearmed_if()) { @@ -406,6 +407,7 @@ class LiftoffCompiler { } else { c->label_state.Split(*__ cache_state()); } + TraceCacheState(decoder); } void PopControl(Decoder* decoder, Control* c) { @@ -431,7 +433,6 @@ class LiftoffCompiler { void UnOp(Decoder* decoder, WasmOpcode opcode, FunctionSig*, const Value& value, Value* result) { - TraceCacheState(decoder); #define CASE_UNOP(opcode, type, fn) \ case WasmOpcode::kExpr##opcode: \ type##UnOp(&LiftoffAssembler::emit_##fn); \ @@ -473,7 +474,6 @@ class LiftoffCompiler { void BinOp(Decoder* decoder, WasmOpcode opcode, FunctionSig*, const Value& lhs, const Value& rhs, Value* result) { - TraceCacheState(decoder); #define CASE_BINOP(opcode, type, fn) \ case WasmOpcode::kExpr##opcode: \ return type##BinOp(&LiftoffAssembler::emit_##fn); @@ -494,7 +494,6 @@ class LiftoffCompiler { } void I32Const(Decoder* decoder, Value* result, int32_t value) { - TraceCacheState(decoder); __ cache_state()->stack_state.emplace_back(kWasmI32, value); CheckStackSizeLimit(decoder); } @@ -515,7 +514,6 @@ class LiftoffCompiler { } void Drop(Decoder* decoder, const Value& value) { - TraceCacheState(decoder); __ DropStackSlot(&__ cache_state()->stack_state.back()); __ cache_state()->stack_state.pop_back(); } @@ -540,7 +538,6 @@ class LiftoffCompiler { void GetLocal(Decoder* decoder, Value* result, const LocalIndexOperand& operand) { - TraceCacheState(decoder); auto& slot = __ cache_state()->stack_state[operand.index]; DCHECK_EQ(slot.type(), operand.type); switch (slot.loc()) { @@ -665,12 +662,10 @@ class LiftoffCompiler { } void Br(Decoder* decoder, Control* target) { - TraceCacheState(decoder); Br(target); } void BrIf(Decoder* decoder, const Value& cond, Control* target) { - TraceCacheState(decoder); Label cont_false; Register value = __ PopToRegister(kGpReg).gp(); __ emit_i32_test(value); @@ -800,8 +795,6 @@ class LiftoffCompiler { if (operand.sig->return_count() > 1) return unsupported(decoder, "multi-return"); - TraceCacheState(decoder); - compiler::CallDescriptor* call_desc = compiler::GetWasmCallDescriptor(&compilation_zone_, operand.sig); diff --git a/src/wasm/function-body-decoder-impl.h b/src/wasm/function-body-decoder-impl.h index 4813da2625..04d918b0a4 100644 --- a/src/wasm/function-body-decoder-impl.h +++ b/src/wasm/function-body-decoder-impl.h @@ -551,6 +551,7 @@ struct ControlWithNamedConstructors : public ControlBase { F(StartFunctionBody, Control* block) \ F(FinishFunction) \ F(OnFirstError) \ + F(NextInstruction, WasmOpcode) \ /* Control: */ \ F(Block, Control* block) \ F(Loop, Control* block) \ @@ -1331,6 +1332,9 @@ class WasmFullDecoder : public WasmDecoder { while (this->pc_ < this->end_) { // decoding loop. unsigned len = 1; WasmOpcode opcode = static_cast(*this->pc_); + + CALL_INTERFACE_IF_REACHABLE(NextInstruction, opcode); + #if DEBUG TraceLine trace_msg; #define TRACE_PART(...) trace_msg.Append(__VA_ARGS__) diff --git a/src/wasm/function-body-decoder.cc b/src/wasm/function-body-decoder.cc index 91024f6166..57ee78f91c 100644 --- a/src/wasm/function-body-decoder.cc +++ b/src/wasm/function-body-decoder.cc @@ -142,11 +142,11 @@ class WasmGraphBuildingInterface { block->end_env = break_env; } - void FinishFunction(Decoder* decoder) { - builder_->PatchInStackCheckIfNeeded(); - } + void FinishFunction(Decoder*) { builder_->PatchInStackCheckIfNeeded(); } - void OnFirstError(Decoder* decoder) {} + void OnFirstError(Decoder*) {} + + void NextInstruction(Decoder*, WasmOpcode) {} void Block(Decoder* decoder, Control* block) { // The break environment is the outer environment.