v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
wasm-interpreter.cc File Reference
Include dependency graph for wasm-interpreter.cc:

Go to the source code of this file.

Classes

class  v8::internal::wasm::HandlersBase
 
class  v8::internal::wasm::Handlers< Compressed >
 

Namespaces

namespace  v8
 
namespace  v8::internal
 
namespace  v8::internal::wasm
 

Macros

#define EMIT_INSTR_HANDLER(name)
 
#define EMIT_INSTR_HANDLER_WITH_PC(name, pc)
 
#define START_EMIT_INSTR_HANDLER()
 
#define START_EMIT_INSTR_HANDLER_WITH_ID(name)
 
#define START_EMIT_INSTR_HANDLER_WITH_PC(name, pc)
 
#define END_EMIT_INSTR_HANDLER()
 
#define EMIT_MEM64_INSTR_HANDLER(name, mem64_name, is_memory64)
 
#define EMIT_MEM64_INSTR_HANDLER_WITH_PC(name, mem64_name, is_memory64, pc)
 
#define ITEM_ENUM_DEFINE(name)
 
#define V(name)
 
#define V(name)
 
#define NextOp()
 
#define TRAP(trap_reason)
 
#define INLINED_TRAP(trap_reason)
 
#define FOREACH_ARITHMETIC_BINOP(V)
 
#define DEFINE_BINOP(name, ctype, reg, op, type)
 
#define FOREACH_SIGNED_DIV_BINOP(V)
 
#define FOREACH_UNSIGNED_DIV_BINOP(V)
 
#define FOREACH_REM_BINOP(V)
 
#define FOREACH_TRAPPING_BINOP(V)
 
#define DEFINE_BINOP(name, ctype, reg, op, type)
 
#define DEFINE_BINOP(name, ctype, reg, op, type)
 
#define DEFINE_BINOP(name, ctype, reg, op, type)
 
#define FOREACH_COMPARISON_BINOP(V)
 
#define DEFINE_BINOP(name, ctype, reg, op, type)
 
#define FOREACH_MORE_BINOP(V)
 
#define DEFINE_BINOP(name, ctype, reg, op, type)
 
#define FOREACH_SIMPLE_UNOP(V)
 
#define DEFINE_UNOP(name, ctype, reg, op, type)
 
#define FOREACH_ADDITIONAL_CONVERT_UNOP(V)
 
#define FOREACH_I64_CONVERT_FROM_FLOAT_UNOP(V)
 
#define FOREACH_I32_CONVERT_FROM_FLOAT_UNOP(V)
 
#define FOREACH_OTHER_CONVERT_UNOP(V)
 
#define FOREACH_CONVERT_UNOP(V)
 
#define DEFINE_UNOP(name, from_ctype, from_type, from_reg, to_ctype, to_type, to_reg)
 
#define DEFINE_UNOP(name, from_ctype, from_type, from_reg, to_ctype, to_type, to_reg)
 
#define DEFINE_UNOP(name, from_ctype, from_type, from_reg, to_ctype, to_type, to_reg)
 
#define FOREACH_REINTERPRET_UNOP(V)
 
#define DEFINE_UNOP(name, from_ctype, from_type, from_reg, to_ctype, to_type, to_reg)
 
#define FOREACH_BITS_UNOP(V)
 
#define DEFINE_REG_BINOP(name, from_ctype, from_type, to_ctype, to_type, op)
 
#define FOREACH_EXTENSION_UNOP(V)
 
#define DEFINE_UNOP(name, from_ctype, from_type, to_ctype, to_type)
 
#define FOREACH_TRUNCSAT_UNOP(V)
 
#define DEFINE_UNOP(name, from_ctype, from_type, from_reg, to_ctype, to_type, to_reg)
 
#define FOREACH_ATOMIC_BINOP(V)
 
#define ATOMIC_BINOP(name, Type, ctype, type, op_ctype, op_type, operation)
 
#define FOREACH_ATOMIC_COMPARE_EXCHANGE_OP(V)
 
#define ATOMIC_COMPARE_EXCHANGE_OP(name, Type, ctype, type, op_ctype, op_type)
 
#define FOREACH_ATOMIC_LOAD_OP(V)
 
#define ATOMIC_LOAD_OP(name, Type, ctype, type, op_ctype, op_type)
 
#define FOREACH_ATOMIC_STORE_OP(V)
 
#define ATOMIC_STORE_OP(name, Type, ctype, type, op_ctype, op_type)
 
#define LANE(i, type)
 
#define SPLAT_CASE(format, stype, valType, op_type, num)
 
#define EXTRACT_LANE_CASE(format, stype, op_type, name)
 
#define EXTRACT_LANE_EXTEND_CASE(format, stype, name, sign, extended_type)
 
#define BINOP_CASE(op, name, stype, count, expr)
 
#define UNOP_CASE(op, name, stype, count, expr)
 
#define BITMASK_CASE(op, name, stype, count)
 
#define CMPOP_CASE(op, name, stype, out_stype, count, expr)
 
#define REPLACE_LANE_CASE(format, name, stype, ctype, op_type)
 
#define SHIFT_CASE(op, name, stype, count, expr)
 
#define CONVERT_CASE(op, src_type, name, dst_type, count, start_index, ctype, expr)
 
#define PACK_CASE(op, src_type, name, dst_type, count, dst_ctype)
 
#define REDUCTION_CASE(op, name, stype, count)
 
#define QFM_CASE(op, name, stype, count, operation)
 
#define V(_)
 
#define V(name)
 
#define V(_)
 
#define V(name)
 
#define LOAD_CASE(name, ctype, mtype, rep, type)
 
#define STORE_CASE(name, ctype, mtype, rep, type)
 
#define EXECUTE_BINOP(name, ctype, reg, op, type)
 
#define EXECUTE_UNOP(name, ctype, reg, op, type)
 
#define EXECUTE_UNOP(name, from_ctype, from_type, from_reg, to_ctype, to_type, to_reg)
 
#define EXECUTE_UNOP(name, from_ctype, from_type, to_ctype, to_type, op)
 
#define EXECUTE_UNOP(name, from_ctype, from_type, to_ctype, to_type)
 
#define DECODE_UNOP(name, from_ctype, from_type, from_reg, to_ctype, to_type, to_reg)
 
#define ATOMIC_BINOP(name, Type, ctype, type, op_ctype, op_type, operation)
 
#define ATOMIC_OP(name, Type, ctype, type, op_ctype, op_type)
 
#define LOAD_CASE(name, ctype, mtype, rep, type)
 
#define STORE_CASE(name, ctype, mtype, rep, type)
 
#define EXECUTE_BINOP(name, ctype, reg, op, type)
 
#define EXECUTE_BINOP(name, ctype, reg, op, type)
 
#define EXECUTE_BINOP(name, ctype, reg, op, type)
 
#define EXECUTE_UNOP(name, ctype, reg, op, type)
 
#define EXECUTE_UNOP(name, from_ctype, from_type, from_reg, to_ctype, to_type, to_reg)
 
#define EXECUTE_UNOP(name, from_ctype, from_type, from_reg, to_ctype, to_type, to_reg)
 
#define EXECUTE_UNOP(name, from_ctype, from_type, to_ctype, to_type, op)
 
#define EXECUTE_UNOP(name, from_ctype, from_type, to_ctype, to_type)
 
#define ATOMIC_BINOP(name, Type, ctype, type, op_ctype, op_type, operation)
 
#define ATOMIC_COMPARE_EXCHANGE_OP(name, Type, ctype, type, op_ctype, op_type)
 
#define ATOMIC_LOAD_OP(name, Type, ctype, type, op_ctype, op_type)
 
#define ATOMIC_STORE_OP(name, Type, ctype, type, op_ctype, op_type)
 
#define SPLAT_CASE(format, stype, valType, op_type, num)
 
#define EXTRACT_LANE_CASE(format, stype, op_type, name)
 
#define EXTRACT_LANE_EXTEND_CASE(format, stype, name, sign, extended_type)
 
#define BINOP_CASE(op, name, stype, count, expr)
 
#define UNOP_CASE(op, name, stype, count, expr)
 
#define BITMASK_CASE(op, name, stype, count)
 
#define CMPOP_CASE(op, name, stype, out_stype, count, expr)
 
#define REPLACE_LANE_CASE(format, name, stype, ctype, op_type)
 
#define SHIFT_CASE(op, name, stype, count, expr)
 
#define EXT_MUL_CASE(op)
 
#define CONVERT_CASE(op, src_type, name, dst_type, count, start_index, ctype, expr)
 
#define PACK_CASE(op, src_type, name, dst_type, count, dst_ctype)
 
#define SELECT_CASE(op)
 
#define REDUCTION_CASE(op, name, stype, count, operation)
 
