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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 #define WASM_CALL_FUNCTION(index, ...) \ | 105 #define WASM_CALL_FUNCTION(index, ...) \ |
106 kExprCallFunction, static_cast<byte>(index), __VA_ARGS__ | 106 kExprCallFunction, static_cast<byte>(index), __VA_ARGS__ |
107 #define WASM_CALL_IMPORT(index, ...) \ | 107 #define WASM_CALL_IMPORT(index, ...) \ |
108 kExprCallImport, static_cast<byte>(index), __VA_ARGS__ | 108 kExprCallImport, static_cast<byte>(index), __VA_ARGS__ |
109 #define WASM_CALL_INDIRECT(index, func, ...) \ | 109 #define WASM_CALL_INDIRECT(index, func, ...) \ |
110 kExprCallIndirect, static_cast<byte>(index), func, __VA_ARGS__ | 110 kExprCallIndirect, static_cast<byte>(index), func, __VA_ARGS__ |
111 #define WASM_CALL_FUNCTION0(index) kExprCallFunction, static_cast<byte>(index) | 111 #define WASM_CALL_FUNCTION0(index) kExprCallFunction, static_cast<byte>(index) |
112 #define WASM_CALL_IMPORT0(index) kExprCallImport, static_cast<byte>(index) | 112 #define WASM_CALL_IMPORT0(index) kExprCallImport, static_cast<byte>(index) |
113 #define WASM_CALL_INDIRECT0(index, func) \ | 113 #define WASM_CALL_INDIRECT0(index, func) \ |
114 kExprCallIndirect, static_cast<byte>(index), func | 114 kExprCallIndirect, static_cast<byte>(index), func |
115 #define WASM_NOT(x) kExprBoolNot, x | 115 #define WASM_NOT(x) kExprI32Eqz, x |
116 | 116 |
117 //------------------------------------------------------------------------------ | 117 //------------------------------------------------------------------------------ |
118 // Constructs that are composed of multiple bytecodes. | 118 // Constructs that are composed of multiple bytecodes. |
119 //------------------------------------------------------------------------------ | 119 //------------------------------------------------------------------------------ |
120 #define WASM_WHILE(x, y) kExprLoop, 1, kExprIf, x, kExprBr, 0, y | 120 #define WASM_WHILE(x, y) kExprLoop, 1, kExprIf, x, kExprBr, 0, y |
121 #define WASM_INC_LOCAL(index) \ | 121 #define WASM_INC_LOCAL(index) \ |
122 kExprSetLocal, static_cast<byte>(index), kExprI32Add, kExprGetLocal, \ | 122 kExprSetLocal, static_cast<byte>(index), kExprI32Add, kExprGetLocal, \ |
123 static_cast<byte>(index), kExprI8Const, 1 | 123 static_cast<byte>(index), kExprI8Const, 1 |
124 #define WASM_INC_LOCAL_BY(index, count) \ | 124 #define WASM_INC_LOCAL_BY(index, count) \ |
125 kExprSetLocal, static_cast<byte>(index), kExprI32Add, kExprGetLocal, \ | 125 kExprSetLocal, static_cast<byte>(index), kExprI32Add, kExprGetLocal, \ |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 #endif // V8_WASM_MACRO_GEN_H_ | 268 #endif // V8_WASM_MACRO_GEN_H_ |
OLD | NEW |