| 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. |
| 11 | 11 |
| 12 //------------------------------------------------------------------------------ | 12 //------------------------------------------------------------------------------ |
| 13 // Control. | 13 // Control. |
| 14 //------------------------------------------------------------------------------ | 14 //------------------------------------------------------------------------------ |
| 15 #define WASM_NOP kExprNop | 15 #define WASM_NOP kExprNop |
| 16 | 16 |
| 17 #define WASM_BLOCK(count, ...) kExprBlock, static_cast<byte>(count), __VA_ARGS__ | 17 #define WASM_BLOCK(count, ...) kExprBlock, static_cast<byte>(count), __VA_ARGS__ |
| 18 #define WASM_INFINITE_LOOP kExprLoop, 1, kExprBr, 0, kExprNop | 18 #define WASM_INFINITE_LOOP kExprLoop, 1, kExprBr, 0, kExprNop |
| 19 #define WASM_LOOP(count, ...) kExprLoop, static_cast<byte>(count), __VA_ARGS__ | 19 #define WASM_LOOP(count, ...) kExprLoop, static_cast<byte>(count), __VA_ARGS__ |
| 20 #define WASM_IF(cond, tstmt) kExprIf, cond, tstmt | 20 #define WASM_IF(cond, tstmt) kExprIf, cond, tstmt |
| 21 #define WASM_IF_ELSE(cond, tstmt, fstmt) kExprIfElse, cond, tstmt, fstmt | 21 #define WASM_IF_ELSE(cond, tstmt, fstmt) kExprIfElse, cond, tstmt, fstmt |
| 22 #define WASM_SELECT(cond, tval, fval) kExprSelect, cond, tval, fval | 22 #define WASM_SELECT(cond, tval, fval) kExprSelect, cond, tval, fval |
| 23 #define WASM_BR(depth) kExprBr, static_cast<byte>(depth), kExprNop | 23 #define WASM_BR(depth) kExprBr, static_cast<byte>(depth), kExprNop |
| 24 #define WASM_BR_IF(depth, cond) \ | 24 #define WASM_BR_IF(depth, cond) \ |
| 25 kExprBrIf, static_cast<byte>(depth), cond, kExprNop | 25 kExprBrIf, static_cast<byte>(depth), kExprNop, cond |
| 26 #define WASM_BRV(depth, val) kExprBr, static_cast<byte>(depth), val | 26 #define WASM_BRV(depth, val) kExprBr, static_cast<byte>(depth), val |
| 27 #define WASM_BRV_IF(depth, cond, val) \ | 27 #define WASM_BRV_IF(depth, val, cond) \ |
| 28 kExprBrIf, static_cast<byte>(depth), cond, val | 28 kExprBrIf, static_cast<byte>(depth), val, cond |
| 29 #define WASM_BREAK(depth) kExprBr, static_cast<byte>(depth + 1), kExprNop | 29 #define WASM_BREAK(depth) kExprBr, static_cast<byte>(depth + 1), kExprNop |
| 30 #define WASM_CONTINUE(depth) kExprBr, static_cast<byte>(depth), kExprNop | 30 #define WASM_CONTINUE(depth) kExprBr, static_cast<byte>(depth), kExprNop |
| 31 #define WASM_BREAKV(depth, val) kExprBr, static_cast<byte>(depth + 1), val | 31 #define WASM_BREAKV(depth, val) kExprBr, static_cast<byte>(depth + 1), val |
| 32 #define WASM_RETURN0 kExprReturn | 32 #define WASM_RETURN0 kExprReturn |
| 33 #define WASM_RETURN(...) kExprReturn, __VA_ARGS__ | 33 #define WASM_RETURN(...) kExprReturn, __VA_ARGS__ |
| 34 #define WASM_UNREACHABLE kExprUnreachable | 34 #define WASM_UNREACHABLE kExprUnreachable |
| 35 | 35 |
| 36 #define WASM_TABLESWITCH_OP(case_count, table_count, ...) \ | 36 #define WASM_TABLESWITCH_OP(case_count, table_count, ...) \ |
| 37 kExprTableSwitch, static_cast<byte>(case_count), \ | 37 kExprTableSwitch, static_cast<byte>(case_count), \ |
| 38 static_cast<byte>(case_count >> 8), static_cast<byte>(table_count), \ | 38 static_cast<byte>(case_count >> 8), static_cast<byte>(table_count), \ |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 #define WASM_F64_SCONVERT_I32(x) kExprF64SConvertI32, x | 256 #define WASM_F64_SCONVERT_I32(x) kExprF64SConvertI32, x |
| 257 #define WASM_F64_UCONVERT_I32(x) kExprF64UConvertI32, x | 257 #define WASM_F64_UCONVERT_I32(x) kExprF64UConvertI32, x |
| 258 #define WASM_F64_SCONVERT_I64(x) kExprF64SConvertI64, x | 258 #define WASM_F64_SCONVERT_I64(x) kExprF64SConvertI64, x |
| 259 #define WASM_F64_UCONVERT_I64(x) kExprF64UConvertI64, x | 259 #define WASM_F64_UCONVERT_I64(x) kExprF64UConvertI64, x |
| 260 #define WASM_F64_CONVERT_F32(x) kExprF64ConvertF32, x | 260 #define WASM_F64_CONVERT_F32(x) kExprF64ConvertF32, x |
| 261 #define WASM_F64_REINTERPRET_I64(x) kExprF64ReinterpretI64, x | 261 #define WASM_F64_REINTERPRET_I64(x) kExprF64ReinterpretI64, x |
| 262 #define WASM_I32_REINTERPRET_F32(x) kExprI32ReinterpretF32, x | 262 #define WASM_I32_REINTERPRET_F32(x) kExprI32ReinterpretF32, x |
| 263 #define WASM_I64_REINTERPRET_F64(x) kExprI64ReinterpretF64, x | 263 #define WASM_I64_REINTERPRET_F64(x) kExprI64ReinterpretF64, x |
| 264 | 264 |
| 265 #endif // V8_WASM_MACRO_GEN_H_ | 265 #endif // V8_WASM_MACRO_GEN_H_ |
| OLD | NEW |