#define QFM_CASE(op, name, stype, count, operation)
 
#define LOAD_SPLAT_CASE(op)
 
#define LOAD_EXTEND_CASE(op)
 
#define LOAD_ZERO_EXTEND_CASE(op, load_type)
 
#define LOAD_LANE_CASE(op)
 
#define STORE_LANE_CASE(op)
 
#define EXT_ADD_PAIRWISE_CASE(op)
 
#define LOAD_CASE(name, ctype, mtype, rep, type)
 
#define STORE_CASE(name, ctype, mtype, rep, type)
 

Enumerations

enum  v8::internal::wasm::BoundsCheckedHandlersCounter { v8::internal::wasm::kTotalItems }
 

Functions

 v8::internal::wasm::V8_DECLARE_ONCE (init_instruction_table_once)
 
 v8::internal::wasm::V8_DECLARE_ONCE (init_trap_handlers_once)
 
INSTRUCTION_HANDLER_FUNC v8::internal::wasm::TrapMemOutOfBounds (const uint8_t *code, uint32_t *sp, WasmInterpreterRuntime *wasm_runtime, int64_t r0, double fp0)
 
void v8::internal::wasm::InitTrapHandlersOnce (Isolate *isolate)
 
void v8::internal::wasm::InitInstructionTableOnce (Isolate *isolate)
 
static int v8::internal::wasm::StructFieldOffset (const StructType *struct_type, int field_index)
 
const char * v8::internal::wasm::GetRegModeString (RegMode reg_mode)
 
const char * v8::internal::wasm::GetOperatorModeString (OperatorMode mode)
 

Variables

constexpr uint32_t v8::internal::wasm::kFloat32SignBitMask = uint32_t{1} << 31
 
constexpr uint64_t v8::internal::wasm::kFloat64SignBitMask = uint64_t{1} << 63
 
InstructionHandler v8::internal::wasm::s_unwind_code = InstructionHandler::k_s2s_Unwind
 
PWasmOp * v8::internal::wasm::kInstructionTable [kInstructionTableSize]
 

Macro Definition Documentation

◆ ATOMIC_BINOP [1/3]

#define ATOMIC_BINOP ( name,
Type,
ctype,
type,
op_ctype,
op_type,
operation )

Definition at line 4399 of file wasm-interpreter.cc.

◆ ATOMIC_BINOP [2/3]

#define ATOMIC_BINOP ( name,
Type,
ctype,
type,
op_ctype,
op_type,
operation )
Value:
case kExpr##name: { \
MachineType memtype = MachineType::Type(); \
MemoryAccessImmediate imm(decoder, code->at(pc + *len), \
ElementSizeLog2Of(memtype.representation()), \
Decoder::kNoValidation); \
optional->offset = imm.offset; \
*len += imm.length; \
break; \
}
const char * name
Definition builtins.cc:39

Definition at line 4399 of file wasm-interpreter.cc.

◆ ATOMIC_BINOP [3/3]

#define ATOMIC_BINOP ( name,
Type,
ctype,
type,
op_ctype,
op_type,
operation )
Value:
case kExpr##name: { \
EMIT_MEM64_INSTR_HANDLER_WITH_PC(s2s_##name, s2s_##name##_Idx64, \
is_memory64_, instr.pc); \
op_type##Pop(); \
EmitMemoryOffset(instr.optional.offset); \
MemIndexPop(); \
op_type##Push(); \
return RegMode::kNoReg; \
}
Instruction * instr

Definition at line 4399 of file wasm-interpreter.cc.

◆ ATOMIC_COMPARE_EXCHANGE_OP [1/2]

#define ATOMIC_COMPARE_EXCHANGE_OP ( name,
Type,
ctype,
type,
op_ctype,
op_type )

Definition at line 4447 of file wasm-interpreter.cc.

◆ ATOMIC_COMPARE_EXCHANGE_OP [2/2]

#define ATOMIC_COMPARE_EXCHANGE_OP ( name,
Type,
ctype,
type,
op_ctype,
op_type )
Value:
case kExpr##name: { \
EMIT_MEM64_INSTR_HANDLER_WITH_PC(s2s_##name, s2s_##name##_Idx64, \
is_memory64_, instr.pc); \
op_type##Pop(); \
op_type##Pop(); \
EmitMemoryOffset(instr.optional.offset); \
MemIndexPop(); \
op_type##Push(); \
return RegMode::kNoReg; \
}

Definition at line 4447 of file wasm-interpreter.cc.

◆ ATOMIC_LOAD_OP [1/2]

#define ATOMIC_LOAD_OP ( name,
Type,
ctype,
type,
op_ctype,
op_type )

Definition at line 4497 of file wasm-interpreter.cc.

◆ ATOMIC_LOAD_OP [2/2]

#define ATOMIC_LOAD_OP ( name,
Type,
ctype,
type,
op_ctype,
op_type )
Value:
case kExpr##name: { \
EMIT_MEM64_INSTR_HANDLER_WITH_PC(s2s_##name, s2s_##name##_Idx64, \
is_memory64_, instr.pc); \
EmitMemoryOffset(instr.optional.offset); \
MemIndexPop(); \
op_type##Push(); \
return RegMode::kNoReg; \
}

Definition at line 4497 of file wasm-interpreter.cc.

◆ ATOMIC_OP

#define ATOMIC_OP ( name,
Type,
ctype,
type,
op_ctype,
op_type )
Value:
case kExpr##name: { \
MachineType memtype = MachineType::Type(); \
MemoryAccessImmediate imm(decoder, code->at(pc + *len), \
ElementSizeLog2Of(memtype.representation()), \
Decoder::kNoValidation); \
optional->offset = imm.offset; \
*len += imm.length; \
break; \
}

◆ ATOMIC_STORE_OP [1/2]

#define ATOMIC_STORE_OP ( name,
Type,
ctype,
type,
op_ctype,
op_type )

Definition at line 4544 of file wasm-interpreter.cc.

◆ ATOMIC_STORE_OP [2/2]

#define ATOMIC_STORE_OP ( name,
Type,
ctype,
type,
op_ctype,
op_type )
Value:
case kExpr##name: { \
EMIT_MEM64_INSTR_HANDLER_WITH_PC(s2s_##name, s2s_##name##_Idx64, \
is_memory64_, instr.pc); \
op_type##Pop(); \
EmitMemoryOffset(instr.optional.offset); \
MemIndexPop(); \
return RegMode::kNoReg; \
}

Definition at line 4544 of file wasm-interpreter.cc.

◆ BINOP_CASE [1/2]

#define BINOP_CASE ( op,
name,
stype,
count,
expr )
Value:
INSTRUCTION_HANDLER_FUNC s2s_Simd##op(const uint8_t* code, uint32_t* sp, \
WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
stype s2 = pop<Simd128>(sp, code, wasm_runtime).to_##name(); \
stype s1 = pop<Simd128>(sp, code, wasm_runtime).to_##name(); \
stype res; \
for (size_t i = 0; i < count; ++i) { \
auto a = s1.val[LANE(i, s1)]; \
auto b = s2.val[LANE(i, s2)]; \
res.val[LANE(i, res)] = expr; \
} \
push<Simd128>(sp, code, wasm_runtime, Simd128(res)); \
NextOp(); \
}
uint32_t count
#define LANE(i, type)
#define INSTRUCTION_HANDLER_FUNC

Definition at line 4656 of file wasm-interpreter.cc.

◆ BINOP_CASE [2/2]

#define BINOP_CASE ( op,
name,
stype,
count,
expr )
Value:
case kExpr##op: { \
EMIT_INSTR_HANDLER(s2s_Simd##op); \
S128Pop(); \
S128Pop(); \
S128Push(); \
return RegMode::kNoReg; \
}

Definition at line 4656 of file wasm-interpreter.cc.

◆ BITMASK_CASE [1/2]

#define BITMASK_CASE ( op,
name,
stype,
count )
Value:
INSTRUCTION_HANDLER_FUNC s2s_Simd##op(const uint8_t* code, uint32_t* sp, \
WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
stype s = pop<Simd128>(sp, code, wasm_runtime).to_##name(); \
int32_t res = 0; \
for (size_t i = 0; i < count; ++i) { \
bool sign = std::signbit(static_cast<double>(s.val[LANE(i, s)])); \
res |= (sign << i); \
} \
push<int32_t>(sp, code, wasm_runtime, res); \
NextOp(); \
}

◆ BITMASK_CASE [2/2]

#define BITMASK_CASE ( op,
name,
stype,
count )
Value:
case kExpr##op: { \
EMIT_INSTR_HANDLER(s2s_Simd##op); \
S128Pop(); \
I32Push(); \
return RegMode::kNoReg; \
}

◆ CMPOP_CASE [1/2]

