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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 uint32_t AddGlobal(LocalType type, bool exported, bool mutability = true, | 215 uint32_t AddGlobal(LocalType type, bool exported, bool mutability = true, |
216 const WasmInitExpr& init = WasmInitExpr()); | 216 const WasmInitExpr& init = WasmInitExpr()); |
217 void AddDataSegment(const byte* data, uint32_t size, uint32_t dest); | 217 void AddDataSegment(const byte* data, uint32_t size, uint32_t dest); |
218 uint32_t AddSignature(FunctionSig* sig); | 218 uint32_t AddSignature(FunctionSig* sig); |
219 void AddIndirectFunction(uint32_t index); | 219 void AddIndirectFunction(uint32_t index); |
220 void MarkStartFunction(WasmFunctionBuilder* builder); | 220 void MarkStartFunction(WasmFunctionBuilder* builder); |
221 | 221 |
222 // Writing methods. | 222 // Writing methods. |
223 void WriteTo(ZoneBuffer& buffer) const; | 223 void WriteTo(ZoneBuffer& buffer) const; |
224 | 224 |
| 225 // TODO(titzer): use SignatureMap from signature-map.h here. |
| 226 // This signature map is zone-allocated, but the other is heap allocated. |
225 struct CompareFunctionSigs { | 227 struct CompareFunctionSigs { |
226 bool operator()(FunctionSig* a, FunctionSig* b) const; | 228 bool operator()(FunctionSig* a, FunctionSig* b) const; |
227 }; | 229 }; |
228 typedef ZoneMap<FunctionSig*, uint32_t, CompareFunctionSigs> SignatureMap; | 230 typedef ZoneMap<FunctionSig*, uint32_t, CompareFunctionSigs> SignatureMap; |
229 | 231 |
230 Zone* zone() { return zone_; } | 232 Zone* zone() { return zone_; } |
231 | 233 |
232 FunctionSig* GetSignature(uint32_t index) { return signatures_[index]; } | 234 FunctionSig* GetSignature(uint32_t index) { return signatures_[index]; } |
233 | 235 |
234 private: | 236 private: |
(...skipping 29 matching lines...) Expand all Loading... |
264 | 266 |
265 inline FunctionSig* WasmFunctionBuilder::signature() { | 267 inline FunctionSig* WasmFunctionBuilder::signature() { |
266 return builder_->signatures_[signature_index_]; | 268 return builder_->signatures_[signature_index_]; |
267 } | 269 } |
268 | 270 |
269 } // namespace wasm | 271 } // namespace wasm |
270 } // namespace internal | 272 } // namespace internal |
271 } // namespace v8 | 273 } // namespace v8 |
272 | 274 |
273 #endif // V8_WASM_WASM_MODULE_BUILDER_H_ | 275 #endif // V8_WASM_WASM_MODULE_BUILDER_H_ |
OLD | NEW |