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

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

Issue 2008043006: [wasm] separate snapshot-able stages (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@refactoring
Patch Set: Created 4 years, 6 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/compiler/wasm-compiler.cc ('k') | src/wasm/wasm-module.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_MODULE_H_ 5 #ifndef V8_WASM_MODULE_H_
6 #define V8_WASM_MODULE_H_ 6 #define V8_WASM_MODULE_H_
7 7
8 #include "src/wasm/wasm-opcodes.h" 8 #include "src/wasm/wasm-opcodes.h"
9 #include "src/wasm/wasm-result.h" 9 #include "src/wasm/wasm-result.h"
10 10
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 Handle<FixedArray> function_table; // indirect function table. 224 Handle<FixedArray> function_table; // indirect function table.
225 std::vector<Handle<Code>> function_code; // code objects for each function. 225 std::vector<Handle<Code>> function_code; // code objects for each function.
226 std::vector<Handle<Code>> import_code; // code objects for each import. 226 std::vector<Handle<Code>> import_code; // code objects for each import.
227 // -- raw memory ------------------------------------------------------------ 227 // -- raw memory ------------------------------------------------------------
228 byte* mem_start; // start of linear memory. 228 byte* mem_start; // start of linear memory.
229 size_t mem_size; // size of the linear memory. 229 size_t mem_size; // size of the linear memory.
230 // -- raw globals ----------------------------------------------------------- 230 // -- raw globals -----------------------------------------------------------
231 byte* globals_start; // start of the globals area. 231 byte* globals_start; // start of the globals area.
232 232
233 explicit WasmModuleInstance(const WasmModule* m) 233 explicit WasmModuleInstance(const WasmModule* m)
234 : module(m), mem_start(nullptr), mem_size(0), globals_start(nullptr) {} 234 : module(m),
235 function_code(m->functions.size()),
236 mem_start(nullptr),
237 mem_size(0),
238 globals_start(nullptr) {}
235 }; 239 };
236 240
237 // forward declaration. 241 // forward declaration.
238 class WasmLinker; 242 class WasmLinker;
239 243
240 // Interface provided to the decoder/graph builder which contains only 244 // Interface provided to the decoder/graph builder which contains only
241 // minimal information about the globals, functions, and function tables. 245 // minimal information about the globals, functions, and function tables.
242 struct ModuleEnv { 246 struct ModuleEnv {
243 const WasmModule* module; 247 const WasmModule* module;
244 WasmModuleInstance* instance; 248 WasmModuleInstance* instance;
245 WasmLinker* linker; 249 WasmLinker* linker;
246 ModuleOrigin origin; 250 ModuleOrigin origin;
247 251
248 bool IsValidGlobal(uint32_t index) { 252 bool IsValidGlobal(uint32_t index) {
249 return module && index < module->globals.size(); 253 return module && index < module->globals.size();
250 } 254 }
251 bool IsValidFunction(uint32_t index) { 255 bool IsValidFunction(uint32_t index) const {
252 return module && index < module->functions.size(); 256 return module && index < module->functions.size();
253 } 257 }
254 bool IsValidSignature(uint32_t index) { 258 bool IsValidSignature(uint32_t index) {
255 return module && index < module->signatures.size(); 259 return module && index < module->signatures.size();
256 } 260 }
257 bool IsValidImport(uint32_t index) { 261 bool IsValidImport(uint32_t index) {
258 return module && index < module->import_table.size(); 262 return module && index < module->import_table.size();
259 } 263 }
260 MachineType GetGlobalType(uint32_t index) { 264 MachineType GetGlobalType(uint32_t index) {
261 DCHECK(IsValidGlobal(index)); 265 DCHECK(IsValidGlobal(index));
(...skipping 10 matching lines...) Expand all
272 FunctionSig* GetSignature(uint32_t index) { 276 FunctionSig* GetSignature(uint32_t index) {
273 DCHECK(IsValidSignature(index)); 277 DCHECK(IsValidSignature(index));
274 return module->signatures[index]; 278 return module->signatures[index];
275 } 279 }
276 size_t FunctionTableSize() { 280 size_t FunctionTableSize() {
277 return module ? module->function_table.size() : 0; 281 return module ? module->function_table.size() : 0;
278 } 282 }
279 283
280 bool asm_js() { return origin == kAsmJsOrigin; } 284 bool asm_js() { return origin == kAsmJsOrigin; }
281 285
282 Handle<Code> GetFunctionCode(uint32_t index); 286 Handle<Code> GetCodeOrPlaceholder(uint32_t index) const;
283 Handle<Code> GetImportCode(uint32_t index); 287 Handle<Code> GetImportCode(uint32_t index);
284 Handle<FixedArray> GetFunctionTable(); 288 Handle<FixedArray> GetFunctionTable();
285 289
286 static compiler::CallDescriptor* GetWasmCallDescriptor(Zone* zone, 290 static compiler::CallDescriptor* GetWasmCallDescriptor(Zone* zone,
287 FunctionSig* sig); 291 FunctionSig* sig);
288 static compiler::CallDescriptor* GetI32WasmCallDescriptor( 292 static compiler::CallDescriptor* GetI32WasmCallDescriptor(
289 Zone* zone, compiler::CallDescriptor* descriptor); 293 Zone* zone, compiler::CallDescriptor* descriptor);
290 compiler::CallDescriptor* GetCallDescriptor(Zone* zone, uint32_t index); 294 compiler::CallDescriptor* GetCallDescriptor(Zone* zone, uint32_t index);
291 }; 295 };
292 296
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 // secure. If it turns out that we need more complete checks, we could add a 329 // secure. If it turns out that we need more complete checks, we could add a
326 // special marker as internal field, which will definitely never occur anywhere 330 // special marker as internal field, which will definitely never occur anywhere
327 // else. 331 // else.
328 bool IsWasmObject(Handle<JSObject> object); 332 bool IsWasmObject(Handle<JSObject> object);
329 333
330 } // namespace wasm 334 } // namespace wasm
331 } // namespace internal 335 } // namespace internal
332 } // namespace v8 336 } // namespace v8
333 337
334 #endif // V8_WASM_MODULE_H_ 338 #endif // V8_WASM_MODULE_H_
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698