Bug 1229399: Group all IR's enums into a single one; r=luke

--HG--
extra : commitid : 7JRmnRSb2CE
extra : rebase_source : 25da0893a4dd499484adfc7ad77b4614e6a5d5f0
This commit is contained in:
Benjamin Bouvier 2016-01-08 15:22:20 +01:00
parent e3de02b1b4
commit 1e4108d6ec
3 changed files with 806 additions and 832 deletions

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,7 @@ class PropertyName;
namespace wasm { namespace wasm {
enum class Stmt : uint8_t enum class Expr : uint8_t
{ {
Ret, Ret,
@ -57,8 +57,6 @@ enum class Stmt : uint8_t
AtomicsFence, AtomicsFence,
// asm.js specific
// Expression statements (to be removed in the future)
I32Expr, I32Expr,
F32Expr, F32Expr,
F64Expr, F64Expr,
@ -66,354 +64,334 @@ enum class Stmt : uint8_t
F32X4Expr, F32X4Expr,
B32X4Expr, B32X4Expr,
// asm.js specific
Id, Id,
Noop, Noop,
InterruptCheckHead, InterruptCheckHead,
InterruptCheckLoop, InterruptCheckLoop,
DebugCheckPoint, DebugCheckPoint,
Bad,
Bad // I32 opcodes
}; I32GetLocal,
I32SetLocal,
I32GetGlobal,
I32SetGlobal,
enum class I32 : uint8_t I32CallInternal,
{ I32CallIndirect,
// Common opcodes I32CallImport,
GetLocal,
SetLocal,
GetGlobal,
SetGlobal,
CallInternal, I32Conditional,
CallIndirect, I32Comma,
CallImport,
Conditional, I32Literal,
Comma,
Literal,
// Binary arith opcodes // Binary arith opcodes
Add, I32Add,
Sub, I32Sub,
Mul, I32Mul,
SDiv, I32SDiv,
SMod, I32SMod,
UDiv, I32UDiv,
UMod, I32UMod,
Min, I32Min,
Max, I32Max,
// Unary arith opcodes // Unary arith opcodes
Not, I32Not,
Neg, I32Neg,
// Bitwise opcodes // Bitwise opcodes
BitOr, I32BitOr,
BitAnd, I32BitAnd,
BitXor, I32BitXor,
BitNot, I32BitNot,
Lsh, I32Lsh,
ArithRsh, I32ArithRsh,
LogicRsh, I32LogicRsh,
// Conversion opcodes // Conversion opcodes
FromF32, I32FromF32,
FromF64, I32FromF64,
// Math builtin opcodes // Math builtin opcodes
Clz, I32Clz,
Abs, I32Abs,
// Comparison opcodes // Comparison opcodes
// Ordering matters (EmitComparison expects signed opcodes to be placed // Ordering matters (EmitComparison expects signed opcodes to be placed
// before unsigned opcodes) // before unsigned opcodes)
EqI32, I32EqI32,
NeI32, I32NeI32,
SLtI32, I32SLtI32,
SLeI32, I32SLeI32,
SGtI32, I32SGtI32,
SGeI32, I32SGeI32,
ULtI32, I32ULtI32,
ULeI32, I32ULeI32,
UGtI32, I32UGtI32,
UGeI32, I32UGeI32,
EqF32, I32EqF32,
NeF32, I32NeF32,
LtF32, I32LtF32,
LeF32, I32LeF32,
GtF32, I32GtF32,
GeF32, I32GeF32,
EqF64, I32EqF64,
NeF64, I32NeF64,
LtF64, I32LtF64,
LeF64, I32LeF64,
GtF64, I32GtF64,
GeF64, I32GeF64,
// Heap accesses opcodes // Heap accesses opcodes
SLoad8, I32SLoad8,
SLoad16, I32SLoad16,
SLoad32, I32SLoad32,
ULoad8, I32ULoad8,
ULoad16, I32ULoad16,
ULoad32, I32ULoad32,
Store8, I32Store8,
Store16, I32Store16,
Store32, I32Store32,
// Atomics opcodes // Atomics opcodes
AtomicsCompareExchange, I32AtomicsCompareExchange,
AtomicsExchange, I32AtomicsExchange,
AtomicsLoad, I32AtomicsLoad,
AtomicsStore, I32AtomicsStore,
AtomicsBinOp, I32AtomicsBinOp,
// SIMD opcodes // SIMD opcodes
I32X4ExtractLane, I32I32X4ExtractLane,
B32X4ExtractLane, I32B32X4ExtractLane,
B32X4AllTrue, I32B32X4AllTrue,
B32X4AnyTrue, I32B32X4AnyTrue,
// Specific to AsmJS // Specific to AsmJS
Id, I32Id,
Bad // F32 opcdoes
};
enum class F32 : uint8_t
{
// Common opcodes // Common opcodes
GetLocal, F32GetLocal,
SetLocal, F32SetLocal,
GetGlobal, F32GetGlobal,
SetGlobal, F32SetGlobal,
CallInternal, F32CallInternal,
CallIndirect, F32CallIndirect,
CallImport, F32CallImport,
Conditional, F32Conditional,
Comma, F32Comma,
Literal, F32Literal,
// Binary arith opcodes // Binary arith opcodes
Add, F32Add,
Sub, F32Sub,
Mul, F32Mul,
Div, F32Div,
Min, F32Min,
Max, F32Max,
Neg, F32Neg,
// Math builtin opcodes // Math builtin opcodes
Abs, F32Abs,
Sqrt, F32Sqrt,
Ceil, F32Ceil,
Floor, F32Floor,
// Conversion opcodes // Conversion opcodes
FromF64, F32FromF64,
FromS32, F32FromS32,
FromU32, F32FromU32,
// Heap accesses opcodes // Heap accesses opcodes
Load, F32Load,
StoreF32, F32StoreF32,
StoreF64, F32StoreF64,
// SIMD opcodes // SIMD opcodes
F32X4ExtractLane, F32F32X4ExtractLane,
// asm.js specific // asm.js specific
Id, F32Id,
Bad
};
enum class F64 : uint8_t // F64 opcodes
{
// Common opcodes // Common opcodes
GetLocal, F64GetLocal,
SetLocal, F64SetLocal,
GetGlobal, F64GetGlobal,
SetGlobal, F64SetGlobal,
CallInternal, F64CallInternal,
CallIndirect, F64CallIndirect,
CallImport, F64CallImport,
Conditional, F64Conditional,
Comma, F64Comma,
Literal, F64Literal,
// Binary arith opcodes // Binary arith opcodes
Add, F64Add,
Sub, F64Sub,
Mul, F64Mul,
Div, F64Div,
Min, F64Min,
Max, F64Max,
Mod, F64Mod,
Neg, F64Neg,
// Math builtin opcodes // Math builtin opcodes
Abs, F64Abs,
Sqrt, F64Sqrt,
Ceil, F64Ceil,
Floor, F64Floor,
Sin, F64Sin,
Cos, F64Cos,
Tan, F64Tan,
Asin, F64Asin,
Acos, F64Acos,
Atan, F64Atan,
Exp, F64Exp,
Log, F64Log,
Pow, F64Pow,
Atan2, F64Atan2,
// Conversions opcodes // Conversions opcodes
FromF32, F64FromF32,
FromS32, F64FromS32,
FromU32, F64FromU32,
// Heap accesses opcodes // Heap accesses opcodes
Load, F64Load,
StoreF32, F64StoreF32,
StoreF64, F64StoreF64,
// asm.js specific // asm.js specific
Id, F64Id,
Bad
};
enum class I32X4 : uint8_t // I32X4 opcodes
{
// Common opcodes // Common opcodes
GetLocal, I32X4GetLocal,
SetLocal, I32X4SetLocal,
GetGlobal, I32X4GetGlobal,
SetGlobal, I32X4SetGlobal,
CallInternal, I32X4CallInternal,
CallIndirect, I32X4CallIndirect,
CallImport, I32X4CallImport,
Conditional, I32X4Conditional,
Comma, I32X4Comma,
Literal, I32X4Literal,
// Specific opcodes // Specific opcodes
Ctor, I32X4Ctor,
Unary, I32X4Unary,
Binary, I32X4Binary,
BinaryBitwise, I32X4BinaryBitwise,
BinaryShift, I32X4BinaryShift,
ReplaceLane, I32X4ReplaceLane,
FromF32X4, I32X4FromF32X4,
FromF32X4Bits, I32X4FromF32X4Bits,
Swizzle, I32X4Swizzle,
Shuffle, I32X4Shuffle,
Select, I32X4Select,
Splat, I32X4Splat,
Load, I32X4Load,
Store, I32X4Store,
// asm.js specific // asm.js specific
Id, I32X4Id,
Bad
};
enum class F32X4 : uint8_t // F32X4 opcodes
{
// Common opcodes // Common opcodes
GetLocal, F32X4GetLocal,
SetLocal, F32X4SetLocal,
GetGlobal, F32X4GetGlobal,
SetGlobal, F32X4SetGlobal,
CallInternal, F32X4CallInternal,
CallIndirect, F32X4CallIndirect,
CallImport, F32X4CallImport,
Conditional, F32X4Conditional,
Comma, F32X4Comma,
Literal, F32X4Literal,
// Specific opcodes // Specific opcodes
Ctor, F32X4Ctor,
Unary, F32X4Unary,
Binary, F32X4Binary,
ReplaceLane, F32X4ReplaceLane,
FromI32X4, F32X4FromI32X4,
FromI32X4Bits, F32X4FromI32X4Bits,
Swizzle, F32X4Swizzle,
Shuffle, F32X4Shuffle,
Select, F32X4Select,
Splat, F32X4Splat,
Load, F32X4Load,
Store, F32X4Store,
// asm.js specific // asm.js specific
Id, F32X4Id,
Bad
};
enum class B32X4 : uint8_t // B32X4 opcodes
{
// Common opcodes // Common opcodes
GetLocal, B32X4GetLocal,
SetLocal, B32X4SetLocal,
GetGlobal, B32X4GetGlobal,
SetGlobal, B32X4SetGlobal,
CallInternal, B32X4CallInternal,
CallIndirect, B32X4CallIndirect,
CallImport, B32X4CallImport,
Conditional, B32X4Conditional,
Comma, B32X4Comma,
Literal, B32X4Literal,
// Specific opcodes // Specific opcodes
Ctor, B32X4Ctor,
Unary, B32X4Unary,
Binary, B32X4Binary,
BinaryCompI32X4, B32X4BinaryCompI32X4,
BinaryCompF32X4, B32X4BinaryCompF32X4,
BinaryBitwise, B32X4BinaryBitwise,
ReplaceLane, B32X4ReplaceLane,
Splat, B32X4Splat,
// asm.js specific // asm.js specific
Id, B32X4Id
Bad
}; };
enum NeedsBoundsCheck : uint8_t enum NeedsBoundsCheck : uint8_t
@ -501,7 +479,7 @@ class Encoder
bool pcIsPatchable(size_t pc, unsigned size) const { bool pcIsPatchable(size_t pc, unsigned size) const {
bool patchable = true; bool patchable = true;
for (unsigned i = 0; patchable && i < size; i++) for (unsigned i = 0; patchable && i < size; i++)
patchable &= Stmt((*bytecode_)[pc]) == Stmt::Bad; patchable &= Expr((*bytecode_)[pc]) == Expr::Bad;
return patchable; return patchable;
} }
#endif #endif

File diff suppressed because it is too large Load Diff