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. | |
22 #define IMPORT_SIG_INDEX(v) U32V_1(v) | 20 #define IMPORT_SIG_INDEX(v) U32V_1(v) |
23 #define FUNC_INDEX(v) U32V_1(v) | 21 #define FUNC_INDEX(v) U32V_1(v) |
| 22 #define TABLE_INDEX(v) U32V_1(v) |
24 #define NO_NAME U32V_1(0) | 23 #define NO_NAME U32V_1(0) |
25 #define NAME_LENGTH(v) U32V_1(v) | 24 #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) U32_LE(v) | 30 #define BR_TARGET(v) U32V_1(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 |
65 #define DEPTH_0 0 | 66 #define DEPTH_0 0 |
66 #define DEPTH_1 1 | 67 #define DEPTH_1 1 |
| 68 #define DEPTH_2 2 |
| 69 #define ARITY_2 2 |
67 | 70 |
68 #define WASM_BLOCK(...) kExprBlock, __VA_ARGS__, kExprEnd | 71 #define WASM_BLOCK(...) kExprBlock, kLocalVoid, __VA_ARGS__, kExprEnd |
69 #define WASM_INFINITE_LOOP kExprLoop, kExprBr, ARITY_0, DEPTH_0, kExprEnd | 72 |
70 #define WASM_LOOP(...) kExprLoop, __VA_ARGS__, kExprEnd | 73 #define WASM_BLOCK_T(t, ...) \ |
71 #define WASM_IF(cond, tstmt) cond, kExprIf, tstmt, kExprEnd | 74 kExprBlock, static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(t)), \ |
| 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 |
72 #define WASM_IF_ELSE(cond, tstmt, fstmt) \ | 98 #define WASM_IF_ELSE(cond, tstmt, fstmt) \ |
73 cond, kExprIf, tstmt, kExprElse, fstmt, kExprEnd | 99 cond, kExprIf, kLocalVoid, 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 |
74 #define WASM_SELECT(tval, fval, cond) tval, fval, cond, kExprSelect | 120 #define WASM_SELECT(tval, fval, cond) tval, fval, cond, kExprSelect |
75 #define WASM_BR(depth) kExprBr, ARITY_0, static_cast<byte>(depth) | 121 |
76 #define WASM_BR_IF(depth, cond) \ | 122 #define WASM_RETURN0 kExprReturn |
77 cond, kExprBrIf, ARITY_0, static_cast<byte>(depth) | 123 #define WASM_RETURN1(val) val, kExprReturn |
78 #define WASM_BRV(depth, val) val, kExprBr, ARITY_1, static_cast<byte>(depth) | 124 #define WASM_RETURNN(count, ...) __VA_ARGS__, kExprReturn |
79 #define WASM_BRV_IF(depth, val, cond) \ | 125 |
80 val, cond, kExprBrIf, ARITY_1, static_cast<byte>(depth) | 126 #define WASM_BR(depth) kExprBr, static_cast<byte>(depth) |
81 #define WASM_BREAK(depth) kExprBr, ARITY_0, static_cast<byte>(depth + 1) | 127 #define WASM_BR_IF(depth, cond) cond, kExprBrIf, static_cast<byte>(depth) |
82 #define WASM_CONTINUE(depth) kExprBr, ARITY_0, static_cast<byte>(depth) | 128 #define WASM_BR_IFD(depth, val, cond) \ |
83 #define WASM_BREAKV(depth, val) \ | 129 val, cond, kExprBrIf, static_cast<byte>(depth), kExprDrop |
84 val, kExprBr, ARITY_1, static_cast<byte>(depth + 1) | 130 #define WASM_CONTINUE(depth) kExprBr, static_cast<byte>(depth) |
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 | |
88 #define WASM_UNREACHABLE kExprUnreachable | 131 #define WASM_UNREACHABLE kExprUnreachable |
89 | 132 |
90 #define WASM_BR_TABLE(key, count, ...) \ | 133 #define WASM_BR_TABLE(key, count, ...) \ |
91 key, kExprBrTable, ARITY_0, U32V_1(count), __VA_ARGS__ | 134 key, kExprBrTable, 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__ | |
95 | 135 |
96 #define WASM_CASE(x) static_cast<byte>(x), static_cast<byte>(x >> 8) | 136 #define WASM_CASE(x) static_cast<byte>(x), static_cast<byte>(x >> 8) |
97 #define WASM_CASE_BR(x) static_cast<byte>(x), static_cast<byte>(0x80 | (x) >> 8) | 137 #define WASM_CASE_BR(x) static_cast<byte>(x), static_cast<byte>(0x80 | (x) >> 8) |
98 | 138 |
99 //------------------------------------------------------------------------------ | 139 //------------------------------------------------------------------------------ |
100 // Misc expressions. | 140 // Misc expressions. |
101 //------------------------------------------------------------------------------ | 141 //------------------------------------------------------------------------------ |
102 #define WASM_ID(...) __VA_ARGS__ | 142 #define WASM_ID(...) __VA_ARGS__ |
103 #define WASM_ZERO kExprI8Const, 0 | 143 #define WASM_ZERO kExprI8Const, 0 |
104 #define WASM_ONE kExprI8Const, 1 | 144 #define WASM_ONE kExprI8Const, 1 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 kExprF64Const, static_cast<byte>(bit_cast<uint64_t>(val)), \ | 376 kExprF64Const, static_cast<byte>(bit_cast<uint64_t>(val)), \ |
337 static_cast<byte>(bit_cast<uint64_t>(val) >> 8), \ | 377 static_cast<byte>(bit_cast<uint64_t>(val) >> 8), \ |
338 static_cast<byte>(bit_cast<uint64_t>(val) >> 16), \ | 378 static_cast<byte>(bit_cast<uint64_t>(val) >> 16), \ |
339 static_cast<byte>(bit_cast<uint64_t>(val) >> 24), \ | 379 static_cast<byte>(bit_cast<uint64_t>(val) >> 24), \ |
340 static_cast<byte>(bit_cast<uint64_t>(val) >> 32), \ | 380 static_cast<byte>(bit_cast<uint64_t>(val) >> 32), \ |
341 static_cast<byte>(bit_cast<uint64_t>(val) >> 40), \ | 381 static_cast<byte>(bit_cast<uint64_t>(val) >> 40), \ |
342 static_cast<byte>(bit_cast<uint64_t>(val) >> 48), \ | 382 static_cast<byte>(bit_cast<uint64_t>(val) >> 48), \ |
343 static_cast<byte>(bit_cast<uint64_t>(val) >> 56) | 383 static_cast<byte>(bit_cast<uint64_t>(val) >> 56) |
344 #define WASM_GET_LOCAL(index) kExprGetLocal, static_cast<byte>(index) | 384 #define WASM_GET_LOCAL(index) kExprGetLocal, static_cast<byte>(index) |
345 #define WASM_SET_LOCAL(index, val) val, kExprSetLocal, static_cast<byte>(index) | 385 #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 |
346 #define WASM_GET_GLOBAL(index) kExprGetGlobal, static_cast<byte>(index) | 388 #define WASM_GET_GLOBAL(index) kExprGetGlobal, static_cast<byte>(index) |
347 #define WASM_SET_GLOBAL(index, val) \ | 389 #define WASM_SET_GLOBAL(index, val) \ |
348 val, kExprSetGlobal, static_cast<byte>(index) | 390 val, kExprSetGlobal, static_cast<byte>(index) |
349 #define WASM_LOAD_MEM(type, index) \ | 391 #define WASM_LOAD_MEM(type, index) \ |
350 index, static_cast<byte>( \ | 392 index, static_cast<byte>( \ |
351 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ | 393 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ |
352 ZERO_ALIGNMENT, ZERO_OFFSET | 394 ZERO_ALIGNMENT, ZERO_OFFSET |
353 #define WASM_STORE_MEM(type, index, val) \ | 395 #define WASM_STORE_MEM(type, index, val) \ |
354 index, val, \ | 396 index, val, \ |
355 static_cast<byte>( \ | 397 static_cast<byte>( \ |
(...skipping 11 matching lines...) Expand all Loading... |
367 #define WASM_LOAD_MEM_ALIGNMENT(type, index, alignment) \ | 409 #define WASM_LOAD_MEM_ALIGNMENT(type, index, alignment) \ |
368 index, static_cast<byte>( \ | 410 index, static_cast<byte>( \ |
369 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ | 411 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ |
370 alignment, ZERO_OFFSET | 412 alignment, ZERO_OFFSET |
371 #define WASM_STORE_MEM_ALIGNMENT(type, index, alignment, val) \ | 413 #define WASM_STORE_MEM_ALIGNMENT(type, index, alignment, val) \ |
372 index, val, \ | 414 index, val, \ |
373 static_cast<byte>( \ | 415 static_cast<byte>( \ |
374 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, true)), \ | 416 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, true)), \ |
375 alignment, ZERO_OFFSET | 417 alignment, ZERO_OFFSET |
376 | 418 |
377 #define WASM_CALL_FUNCTION0(index) \ | 419 #define WASM_CALL_FUNCTION0(index) kExprCallFunction, static_cast<byte>(index) |
378 kExprCallFunction, 0, static_cast<byte>(index) | 420 #define WASM_CALL_FUNCTION(index, ...) \ |
379 #define WASM_CALL_FUNCTION1(index, a) \ | 421 __VA_ARGS__, kExprCallFunction, static_cast<byte>(index) |
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) | |
391 | 422 |
392 #define WASM_CALL_IMPORT0(index) kExprCallImport, 0, static_cast<byte>(index) | 423 // TODO(titzer): change usages of these macros to put func last. |
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 | |
406 #define WASM_CALL_INDIRECT0(index, func) \ | 424 #define WASM_CALL_INDIRECT0(index, func) \ |
407 func, kExprCallIndirect, 0, static_cast<byte>(index) | 425 func, kExprCallIndirect, static_cast<byte>(index) |
408 #define WASM_CALL_INDIRECT1(index, func, a) \ | 426 #define WASM_CALL_INDIRECT1(index, func, a) \ |
409 func, a, kExprCallIndirect, 1, static_cast<byte>(index) | 427 a, func, kExprCallIndirect, static_cast<byte>(index) |
410 #define WASM_CALL_INDIRECT2(index, func, a, b) \ | 428 #define WASM_CALL_INDIRECT2(index, func, a, b) \ |
411 func, a, b, kExprCallIndirect, 2, static_cast<byte>(index) | 429 a, b, func, kExprCallIndirect, static_cast<byte>(index) |
412 #define WASM_CALL_INDIRECT3(index, func, a, b, c) \ | 430 #define WASM_CALL_INDIRECT3(index, func, a, b, c) \ |
413 func, a, b, c, kExprCallIndirect, 3, static_cast<byte>(index) | 431 a, b, c, func, kExprCallIndirect, static_cast<byte>(index) |
414 #define WASM_CALL_INDIRECT4(index, func, a, b, c, d) \ | 432 #define WASM_CALL_INDIRECT4(index, func, a, b, c, d) \ |
415 func, a, b, c, d, kExprCallIndirect, 4, static_cast<byte>(index) | 433 a, b, c, d, func, kExprCallIndirect, static_cast<byte>(index) |
416 #define WASM_CALL_INDIRECT5(index, func, a, b, c, d, e) \ | 434 #define WASM_CALL_INDIRECT5(index, func, a, b, c, d, e) \ |
417 func, a, b, c, d, e, kExprCallIndirect, 5, static_cast<byte>(index) | 435 a, b, c, d, e, func, kExprCallIndirect, static_cast<byte>(index) |
418 #define WASM_CALL_INDIRECTN(arity, index, func, ...) \ | 436 #define WASM_CALL_INDIRECTN(arity, index, func, ...) \ |
419 func, __VA_ARGS__, kExprCallIndirect, U32V_1(arity), static_cast<byte>(index) | 437 __VA_ARGS__, func, kExprCallIndirect, static_cast<byte>(index) |
420 | 438 |
421 #define WASM_NOT(x) x, kExprI32Eqz | 439 #define WASM_NOT(x) x, kExprI32Eqz |
422 #define WASM_SEQ(...) __VA_ARGS__ | 440 #define WASM_SEQ(...) __VA_ARGS__ |
423 | 441 |
424 //------------------------------------------------------------------------------ | 442 //------------------------------------------------------------------------------ |
425 // Constructs that are composed of multiple bytecodes. | 443 // Constructs that are composed of multiple bytecodes. |
426 //------------------------------------------------------------------------------ | 444 //------------------------------------------------------------------------------ |
427 #define WASM_WHILE(x, y) \ | 445 #define WASM_WHILE(x, y) \ |
428 kExprLoop, x, kExprIf, y, kExprBr, ARITY_1, DEPTH_1, kExprEnd, kExprEnd | 446 kExprLoop, kLocalVoid, x, kExprIf, kLocalVoid, y, kExprBr, DEPTH_1, \ |
| 447 kExprEnd, kExprEnd |
429 #define WASM_INC_LOCAL(index) \ | 448 #define WASM_INC_LOCAL(index) \ |
430 kExprGetLocal, static_cast<byte>(index), kExprI8Const, 1, kExprI32Add, \ | 449 kExprGetLocal, static_cast<byte>(index), kExprI8Const, 1, kExprI32Add, \ |
431 kExprSetLocal, static_cast<byte>(index) | 450 kExprTeeLocal, 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) |
432 #define WASM_INC_LOCAL_BY(index, count) \ | 455 #define WASM_INC_LOCAL_BY(index, count) \ |
433 kExprGetLocal, static_cast<byte>(index), kExprI8Const, \ | 456 kExprGetLocal, static_cast<byte>(index), kExprI8Const, \ |
434 static_cast<byte>(count), kExprI32Add, kExprSetLocal, \ | 457 static_cast<byte>(count), kExprI32Add, kExprSetLocal, \ |
435 static_cast<byte>(index) | 458 static_cast<byte>(index) |
436 #define WASM_UNOP(opcode, x) x, static_cast<byte>(opcode) | 459 #define WASM_UNOP(opcode, x) x, static_cast<byte>(opcode) |
437 #define WASM_BINOP(opcode, x, y) x, y, static_cast<byte>(opcode) | 460 #define WASM_BINOP(opcode, x, y) x, y, static_cast<byte>(opcode) |
438 | 461 |
439 //------------------------------------------------------------------------------ | 462 //------------------------------------------------------------------------------ |
440 // Int32 operations | 463 // Int32 operations |
441 //------------------------------------------------------------------------------ | 464 //------------------------------------------------------------------------------ |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 | 627 |
605 #define SIG_ENTRY_x(r) kWasmFunctionTypeForm, 0, 1, r | 628 #define SIG_ENTRY_x(r) kWasmFunctionTypeForm, 0, 1, r |
606 #define SIG_ENTRY_x_x(r, a) kWasmFunctionTypeForm, 1, a, 1, r | 629 #define SIG_ENTRY_x_x(r, a) kWasmFunctionTypeForm, 1, a, 1, r |
607 #define SIG_ENTRY_x_xx(r, a, b) kWasmFunctionTypeForm, 2, a, b, 1, r | 630 #define SIG_ENTRY_x_xx(r, a, b) kWasmFunctionTypeForm, 2, a, b, 1, r |
608 #define SIG_ENTRY_x_xxx(r, a, b, c) kWasmFunctionTypeForm, 3, a, b, c, 1, r | 631 #define SIG_ENTRY_x_xxx(r, a, b, c) kWasmFunctionTypeForm, 3, a, b, c, 1, r |
609 #define SIZEOF_SIG_ENTRY_x 4 | 632 #define SIZEOF_SIG_ENTRY_x 4 |
610 #define SIZEOF_SIG_ENTRY_x_x 5 | 633 #define SIZEOF_SIG_ENTRY_x_x 5 |
611 #define SIZEOF_SIG_ENTRY_x_xx 6 | 634 #define SIZEOF_SIG_ENTRY_x_xx 6 |
612 #define SIZEOF_SIG_ENTRY_x_xxx 7 | 635 #define SIZEOF_SIG_ENTRY_x_xxx 7 |
613 | 636 |
| 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 |
614 #endif // V8_WASM_MACRO_GEN_H_ | 646 #endif // V8_WASM_MACRO_GEN_H_ |
OLD | NEW |