Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1857)

Unified Diff: test/mjsunit/wasm/wasm-constants.js

Issue 2440953002: [wasm] Binary 0xD: update encoding of opcodes, types, and add immediates. (Closed)
Patch Set: Fix imported table kind. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/wasm/trap-location.js ('k') | test/unittests/wasm/ast-decoder-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/wasm-constants.js
diff --git a/test/mjsunit/wasm/wasm-constants.js b/test/mjsunit/wasm/wasm-constants.js
index e4febc1e63f2a4e7296c3577166dc8b11c512ae9..b053c68b7a7cf511f3509c7c22d697d6d6c09442 100644
--- a/test/mjsunit/wasm/wasm-constants.js
+++ b/test/mjsunit/wasm/wasm-constants.js
@@ -21,7 +21,7 @@ var kWasmH1 = 0x61;
var kWasmH2 = 0x73;
var kWasmH3 = 0x6d;
-var kWasmV0 = 0xC;
+var kWasmV0 = 0xD;
var kWasmV1 = 0;
var kWasmV2 = 0;
var kWasmV3 = 0;
@@ -48,68 +48,71 @@ function bytesWithHeader() {
return buffer;
}
-var kDeclNoLocals = 0;
+let kDeclNoLocals = 0;
// Section declaration constants
-var kUnknownSectionCode = 0;
-var kTypeSectionCode = 1; // Function signature declarations
-var kImportSectionCode = 2; // Import declarations
-var kFunctionSectionCode = 3; // Function declarations
-var kTableSectionCode = 4; // Indirect function table and other tables
-var kMemorySectionCode = 5; // Memory attributes
-var kGlobalSectionCode = 6; // Global declarations
-var kExportSectionCode = 7; // Exports
-var kStartSectionCode = 8; // Start function declaration
-var kElementSectionCode = 9; // Elements section
-var kCodeSectionCode = 10; // Function code
-var kDataSectionCode = 11; // Data segments
-var kNameSectionCode = 12; // Name section (encoded as string)
+let kUnknownSectionCode = 0;
+let kTypeSectionCode = 1; // Function signature declarations
+let kImportSectionCode = 2; // Import declarations
+let kFunctionSectionCode = 3; // Function declarations
+let kTableSectionCode = 4; // Indirect function table and other tables
+let kMemorySectionCode = 5; // Memory attributes
+let kGlobalSectionCode = 6; // Global declarations
+let kExportSectionCode = 7; // Exports
+let kStartSectionCode = 8; // Start function declaration
+let kElementSectionCode = 9; // Elements section
+let kCodeSectionCode = 10; // Function code
+let kDataSectionCode = 11; // Data segments
+let kNameSectionCode = 12; // Name section (encoded as string)
-var kWasmFunctionTypeForm = 0x40;
-var kWasmAnyFunctionTypeForm = 0x20;
+let kWasmFunctionTypeForm = 0x60;
+let kWasmAnyFunctionTypeForm = 0x70;
-var kResizableMaximumFlag = 1;
+let kResizableMaximumFlag = 1;
// Function declaration flags
-var kDeclFunctionName = 0x01;
-var kDeclFunctionImport = 0x02;
-var kDeclFunctionLocals = 0x04;
-var kDeclFunctionExport = 0x08;
+let kDeclFunctionName = 0x01;
+let kDeclFunctionImport = 0x02;
+let kDeclFunctionLocals = 0x04;
+let kDeclFunctionExport = 0x08;
// Local types
-var kAstStmt = 0;
-var kAstI32 = 1;
-var kAstI64 = 2;
-var kAstF32 = 3;
-var kAstF64 = 4;
-var kAstS128 = 5;
+let kAstStmt = 0x40;
+let kAstI32 = 0x7f;
+let kAstI64 = 0x7e;
+let kAstF32 = 0x7d;
+let kAstF64 = 0x7c;
+let kAstS128 = 0x7b;
-var kExternalFunction = 0;
-var kExternalTable = 1;
-var kExternalMemory = 2;
-var kExternalGlobal = 3;
+let kExternalFunction = 0;
+let kExternalTable = 1;
+let kExternalMemory = 2;
+let kExternalGlobal = 3;
+
+let kTableZero = 0;
+let kMemoryZero = 0;
// Useful signatures
-var kSig_i_i = makeSig([kAstI32], [kAstI32]);
-var kSig_i_l = makeSig([kAstI64], [kAstI32]);
-var kSig_i_ii = makeSig([kAstI32, kAstI32], [kAstI32]);
-var kSig_i_iii = makeSig([kAstI32, kAstI32, kAstI32], [kAstI32]);
-var kSig_d_dd = makeSig([kAstF64, kAstF64], [kAstF64]);
-var kSig_l_ll = makeSig([kAstI64, kAstI64], [kAstI64]);
-var kSig_i_dd = makeSig([kAstF64, kAstF64], [kAstI32]);
-var kSig_v_v = makeSig([], []);
-var kSig_i_v = makeSig([], [kAstI32]);
-var kSig_l_v = makeSig([], [kAstI64]);
-var kSig_f_v = makeSig([], [kAstF64]);
-var kSig_d_v = makeSig([], [kAstF64]);
-var kSig_v_i = makeSig([kAstI32], []);
-var kSig_v_ii = makeSig([kAstI32, kAstI32], []);
-var kSig_v_iii = makeSig([kAstI32, kAstI32, kAstI32], []);
-var kSig_v_l = makeSig([kAstI64], []);
-var kSig_v_d = makeSig([kAstF64], []);
-var kSig_v_dd = makeSig([kAstF64, kAstF64], []);
-var kSig_v_ddi = makeSig([kAstF64, kAstF64, kAstI32], []);
-var kSig_s_v = makeSig([], [kAstS128]);
+let kSig_i_i = makeSig([kAstI32], [kAstI32]);
+let kSig_i_l = makeSig([kAstI64], [kAstI32]);
+let kSig_i_ii = makeSig([kAstI32, kAstI32], [kAstI32]);
+let kSig_i_iii = makeSig([kAstI32, kAstI32, kAstI32], [kAstI32]);
+let kSig_d_dd = makeSig([kAstF64, kAstF64], [kAstF64]);
+let kSig_l_ll = makeSig([kAstI64, kAstI64], [kAstI64]);
+let kSig_i_dd = makeSig([kAstF64, kAstF64], [kAstI32]);
+let kSig_v_v = makeSig([], []);
+let kSig_i_v = makeSig([], [kAstI32]);
+let kSig_l_v = makeSig([], [kAstI64]);
+let kSig_f_v = makeSig([], [kAstF64]);
+let kSig_d_v = makeSig([], [kAstF64]);
+let kSig_v_i = makeSig([kAstI32], []);
+let kSig_v_ii = makeSig([kAstI32, kAstI32], []);
+let kSig_v_iii = makeSig([kAstI32, kAstI32, kAstI32], []);
+let kSig_v_l = makeSig([kAstI64], []);
+let kSig_v_d = makeSig([kAstF64], []);
+let kSig_v_dd = makeSig([kAstF64, kAstF64], []);
+let kSig_v_ddi = makeSig([kAstF64, kAstF64, kAstI32], []);
+let kSig_s_v = makeSig([], [kAstS128]);
function makeSig(params, results) {
return {params: params, results: results};
@@ -136,198 +139,194 @@ function makeSig_r_xx(r, x) {
}
// Opcodes
-var kExprUnreachable = 0x00;
-var kExprNop = 0x0a;
-var kExprBlock = 0x01;
-var kExprLoop = 0x02;
-var kExprIf = 0x03;
-var kExprElse = 0x04;
-var kExprSelect = 0x05;
-var kExprBr = 0x06;
-var kExprBrIf = 0x07;
-var kExprBrTable = 0x08;
-var kExprReturn = 0x09;
-var kExprThrow = 0xfa;
-var kExprTry = 0xfb;
-var kExprCatch = 0xfe;
-var kExprEnd = 0x0f;
-var kExprTeeLocal = 0x19;
-var kExprDrop = 0x0b;
-
-var kExprI32Const = 0x10;
-var kExprI64Const = 0x11;
-var kExprF64Const = 0x12;
-var kExprF32Const = 0x13;
-var kExprGetLocal = 0x14;
-var kExprSetLocal = 0x15;
-var kExprCallFunction = 0x16;
-var kExprCallIndirect = 0x17;
-var kExprI8Const = 0xcb;
-var kExprGetGlobal = 0xbb;
-var kExprSetGlobal = 0xbc;
-
-var kExprI32LoadMem8S = 0x20;
-var kExprI32LoadMem8U = 0x21;
-var kExprI32LoadMem16S = 0x22;
-var kExprI32LoadMem16U = 0x23;
-var kExprI64LoadMem8S = 0x24;
-var kExprI64LoadMem8U = 0x25;
-var kExprI64LoadMem16S = 0x26;
-var kExprI64LoadMem16U = 0x27;
-var kExprI64LoadMem32S = 0x28;
-var kExprI64LoadMem32U = 0x29;
-var kExprI32LoadMem = 0x2a;
-var kExprI64LoadMem = 0x2b;
-var kExprF32LoadMem = 0x2c;
-var kExprF64LoadMem = 0x2d;
-
-var kExprI32StoreMem8 = 0x2e;
-var kExprI32StoreMem16 = 0x2f;
-var kExprI64StoreMem8 = 0x30;
-var kExprI64StoreMem16 = 0x31;
-var kExprI64StoreMem32 = 0x32;
-var kExprI32StoreMem = 0x33;
-var kExprI64StoreMem = 0x34;
-var kExprF32StoreMem = 0x35;
-var kExprF64StoreMem = 0x36;
-
-var kExprMemorySize = 0x3b;
-var kExprGrowMemory = 0x39;
-
-var kExprI32Add = 0x40;
-var kExprI32Sub = 0x41;
-var kExprI32Mul = 0x42;
-var kExprI32DivS = 0x43;
-var kExprI32DivU = 0x44;
-var kExprI32RemS = 0x45;
-var kExprI32RemU = 0x46;
-var kExprI32And = 0x47;
-var kExprI32Ior = 0x48;
-var kExprI32Xor = 0x49;
-var kExprI32Shl = 0x4a;
-var kExprI32ShrU = 0x4b;
-var kExprI32ShrS = 0x4c;
-var kExprI32Eq = 0x4d;
-var kExprI32Ne = 0x4e;
-var kExprI32LtS = 0x4f;
-var kExprI32LeS = 0x50;
-var kExprI32LtU = 0x51;
-var kExprI32LeU = 0x52;
-var kExprI32GtS = 0x53;
-var kExprI32GeS = 0x54;
-var kExprI32GtU = 0x55;
-var kExprI32GeU = 0x56;
-var kExprI32Clz = 0x57;
-var kExprI32Ctz = 0x58;
-var kExprI32Popcnt = 0x59;
-var kExprI32Eqz = 0x5a;
-var kExprI64Add = 0x5b;
-var kExprI64Sub = 0x5c;
-var kExprI64Mul = 0x5d;
-var kExprI64DivS = 0x5e;
-var kExprI64DivU = 0x5f;
-var kExprI64RemS = 0x60;
-var kExprI64RemU = 0x61;
-var kExprI64And = 0x62;
-var kExprI64Ior = 0x63;
-var kExprI64Xor = 0x64;
-var kExprI64Shl = 0x65;
-var kExprI64ShrU = 0x66;
-var kExprI64ShrS = 0x67;
-var kExprI64Eq = 0x68;
-var kExprI64Ne = 0x69;
-var kExprI64LtS = 0x6a;
-var kExprI64LeS = 0x6b;
-var kExprI64LtU = 0x6c;
-var kExprI64LeU = 0x6d;
-var kExprI64GtS = 0x6e;
-var kExprI64GeS = 0x6f;
-var kExprI64GtU = 0x70;
-var kExprI64GeU = 0x71;
-var kExprI64Clz = 0x72;
-var kExprI64Ctz = 0x73;
-var kExprI64Popcnt = 0x74;
-var kExprF32Add = 0x75;
-var kExprF32Sub = 0x76;
-var kExprF32Mul = 0x77;
-var kExprF32Div = 0x78;
-var kExprF32Min = 0x79;
-var kExprF32Max = 0x7a;
-var kExprF32Abs = 0x7b;
-var kExprF32Neg = 0x7c;
-var kExprF32CopySign = 0x7d;
-var kExprF32Ceil = 0x7e;
-var kExprF32Floor = 0x7f;
-var kExprF32Trunc = 0x80;
-var kExprF32NearestInt = 0x81;
-var kExprF32Sqrt = 0x82;
-var kExprF32Eq = 0x83;
-var kExprF32Ne = 0x84;
-var kExprF32Lt = 0x85;
-var kExprF32Le = 0x86;
-var kExprF32Gt = 0x87;
-var kExprF32Ge = 0x88;
-var kExprF64Add = 0x89;
-var kExprF64Sub = 0x8a;
-var kExprF64Mul = 0x8b;
-var kExprF64Div = 0x8c;
-var kExprF64Min = 0x8d;
-var kExprF64Max = 0x8e;
-var kExprF64Abs = 0x8f;
-var kExprF64Neg = 0x90;
-var kExprF64CopySign = 0x91;
-var kExprF64Ceil = 0x92;
-var kExprF64Floor = 0x93;
-var kExprF64Trunc = 0x94;
-var kExprF64NearestInt = 0x95;
-var kExprF64Sqrt = 0x96;
-var kExprF64Eq = 0x97;
-var kExprF64Ne = 0x98;
-var kExprF64Lt = 0x99;
-var kExprF64Le = 0x9a;
-var kExprF64Gt = 0x9b;
-var kExprF64Ge = 0x9c;
-var kExprI32SConvertF32 = 0x9d;
-var kExprI32SConvertF64 = 0x9e;
-var kExprI32UConvertF32 = 0x9f;
-var kExprI32UConvertF64 = 0xa0;
-var kExprI32ConvertI64 = 0xa1;
-var kExprI64SConvertF32 = 0xa2;
-var kExprI64SConvertF64 = 0xa3;
-var kExprI64UConvertF32 = 0xa4;
-var kExprI64UConvertF64 = 0xa5;
-var kExprI64SConvertI32 = 0xa6;
-var kExprI64UConvertI32 = 0xa7;
-var kExprF32SConvertI32 = 0xa8;
-var kExprF32UConvertI32 = 0xa9;
-var kExprF32SConvertI64 = 0xaa;
-var kExprF32UConvertI64 = 0xab;
-var kExprF32ConvertF64 = 0xac;
-var kExprF32ReinterpretI32 = 0xad;
-var kExprF64SConvertI32 = 0xae;
-var kExprF64UConvertI32 = 0xaf;
-var kExprF64SConvertI64 = 0xb0;
-var kExprF64UConvertI64 = 0xb1;
-var kExprF64ConvertF32 = 0xb2;
-var kExprF64ReinterpretI64 = 0xb3;
-var kExprI32ReinterpretF32 = 0xb4;
-var kExprI64ReinterpretF64 = 0xb5;
-var kExprI32Ror = 0xb6;
-var kExprI32Rol = 0xb7;
-var kExprI64Ror = 0xb8;
-var kExprI64Rol = 0xb9;
+let kExprUnreachable = 0x00;
+let kExprNop = 0x01;
+let kExprBlock = 0x02;
+let kExprLoop = 0x03;
+let kExprIf = 0x04;
+let kExprElse = 0x05;
+let kExprTry = 0x06;
+let kExprCatch = 0x07;
+let kExprThrow = 0x08;
+let kExprEnd = 0x0b;
+let kExprBr = 0x0c;
+let kExprBrIf = 0x0d;
+let kExprBrTable = 0x0e;
+let kExprReturn = 0x0f;
+let kExprCallFunction = 0x10;
+let kExprCallIndirect = 0x11;
+let kExprDrop = 0x1a;
+let kExprSelect = 0x1b;
+let kExprGetLocal = 0x20;
+let kExprSetLocal = 0x21;
+let kExprTeeLocal = 0x22;
+let kExprGetGlobal = 0x23;
+let kExprSetGlobal = 0x24;
+let kExprI32Const = 0x41;
+let kExprI64Const = 0x42;
+let kExprF32Const = 0x43;
+let kExprF64Const = 0x44;
+let kExprI8Const = 0xcb;
+let kExprI32LoadMem = 0x28;
+let kExprI64LoadMem = 0x29;
+let kExprF32LoadMem = 0x2a;
+let kExprF64LoadMem = 0x2b;
+let kExprI32LoadMem8S = 0x2c;
+let kExprI32LoadMem8U = 0x2d;
+let kExprI32LoadMem16S = 0x2e;
+let kExprI32LoadMem16U = 0x2f;
+let kExprI64LoadMem8S = 0x30;
+let kExprI64LoadMem8U = 0x31;
+let kExprI64LoadMem16S = 0x32;
+let kExprI64LoadMem16U = 0x33;
+let kExprI64LoadMem32S = 0x34;
+let kExprI64LoadMem32U = 0x35;
+let kExprI32StoreMem = 0x36;
+let kExprI64StoreMem = 0x37;
+let kExprF32StoreMem = 0x38;
+let kExprF64StoreMem = 0x39;
+let kExprI32StoreMem8 = 0x3a;
+let kExprI32StoreMem16 = 0x3b;
+let kExprI64StoreMem8 = 0x3c;
+let kExprI64StoreMem16 = 0x3d;
+let kExprI64StoreMem32 = 0x3e;
+let kExprMemorySize = 0x3f;
+let kExprGrowMemory = 0x40;
+let kExprI32Eqz = 0x45;
+let kExprI32Eq = 0x46;
+let kExprI32Ne = 0x47;
+let kExprI32LtS = 0x48;
+let kExprI32LtU = 0x49;
+let kExprI32GtS = 0x4a;
+let kExprI32GtU = 0x4b;
+let kExprI32LeS = 0x4c;
+let kExprI32LeU = 0x4d;
+let kExprI32GeS = 0x4e;
+let kExprI32GeU = 0x4f;
+let kExprI64Eqz = 0x50;
+let kExprI64Eq = 0x51;
+let kExprI64Ne = 0x52;
+let kExprI64LtS = 0x53;
+let kExprI64LtU = 0x54;
+let kExprI64GtS = 0x55;
+let kExprI64GtU = 0x56;
+let kExprI64LeS = 0x57;
+let kExprI64LeU = 0x58;
+let kExprI64GeS = 0x59;
+let kExprI64GeU = 0x5a;
+let kExprF32Eq = 0x5b;
+let kExprF32Ne = 0x5c;
+let kExprF32Lt = 0x5d;
+let kExprF32Gt = 0x5e;
+let kExprF32Le = 0x5f;
+let kExprF32Ge = 0x60;
+let kExprF64Eq = 0x61;
+let kExprF64Ne = 0x62;
+let kExprF64Lt = 0x63;
+let kExprF64Gt = 0x64;
+let kExprF64Le = 0x65;
+let kExprF64Ge = 0x66;
+let kExprI32Clz = 0x67;
+let kExprI32Ctz = 0x68;
+let kExprI32Popcnt = 0x69;
+let kExprI32Add = 0x6a;
+let kExprI32Sub = 0x6b;
+let kExprI32Mul = 0x6c;
+let kExprI32DivS = 0x6d;
+let kExprI32DivU = 0x6e;
+let kExprI32RemS = 0x6f;
+let kExprI32RemU = 0x70;
+let kExprI32And = 0x71;
+let kExprI32Ior = 0x72;
+let kExprI32Xor = 0x73;
+let kExprI32Shl = 0x74;
+let kExprI32ShrS = 0x75;
+let kExprI32ShrU = 0x76;
+let kExprI32Rol = 0x77;
+let kExprI32Ror = 0x78;
+let kExprI64Clz = 0x79;
+let kExprI64Ctz = 0x7a;
+let kExprI64Popcnt = 0x7b;
+let kExprI64Add = 0x7c;
+let kExprI64Sub = 0x7d;
+let kExprI64Mul = 0x7e;
+let kExprI64DivS = 0x7f;
+let kExprI64DivU = 0x80;
+let kExprI64RemS = 0x81;
+let kExprI64RemU = 0x82;
+let kExprI64And = 0x83;
+let kExprI64Ior = 0x84;
+let kExprI64Xor = 0x85;
+let kExprI64Shl = 0x86;
+let kExprI64ShrS = 0x87;
+let kExprI64ShrU = 0x88;
+let kExprI64Rol = 0x89;
+let kExprI64Ror = 0x8a;
+let kExprF32Abs = 0x8b;
+let kExprF32Neg = 0x8c;
+let kExprF32Ceil = 0x8d;
+let kExprF32Floor = 0x8e;
+let kExprF32Trunc = 0x8f;
+let kExprF32NearestInt = 0x90;
+let kExprF32Sqrt = 0x91;
+let kExprF32Add = 0x92;
+let kExprF32Sub = 0x93;
+let kExprF32Mul = 0x94;
+let kExprF32Div = 0x95;
+let kExprF32Min = 0x96;
+let kExprF32Max = 0x97;
+let kExprF32CopySign = 0x98;
+let kExprF64Abs = 0x99;
+let kExprF64Neg = 0x9a;
+let kExprF64Ceil = 0x9b;
+let kExprF64Floor = 0x9c;
+let kExprF64Trunc = 0x9d;
+let kExprF64NearestInt = 0x9e;
+let kExprF64Sqrt = 0x9f;
+let kExprF64Add = 0xa0;
+let kExprF64Sub = 0xa1;
+let kExprF64Mul = 0xa2;
+let kExprF64Div = 0xa3;
+let kExprF64Min = 0xa4;
+let kExprF64Max = 0xa5;
+let kExprF64CopySign = 0xa6;
+let kExprI32ConvertI64 = 0xa7;
+let kExprI32SConvertF32 = 0xa8;
+let kExprI32UConvertF32 = 0xa9;
+let kExprI32SConvertF64 = 0xaa;
+let kExprI32UConvertF64 = 0xab;
+let kExprI64SConvertI32 = 0xac;
+let kExprI64UConvertI32 = 0xad;
+let kExprI64SConvertF32 = 0xae;
+let kExprI64UConvertF32 = 0xaf;
+let kExprI64SConvertF64 = 0xb0;
+let kExprI64UConvertF64 = 0xb1;
+let kExprF32SConvertI32 = 0xb2;
+let kExprF32UConvertI32 = 0xb3;
+let kExprF32SConvertI64 = 0xb4;
+let kExprF32UConvertI64 = 0xb5;
+let kExprF32ConvertF64 = 0xb6;
+let kExprF64SConvertI32 = 0xb7;
+let kExprF64UConvertI32 = 0xb8;
+let kExprF64SConvertI64 = 0xb9;
+let kExprF64UConvertI64 = 0xba;
+let kExprF64ConvertF32 = 0xbb;
+let kExprI32ReinterpretF32 = 0xbc;
+let kExprI64ReinterpretF64 = 0xbd;
+let kExprF32ReinterpretI32 = 0xbe;
+let kExprF64ReinterpretI64 = 0xbf;
-var kTrapUnreachable = 0;
-var kTrapMemOutOfBounds = 1;
-var kTrapDivByZero = 2;
-var kTrapDivUnrepresentable = 3;
-var kTrapRemByZero = 4;
-var kTrapFloatUnrepresentable = 5;
-var kTrapFuncInvalid = 6;
-var kTrapFuncSigMismatch = 7;
-var kTrapInvalidIndex = 8;
+let kTrapUnreachable = 0;
+let kTrapMemOutOfBounds = 1;
+let kTrapDivByZero = 2;
+let kTrapDivUnrepresentable = 3;
+let kTrapRemByZero = 4;
+let kTrapFloatUnrepresentable = 5;
+let kTrapFuncInvalid = 6;
+let kTrapFuncSigMismatch = 7;
+let kTrapInvalidIndex = 8;
-var kTrapMsgs = [
+let kTrapMsgs = [
"unreachable",
"memory access out of bounds",
"divide by zero",
« no previous file with comments | « test/mjsunit/wasm/trap-location.js ('k') | test/unittests/wasm/ast-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698