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_WASM_MODULE_BUILDER_H_ | 5 #ifndef V8_WASM_WASM_MODULE_BUILDER_H_ |
6 #define V8_WASM_WASM_MODULE_BUILDER_H_ | 6 #define V8_WASM_WASM_MODULE_BUILDER_H_ |
7 | 7 |
8 #include "src/signature.h" | 8 #include "src/signature.h" |
9 #include "src/zone/zone-containers.h" | 9 #include "src/zone/zone-containers.h" |
10 | 10 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // Building methods. | 208 // Building methods. |
209 uint32_t AddImport(const char* name, int name_length, FunctionSig* sig); | 209 uint32_t AddImport(const char* name, int name_length, FunctionSig* sig); |
210 void SetImportName(uint32_t index, const char* name, int name_length) { | 210 void SetImportName(uint32_t index, const char* name, int name_length) { |
211 imports_[index].name = name; | 211 imports_[index].name = name; |
212 imports_[index].name_length = name_length; | 212 imports_[index].name_length = name_length; |
213 } | 213 } |
214 WasmFunctionBuilder* AddFunction(FunctionSig* sig = nullptr); | 214 WasmFunctionBuilder* AddFunction(FunctionSig* sig = nullptr); |
215 uint32_t AddGlobal(LocalType type, bool exported, bool mutability = true); | 215 uint32_t AddGlobal(LocalType type, bool exported, bool mutability = true); |
216 void AddDataSegment(const byte* data, uint32_t size, uint32_t dest); | 216 void AddDataSegment(const byte* data, uint32_t size, uint32_t dest); |
217 uint32_t AddSignature(FunctionSig* sig); | 217 uint32_t AddSignature(FunctionSig* sig); |
218 void AddIndirectFunction(uint32_t index); | 218 uint32_t AllocateIndirectFunctions(uint32_t count); |
| 219 void SetIndirectFunction(uint32_t indirect, uint32_t direct); |
219 void MarkStartFunction(WasmFunctionBuilder* builder); | 220 void MarkStartFunction(WasmFunctionBuilder* builder); |
220 | 221 |
221 // Writing methods. | 222 // Writing methods. |
222 void WriteTo(ZoneBuffer& buffer) const; | 223 void WriteTo(ZoneBuffer& buffer) const; |
223 | 224 |
224 struct CompareFunctionSigs { | 225 struct CompareFunctionSigs { |
225 bool operator()(FunctionSig* a, FunctionSig* b) const; | 226 bool operator()(FunctionSig* a, FunctionSig* b) const; |
226 }; | 227 }; |
227 typedef ZoneMap<FunctionSig*, uint32_t, CompareFunctionSigs> SignatureMap; | 228 typedef ZoneMap<FunctionSig*, uint32_t, CompareFunctionSigs> SignatureMap; |
228 | 229 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 263 |
263 inline FunctionSig* WasmFunctionBuilder::signature() { | 264 inline FunctionSig* WasmFunctionBuilder::signature() { |
264 return builder_->signatures_[signature_index_]; | 265 return builder_->signatures_[signature_index_]; |
265 } | 266 } |
266 | 267 |
267 } // namespace wasm | 268 } // namespace wasm |
268 } // namespace internal | 269 } // namespace internal |
269 } // namespace v8 | 270 } // namespace v8 |
270 | 271 |
271 #endif // V8_WASM_WASM_MODULE_BUILDER_H_ | 272 #endif // V8_WASM_WASM_MODULE_BUILDER_H_ |
OLD | NEW |