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 // Convenience macros for building Wasm bytecode directly into a byte array. | 10 // Convenience macros for building Wasm bytecode directly into a byte array. |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 #define WASM_F32_REINTERPRET_I32(x) kExprF32ReinterpretI32, x | 258 #define WASM_F32_REINTERPRET_I32(x) kExprF32ReinterpretI32, x |
259 #define WASM_F64_SCONVERT_I32(x) kExprF64SConvertI32, x | 259 #define WASM_F64_SCONVERT_I32(x) kExprF64SConvertI32, x |
260 #define WASM_F64_UCONVERT_I32(x) kExprF64UConvertI32, x | 260 #define WASM_F64_UCONVERT_I32(x) kExprF64UConvertI32, x |
261 #define WASM_F64_SCONVERT_I64(x) kExprF64SConvertI64, x | 261 #define WASM_F64_SCONVERT_I64(x) kExprF64SConvertI64, x |
262 #define WASM_F64_UCONVERT_I64(x) kExprF64UConvertI64, x | 262 #define WASM_F64_UCONVERT_I64(x) kExprF64UConvertI64, x |
263 #define WASM_F64_CONVERT_F32(x) kExprF64ConvertF32, x | 263 #define WASM_F64_CONVERT_F32(x) kExprF64ConvertF32, x |
264 #define WASM_F64_REINTERPRET_I64(x) kExprF64ReinterpretI64, x | 264 #define WASM_F64_REINTERPRET_I64(x) kExprF64ReinterpretI64, x |
265 #define WASM_I32_REINTERPRET_F32(x) kExprI32ReinterpretF32, x | 265 #define WASM_I32_REINTERPRET_F32(x) kExprI32ReinterpretF32, x |
266 #define WASM_I64_REINTERPRET_F64(x) kExprI64ReinterpretF64, x | 266 #define WASM_I64_REINTERPRET_F64(x) kExprI64ReinterpretF64, x |
267 | 267 |
| 268 #define U32_LE(v) \ |
| 269 static_cast<byte>(v), static_cast<byte>((v) >> 8), \ |
| 270 static_cast<byte>((v) >> 16), static_cast<byte>((v) >> 24) |
| 271 |
| 272 #define U16_LE(v) static_cast<byte>(v), static_cast<byte>((v) >> 8) |
| 273 |
| 274 #define WASM_MODULE_HEADER U32_LE(kWasmMagic), U32_LE(kWasmVersion) |
| 275 |
| 276 #define SIG_INDEX(v) U16_LE(v) |
| 277 #define FUNC_INDEX(v) U16_LE(v) |
| 278 #define NAME_OFFSET(v) U32_LE(v) |
| 279 |
268 #endif // V8_WASM_MACRO_GEN_H_ | 280 #endif // V8_WASM_MACRO_GEN_H_ |
OLD | NEW |