#define CMPOP_CASE ( op,
name,
stype,
out_stype,
count,
expr )
Value:
INSTRUCTION_HANDLER_FUNC s2s_Simd##op(const uint8_t* code, uint32_t* sp, \
WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
stype s2 = pop<Simd128>(sp, code, wasm_runtime).to_##name(); \
stype s1 = pop<Simd128>(sp, code, wasm_runtime).to_##name(); \
out_stype res; \
for (size_t i = 0; i < count; ++i) { \
auto a = s1.val[LANE(i, s1)]; \
auto b = s2.val[LANE(i, s2)]; \
auto result = expr; \
res.val[LANE(i, res)] = result ? -1 : 0; \
} \
push<Simd128>(sp, code, wasm_runtime, Simd128(res)); \
NextOp(); \
}
ZoneVector< RpoNumber > & result

◆ CMPOP_CASE [2/2]

#define CMPOP_CASE ( op,
name,
stype,
out_stype,
count,
expr )
Value:
case kExpr##op: { \
EMIT_INSTR_HANDLER(s2s_Simd##op); \
S128Pop(); \
S128Pop(); \
S128Push(); \
return RegMode::kNoReg; \
}

◆ CONVERT_CASE [1/2]

#define CONVERT_CASE ( op,
src_type,
name,
dst_type,
count,
start_index,
ctype,
expr )
Value:
INSTRUCTION_HANDLER_FUNC s2s_Simd##op(const uint8_t* code, uint32_t* sp, \
WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
src_type s = pop<Simd128>(sp, code, wasm_runtime).to_##name(); \
dst_type res = {0}; \
for (size_t i = 0; i < count; ++i) { \
ctype a = s.val[LANE(start_index + i, s)]; \
res.val[LANE(i, res)] = expr; \
} \
push<Simd128>(sp, code, wasm_runtime, Simd128(res)); \
NextOp(); \
}
WordWithBits< 128 > Simd128
Definition index.h:236

Definition at line 5041 of file wasm-interpreter.cc.

◆ CONVERT_CASE [2/2]

#define CONVERT_CASE ( op,
src_type,
name,
dst_type,
count,
start_index,
ctype,
expr )
Value:
case kExpr##op: { \
EMIT_INSTR_HANDLER(s2s_Simd##op); \
S128Pop(); \
S128Push(); \
return RegMode::kNoReg; \
}

Definition at line 5041 of file wasm-interpreter.cc.

◆ DECODE_UNOP

#define DECODE_UNOP ( name,
from_ctype,
from_type,
from_reg,
to_ctype,
to_type,
to_reg )
Value:
case kExpr##name: \
break;

◆ DEFINE_BINOP [1/6]

#define DEFINE_BINOP ( name,
ctype,
reg,
op,
type )

Definition at line 1959 of file wasm-interpreter.cc.

◆ DEFINE_BINOP [2/6]

#define DEFINE_BINOP ( name,
ctype,
reg,
op,
type )

Definition at line 1959 of file wasm-interpreter.cc.

◆ DEFINE_BINOP [3/6]

#define DEFINE_BINOP ( name,
ctype,
reg,
op,
type )

Definition at line 1959 of file wasm-interpreter.cc.

◆ DEFINE_BINOP [4/6]

#define DEFINE_BINOP ( name,
ctype,
reg,
op,
type )

Definition at line 1959 of file wasm-interpreter.cc.

◆ DEFINE_BINOP [5/6]

#define DEFINE_BINOP ( name,
ctype,
reg,
op,
type )

Definition at line 1959 of file wasm-interpreter.cc.

◆ DEFINE_BINOP [6/6]

#define DEFINE_BINOP ( name,
ctype,
reg,
op,
type )

Definition at line 1959 of file wasm-interpreter.cc.

◆ DEFINE_REG_BINOP

#define DEFINE_REG_BINOP ( name,
from_ctype,
from_type,
to_ctype,
to_type,
op )

Definition at line 2664 of file wasm-interpreter.cc.

◆ DEFINE_UNOP [1/7]

#define DEFINE_UNOP ( name,
ctype,
reg,
op,
type )

Definition at line 2364 of file wasm-interpreter.cc.

◆ DEFINE_UNOP [2/7]

#define DEFINE_UNOP ( name,
from_ctype,
from_type,
from_reg,
to_ctype,
to_type,
to_reg )

Definition at line 2364 of file wasm-interpreter.cc.

◆ DEFINE_UNOP [3/7]

#define DEFINE_UNOP ( name,
from_ctype,
from_type,
from_reg,
to_ctype,
to_type,
to_reg )

Definition at line 2364 of file wasm-interpreter.cc.

◆ DEFINE_UNOP [4/7]

#define DEFINE_UNOP ( name,
from_ctype,
from_type,
from_reg,
to_ctype,
to_type,
to_reg )
Value:
INSTRUCTION_HANDLER_FUNC r2r_##name(const uint8_t* code, uint32_t* sp, \
WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
to_reg = static_cast<to_ctype>(static_cast<from_ctype>(from_reg)); \
NextOp(); \
} \
\
INSTRUCTION_HANDLER_FUNC r2s_##name(const uint8_t* code, uint32_t* sp, \
WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
to_ctype val = static_cast<from_ctype>(from_reg); \
push<to_ctype>(sp, code, wasm_runtime, val); \
NextOp(); \
} \
\
INSTRUCTION_HANDLER_FUNC s2r_##name(const uint8_t* code, uint32_t* sp, \
WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
to_reg = static_cast<to_ctype>(pop<from_ctype>(sp, code, wasm_runtime)); \
NextOp(); \
} \
\
INSTRUCTION_HANDLER_FUNC s2s_##name(const uint8_t* code, uint32_t* sp, \
WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
to_ctype val = pop<from_ctype>(sp, code, wasm_runtime); \
push<to_ctype>(sp, code, wasm_runtime, val); \
NextOp(); \
}

Definition at line 2364 of file wasm-interpreter.cc.

◆ DEFINE_UNOP [5/7]

#define DEFINE_UNOP ( name,
from_ctype,
from_type,
from_reg,
to_ctype,
to_type,
to_reg )

Definition at line 2364 of file wasm-interpreter.cc.

◆ DEFINE_UNOP [6/7]

#define DEFINE_UNOP ( name,
from_ctype,
from_type,
from_reg,
to_ctype,
to_type,
to_reg )

Definition at line 2364 of file wasm-interpreter.cc.

◆ DEFINE_UNOP [7/7]

#define DEFINE_UNOP ( name,
from_ctype,
from_type,
to_ctype,
to_type )

Definition at line 2364 of file wasm-interpreter.cc.

◆ EMIT_INSTR_HANDLER

#define EMIT_INSTR_HANDLER ( name)
Value:
EmitFnId(k_##name);

Definition at line 32 of file wasm-interpreter.cc.

◆ EMIT_INSTR_HANDLER_WITH_PC

#define EMIT_INSTR_HANDLER_WITH_PC ( name,
pc )
Value:
EmitFnId(k_##name, pc);

Definition at line 33 of file wasm-interpreter.cc.

◆ EMIT_MEM64_INSTR_HANDLER

#define EMIT_MEM64_INSTR_HANDLER ( name,
mem64_name,
is_memory64 )
Value:
if (V8_UNLIKELY(is_memory64)) { \
EMIT_INSTR_HANDLER(mem64_name); \
} else { \
EMIT_INSTR_HANDLER(name); \
}
#define V8_UNLIKELY(condition)
Definition v8config.h:660

Definition at line 76 of file wasm-interpreter.cc.

◆ EMIT_MEM64_INSTR_HANDLER_WITH_PC

#define EMIT_MEM64_INSTR_HANDLER_WITH_PC ( name,
mem64_name,
is_memory64,
pc )
Value:
if (V8_UNLIKELY(is_memory64)) { \
EMIT_INSTR_HANDLER_WITH_PC(mem64_name, pc); \
} else { \
EMIT_INSTR_HANDLER_WITH_PC(name, pc); \
}

Definition at line 83 of file wasm-interpreter.cc.

◆ END_EMIT_INSTR_HANDLER

#define END_EMIT_INSTR_HANDLER ( )
Value:
if (v8_flags.drumbrake_compact_bytecode && current_instr_encoding_failed_) { \
code_.resize(_current_code_offset); \
slots_.resize(_current_slots_size); \
stack_.rollback(); \
current_instr_encoding_failed_ = false; \
handler_size_ = InstrHandlerSize::Large; \
continue; \
} \
break; \
} \
DCHECK(!current_instr_encoding_failed_); \
no_nested_emit_instr_handler_guard_ = false; \
}
ZoneList< RegExpInstruction > code_

Definition at line 58 of file wasm-interpreter.cc.

◆ EXECUTE_BINOP [1/4]

