Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Side by Side Diff: src/wasm/wasm-module-builder.h

Issue 2403093002: [wasm] Canonicalize function signature indices for matching in indirect calls. (Closed)
Patch Set: Address review comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 uint32_t AddGlobal(LocalType type, bool exported, bool mutability = true, 222 uint32_t AddGlobal(LocalType type, bool exported, bool mutability = true,
223 const WasmInitExpr& init = WasmInitExpr()); 223 const WasmInitExpr& init = WasmInitExpr());
224 void AddDataSegment(const byte* data, uint32_t size, uint32_t dest); 224 void AddDataSegment(const byte* data, uint32_t size, uint32_t dest);
225 uint32_t AddSignature(FunctionSig* sig); 225 uint32_t AddSignature(FunctionSig* sig);
226 void AddIndirectFunction(uint32_t index); 226 void AddIndirectFunction(uint32_t index);
227 void MarkStartFunction(WasmFunctionBuilder* builder); 227 void MarkStartFunction(WasmFunctionBuilder* builder);
228 228
229 // Writing methods. 229 // Writing methods.
230 void WriteTo(ZoneBuffer& buffer) const; 230 void WriteTo(ZoneBuffer& buffer) const;
231 231
232 // TODO(titzer): use SignatureMap from signature-map.h here.
233 // This signature map is zone-allocated, but the other is heap allocated.
232 struct CompareFunctionSigs { 234 struct CompareFunctionSigs {
233 bool operator()(FunctionSig* a, FunctionSig* b) const; 235 bool operator()(FunctionSig* a, FunctionSig* b) const;
234 }; 236 };
235 typedef ZoneMap<FunctionSig*, uint32_t, CompareFunctionSigs> SignatureMap; 237 typedef ZoneMap<FunctionSig*, uint32_t, CompareFunctionSigs> SignatureMap;
236 238
237 Zone* zone() { return zone_; } 239 Zone* zone() { return zone_; }
238 240
239 FunctionSig* GetSignature(uint32_t index) { return signatures_[index]; } 241 FunctionSig* GetSignature(uint32_t index) { return signatures_[index]; }
240 242
241 private: 243 private:
(...skipping 29 matching lines...) Expand all
271 273
272 inline FunctionSig* WasmFunctionBuilder::signature() { 274 inline FunctionSig* WasmFunctionBuilder::signature() {
273 return builder_->signatures_[signature_index_]; 275 return builder_->signatures_[signature_index_];
274 } 276 }
275 277
276 } // namespace wasm 278 } // namespace wasm
277 } // namespace internal 279 } // namespace internal
278 } // namespace v8 280 } // namespace v8
279 281
280 #endif // V8_WASM_WASM_MODULE_BUILDER_H_ 282 #endif // V8_WASM_WASM_MODULE_BUILDER_H_
OLDNEW
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698