OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_WASM_MACRO_GEN_H_ | 5 #ifndef V8_WASM_MACRO_GEN_H_ |
6 #define V8_WASM_MACRO_GEN_H_ | 6 #define V8_WASM_MACRO_GEN_H_ |
7 | 7 |
8 #include "src/wasm/wasm-opcodes.h" | 8 #include "src/wasm/wasm-opcodes.h" |
9 | 9 |
10 #include "src/zone/zone-containers.h" | 10 #include "src/zone/zone-containers.h" |
11 | 11 |
12 #define U32_LE(v) \ | 12 #define U32_LE(v) \ |
13 static_cast<byte>(v), static_cast<byte>((v) >> 8), \ | 13 static_cast<byte>(v), static_cast<byte>((v) >> 8), \ |
14 static_cast<byte>((v) >> 16), static_cast<byte>((v) >> 24) | 14 static_cast<byte>((v) >> 16), static_cast<byte>((v) >> 24) |
15 | 15 |
16 #define U16_LE(v) static_cast<byte>(v), static_cast<byte>((v) >> 8) | 16 #define U16_LE(v) static_cast<byte>(v), static_cast<byte>((v) >> 8) |
17 | 17 |
18 #define WASM_MODULE_HEADER U32_LE(kWasmMagic), U32_LE(kWasmVersion) | 18 #define WASM_MODULE_HEADER U32_LE(kWasmMagic), U32_LE(kWasmVersion) |
19 | 19 |
| 20 #define SIG_INDEX(v) U16_LE(v) |
| 21 // TODO(binji): make SIG_INDEX match this. |
20 #define IMPORT_SIG_INDEX(v) U32V_1(v) | 22 #define IMPORT_SIG_INDEX(v) U32V_1(v) |
21 #define FUNC_INDEX(v) U32V_1(v) | 23 #define FUNC_INDEX(v) U32V_1(v) |
22 #define TABLE_INDEX(v) U32V_1(v) | |
23 #define NO_NAME U32V_1(0) | 24 #define NO_NAME U32V_1(0) |
24 #define NAME_LENGTH(v) U32V_1(v) | 25 #define NAME_LENGTH(v) U32V_1(v) |
25 #define ENTRY_COUNT(v) U32V_1(v) | |
26 | 26 |
27 #define ZERO_ALIGNMENT 0 | 27 #define ZERO_ALIGNMENT 0 |
28 #define ZERO_OFFSET 0 | 28 #define ZERO_OFFSET 0 |
29 | 29 |
30 #define BR_TARGET(v) U32V_1(v) | 30 #define BR_TARGET(v) U32_LE(v) |
31 | 31 |
32 #define MASK_7 ((1 << 7) - 1) | 32 #define MASK_7 ((1 << 7) - 1) |
33 #define MASK_14 ((1 << 14) - 1) | 33 #define MASK_14 ((1 << 14) - 1) |
34 #define MASK_21 ((1 << 21) - 1) | 34 #define MASK_21 ((1 << 21) - 1) |
35 #define MASK_28 ((1 << 28) - 1) | 35 #define MASK_28 ((1 << 28) - 1) |
36 | 36 |
37 #define U32V_1(x) static_cast<byte>((x)&MASK_7) | 37 #define U32V_1(x) static_cast<byte>((x)&MASK_7) |
38 #define U32V_2(x) \ | 38 #define U32V_2(x) \ |
39 static_cast<byte>(((x)&MASK_7) | 0x80), static_cast<byte>(((x) >> 7) & MASK_7) | 39 static_cast<byte>(((x)&MASK_7) | 0x80), static_cast<byte>(((x) >> 7) & MASK_7) |
40 #define U32V_3(x) \ | 40 #define U32V_3(x) \ |
(...skipping 14 matching lines...) Expand all Loading... |
55 | 55 |
56 // Convenience macros for building Wasm bytecode directly into a byte array. | 56 // Convenience macros for building Wasm bytecode directly into a byte array. |
57 | 57 |
58 //------------------------------------------------------------------------------ | 58 //------------------------------------------------------------------------------ |
59 // Control. | 59 // Control. |
60 //------------------------------------------------------------------------------ | 60 //------------------------------------------------------------------------------ |
61 #define WASM_NOP kExprNop | 61 #define WASM_NOP kExprNop |
62 | 62 |
63 #define ARITY_0 0 | 63 #define ARITY_0 0 |
64 #define ARITY_1 1 | 64 #define ARITY_1 1 |
65 #define ARITY_2 2 | |
66 #define DEPTH_0 0 | 65 #define DEPTH_0 0 |
67 #define DEPTH_1 1 | 66 #define DEPTH_1 1 |
68 #define DEPTH_2 2 | |
69 #define ARITY_2 2 | |
70 | 67 |
71 #define WASM_BLOCK(...) kExprBlock, kLocalVoid, __VA_ARGS__, kExprEnd | 68 #define WASM_BLOCK(...) kExprBlock, __VA_ARGS__, kExprEnd |
72 | 69 #define WASM_INFINITE_LOOP kExprLoop, kExprBr, ARITY_0, DEPTH_0, kExprEnd |
73 #define WASM_BLOCK_T(t, ...) \ | 70 #define WASM_LOOP(...) kExprLoop, __VA_ARGS__, kExprEnd |
74 kExprBlock, static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(t)), \ | 71 #define WASM_IF(cond, tstmt) cond, kExprIf, tstmt, kExprEnd |
75 __VA_ARGS__, kExprEnd | |
76 | |
77 #define WASM_BLOCK_TT(t1, t2, ...) \ | |
78 kExprBlock, kMultivalBlock, 0, \ | |
79 static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(t1)), \ | |
80 static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(t2)), __VA_ARGS__, \ | |
81 kExprEnd | |
82 | |
83 #define WASM_BLOCK_I(...) kExprBlock, kLocalI32, __VA_ARGS__, kExprEnd | |
84 #define WASM_BLOCK_L(...) kExprBlock, kLocalI64, __VA_ARGS__, kExprEnd | |
85 #define WASM_BLOCK_F(...) kExprBlock, kLocalF32, __VA_ARGS__, kExprEnd | |
86 #define WASM_BLOCK_D(...) kExprBlock, kLocalF64, __VA_ARGS__, kExprEnd | |
87 | |
88 #define WASM_INFINITE_LOOP kExprLoop, kLocalVoid, kExprBr, DEPTH_0, kExprEnd | |
89 | |
90 #define WASM_LOOP(...) kExprLoop, kLocalVoid, __VA_ARGS__, kExprEnd | |
91 #define WASM_LOOP_I(...) kExprLoop, kLocalI32, __VA_ARGS__, kExprEnd | |
92 #define WASM_LOOP_L(...) kExprLoop, kLocalI64, __VA_ARGS__, kExprEnd | |
93 #define WASM_LOOP_F(...) kExprLoop, kLocalF32, __VA_ARGS__, kExprEnd | |
94 #define WASM_LOOP_D(...) kExprLoop, kLocalF64, __VA_ARGS__, kExprEnd | |
95 | |
96 #define WASM_IF(cond, tstmt) cond, kExprIf, kLocalVoid, tstmt, kExprEnd | |
97 | |
98 #define WASM_IF_ELSE(cond, tstmt, fstmt) \ | 72 #define WASM_IF_ELSE(cond, tstmt, fstmt) \ |
99 cond, kExprIf, kLocalVoid, tstmt, kExprElse, fstmt, kExprEnd | 73 cond, kExprIf, tstmt, kExprElse, fstmt, kExprEnd |
100 | |
101 #define WASM_IF_ELSE_T(t, cond, tstmt, fstmt) \ | |
102 cond, kExprIf, static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(t)), tstmt, \ | |
103 kExprElse, fstmt, kExprEnd | |
104 | |
105 #define WASM_IF_ELSE_TT(t1, t2, cond, tstmt, fstmt) \ | |
106 cond, kExprIf, kMultivalBlock, 0, \ | |
107 static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(t1)), \ | |
108 static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(t2)), tstmt, kExprElse, \ | |
109 fstmt, kExprEnd | |
110 | |
111 #define WASM_IF_ELSE_I(cond, tstmt, fstmt) \ | |
112 cond, kExprIf, kLocalI32, tstmt, kExprElse, fstmt, kExprEnd | |
113 #define WASM_IF_ELSE_L(cond, tstmt, fstmt) \ | |
114 cond, kExprIf, kLocalI64, tstmt, kExprElse, fstmt, kExprEnd | |
115 #define WASM_IF_ELSE_F(cond, tstmt, fstmt) \ | |
116 cond, kExprIf, kLocalF32, tstmt, kExprElse, fstmt, kExprEnd | |
117 #define WASM_IF_ELSE_D(cond, tstmt, fstmt) \ | |
118 cond, kExprIf, kLocalF64, tstmt, kExprElse, fstmt, kExprEnd | |
119 | |
120 #define WASM_SELECT(tval, fval, cond) tval, fval, cond, kExprSelect | 74 #define WASM_SELECT(tval, fval, cond) tval, fval, cond, kExprSelect |
121 | 75 #define WASM_BR(depth) kExprBr, ARITY_0, static_cast<byte>(depth) |
122 #define WASM_RETURN0 kExprReturn | 76 #define WASM_BR_IF(depth, cond) \ |
123 #define WASM_RETURN1(val) val, kExprReturn | 77 cond, kExprBrIf, ARITY_0, static_cast<byte>(depth) |
124 #define WASM_RETURNN(count, ...) __VA_ARGS__, kExprReturn | 78 #define WASM_BRV(depth, val) val, kExprBr, ARITY_1, static_cast<byte>(depth) |
125 | 79 #define WASM_BRV_IF(depth, val, cond) \ |
126 #define WASM_BR(depth) kExprBr, static_cast<byte>(depth) | 80 val, cond, kExprBrIf, ARITY_1, static_cast<byte>(depth) |
127 #define WASM_BR_IF(depth, cond) cond, kExprBrIf, static_cast<byte>(depth) | 81 #define WASM_BREAK(depth) kExprBr, ARITY_0, static_cast<byte>(depth + 1) |
128 #define WASM_BR_IFD(depth, val, cond) \ | 82 #define WASM_CONTINUE(depth) kExprBr, ARITY_0, static_cast<byte>(depth) |
129 val, cond, kExprBrIf, static_cast<byte>(depth), kExprDrop | 83 #define WASM_BREAKV(depth, val) \ |
130 #define WASM_CONTINUE(depth) kExprBr, static_cast<byte>(depth) | 84 val, kExprBr, ARITY_1, static_cast<byte>(depth + 1) |
| 85 #define WASM_RETURN0 kExprReturn, ARITY_0 |
| 86 #define WASM_RETURN1(val) val, kExprReturn, ARITY_1 |
| 87 #define WASM_RETURNN(count, ...) __VA_ARGS__, kExprReturn, count |
131 #define WASM_UNREACHABLE kExprUnreachable | 88 #define WASM_UNREACHABLE kExprUnreachable |
132 | 89 |
133 #define WASM_BR_TABLE(key, count, ...) \ | 90 #define WASM_BR_TABLE(key, count, ...) \ |
134 key, kExprBrTable, U32V_1(count), __VA_ARGS__ | 91 key, kExprBrTable, ARITY_0, U32V_1(count), __VA_ARGS__ |
| 92 |
| 93 #define WASM_BR_TABLEV(val, key, count, ...) \ |
| 94 val, key, kExprBrTable, ARITY_1, U32V_1(count), __VA_ARGS__ |
135 | 95 |
136 #define WASM_CASE(x) static_cast<byte>(x), static_cast<byte>(x >> 8) | 96 #define WASM_CASE(x) static_cast<byte>(x), static_cast<byte>(x >> 8) |
137 #define WASM_CASE_BR(x) static_cast<byte>(x), static_cast<byte>(0x80 | (x) >> 8) | 97 #define WASM_CASE_BR(x) static_cast<byte>(x), static_cast<byte>(0x80 | (x) >> 8) |
138 | 98 |
139 //------------------------------------------------------------------------------ | 99 //------------------------------------------------------------------------------ |
140 // Misc expressions. | 100 // Misc expressions. |
141 //------------------------------------------------------------------------------ | 101 //------------------------------------------------------------------------------ |
142 #define WASM_ID(...) __VA_ARGS__ | 102 #define WASM_ID(...) __VA_ARGS__ |
143 #define WASM_ZERO kExprI8Const, 0 | 103 #define WASM_ZERO kExprI8Const, 0 |
144 #define WASM_ONE kExprI8Const, 1 | 104 #define WASM_ONE kExprI8Const, 1 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 kExprF64Const, static_cast<byte>(bit_cast<uint64_t>(val)), \ | 336 kExprF64Const, static_cast<byte>(bit_cast<uint64_t>(val)), \ |
377 static_cast<byte>(bit_cast<uint64_t>(val) >> 8), \ | 337 static_cast<byte>(bit_cast<uint64_t>(val) >> 8), \ |
378 static_cast<byte>(bit_cast<uint64_t>(val) >> 16), \ | 338 static_cast<byte>(bit_cast<uint64_t>(val) >> 16), \ |
379 static_cast<byte>(bit_cast<uint64_t>(val) >> 24), \ | 339 static_cast<byte>(bit_cast<uint64_t>(val) >> 24), \ |
380 static_cast<byte>(bit_cast<uint64_t>(val) >> 32), \ | 340 static_cast<byte>(bit_cast<uint64_t>(val) >> 32), \ |
381 static_cast<byte>(bit_cast<uint64_t>(val) >> 40), \ | 341 static_cast<byte>(bit_cast<uint64_t>(val) >> 40), \ |
382 static_cast<byte>(bit_cast<uint64_t>(val) >> 48), \ | 342 static_cast<byte>(bit_cast<uint64_t>(val) >> 48), \ |
383 static_cast<byte>(bit_cast<uint64_t>(val) >> 56) | 343 static_cast<byte>(bit_cast<uint64_t>(val) >> 56) |
384 #define WASM_GET_LOCAL(index) kExprGetLocal, static_cast<byte>(index) | 344 #define WASM_GET_LOCAL(index) kExprGetLocal, static_cast<byte>(index) |
385 #define WASM_SET_LOCAL(index, val) val, kExprSetLocal, static_cast<byte>(index) | 345 #define WASM_SET_LOCAL(index, val) val, kExprSetLocal, static_cast<byte>(index) |
386 #define WASM_TEE_LOCAL(index, val) val, kExprTeeLocal, static_cast<byte>(index) | |
387 #define WASM_DROP kExprDrop | |
388 #define WASM_GET_GLOBAL(index) kExprGetGlobal, static_cast<byte>(index) | 346 #define WASM_GET_GLOBAL(index) kExprGetGlobal, static_cast<byte>(index) |
389 #define WASM_SET_GLOBAL(index, val) \ | 347 #define WASM_SET_GLOBAL(index, val) \ |
390 val, kExprSetGlobal, static_cast<byte>(index) | 348 val, kExprSetGlobal, static_cast<byte>(index) |
391 #define WASM_LOAD_MEM(type, index) \ | 349 #define WASM_LOAD_MEM(type, index) \ |
392 index, static_cast<byte>( \ | 350 index, static_cast<byte>( \ |
393 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ | 351 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ |
394 ZERO_ALIGNMENT, ZERO_OFFSET | 352 ZERO_ALIGNMENT, ZERO_OFFSET |
395 #define WASM_STORE_MEM(type, index, val) \ | 353 #define WASM_STORE_MEM(type, index, val) \ |
396 index, val, \ | 354 index, val, \ |
397 static_cast<byte>( \ | 355 static_cast<byte>( \ |
(...skipping 11 matching lines...) Expand all Loading... |
409 #define WASM_LOAD_MEM_ALIGNMENT(type, index, alignment) \ | 367 #define WASM_LOAD_MEM_ALIGNMENT(type, index, alignment) \ |
410 index, static_cast<byte>( \ | 368 index, static_cast<byte>( \ |
411 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ | 369 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ |
412 alignment, ZERO_OFFSET | 370 alignment, ZERO_OFFSET |
413 #define WASM_STORE_MEM_ALIGNMENT(type, index, alignment, val) \ | 371 #define WASM_STORE_MEM_ALIGNMENT(type, index, alignment, val) \ |
414 index, val, \ | 372 index, val, \ |
415 static_cast<byte>( \ | 373 static_cast<byte>( \ |
416 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, true)), \ | 374 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, true)), \ |
417 alignment, ZERO_OFFSET | 375 alignment, ZERO_OFFSET |
418 | 376 |
419 #define WASM_CALL_FUNCTION0(index) kExprCallFunction, static_cast<byte>(index) | 377 #define WASM_CALL_FUNCTION0(index) \ |
420 #define WASM_CALL_FUNCTION(index, ...) \ | 378 kExprCallFunction, 0, static_cast<byte>(index) |
421 __VA_ARGS__, kExprCallFunction, static_cast<byte>(index) | 379 #define WASM_CALL_FUNCTION1(index, a) \ |
| 380 a, kExprCallFunction, 1, static_cast<byte>(index) |
| 381 #define WASM_CALL_FUNCTION2(index, a, b) \ |
| 382 a, b, kExprCallFunction, 2, static_cast<byte>(index) |
| 383 #define WASM_CALL_FUNCTION3(index, a, b, c) \ |
| 384 a, b, c, kExprCallFunction, 3, static_cast<byte>(index) |
| 385 #define WASM_CALL_FUNCTION4(index, a, b, c, d) \ |
| 386 a, b, c, d, kExprCallFunction, 4, static_cast<byte>(index) |
| 387 #define WASM_CALL_FUNCTION5(index, a, b, c, d, e) \ |
| 388 kExprCallFunction, 5, static_cast<byte>(index) |
| 389 #define WASM_CALL_FUNCTIONN(arity, index, ...) \ |
| 390 __VA_ARGS__, kExprCallFunction, arity, static_cast<byte>(index) |
422 | 391 |
423 // TODO(titzer): change usages of these macros to put func last. | 392 #define WASM_CALL_IMPORT0(index) kExprCallImport, 0, static_cast<byte>(index) |
| 393 #define WASM_CALL_IMPORT1(index, a) \ |
| 394 a, kExprCallImport, 1, static_cast<byte>(index) |
| 395 #define WASM_CALL_IMPORT2(index, a, b) \ |
| 396 a, b, kExprCallImport, 2, static_cast<byte>(index) |
| 397 #define WASM_CALL_IMPORT3(index, a, b, c) \ |
| 398 a, b, c, kExprCallImport, 3, static_cast<byte>(index) |
| 399 #define WASM_CALL_IMPORT4(index, a, b, c, d) \ |
| 400 a, b, c, d, kExprCallImport, 4, static_cast<byte>(index) |
| 401 #define WASM_CALL_IMPORT5(index, a, b, c, d, e) \ |
| 402 a, b, c, d, e, kExprCallImport, 5, static_cast<byte>(index) |
| 403 #define WASM_CALL_IMPORTN(arity, index, ...) \ |
| 404 __VA_ARGS__, kExprCallImport, U32V_1(arity), static_cast<byte>(index), |
| 405 |
424 #define WASM_CALL_INDIRECT0(index, func) \ | 406 #define WASM_CALL_INDIRECT0(index, func) \ |
425 func, kExprCallIndirect, static_cast<byte>(index) | 407 func, kExprCallIndirect, 0, static_cast<byte>(index) |
426 #define WASM_CALL_INDIRECT1(index, func, a) \ | 408 #define WASM_CALL_INDIRECT1(index, func, a) \ |
427 a, func, kExprCallIndirect, static_cast<byte>(index) | 409 func, a, kExprCallIndirect, 1, static_cast<byte>(index) |
428 #define WASM_CALL_INDIRECT2(index, func, a, b) \ | 410 #define WASM_CALL_INDIRECT2(index, func, a, b) \ |
429 a, b, func, kExprCallIndirect, static_cast<byte>(index) | 411 func, a, b, kExprCallIndirect, 2, static_cast<byte>(index) |
430 #define WASM_CALL_INDIRECT3(index, func, a, b, c) \ | 412 #define WASM_CALL_INDIRECT3(index, func, a, b, c) \ |
431 a, b, c, func, kExprCallIndirect, static_cast<byte>(index) | 413 func, a, b, c, kExprCallIndirect, 3, static_cast<byte>(index) |
432 #define WASM_CALL_INDIRECT4(index, func, a, b, c, d) \ | 414 #define WASM_CALL_INDIRECT4(index, func, a, b, c, d) \ |
433 a, b, c, d, func, kExprCallIndirect, static_cast<byte>(index) | 415 func, a, b, c, d, kExprCallIndirect, 4, static_cast<byte>(index) |
434 #define WASM_CALL_INDIRECT5(index, func, a, b, c, d, e) \ | 416 #define WASM_CALL_INDIRECT5(index, func, a, b, c, d, e) \ |
435 a, b, c, d, e, func, kExprCallIndirect, static_cast<byte>(index) | 417 func, a, b, c, d, e, kExprCallIndirect, 5, static_cast<byte>(index) |
436 #define WASM_CALL_INDIRECTN(arity, index, func, ...) \ | 418 #define WASM_CALL_INDIRECTN(arity, index, func, ...) \ |
437 __VA_ARGS__, func, kExprCallIndirect, static_cast<byte>(index) | 419 func, __VA_ARGS__, kExprCallIndirect, U32V_1(arity), static_cast<byte>(index) |
438 | 420 |
439 #define WASM_NOT(x) x, kExprI32Eqz | 421 #define WASM_NOT(x) x, kExprI32Eqz |
440 #define WASM_SEQ(...) __VA_ARGS__ | 422 #define WASM_SEQ(...) __VA_ARGS__ |
441 | 423 |
442 //------------------------------------------------------------------------------ | 424 //------------------------------------------------------------------------------ |
443 // Constructs that are composed of multiple bytecodes. | 425 // Constructs that are composed of multiple bytecodes. |
444 //------------------------------------------------------------------------------ | 426 //------------------------------------------------------------------------------ |
445 #define WASM_WHILE(x, y) \ | 427 #define WASM_WHILE(x, y) \ |
446 kExprLoop, kLocalVoid, x, kExprIf, kLocalVoid, y, kExprBr, DEPTH_1, \ | 428 kExprLoop, x, kExprIf, y, kExprBr, ARITY_1, DEPTH_1, kExprEnd, kExprEnd |
447 kExprEnd, kExprEnd | |
448 #define WASM_INC_LOCAL(index) \ | 429 #define WASM_INC_LOCAL(index) \ |
449 kExprGetLocal, static_cast<byte>(index), kExprI8Const, 1, kExprI32Add, \ | 430 kExprGetLocal, static_cast<byte>(index), kExprI8Const, 1, kExprI32Add, \ |
450 kExprTeeLocal, static_cast<byte>(index) | 431 kExprSetLocal, static_cast<byte>(index) |
451 #define WASM_INC_LOCAL_BYV(index, count) \ | |
452 kExprGetLocal, static_cast<byte>(index), kExprI8Const, \ | |
453 static_cast<byte>(count), kExprI32Add, kExprTeeLocal, \ | |
454 static_cast<byte>(index) | |
455 #define WASM_INC_LOCAL_BY(index, count) \ | 432 #define WASM_INC_LOCAL_BY(index, count) \ |
456 kExprGetLocal, static_cast<byte>(index), kExprI8Const, \ | 433 kExprGetLocal, static_cast<byte>(index), kExprI8Const, \ |
457 static_cast<byte>(count), kExprI32Add, kExprSetLocal, \ | 434 static_cast<byte>(count), kExprI32Add, kExprSetLocal, \ |
458 static_cast<byte>(index) | 435 static_cast<byte>(index) |
459 #define WASM_UNOP(opcode, x) x, static_cast<byte>(opcode) | 436 #define WASM_UNOP(opcode, x) x, static_cast<byte>(opcode) |
460 #define WASM_BINOP(opcode, x, y) x, y, static_cast<byte>(opcode) | 437 #define WASM_BINOP(opcode, x, y) x, y, static_cast<byte>(opcode) |
461 | 438 |
462 //------------------------------------------------------------------------------ | 439 //------------------------------------------------------------------------------ |
463 // Int32 operations | 440 // Int32 operations |
464 //------------------------------------------------------------------------------ | 441 //------------------------------------------------------------------------------ |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 | 604 |
628 #define SIG_ENTRY_x(r) kWasmFunctionTypeForm, 0, 1, r | 605 #define SIG_ENTRY_x(r) kWasmFunctionTypeForm, 0, 1, r |
629 #define SIG_ENTRY_x_x(r, a) kWasmFunctionTypeForm, 1, a, 1, r | 606 #define SIG_ENTRY_x_x(r, a) kWasmFunctionTypeForm, 1, a, 1, r |
630 #define SIG_ENTRY_x_xx(r, a, b) kWasmFunctionTypeForm, 2, a, b, 1, r | 607 #define SIG_ENTRY_x_xx(r, a, b) kWasmFunctionTypeForm, 2, a, b, 1, r |
631 #define SIG_ENTRY_x_xxx(r, a, b, c) kWasmFunctionTypeForm, 3, a, b, c, 1, r | 608 #define SIG_ENTRY_x_xxx(r, a, b, c) kWasmFunctionTypeForm, 3, a, b, c, 1, r |
632 #define SIZEOF_SIG_ENTRY_x 4 | 609 #define SIZEOF_SIG_ENTRY_x 4 |
633 #define SIZEOF_SIG_ENTRY_x_x 5 | 610 #define SIZEOF_SIG_ENTRY_x_x 5 |
634 #define SIZEOF_SIG_ENTRY_x_xx 6 | 611 #define SIZEOF_SIG_ENTRY_x_xx 6 |
635 #define SIZEOF_SIG_ENTRY_x_xxx 7 | 612 #define SIZEOF_SIG_ENTRY_x_xxx 7 |
636 | 613 |
637 #define WASM_BRV(depth, val) val, kExprBr, static_cast<byte>(depth) | |
638 #define WASM_BRV_IF(depth, val, cond) \ | |
639 val, cond, kExprBrIf, static_cast<byte>(depth) | |
640 #define WASM_BRV_IFD(depth, val, cond) \ | |
641 val, cond, kExprBrIf, static_cast<byte>(depth), kExprDrop | |
642 #define WASM_IFB(cond, ...) cond, kExprIf, kLocalVoid, __VA_ARGS__, kExprEnd | |
643 #define WASM_BR_TABLEV(val, key, count, ...) \ | |
644 val, key, kExprBrTable, U32V_1(count), __VA_ARGS__ | |
645 | |
646 #endif // V8_WASM_MACRO_GEN_H_ | 614 #endif // V8_WASM_MACRO_GEN_H_ |
OLD | NEW |