#define EXECUTE_BINOP ( name,
ctype,
reg,
op,
type )
Value:
case kExpr##name: \
break;

◆ EXECUTE_BINOP [2/4]

#define EXECUTE_BINOP ( name,
ctype,
reg,
op,
type )
Value:
case kExpr##name: { \
switch (mode) { \
case kR2R: \
EMIT_INSTR_HANDLER(r2r_##name); \
type##Pop(); \
return RegMode::kI32Reg; \
case kR2S: \
EMIT_INSTR_HANDLER(r2s_##name); \
type##Pop(); \
I32Push(); \
return RegMode::kNoReg; \
case kS2R: \
EMIT_INSTR_HANDLER(s2r_##name); \
type##Pop(); \
type##Pop(); \
return RegMode::kI32Reg; \
case kS2S: \
EMIT_INSTR_HANDLER(s2s_##name); \
type##Pop(); \
type##Pop(); \
I32Push(); \
return RegMode::kNoReg; \
} \
break; \
}

◆ EXECUTE_BINOP [3/4]

#define EXECUTE_BINOP ( name,
ctype,
reg,
op,
type )
Value:
case kExpr##name: { \
switch (mode) { \
case kR2R: \
EMIT_INSTR_HANDLER(r2r_##name); \
type##Pop(); \
return RegMode::k##type##Reg; \
case kR2S: \
EMIT_INSTR_HANDLER(r2s_##name); \
type##Pop(); \
type##Push(); \
return RegMode::kNoReg; \
case kS2R: \
EMIT_INSTR_HANDLER(s2r_##name); \
type##Pop(); \
type##Pop(); \
return RegMode::k##type##Reg; \
case kS2S: \
EMIT_INSTR_HANDLER(s2s_##name); \
type##Pop(); \
type##Pop(); \
type##Push(); \
return RegMode::kNoReg; \
} \
break; \
}

◆ EXECUTE_BINOP [4/4]

#define EXECUTE_BINOP ( name,
ctype,
reg,
op,
type )
Value:
case kExpr##name: { \
switch (mode) { \
case kR2R: \
EMIT_INSTR_HANDLER_WITH_PC(r2r_##name, instr.pc); \
type##Pop(); \
return RegMode::k##type##Reg; \
case kR2S: \
EMIT_INSTR_HANDLER_WITH_PC(r2s_##name, instr.pc); \
type##Pop(); \
type##Push(); \
return RegMode::kNoReg; \
case kS2R: \
EMIT_INSTR_HANDLER_WITH_PC(s2r_##name, instr.pc); \
type##Pop(); \
type##Pop(); \
return RegMode::k##type##Reg; \
case kS2S: \
EMIT_INSTR_HANDLER_WITH_PC(s2s_##name, instr.pc); \
type##Pop(); \
type##Pop(); \
type##Push(); \
return RegMode::kNoReg; \
} \
break; \
}

◆ EXECUTE_UNOP [1/9]

#define EXECUTE_UNOP ( name,
ctype,
reg,
op,
type )
Value:
case kExpr##name: \
break;

◆ EXECUTE_UNOP [2/9]

#define EXECUTE_UNOP ( name,
ctype,
reg,
op,
type )
Value:
case kExpr##name: { \
switch (mode) { \
case kR2R: \
EMIT_INSTR_HANDLER(r2r_##name); \
return RegMode::k##type##Reg; \
case kR2S: \
EMIT_INSTR_HANDLER(r2s_##name); \
type##Push(); \
return RegMode::kNoReg; \
case kS2R: \
EMIT_INSTR_HANDLER(s2r_##name); \
type##Pop(); \
return RegMode::k##type##Reg; \
case kS2S: \
EMIT_INSTR_HANDLER(s2s_##name); \
type##Pop(); \
type##Push(); \
return RegMode::kNoReg; \
} \
break; \
}

◆ EXECUTE_UNOP [3/9]

#define EXECUTE_UNOP ( name,
from_ctype,
from_type,
from_reg,
to_ctype,
to_type,
to_reg )
Value:
case kExpr##name: \
break;

◆ EXECUTE_UNOP [4/9]

#define EXECUTE_UNOP ( name,
from_ctype,
from_type,
from_reg,
to_ctype,
to_type,
to_reg )
Value:
case kExpr##name: { \
switch (mode) { \
case kR2R: \
EMIT_INSTR_HANDLER(r2r_##name); \
return RegMode::k##to_type##Reg; \
case kR2S: \
EMIT_INSTR_HANDLER(r2s_##name); \
to_type##Push(); \
return RegMode::kNoReg; \
case kS2R: \
EMIT_INSTR_HANDLER(s2r_##name); \
from_type##Pop(); \
return RegMode::k##to_type##Reg; \
case kS2S: \
EMIT_INSTR_HANDLER(s2s_##name); \
from_type##Pop(); \
to_type##Push(); \
return RegMode::kNoReg; \
} \
break; \
}

◆ EXECUTE_UNOP [5/9]

#define EXECUTE_UNOP ( name,
from_ctype,
from_type,
from_reg,
to_ctype,
to_type,
to_reg )
Value:
case kExpr##name: { \
switch (mode) { \
case kR2R: \
EMIT_INSTR_HANDLER_WITH_PC(r2r_##name, instr.pc); \
return RegMode::k##to_type##Reg; \
case kR2S: \
EMIT_INSTR_HANDLER_WITH_PC(r2s_##name, instr.pc); \
to_type##Push(); \
return RegMode::kNoReg; \
case kS2R: \
EMIT_INSTR_HANDLER_WITH_PC(s2r_##name, instr.pc); \
from_type##Pop(); \
return RegMode::k##to_type##Reg; \
case kS2S: \
EMIT_INSTR_HANDLER_WITH_PC(s2s_##name, instr.pc); \
from_type##Pop(); \
to_type##Push(); \
return RegMode::kNoReg; \
} \
break; \
}

◆ EXECUTE_UNOP [6/9]

#define EXECUTE_UNOP ( name,
from_ctype,
from_type,
to_ctype,
to_type )
Value:
case kExpr##name: \
break;

◆ EXECUTE_UNOP [7/9]

#define EXECUTE_UNOP ( name,
from_ctype,
from_type,
to_ctype,
to_type )
Value:
case kExpr##name: { \
switch (mode) { \
case kR2R: \
EMIT_INSTR_HANDLER(r2r_##name); \
return RegMode::k##to_type##Reg; \
case kR2S: \
EMIT_INSTR_HANDLER(r2s_##name); \
to_type##Push(); \
return RegMode::kNoReg; \
case kS2R: \
EMIT_INSTR_HANDLER(s2r_##name); \
from_type##Pop(); \
return RegMode::k##to_type##Reg; \
case kS2S: \
EMIT_INSTR_HANDLER(s2s_##name); \
from_type##Pop(); \
to_type##Push(); \
return RegMode::kNoReg; \
} \
break; \
}

◆ EXECUTE_UNOP [8/9]

#define EXECUTE_UNOP ( name,
from_ctype,
from_type,
to_ctype,
to_type,
op )
Value:
case kExpr##name: \
break;

◆ EXECUTE_UNOP [9/9]

#define EXECUTE_UNOP ( name,
from_ctype,
from_type,
to_ctype,
to_type,
op )
Value:
case kExpr##name: { \
switch (mode) { \
case kR2R: \
EMIT_INSTR_HANDLER(r2r_##name); \
return RegMode::k##to_type##Reg; \
case kR2S: \
EMIT_INSTR_HANDLER(r2s_##name); \
to_type##Push(); \
return RegMode::kNoReg; \
case kS2R: \
EMIT_INSTR_HANDLER(s2r_##name); \
from_type##Pop(); \
return RegMode::k##to_type##Reg; \
case kS2S: \
EMIT_INSTR_HANDLER(s2s_##name); \
from_type##Pop(); \
to_type##Push(); \
return RegMode::kNoReg; \
} \
break; \
}

◆ EXT_ADD_PAIRWISE_CASE

#define EXT_ADD_PAIRWISE_CASE ( op)
Value:
case kExpr##op: { \
EMIT_INSTR_HANDLER(s2s_Simd##op); \
S128Pop(); \
S128Push(); \
return RegMode::kNoReg; \
}

◆ EXT_MUL_CASE

#define EXT_MUL_CASE ( op)
Value:
case kExpr##op: { \
EMIT_INSTR_HANDLER(s2s_Simd##op); \
S128Pop(); \
S128Pop(); \
S128Push(); \
return RegMode::kNoReg; \
}

◆ EXTRACT_LANE_CASE [1/2]

#define EXTRACT_LANE_CASE ( format,
stype,
op_type,
name )
Value:
INSTRUCTION_HANDLER_FUNC s2s_Simd##format##ExtractLane( \
const uint8_t* code, uint32_t* sp, WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
uint16_t lane = Read<int16_t>(code); \
DCHECK_LT(lane, 4); \
Simd128 v = pop<Simd128>(sp, code, wasm_runtime); \
stype s = v.to_##name(); \
push(sp, code, wasm_runtime, s.val[LANE(lane, s)]); \
NextOp(); \
}

Definition at line 4609 of file wasm-interpreter.cc.

◆ EXTRACT_LANE_CASE [2/2]

#define EXTRACT_LANE_CASE ( format,
stype,
op_type,
name )
Value:
case kExpr##format##ExtractLane: { \
EMIT_INSTR_HANDLER(s2s_Simd##format##ExtractLane); \
/* emit 8 bits ? */ \
EmitI16Const(instr.optional.simd_lane); \
S128Pop(); \
op_type##Push(); \
return RegMode::kNoReg; \
}

Definition at line 4609 of file wasm-interpreter.cc.

◆ EXTRACT_LANE_EXTEND_CASE [1/2]

#define EXTRACT_LANE_EXTEND_CASE ( format,
stype,
name,
sign,
extended_type )
Value:
INSTRUCTION_HANDLER_FUNC s2s_Simd##format##ExtractLane##sign( \
const uint8_t* code, uint32_t* sp, WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
uint16_t lane = Read<int16_t>(code); \
DCHECK_LT(lane, 16); \
Simd128 s = pop<Simd128>(sp, code, wasm_runtime); \
stype ss = s.to_##name(); \
auto res = ss.val[LANE(lane, ss)]; \
DCHECK(std::is_signed<decltype(res)>::value); \
if (std::is_unsigned<extended_type>::value) { \
using unsigned_type = std::make_unsigned<decltype(res)>::type; \
push(sp, code, wasm_runtime, \
static_cast<extended_type>(static_cast<unsigned_type>(res))); \
} else { \
push(sp, code, wasm_runtime, static_cast<extended_type>(res)); \
} \
NextOp(); \
}

Definition at line 4631 of file wasm-interpreter.cc.

◆ EXTRACT_LANE_EXTEND_CASE [2/2]

#define EXTRACT_LANE_EXTEND_CASE ( format,
stype,
name,
sign,
extended_type )
Value:
case kExpr##format##ExtractLane##sign: { \
EMIT_INSTR_HANDLER(s2s_Simd##format##ExtractLane##sign); \
/* emit 8 bits ? */ \
EmitI16Const(instr.optional.simd_lane); \
S128Pop(); \
I32Push(); \
return RegMode::kNoReg; \
}

Definition at line 4631 of file wasm-interpreter.cc.

◆ FOREACH_ADDITIONAL_CONVERT_UNOP

#define FOREACH_ADDITIONAL_CONVERT_UNOP ( V)
Value:
V(I32ConvertI64, int64_t, I64, r0, int32_t, I32, r0)
#define V(name)

Definition at line 2402 of file wasm-interpreter.cc.

◆ FOREACH_ARITHMETIC_BINOP

#define FOREACH_ARITHMETIC_BINOP ( V)
Value:
V(I32Add, uint32_t, r0, +, I32) \
V(I32Sub, uint32_t, r0, -, I32) \
V(I32Mul, uint32_t, r0, *, I32) \
V(I32And, uint32_t, r0, &, I32) \
V(I32Ior, uint32_t, r0, |, I32) \
V(I32Xor, uint32_t, r0, ^, I32) \
V(I64Add, uint64_t, r0, +, I64) \
V(I64Sub, uint64_t, r0, -, I64) \
V(I64Mul, uint64_t, r0, *, I64) \
V(I64And, uint64_t, r0, &, I64) \
V(I64Ior, uint64_t, r0, |, I64) \
V(I64Xor, uint64_t, r0, ^, I64) \
V(F32Add, float, fp0, +, F32) \
V(F32Sub, float, fp0, -, F32) \
V(F32Mul, float, fp0, *, F32) \
V(F32Div, float, fp0, /, F32) \
V(F64Add, double, fp0, +, F64) \
V(F64Sub, double, fp0, -, F64) \
V(F64Mul, double, fp0, *, F64) \
V(F64Div, double, fp0, /, F64)

Definition at line 1937 of file wasm-interpreter.cc.

◆ FOREACH_ATOMIC_BINOP

#define FOREACH_ATOMIC_BINOP ( V)

Definition at line 4333 of file wasm-interpreter.cc.

◆ FOREACH_ATOMIC_COMPARE_EXCHANGE_OP

#define FOREACH_ATOMIC_COMPARE_EXCHANGE_OP ( V)
Value:
V(I32AtomicCompareExchange, Uint32, uint32_t, I32, uint32_t, I32) \
V(I32AtomicCompareExchange8U, Uint8, uint8_t, I32, uint32_t, I32) \
V(I32AtomicCompareExchange16U, Uint16, uint16_t, I32, uint32_t, I32) \
V(I64AtomicCompareExchange, Uint64, uint64_t, I64, uint64_t, I64) \
V(I64AtomicCompareExchange8U, Uint8, uint8_t, I32, uint64_t, I64) \
V(I64AtomicCompareExchange16U, Uint16, uint16_t, I32, uint64_t, I64) \
V(I64AtomicCompareExchange32U, Uint32, uint32_t, I32, uint64_t, I64)

Definition at line 4438 of file wasm-interpreter.cc.

◆ FOREACH_ATOMIC_LOAD_OP

#define FOREACH_ATOMIC_LOAD_OP ( V)
Value:
V(I32AtomicLoad, Uint32, uint32_t, I32, uint32_t, I32) \
V(I32AtomicLoad8U, Uint8, uint8_t, I32, uint32_t, I32) \
V(I32AtomicLoad16U, Uint16, uint16_t, I32, uint32_t, I32) \
V(I64AtomicLoad, Uint64, uint64_t, I64, uint64_t, I64) \
V(I64AtomicLoad8U, Uint8, uint8_t, I32, uint64_t, I64) \
V(I64AtomicLoad16U, Uint16, uint16_t, I32, uint64_t, I64) \
V(I64AtomicLoad32U, Uint32, uint32_t, I32, uint64_t, I64)

Definition at line 4488 of file wasm-interpreter.cc.

◆ FOREACH_ATOMIC_STORE_OP

#define FOREACH_ATOMIC_STORE_OP ( V)
Value:
V(I32AtomicStore, Uint32, uint32_t, I32, uint32_t, I32) \
V(I32AtomicStore8U, Uint8, uint8_t, I32, uint32_t, I32) \
V(I32AtomicStore16U, Uint16, uint16_t, I32, uint32_t, I32) \
V(I64AtomicStore, Uint64, uint64_t, I64, uint64_t, I64) \
V(I64AtomicStore8U, Uint8, uint8_t, I32, uint64_t, I64) \
V(I64AtomicStore16U, Uint16, uint16_t, I32, uint64_t, I64) \
V(I64AtomicStore32U, Uint32, uint32_t, I32, uint64_t, I64)

Definition at line 4535 of file wasm-interpreter.cc.

◆ FOREACH_BITS_UNOP

#define FOREACH_BITS_UNOP ( V)
Value:
V(I32Clz, uint32_t, I32, uint32_t, I32, base::bits::CountLeadingZeros(val)) \
V(I32Ctz, uint32_t, I32, uint32_t, I32, base::bits::CountTrailingZeros(val)) \
V(I32Popcnt, uint32_t, I32, uint32_t, I32, base::bits::CountPopulation(val)) \
V(I32Eqz, uint32_t, I32, int32_t, I32, val == 0 ? 1 : 0) \
V(I64Clz, uint64_t, I64, uint64_t, I64, base::bits::CountLeadingZeros(val)) \
V(I64Ctz, uint64_t, I64, uint64_t, I64, base::bits::CountTrailingZeros(val)) \
V(I64Popcnt, uint64_t, I64, uint64_t, I64, base::bits::CountPopulation(val)) \
V(I64Eqz, uint64_t, I64, int32_t, I32, val == 0 ? 1 : 0)

Definition at line 2654 of file wasm-interpreter.cc.

◆ FOREACH_COMPARISON_BINOP

#define FOREACH_COMPARISON_BINOP ( V)

Definition at line 2196 of file wasm-interpreter.cc.

◆ FOREACH_CONVERT_UNOP

#define FOREACH_CONVERT_UNOP ( V)
Value:
FOREACH_I32_CONVERT_FROM_FLOAT_UNOP(V) \
FOREACH_OTHER_CONVERT_UNOP(V)
#define FOREACH_I64_CONVERT_FROM_FLOAT_UNOP(V)

Definition at line 2457 of file wasm-interpreter.cc.

◆ FOREACH_EXTENSION_UNOP

#define FOREACH_EXTENSION_UNOP ( V)
Value:
V(I32SExtendI8, int8_t, I32, int32_t, I32) \
V(I32SExtendI16, int16_t, I32, int32_t, I32) \
V(I64SExtendI8, int8_t, I64, int64_t, I64) \
V(I64SExtendI16, int16_t, I64, int64_t, I64) \
V(I64SExtendI32, int32_t, I64, int64_t, I64)

Definition at line 2702 of file wasm-interpreter.cc.

◆ FOREACH_I32_CONVERT_FROM_FLOAT_UNOP

#define FOREACH_I32_CONVERT_FROM_FLOAT_UNOP ( V)
Value:
V(I32SConvertF32, float, F32, fp0, int32_t, I32, r0) \
V(I32UConvertF32, float, F32, fp0, uint32_t, I32, r0) \
V(I32SConvertF64, double, F64, fp0, int32_t, I32, r0) \
V(I32UConvertF64, double, F64, fp0, uint32_t, I32, r0)

Definition at line 2437 of file wasm-interpreter.cc.

◆ FOREACH_I64_CONVERT_FROM_FLOAT_UNOP

#define FOREACH_I64_CONVERT_FROM_FLOAT_UNOP ( V)
Value:
V(I64SConvertF32, float, F32, fp0, int64_t, I64, r0) \
V(I64SConvertF64, double, F64, fp0, int64_t, I64, r0) \
V(I64UConvertF32, float, F32, fp0, uint64_t, I64, r0) \
V(I64UConvertF64, double, F64, fp0, uint64_t, I64, r0)

Definition at line 2431 of file wasm-interpreter.cc.

◆ FOREACH_MORE_BINOP

#define FOREACH_MORE_BINOP ( V)

Definition at line 2272 of file wasm-interpreter.cc.

◆ FOREACH_OTHER_CONVERT_UNOP

#define FOREACH_OTHER_CONVERT_UNOP ( V)
Value:
V(I64SConvertI32, int32_t, I32, r0, int64_t, I64, r0) \
V(I64UConvertI32, uint32_t, I32, r0, uint64_t, I64, r0) \
V(F32SConvertI32, int32_t, I32, r0, float, F32, fp0) \
V(F32UConvertI32, uint32_t, I32, r0, float, F32, fp0) \
V(F32SConvertI64, int64_t, I64, r0, float, F32, fp0) \
V(F32UConvertI64, uint64_t, I64, r0, float, F32, fp0) \
V(F32ConvertF64, double, F64, fp0, float, F32, fp0) \
V(F64SConvertI32, int32_t, I32, r0, double, F64, fp0) \
V(F64UConvertI32, uint32_t, I32, r0, double, F64, fp0) \
V(F64SConvertI64, int64_t, I64, r0, double, F64, fp0) \
V(F64UConvertI64, uint64_t, I64, r0, double, F64, fp0) \
V(F64ConvertF32, float, F32, fp0, double, F64, fp0)

Definition at line 2443 of file wasm-interpreter.cc.

◆ FOREACH_REINTERPRET_UNOP

#define FOREACH_REINTERPRET_UNOP ( V)
Value:
V(F32ReinterpretI32, int32_t, I32, r0, float, F32, fp0) \
V(F64ReinterpretI64, int64_t, I64, r0, double, F64, fp0) \
V(I32ReinterpretF32, float, F32, fp0, int32_t, I32, r0) \
V(I64ReinterpretF64, double, F64, fp0, int64_t, I64, r0)

Definition at line 2603 of file wasm-interpreter.cc.

◆ FOREACH_REM_BINOP

#define FOREACH_REM_BINOP ( V)
Value:
V(I32RemS, int32_t, r0, ExecuteRemS, I32) \
V(I64RemS, int64_t, r0, ExecuteRemS, I64) \
V(I32RemU, uint32_t, r0, ExecuteRemU, I32) \
V(I64RemU, uint64_t, r0, ExecuteRemU, I64)

Definition at line 2009 of file wasm-interpreter.cc.

◆ FOREACH_SIGNED_DIV_BINOP

#define FOREACH_SIGNED_DIV_BINOP ( V)
Value:
V(I32DivS, int32_t, r0, /, I32) \
V(I64DivS, int64_t, r0, /, I64)

Definition at line 2001 of file wasm-interpreter.cc.

◆ FOREACH_SIMPLE_UNOP

#define FOREACH_SIMPLE_UNOP ( V)
Value:
V(F32Abs, float, fp0, abs(val), F32) \
V(F32Neg, float, fp0, -val, F32) \
V(F32Ceil, float, fp0, ceilf(val), F32) \
V(F32Floor, float, fp0, floorf(val), F32) \
V(F32Trunc, float, fp0, truncf(val), F32) \
V(F32NearestInt, float, fp0, nearbyintf(val), F32) \
V(F32Sqrt, float, fp0, sqrt(val), F32) \
V(F64Abs, double, fp0, abs(val), F64) \
V(F64Neg, double, fp0, (-val), F64) \
V(F64Ceil, double, fp0, ceil(val), F64) \
V(F64Floor, double, fp0, floor(val), F64) \
V(F64Trunc, double, fp0, trunc(val), F64) \
V(F64NearestInt, double, fp0, nearbyint(val), F64) \
V(F64Sqrt, double, fp0, sqrt(val), F64)

Definition at line 2348 of file wasm-interpreter.cc.

◆ FOREACH_TRAPPING_BINOP

#define FOREACH_TRAPPING_BINOP ( V)
Value:
FOREACH_UNSIGNED_DIV_BINOP(V) \
FOREACH_REM_BINOP(V)
#define FOREACH_SIGNED_DIV_BINOP(V)

Definition at line 2015 of file wasm-interpreter.cc.

◆ FOREACH_TRUNCSAT_UNOP

#define FOREACH_TRUNCSAT_UNOP ( V)
Value:
V(I32SConvertSatF32, float, F32, fp0, int32_t, I32, r0) \
V(I32UConvertSatF32, float, F32, fp0, uint32_t, I32, r0) \
V(I32SConvertSatF64, double, F64, fp0, int32_t, I32, r0) \
V(I32UConvertSatF64, double, F64, fp0, uint32_t, I32, r0) \
V(I64SConvertSatF32, float, F32, fp0, int64_t, I64, r0) \
V(I64UConvertSatF32, float, F32, fp0, uint64_t, I64, r0) \
V(I64SConvertSatF64, double, F64, fp0, int64_t, I64, r0) \
V(I64UConvertSatF64, double, F64, fp0, uint64_t, I64, r0)

Definition at line 2749 of file wasm-interpreter.cc.

◆ FOREACH_UNSIGNED_DIV_BINOP

#define FOREACH_UNSIGNED_DIV_BINOP ( V)
Value:
V(I32DivU, uint32_t, r0, /, I32) \
V(I64DivU, uint64_t, r0, /, I64)

Definition at line 2005 of file wasm-interpreter.cc.

◆ INLINED_TRAP

#define INLINED_TRAP ( trap_reason)
Value:
wasm_runtime->SetTrap(trap_reason, code); \
MUSTTAIL return s_unwind_func_addr(code, sp, wasm_runtime, trap_reason, .0);
#define MUSTTAIL

Definition at line 782 of file wasm-interpreter.cc.

◆ ITEM_ENUM_DEFINE

#define ITEM_ENUM_DEFINE ( name)
Value:
name##counter,

Definition at line 540 of file wasm-interpreter.cc.

◆ LANE

#define LANE ( i,
type )
Value:
(i)

Definition at line 4588 of file wasm-interpreter.cc.

◆ LOAD_CASE [1/3]

#define LOAD_CASE ( name,
ctype,
mtype,
rep,
type )
Value:
case kExpr##name: { \
MemoryAccessImmediate imm( \
&decoder, wasm_code_->at(pc + 1), sizeof(ctype), \
Decoder::kNoValidation); \
len = 1 + imm.length; \
optional.offset = imm.offset; \
break; \
}

◆ LOAD_CASE [2/3]

#define LOAD_CASE ( name,
ctype,
mtype,
rep,
type )
Value:
case kExpr##name: { \
switch (mode) { \
case kR2R: \
EMIT_MEM64_INSTR_HANDLER_WITH_PC(r2r_##name, r2r_##name##_Idx64, \
is_memory64_, instr.pc); \
EmitMemoryOffset(instr.optional.offset); \
return RegMode::k##type##Reg; \
case kR2S: \
EMIT_MEM64_INSTR_HANDLER_WITH_PC(r2s_##name, r2s_##name##_Idx64, \
is_memory64_, instr.pc); \
EmitMemoryOffset(instr.optional.offset); \
type##Push(); \
return RegMode::kNoReg; \
case kS2R: \
EMIT_MEM64_INSTR_HANDLER_WITH_PC(s2r_##name, s2r_##name##_Idx64, \
is_memory64_, instr.pc); \
EmitMemoryOffset(instr.optional.offset); \
MemIndexPop(); \
return RegMode::k##type##Reg; \
case kS2S: \
EMIT_MEM64_INSTR_HANDLER_WITH_PC(s2s_##name, s2s_##name##_Idx64, \
is_memory64_, instr.pc); \
EmitMemoryOffset(instr.optional.offset); \
MemIndexPop(); \
type##Push(); \
return RegMode::kNoReg; \
} \
break; \
}

◆ LOAD_CASE [3/3]

#define LOAD_CASE ( name,
ctype,
mtype,
rep,
type )
Value:
case kExpr##name: { \
if (reg_mode == RegMode::kNoReg) { \
EMIT_MEM64_INSTR_HANDLER_WITH_PC(s2s_##name##_LocalSet, \
s2s_##name##_LocalSet_Idx64, \
is_memory64_, curr_instr.pc); \
EmitMemoryOffset(curr_instr.optional.offset); \
MemIndexPop(); \
EmitSlotOffset(slots_[stack_[to_stack_index]].slot_offset); \
reg_mode = RegMode::kNoReg; \
} else { \
EMIT_MEM64_INSTR_HANDLER_WITH_PC(r2s_##name, r2s_##name##_Idx64, \
is_memory64_, curr_instr.pc); \
EmitMemoryOffset(static_cast<uint64_t>(curr_instr.optional.offset)); \
EmitSlotOffset(slots_[stack_[to_stack_index]].slot_offset); \
reg_mode = RegMode::kNoReg; \
} \
return true; \
}

