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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 uint32_t AddImport(const char* name, int name_length, FunctionSig* sig); | 223 uint32_t AddImport(const char* name, int name_length, FunctionSig* sig); |
224 void SetImportName(uint32_t index, const char* name, int name_length) { | 224 void SetImportName(uint32_t index, const char* name, int name_length) { |
225 imports_[index].name = name; | 225 imports_[index].name = name; |
226 imports_[index].name_length = name_length; | 226 imports_[index].name_length = name_length; |
227 } | 227 } |
228 WasmFunctionBuilder* AddFunction(FunctionSig* sig = nullptr); | 228 WasmFunctionBuilder* AddFunction(FunctionSig* sig = nullptr); |
229 uint32_t AddGlobal(LocalType type, bool exported, bool mutability = true, | 229 uint32_t AddGlobal(LocalType type, bool exported, bool mutability = true, |
230 const WasmInitExpr& init = WasmInitExpr()); | 230 const WasmInitExpr& init = WasmInitExpr()); |
231 void AddDataSegment(const byte* data, uint32_t size, uint32_t dest); | 231 void AddDataSegment(const byte* data, uint32_t size, uint32_t dest); |
232 uint32_t AddSignature(FunctionSig* sig); | 232 uint32_t AddSignature(FunctionSig* sig); |
233 void AddIndirectFunction(uint32_t index); | 233 uint32_t AllocateIndirectFunctions(uint32_t count); |
| 234 void SetIndirectFunction(uint32_t indirect, uint32_t direct); |
234 void MarkStartFunction(WasmFunctionBuilder* builder); | 235 void MarkStartFunction(WasmFunctionBuilder* builder); |
235 | 236 |
236 // Writing methods. | 237 // Writing methods. |
237 void WriteTo(ZoneBuffer& buffer) const; | 238 void WriteTo(ZoneBuffer& buffer) const; |
238 void WriteAsmJsOffsetTable(ZoneBuffer& buffer) const; | 239 void WriteAsmJsOffsetTable(ZoneBuffer& buffer) const; |
239 | 240 |
240 // TODO(titzer): use SignatureMap from signature-map.h here. | 241 // TODO(titzer): use SignatureMap from signature-map.h here. |
241 // This signature map is zone-allocated, but the other is heap allocated. | 242 // This signature map is zone-allocated, but the other is heap allocated. |
242 struct CompareFunctionSigs { | 243 struct CompareFunctionSigs { |
243 bool operator()(FunctionSig* a, FunctionSig* b) const; | 244 bool operator()(FunctionSig* a, FunctionSig* b) const; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 282 |
282 inline FunctionSig* WasmFunctionBuilder::signature() { | 283 inline FunctionSig* WasmFunctionBuilder::signature() { |
283 return builder_->signatures_[signature_index_]; | 284 return builder_->signatures_[signature_index_]; |
284 } | 285 } |
285 | 286 |
286 } // namespace wasm | 287 } // namespace wasm |
287 } // namespace internal | 288 } // namespace internal |
288 } // namespace v8 | 289 } // namespace v8 |
289 | 290 |
290 #endif // V8_WASM_WASM_MODULE_BUILDER_H_ | 291 #endif // V8_WASM_WASM_MODULE_BUILDER_H_ |
OLD | NEW |