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 #include "src/zone-containers.h" | 10 #include "src/zone-containers.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 size_t pos = Emit(buffer); | 146 size_t pos = Emit(buffer); |
147 memcpy(buffer + pos, *start, size); | 147 memcpy(buffer + pos, *start, size); |
148 pos += size; | 148 pos += size; |
149 *start = buffer; | 149 *start = buffer; |
150 *end = buffer + pos; | 150 *end = buffer + pos; |
151 } | 151 } |
152 | 152 |
153 size_t Emit(byte* buffer) const { | 153 size_t Emit(byte* buffer) const { |
154 size_t pos = 0; | 154 size_t pos = 0; |
155 pos = WriteUint32v(buffer, pos, static_cast<uint32_t>(local_decls.size())); | 155 pos = WriteUint32v(buffer, pos, static_cast<uint32_t>(local_decls.size())); |
156 for (size_t i = 0; i < local_decls.size(); i++) { | 156 for (size_t i = 0; i < local_decls.size(); ++i) { |
157 pos = WriteUint32v(buffer, pos, local_decls[i].first); | 157 pos = WriteUint32v(buffer, pos, local_decls[i].first); |
158 buffer[pos++] = WasmOpcodes::LocalTypeCodeFor(local_decls[i].second); | 158 buffer[pos++] = WasmOpcodes::LocalTypeCodeFor(local_decls[i].second); |
159 } | 159 } |
160 DCHECK_EQ(Size(), pos); | 160 DCHECK_EQ(Size(), pos); |
161 return pos; | 161 return pos; |
162 } | 162 } |
163 | 163 |
164 // Add locals declarations to this helper. Return the index of the newly added | 164 // Add locals declarations to this helper. Return the index of the newly added |
165 // local(s), with an optional adjustment for the parameters. | 165 // local(s), with an optional adjustment for the parameters. |
166 uint32_t AddLocals(uint32_t count, LocalType type) { | 166 uint32_t AddLocals(uint32_t count, LocalType type) { |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 #define SIG_ENTRY_x(r) kWasmFunctionTypeForm, 0, 1, r | 592 #define SIG_ENTRY_x(r) kWasmFunctionTypeForm, 0, 1, r |
593 #define SIG_ENTRY_x_x(r, a) kWasmFunctionTypeForm, 1, a, 1, r | 593 #define SIG_ENTRY_x_x(r, a) kWasmFunctionTypeForm, 1, a, 1, r |
594 #define SIG_ENTRY_x_xx(r, a, b) kWasmFunctionTypeForm, 2, a, b, 1, r | 594 #define SIG_ENTRY_x_xx(r, a, b) kWasmFunctionTypeForm, 2, a, b, 1, r |
595 #define SIG_ENTRY_x_xxx(r, a, b, c) kWasmFunctionTypeForm, 3, a, b, c, 1, r | 595 #define SIG_ENTRY_x_xxx(r, a, b, c) kWasmFunctionTypeForm, 3, a, b, c, 1, r |
596 #define SIZEOF_SIG_ENTRY_x 4 | 596 #define SIZEOF_SIG_ENTRY_x 4 |
597 #define SIZEOF_SIG_ENTRY_x_x 5 | 597 #define SIZEOF_SIG_ENTRY_x_x 5 |
598 #define SIZEOF_SIG_ENTRY_x_xx 6 | 598 #define SIZEOF_SIG_ENTRY_x_xx 6 |
599 #define SIZEOF_SIG_ENTRY_x_xxx 7 | 599 #define SIZEOF_SIG_ENTRY_x_xxx 7 |
600 | 600 |
601 #endif // V8_WASM_MACRO_GEN_H_ | 601 #endif // V8_WASM_MACRO_GEN_H_ |
OLD | NEW |