◆ LOAD_EXTEND_CASE

#define LOAD_EXTEND_CASE ( op)
Value:
case kExprS128##op: { \
EMIT_MEM64_INSTR_HANDLER_WITH_PC( \
s2s_SimdS128##op, s2s_SimdS128##op##_Idx64, is_memory64_, instr.pc); \
EmitMemoryOffset(instr.optional.offset); \
MemIndexPop(); \
S128Push(); \
return RegMode::kNoReg; \
}

◆ LOAD_LANE_CASE

#define LOAD_LANE_CASE ( op)
Value:
case kExprS128##op: { \
EMIT_MEM64_INSTR_HANDLER_WITH_PC( \
s2s_SimdS128##op, s2s_SimdS128##op##_Idx64, is_memory64_, instr.pc); \
S128Pop(); \
EmitMemoryOffset(instr.optional.simd_loadstore_lane.offset); \
MemIndexPop(); \
/* emit 8 bits ? */ \
EmitI16Const(instr.optional.simd_loadstore_lane.lane); \
S128Push(); \
return RegMode::kNoReg; \
}

◆ LOAD_SPLAT_CASE

#define LOAD_SPLAT_CASE ( op)
Value:
case kExprS128##op: { \
EMIT_MEM64_INSTR_HANDLER_WITH_PC( \
s2s_SimdS128##op, s2s_SimdS128##op##_Idx64, is_memory64_, instr.pc); \
EmitMemoryOffset(instr.optional.offset); \
MemIndexPop(); \
S128Push(); \
return RegMode::kNoReg; \
}

