| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ | 97 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, false)), \ |
| 98 v8::internal::wasm::WasmOpcodes::LoadStoreAccessOf(true), \ | 98 v8::internal::wasm::WasmOpcodes::LoadStoreAccessOf(true), \ |
| 99 static_cast<byte>(offset), index | 99 static_cast<byte>(offset), index |
| 100 #define WASM_STORE_MEM_OFFSET(type, offset, index, val) \ | 100 #define WASM_STORE_MEM_OFFSET(type, offset, index, val) \ |
| 101 static_cast<byte>( \ | 101 static_cast<byte>( \ |
| 102 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, true)), \ | 102 v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf(type, true)), \ |
| 103 v8::internal::wasm::WasmOpcodes::LoadStoreAccessOf(true), \ | 103 v8::internal::wasm::WasmOpcodes::LoadStoreAccessOf(true), \ |
| 104 static_cast<byte>(offset), index, val | 104 static_cast<byte>(offset), index, val |
| 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, ...) \ |
| 108 kExprCallImport, static_cast<byte>(index), __VA_ARGS__ |
| 107 #define WASM_CALL_INDIRECT(index, func, ...) \ | 109 #define WASM_CALL_INDIRECT(index, func, ...) \ |
| 108 kExprCallIndirect, static_cast<byte>(index), func, __VA_ARGS__ | 110 kExprCallIndirect, static_cast<byte>(index), func, __VA_ARGS__ |
| 109 #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) |
| 110 #define WASM_CALL_INDIRECT0(index, func) \ | 113 #define WASM_CALL_INDIRECT0(index, func) \ |
| 111 kExprCallIndirect, static_cast<byte>(index), func | 114 kExprCallIndirect, static_cast<byte>(index), func |
| 112 #define WASM_NOT(x) kExprBoolNot, x | 115 #define WASM_NOT(x) kExprBoolNot, x |
| 113 | 116 |
| 114 //------------------------------------------------------------------------------ | 117 //------------------------------------------------------------------------------ |
| 115 // Constructs that are composed of multiple bytecodes. | 118 // Constructs that are composed of multiple bytecodes. |
| 116 //------------------------------------------------------------------------------ | 119 //------------------------------------------------------------------------------ |
| 117 #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 |
| 118 #define WASM_INC_LOCAL(index) \ | 121 #define WASM_INC_LOCAL(index) \ |
| 119 kExprSetLocal, static_cast<byte>(index), kExprI32Add, kExprGetLocal, \ | 122 kExprSetLocal, static_cast<byte>(index), kExprI32Add, kExprGetLocal, \ |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 #define WASM_F64_SCONVERT_I32(x) kExprF64SConvertI32, x | 259 #define WASM_F64_SCONVERT_I32(x) kExprF64SConvertI32, x |
| 257 #define WASM_F64_UCONVERT_I32(x) kExprF64UConvertI32, x | 260 #define WASM_F64_UCONVERT_I32(x) kExprF64UConvertI32, x |
| 258 #define WASM_F64_SCONVERT_I64(x) kExprF64SConvertI64, x | 261 #define WASM_F64_SCONVERT_I64(x) kExprF64SConvertI64, x |
| 259 #define WASM_F64_UCONVERT_I64(x) kExprF64UConvertI64, x | 262 #define WASM_F64_UCONVERT_I64(x) kExprF64UConvertI64, x |
| 260 #define WASM_F64_CONVERT_F32(x) kExprF64ConvertF32, x | 263 #define WASM_F64_CONVERT_F32(x) kExprF64ConvertF32, x |
| 261 #define WASM_F64_REINTERPRET_I64(x) kExprF64ReinterpretI64, x | 264 #define WASM_F64_REINTERPRET_I64(x) kExprF64ReinterpretI64, x |
| 262 #define WASM_I32_REINTERPRET_F32(x) kExprI32ReinterpretF32, x | 265 #define WASM_I32_REINTERPRET_F32(x) kExprI32ReinterpretF32, x |
| 263 #define WASM_I64_REINTERPRET_F64(x) kExprI64ReinterpretF64, x | 266 #define WASM_I64_REINTERPRET_F64(x) kExprI64ReinterpretF64, x |
| 264 | 267 |
| 265 #endif // V8_WASM_MACRO_GEN_H_ | 268 #endif // V8_WASM_MACRO_GEN_H_ |
| OLD | NEW |