[wasm] Split interface functions
Split interface functions into constant, non-constant, and meta functions. This will be useful once initializer expression decoding is implemented as an interface for WasmFullDecoder. Additionally, add ArrayInit() interface function (currently unused). Bug: v8:11895 Change-Id: If076fe47871868c2d754f9c72c865f0a7f9f97d3 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2964609 Commit-Queue: Manos Koukoutos <manoskouk@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#75251}
This commit is contained in:
parent
24c626c1f7
commit
29dbe17726
@ -5130,6 +5130,12 @@ class LiftoffCompiler {
|
|||||||
__ cache_state()->stack_state.pop_back(5);
|
__ cache_state()->stack_state.pop_back(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ArrayInit(FullDecoder* decoder, const ArrayIndexImmediate<validate>& imm,
|
||||||
|
const base::Vector<Value>& elements, const Value& rtt,
|
||||||
|
Value* result) {
|
||||||
|
UNREACHABLE();
|
||||||
|
}
|
||||||
|
|
||||||
// 1 bit Smi tag, 31 bits Smi shift, 1 bit i31ref high-bit truncation.
|
// 1 bit Smi tag, 31 bits Smi shift, 1 bit i31ref high-bit truncation.
|
||||||
constexpr static int kI31To32BitSmiShift = 33;
|
constexpr static int kI31To32BitSmiShift = 33;
|
||||||
|
|
||||||
|
@ -916,14 +916,38 @@ struct ControlBase : public PcForErrors<validate> {
|
|||||||
// This is the list of callback functions that an interface for the
|
// This is the list of callback functions that an interface for the
|
||||||
// WasmFullDecoder should implement.
|
// WasmFullDecoder should implement.
|
||||||
// F(Name, args...)
|
// F(Name, args...)
|
||||||
#define INTERFACE_FUNCTIONS(F) \
|
#define INTERFACE_FUNCTIONS(F) \
|
||||||
/* General: */ \
|
INTERFACE_META_FUNCTIONS(F) \
|
||||||
F(StartFunction) \
|
INTERFACE_CONSTANT_FUNCTIONS(F) \
|
||||||
F(StartFunctionBody, Control* block) \
|
INTERFACE_NON_CONSTANT_FUNCTIONS(F)
|
||||||
F(FinishFunction) \
|
|
||||||
F(OnFirstError) \
|
#define INTERFACE_META_FUNCTIONS(F) \
|
||||||
F(NextInstruction, WasmOpcode) \
|
F(StartFunction) \
|
||||||
F(Forward, const Value& from, Value* to) \
|
F(StartFunctionBody, Control* block) \
|
||||||
|
F(FinishFunction) \
|
||||||
|
F(OnFirstError) \
|
||||||
|
F(NextInstruction, WasmOpcode) \
|
||||||
|
F(Forward, const Value& from, Value* to)
|
||||||
|
|
||||||
|
#define INTERFACE_CONSTANT_FUNCTIONS(F) \
|
||||||
|
F(I32Const, Value* result, int32_t value) \
|
||||||
|
F(I64Const, Value* result, int64_t value) \
|
||||||
|
F(F32Const, Value* result, float value) \
|
||||||
|
F(F64Const, Value* result, double value) \
|
||||||
|
F(S128Const, Simd128Immediate<validate>& imm, Value* result) \
|
||||||
|
F(RefNull, ValueType type, Value* result) \
|
||||||
|
F(RefFunc, uint32_t function_index, Value* result) \
|
||||||
|
F(GlobalGet, Value* result, const GlobalIndexImmediate<validate>& imm) \
|
||||||
|
F(StructNewWithRtt, const StructIndexImmediate<validate>& imm, \
|
||||||
|
const Value& rtt, const Value args[], Value* result) \
|
||||||
|
F(ArrayInit, const ArrayIndexImmediate<validate>& imm, \
|
||||||
|
const base::Vector<Value>& elements, const Value& rtt, Value* result) \
|
||||||
|
F(RttCanon, uint32_t type_index, Value* result) \
|
||||||
|
F(RttSub, uint32_t type_index, const Value& parent, Value* result, \
|
||||||
|
WasmRttSubMode mode) \
|
||||||
|
F(DoReturn, uint32_t drop_values)
|
||||||
|
|
||||||
|
#define INTERFACE_NON_CONSTANT_FUNCTIONS(F) \
|
||||||
/* Control: */ \
|
/* Control: */ \
|
||||||
F(Block, Control* block) \
|
F(Block, Control* block) \
|
||||||
F(Loop, Control* block) \
|
F(Loop, Control* block) \
|
||||||
@ -935,22 +959,14 @@ struct ControlBase : public PcForErrors<validate> {
|
|||||||
F(UnOp, WasmOpcode opcode, const Value& value, Value* result) \
|
F(UnOp, WasmOpcode opcode, const Value& value, Value* result) \
|
||||||
F(BinOp, WasmOpcode opcode, const Value& lhs, const Value& rhs, \
|
F(BinOp, WasmOpcode opcode, const Value& lhs, const Value& rhs, \
|
||||||
Value* result) \
|
Value* result) \
|
||||||
F(I32Const, Value* result, int32_t value) \
|
|
||||||
F(I64Const, Value* result, int64_t value) \
|
|
||||||
F(F32Const, Value* result, float value) \
|
|
||||||
F(F64Const, Value* result, double value) \
|
|
||||||
F(RefNull, ValueType type, Value* result) \
|
|
||||||
F(RefFunc, uint32_t function_index, Value* result) \
|
|
||||||
F(RefAsNonNull, const Value& arg, Value* result) \
|
F(RefAsNonNull, const Value& arg, Value* result) \
|
||||||
F(Drop) \
|
F(Drop) \
|
||||||
F(DoReturn, uint32_t drop_values) \
|
|
||||||
F(LocalGet, Value* result, const IndexImmediate<validate>& imm) \
|
F(LocalGet, Value* result, const IndexImmediate<validate>& imm) \
|
||||||
F(LocalSet, const Value& value, const IndexImmediate<validate>& imm) \
|
F(LocalSet, const Value& value, const IndexImmediate<validate>& imm) \
|
||||||
F(LocalTee, const Value& value, Value* result, \
|
F(LocalTee, const Value& value, Value* result, \
|
||||||
const IndexImmediate<validate>& imm) \
|
const IndexImmediate<validate>& imm) \
|
||||||
F(AllocateLocals, base::Vector<Value> local_values) \
|
F(AllocateLocals, base::Vector<Value> local_values) \
|
||||||
F(DeallocateLocals, uint32_t count) \
|
F(DeallocateLocals, uint32_t count) \
|
||||||
F(GlobalGet, Value* result, const GlobalIndexImmediate<validate>& imm) \
|
|
||||||
F(GlobalSet, const Value& value, const GlobalIndexImmediate<validate>& imm) \
|
F(GlobalSet, const Value& value, const GlobalIndexImmediate<validate>& imm) \
|
||||||
F(TableGet, const Value& index, Value* result, \
|
F(TableGet, const Value& index, Value* result, \
|
||||||
const IndexImmediate<validate>& imm) \
|
const IndexImmediate<validate>& imm) \
|
||||||
@ -1026,8 +1042,6 @@ struct ControlBase : public PcForErrors<validate> {
|
|||||||
F(TableSize, const IndexImmediate<validate>& imm, Value* result) \
|
F(TableSize, const IndexImmediate<validate>& imm, Value* result) \
|
||||||
F(TableFill, const IndexImmediate<validate>& imm, const Value& start, \
|
F(TableFill, const IndexImmediate<validate>& imm, const Value& start, \
|
||||||
const Value& value, const Value& count) \
|
const Value& value, const Value& count) \
|
||||||
F(StructNewWithRtt, const StructIndexImmediate<validate>& imm, \
|
|
||||||
const Value& rtt, const Value args[], Value* result) \
|
|
||||||
F(StructNewDefault, const StructIndexImmediate<validate>& imm, \
|
F(StructNewDefault, const StructIndexImmediate<validate>& imm, \
|
||||||
const Value& rtt, Value* result) \
|
const Value& rtt, Value* result) \
|
||||||
F(StructGet, const Value& struct_object, \
|
F(StructGet, const Value& struct_object, \
|
||||||
@ -1051,9 +1065,6 @@ struct ControlBase : public PcForErrors<validate> {
|
|||||||
F(I31New, const Value& input, Value* result) \
|
F(I31New, const Value& input, Value* result) \
|
||||||
F(I31GetS, const Value& input, Value* result) \
|
F(I31GetS, const Value& input, Value* result) \
|
||||||
F(I31GetU, const Value& input, Value* result) \
|
F(I31GetU, const Value& input, Value* result) \
|
||||||
F(RttCanon, uint32_t type_index, Value* result) \
|
|
||||||
F(RttSub, uint32_t type_index, const Value& parent, Value* result, \
|
|
||||||
WasmRttSubMode mode) \
|
|
||||||
F(RefTest, const Value& obj, const Value& rtt, Value* result) \
|
F(RefTest, const Value& obj, const Value& rtt, Value* result) \
|
||||||
F(RefCast, const Value& obj, const Value& rtt, Value* result) \
|
F(RefCast, const Value& obj, const Value& rtt, Value* result) \
|
||||||
F(AssertNull, const Value& obj, Value* result) \
|
F(AssertNull, const Value& obj, Value* result) \
|
||||||
|
@ -987,6 +987,12 @@ class WasmGraphBuildingInterface {
|
|||||||
length.node, decoder->position());
|
length.node, decoder->position());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ArrayInit(FullDecoder* decoder, const ArrayIndexImmediate<validate>& imm,
|
||||||
|
const base::Vector<Value>& elements, const Value& rtt,
|
||||||
|
Value* result) {
|
||||||
|
UNREACHABLE();
|
||||||
|
}
|
||||||
|
|
||||||
void I31New(FullDecoder* decoder, const Value& input, Value* result) {
|
void I31New(FullDecoder* decoder, const Value& input, Value* result) {
|
||||||
result->node = builder_->I31New(input.node);
|
result->node = builder_->I31New(input.node);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user