◆ LOAD_ZERO_EXTEND_CASE

#define LOAD_ZERO_EXTEND_CASE ( op,
load_type )
Value:
case kExprS128##op: { \
EMIT_MEM64_INSTR_HANDLER_WITH_PC( \
s2s_SimdS128##op, s2s_SimdS128##op##_Idx64, is_memory64_, instr.pc); \
EmitMemoryOffset(instr.optional.offset); \
MemIndexPop(); \
S128Push(); \
return RegMode::kNoReg; \
}

◆ NextOp

#define NextOp ( )
Value:
MUSTTAIL return kInstructionTable[ReadFnId(code) & kInstructionTableMask]( \
code, sp, wasm_runtime, r0, fp0)
Handle< Code > code

Definition at line 740 of file wasm-interpreter.cc.

◆ PACK_CASE [1/2]

#define PACK_CASE ( op,
src_type,
name,
dst_type,
count,
dst_ctype )
Value:
INSTRUCTION_HANDLER_FUNC s2s_Simd##op(const uint8_t* code, uint32_t* sp, \
WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
src_type s2 = pop<Simd128>(sp, code, wasm_runtime).to_##name(); \
src_type s1 = pop<Simd128>(sp, code, wasm_runtime).to_##name(); \
dst_type res; \
for (size_t i = 0; i < count; ++i) { \
int64_t v = i < count / 2 ? s1.val[LANE(i, s1)] \
: s2.val[LANE(i - count / 2, s2)]; \
res.val[LANE(i, res)] = base::saturated_cast<dst_ctype>(v); \
} \
push<Simd128>(sp, code, wasm_runtime, Simd128(res)); \
NextOp(); \
}

