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

Side by Side Diff: src/wasm/encoder.h

Issue 2165633006: [wasm] Remove special memory type for (internal) globals and use local type instead. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: [wasm] Remove special memory type for (internal) globals and use local type instead. Created 4 years, 5 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/ast-decoder.cc ('k') | src/wasm/encoder.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_ENCODER_H_ 5 #ifndef V8_WASM_ENCODER_H_
6 #define V8_WASM_ENCODER_H_ 6 #define V8_WASM_ENCODER_H_
7 7
8 #include "src/signature.h" 8 #include "src/signature.h"
9 #include "src/zone-containers.h" 9 #include "src/zone-containers.h"
10 10
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 const char* name; 163 const char* name;
164 int name_length; 164 int name_length;
165 }; 165 };
166 166
167 class WasmModuleBuilder : public ZoneObject { 167 class WasmModuleBuilder : public ZoneObject {
168 public: 168 public:
169 explicit WasmModuleBuilder(Zone* zone); 169 explicit WasmModuleBuilder(Zone* zone);
170 170
171 // Building methods. 171 // Building methods.
172 uint32_t AddFunction(); 172 uint32_t AddFunction();
173 uint32_t AddGlobal(MachineType type, bool exported); 173 uint32_t AddGlobal(LocalType type, bool exported);
174 WasmFunctionBuilder* FunctionAt(size_t index); 174 WasmFunctionBuilder* FunctionAt(size_t index);
175 void AddDataSegment(WasmDataSegmentEncoder* data); 175 void AddDataSegment(WasmDataSegmentEncoder* data);
176 uint32_t AddSignature(FunctionSig* sig); 176 uint32_t AddSignature(FunctionSig* sig);
177 void AddIndirectFunction(uint32_t index); 177 void AddIndirectFunction(uint32_t index);
178 void MarkStartFunction(uint32_t index); 178 void MarkStartFunction(uint32_t index);
179 uint32_t AddImport(const char* name, int name_length, FunctionSig* sig); 179 uint32_t AddImport(const char* name, int name_length, FunctionSig* sig);
180 180
181 // Writing methods. 181 // Writing methods.
182 void WriteTo(ZoneBuffer& buffer) const; 182 void WriteTo(ZoneBuffer& buffer) const;
183 183
184 struct CompareFunctionSigs { 184 struct CompareFunctionSigs {
185 bool operator()(FunctionSig* a, FunctionSig* b) const; 185 bool operator()(FunctionSig* a, FunctionSig* b) const;
186 }; 186 };
187 typedef ZoneMap<FunctionSig*, uint32_t, CompareFunctionSigs> SignatureMap; 187 typedef ZoneMap<FunctionSig*, uint32_t, CompareFunctionSigs> SignatureMap;
188 188
189 Zone* zone() { return zone_; } 189 Zone* zone() { return zone_; }
190 190
191 private: 191 private:
192 Zone* zone_; 192 Zone* zone_;
193 ZoneVector<FunctionSig*> signatures_; 193 ZoneVector<FunctionSig*> signatures_;
194 ZoneVector<WasmFunctionImport> imports_; 194 ZoneVector<WasmFunctionImport> imports_;
195 ZoneVector<WasmFunctionBuilder*> functions_; 195 ZoneVector<WasmFunctionBuilder*> functions_;
196 ZoneVector<WasmDataSegmentEncoder*> data_segments_; 196 ZoneVector<WasmDataSegmentEncoder*> data_segments_;
197 ZoneVector<uint32_t> indirect_functions_; 197 ZoneVector<uint32_t> indirect_functions_;
198 ZoneVector<std::pair<MachineType, bool>> globals_; 198 ZoneVector<std::pair<LocalType, bool>> globals_;
199 SignatureMap signature_map_; 199 SignatureMap signature_map_;
200 int start_function_index_; 200 int start_function_index_;
201 }; 201 };
202 202
203 } // namespace wasm 203 } // namespace wasm
204 } // namespace internal 204 } // namespace internal
205 } // namespace v8 205 } // namespace v8
206 206
207 #endif // V8_WASM_ENCODER_H_ 207 #endif // V8_WASM_ENCODER_H_
OLDNEW
« no previous file with comments | « src/wasm/ast-decoder.cc ('k') | src/wasm/encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698