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 #define U32_LE(v) \ | 10 #define U32_LE(v) \ |
11 static_cast<byte>(v), static_cast<byte>((v) >> 8), \ | 11 static_cast<byte>(v), static_cast<byte>((v) >> 8), \ |
12 static_cast<byte>((v) >> 16), static_cast<byte>((v) >> 24) | 12 static_cast<byte>((v) >> 16), static_cast<byte>((v) >> 24) |
13 | 13 |
14 #define U16_LE(v) static_cast<byte>(v), static_cast<byte>((v) >> 8) | 14 #define U16_LE(v) static_cast<byte>(v), static_cast<byte>((v) >> 8) |
15 | 15 |
16 #define WASM_MODULE_HEADER U32_LE(kWasmMagic), U32_LE(kWasmVersion) | 16 #define WASM_MODULE_HEADER U32_LE(kWasmMagic), U32_LE(kWasmVersion) |
17 | 17 |
18 #define SIG_INDEX(v) U16_LE(v) | 18 #define SIG_INDEX(v) U16_LE(v) |
| 19 // TODO(binji): make SIG_INDEX match this. |
| 20 #define IMPORT_SIG_INDEX(v) U32V_1(v) |
19 #define FUNC_INDEX(v) U32V_1(v) | 21 #define FUNC_INDEX(v) U32V_1(v) |
20 #define NAME_OFFSET(v) U32_LE(v) | 22 #define NO_NAME U32V_1(0) |
| 23 #define NAME_LENGTH(v) U32V_1(v) |
21 | 24 |
22 #define BR_TARGET(v) U32_LE(v) | 25 #define BR_TARGET(v) U32_LE(v) |
23 | 26 |
24 #define MASK_7 ((1 << 7) - 1) | 27 #define MASK_7 ((1 << 7) - 1) |
25 #define MASK_14 ((1 << 14) - 1) | 28 #define MASK_14 ((1 << 14) - 1) |
26 #define MASK_21 ((1 << 21) - 1) | 29 #define MASK_21 ((1 << 21) - 1) |
27 #define MASK_28 ((1 << 28) - 1) | 30 #define MASK_28 ((1 << 28) - 1) |
28 | 31 |
29 #define U32V_1(x) static_cast<byte>((x)&MASK_7) | 32 #define U32V_1(x) static_cast<byte>((x)&MASK_7) |
30 #define U32V_2(x) \ | 33 #define U32V_2(x) \ |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 #define WASM_F64_SCONVERT_I32(x) kExprF64SConvertI32, x | 504 #define WASM_F64_SCONVERT_I32(x) kExprF64SConvertI32, x |
502 #define WASM_F64_UCONVERT_I32(x) kExprF64UConvertI32, x | 505 #define WASM_F64_UCONVERT_I32(x) kExprF64UConvertI32, x |
503 #define WASM_F64_SCONVERT_I64(x) kExprF64SConvertI64, x | 506 #define WASM_F64_SCONVERT_I64(x) kExprF64SConvertI64, x |
504 #define WASM_F64_UCONVERT_I64(x) kExprF64UConvertI64, x | 507 #define WASM_F64_UCONVERT_I64(x) kExprF64UConvertI64, x |
505 #define WASM_F64_CONVERT_F32(x) kExprF64ConvertF32, x | 508 #define WASM_F64_CONVERT_F32(x) kExprF64ConvertF32, x |
506 #define WASM_F64_REINTERPRET_I64(x) kExprF64ReinterpretI64, x | 509 #define WASM_F64_REINTERPRET_I64(x) kExprF64ReinterpretI64, x |
507 #define WASM_I32_REINTERPRET_F32(x) kExprI32ReinterpretF32, x | 510 #define WASM_I32_REINTERPRET_F32(x) kExprI32ReinterpretF32, x |
508 #define WASM_I64_REINTERPRET_F64(x) kExprI64ReinterpretF64, x | 511 #define WASM_I64_REINTERPRET_F64(x) kExprI64ReinterpretF64, x |
509 | 512 |
510 #endif // V8_WASM_MACRO_GEN_H_ | 513 #endif // V8_WASM_MACRO_GEN_H_ |
OLD | NEW |