◆ PACK_CASE [2/2]

#define PACK_CASE ( op,
src_type,
name,
dst_type,
count,
dst_ctype )
Value:
case kExpr##op: { \
EMIT_INSTR_HANDLER(s2s_Simd##op); \
S128Pop(); \
S128Pop(); \
S128Push(); \
return RegMode::kNoReg; \
}

◆ QFM_CASE [1/2]

#define QFM_CASE ( op,
name,
stype,
count,
operation )
Value:
INSTRUCTION_HANDLER_FUNC s2s_Simd##op(const uint8_t* code, uint32_t* sp, \
WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
stype c = pop<Simd128>(sp, code, wasm_runtime).to_##name(); \
stype b = pop<Simd128>(sp, code, wasm_runtime).to_##name(); \
stype a = pop<Simd128>(sp, code, wasm_runtime).to_##name(); \
stype res; \
for (size_t i = 0; i < count; i++) { \
res.val[LANE(i, res)] = \
operation(a.val[LANE(i, a)] * b.val[LANE(i, b)]) + \
c.val[LANE(i, c)]; \
} \
push<Simd128>(sp, code, wasm_runtime, Simd128(res)); \
NextOp(); \
}

Definition at line 5258 of file wasm-interpreter.cc.

◆ QFM_CASE [2/2]

#define QFM_CASE ( op,
name,
stype,
count,
operation )
Value:
case kExpr##op: { \
EMIT_INSTR_HANDLER(s2s_Simd##op); \
S128Pop(); \
S128Pop(); \
S128Pop(); \
S128Push(); \
return RegMode::kNoReg; \
}

Definition at line 5258 of file wasm-interpreter.cc.

◆ REDUCTION_CASE [1/2]

#define REDUCTION_CASE ( op,
name,
stype,
count )
Value:
INSTRUCTION_HANDLER_FUNC s2s_Simd##op(const uint8_t* code, uint32_t* sp, \
WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
stype s = pop<Simd128>(sp, code, wasm_runtime).to_##name(); \
bool res = true; \
for (size_t i = 0; i < count; ++i) { \
res = res & static_cast<bool>(s.val[LANE(i, s)]); \
} \
push<int32_t>(sp, code, wasm_runtime, res); \
NextOp(); \
}

Definition at line 5240 of file wasm-interpreter.cc.

◆ REDUCTION_CASE [2/2]

#define REDUCTION_CASE ( op,
name,
stype,
count,
operation )
Value:
case kExpr##op: { \
EMIT_INSTR_HANDLER(s2s_Simd##op); \
S128Pop(); \
I32Push(); \
return RegMode::kNoReg; \
}

Definition at line 5240 of file wasm-interpreter.cc.

◆ REPLACE_LANE_CASE [1/2]

#define REPLACE_LANE_CASE ( format,
name,
stype,
ctype,
op_type )
Value:
INSTRUCTION_HANDLER_FUNC s2s_Simd##format##ReplaceLane( \
const uint8_t* code, uint32_t* sp, WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
uint16_t lane = Read<int16_t>(code); \
DCHECK_LT(lane, 16); \
ctype new_val = pop<ctype>(sp, code, wasm_runtime); \
Simd128 simd_val = pop<Simd128>(sp, code, wasm_runtime); \
stype s = simd_val.to_##name(); \
s.val[LANE(lane, s)] = new_val; \
push<Simd128>(sp, code, wasm_runtime, Simd128(s)); \
NextOp(); \
}

◆ REPLACE_LANE_CASE [2/2]

#define REPLACE_LANE_CASE ( format,
name,
stype,
ctype,
op_type )
Value:
case kExpr##format##ReplaceLane: { \
EMIT_INSTR_HANDLER(s2s_Simd##format##ReplaceLane); \
/* emit 8 bits ? */ \
EmitI16Const(instr.optional.simd_lane); \
op_type##Pop(); \
S128Pop(); \
S128Push(); \
return RegMode::kNoReg; \
}

◆ SELECT_CASE

#define SELECT_CASE ( op)
Value:
case kExpr##op: { \
EMIT_INSTR_HANDLER(s2s_Simd##op); \
S128Pop(); \
S128Pop(); \
S128Pop(); \
S128Push(); \
return RegMode::kNoReg; \
}

◆ SHIFT_CASE [1/2]

#define SHIFT_CASE ( op,
name,
stype,
count,
expr )
Value:
INSTRUCTION_HANDLER_FUNC s2s_Simd##op(const uint8_t* code, uint32_t* sp, \
WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
uint32_t shift = pop<uint32_t>(sp, code, wasm_runtime); \
stype s = pop<Simd128>(sp, code, wasm_runtime).to_##name(); \
stype res; \
for (size_t i = 0; i < count; ++i) { \
auto a = s.val[LANE(i, s)]; \
res.val[LANE(i, res)] = expr; \
} \
push<Simd128>(sp, code, wasm_runtime, Simd128(res)); \
NextOp(); \
}

Definition at line 4960 of file wasm-interpreter.cc.

◆ SHIFT_CASE [2/2]

#define SHIFT_CASE ( op,
name,
stype,
count,
expr )
Value:
case kExpr##op: { \
EMIT_INSTR_HANDLER(s2s_Simd##op); \
I32Pop(); \
S128Pop(); \
S128Push(); \
return RegMode::kNoReg; \
}

Definition at line 4960 of file wasm-interpreter.cc.

◆ SPLAT_CASE [1/2]

#define SPLAT_CASE ( format,
stype,
valType,
op_type,
num )
Value:
INSTRUCTION_HANDLER_FUNC s2s_Simd##format##Splat( \
const uint8_t* code, uint32_t* sp, WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
valType v = pop<valType>(sp, code, wasm_runtime); \
stype s; \
for (int i = 0; i < num; i++) s.val[i] = v; \
push<Simd128>(sp, code, wasm_runtime, Simd128(s)); \
NextOp(); \
}
int s
Definition mul-fft.cc:297

Definition at line 4591 of file wasm-interpreter.cc.

◆ SPLAT_CASE [2/2]

#define SPLAT_CASE ( format,
stype,
valType,
op_type,
num )
Value:
case kExpr##format##Splat: { \
EMIT_INSTR_HANDLER(s2s_Simd##format##Splat); \
op_type##Pop(); \
S128Push(); \
return RegMode::kNoReg; \
}

Definition at line 4591 of file wasm-interpreter.cc.

◆ START_EMIT_INSTR_HANDLER

#define START_EMIT_INSTR_HANDLER ( )
Value:
{ \
size_t _current_code_offset = code_.size(); \
size_t _current_slots_size = slots_.size(); \
DCHECK(!no_nested_emit_instr_handler_guard_); \
no_nested_emit_instr_handler_guard_ = true; \
stack_.clear_history(); \
if (v8_flags.drumbrake_compact_bytecode) { \
handler_size_ = InstrHandlerSize::Small; \
} else { \
DCHECK_EQ(handler_size_, InstrHandlerSize::Large); \
} \
while (true) { \
current_instr_encoding_failed_ = false;

Definition at line 35 of file wasm-interpreter.cc.

◆ START_EMIT_INSTR_HANDLER_WITH_ID

#define START_EMIT_INSTR_HANDLER_WITH_ID ( name)
Value:
EMIT_INSTR_HANDLER(name)
#define START_EMIT_INSTR_HANDLER()

Definition at line 50 of file wasm-interpreter.cc.

◆ START_EMIT_INSTR_HANDLER_WITH_PC

#define START_EMIT_INSTR_HANDLER_WITH_PC ( name,
pc )
Value:
EMIT_INSTR_HANDLER_WITH_PC(name, pc)

Definition at line 54 of file wasm-interpreter.cc.

◆ STORE_CASE [1/3]

#define STORE_CASE ( name,
ctype,
mtype,
rep,
type )
Value:
case kExpr##name: { \
MemoryAccessImmediate imm( \
&decoder, wasm_code_->at(pc + 1), sizeof(ctype), \
Decoder::kNoValidation); \
len = 1 + imm.length; \
optional.offset = imm.offset; \
break; \
}

◆ STORE_CASE [2/3]

#define STORE_CASE ( name,
ctype,
mtype,
rep,
type )
Value:
case kExpr##name: { \
switch (mode) { \
case kR2R: \
case kS2R: \
UNREACHABLE(); \
break; \
case kR2S: \
EMIT_MEM64_INSTR_HANDLER_WITH_PC(r2s_##name, r2s_##name##_Idx64, \
is_memory64_, instr.pc); \
EmitMemoryOffset(instr.optional.offset); \
MemIndexPop(); \
return RegMode::kNoReg; \
case kS2S: \
EMIT_MEM64_INSTR_HANDLER_WITH_PC(s2s_##name, s2s_##name##_Idx64, \
is_memory64_, instr.pc); \
type##Pop(); \
EmitMemoryOffset(instr.optional.offset); \
MemIndexPop(); \
return RegMode::kNoReg; \
} \
break; \
}

◆ STORE_CASE [3/3]

#define STORE_CASE ( name,
ctype,
mtype,
rep,
type )
Value:
case kExpr##name: { \
EMIT_MEM64_INSTR_HANDLER_WITH_PC(s2s_##name, s2s_##name##_Idx64, \
is_memory64_, curr_instr.pc); \
EmitSlotOffset(slots_[stack_[curr_instr.optional.index]].slot_offset); \
EmitMemoryOffset(next_instr.optional.offset); \
MemIndexPop(); \
reg_mode = RegMode::kNoReg; \
return true; \
}

◆ STORE_LANE_CASE

#define STORE_LANE_CASE ( op)
Value:
case kExprS128##op: { \
EMIT_MEM64_INSTR_HANDLER_WITH_PC( \
s2s_SimdS128##op, s2s_SimdS128##op##_Idx64, is_memory64_, instr.pc); \
S128Pop(); \
EmitMemoryOffset(instr.optional.simd_loadstore_lane.offset); \
MemIndexPop(); \
/* emit 8 bits ? */ \
EmitI16Const(instr.optional.simd_loadstore_lane.lane); \
return RegMode::kNoReg; \
}

◆ TRAP

#define TRAP ( trap_reason)
Value:
MUSTTAIL return HandlersBase::Trap(code, sp, wasm_runtime, trap_reason, fp0);

Definition at line 779 of file wasm-interpreter.cc.

◆ UNOP_CASE [1/2]

#define UNOP_CASE ( op,
name,
stype,
count,
expr )
Value:
INSTRUCTION_HANDLER_FUNC s2s_Simd##op(const uint8_t* code, uint32_t* sp, \
WasmInterpreterRuntime* wasm_runtime, \
int64_t r0, double fp0) { \
stype s = pop<Simd128>(sp, code, wasm_runtime).to_##name(); \
stype res; \
for (size_t i = 0; i < count; ++i) { \
auto a = s.val[LANE(i, s)]; \
res.val[LANE(i, res)] = expr; \
} \
push<Simd128>(sp, code, wasm_runtime, Simd128(res)); \
NextOp(); \
}

◆ UNOP_CASE [2/2]

#define UNOP_CASE ( op,
name,
stype,
count,
expr )
Value:
case kExpr##op: { \
EMIT_INSTR_HANDLER(s2s_Simd##op); \
S128Pop(); \
S128Push(); \
return RegMode::kNoReg; \
}

◆ V [1/6]

#define V ( _)
Value:
nullptr,

◆ V [2/6]

#define V ( _)
Value:
nullptr,

◆ V [3/6]

#define V ( name)
Value:
if (v8_flags.drumbrake_compact_bytecode) { \
trap_handler::RegisterHandlerData( \
reinterpret_cast<Address>(kInstructionTable[k_##name]), \
embedded_data.InstructionSizeOf(Builtin::k##name##_s), 0, nullptr); \
} \
trap_handler::RegisterHandlerData( \
reinterpret_cast<Address>( \
kInstructionTable[k_##name + kInstructionCount]), \
embedded_data.InstructionSizeOf(Builtin::k##name##_l), 0, nullptr);

◆ V [4/6]

#define V ( name)
Value:
if (v8_flags.drumbrake_compact_bytecode) { \
kInstructionTable[index] = reinterpret_cast<PWasmOp*>( \
isolate->builtins()->code(Builtin::k##name##_s)->instruction_start()); \
} \
kInstructionTable[kInstructionCount + index++] = reinterpret_cast<PWasmOp*>( \
isolate->builtins()->code(Builtin::k##name##_l)->instruction_start());
OptionalOpIndex index

◆ V [5/6]

#define V ( name)
Value:
Handlers<true>::name,

◆ V [6/6]

#define V ( name)
Value:
Handlers<false>::name,