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

Unified Diff: src/wasm/wasm-module.h

Issue 1637923002: [wasm] Factor out WasmModuleInstance from ModuleEnv. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Finish comment. Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/module-decoder.cc ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.h
diff --git a/src/wasm/wasm-module.h b/src/wasm/wasm-module.h
index 5e2ba58a441dd237e9c3258cfee676dd4eb1670d..5e84945da9a6d3828b90e8589a2dff56b1babd57 100644
--- a/src/wasm/wasm-module.h
+++ b/src/wasm/wasm-module.h
@@ -121,22 +121,41 @@ struct WasmModule {
Handle<JSArrayBuffer> memory);
};
+// An instantiated WASM module, including memory, function table, etc.
+struct WasmModuleInstance {
+ WasmModule* module; // static representation of the module.
+ // -- Heap allocated --------------------------------------------------------
+ Handle<JSObject> js_object; // JavaScript module object.
+ Handle<Context> context; // JavaScript native context.
+ Handle<JSArrayBuffer> mem_buffer; // Handle to array buffer of memory.
+ Handle<JSArrayBuffer> globals_buffer; // Handle to array buffer of globals.
+ Handle<FixedArray> function_table; // indirect function table.
+ std::vector<Handle<Code>>* function_code; // code objects for each function.
+ // -- raw memory ------------------------------------------------------------
+ byte* mem_start; // start of linear memory.
+ size_t mem_size; // size of the linear memory.
+ // -- raw globals -----------------------------------------------------------
+ byte* globals_start; // start of the globals area.
+ size_t globals_size; // size of the globals area.
+
+ explicit WasmModuleInstance(WasmModule* m)
+ : module(m),
+ function_code(nullptr),
+ mem_start(nullptr),
+ mem_size(0),
+ globals_start(nullptr),
+ globals_size(0) {}
+};
+
// forward declaration.
class WasmLinker;
// Interface provided to the decoder/graph builder which contains only
// minimal information about the globals, functions, and function tables.
struct ModuleEnv {
- uintptr_t globals_area; // address of the globals area.
- uintptr_t mem_start; // address of the start of linear memory.
- uintptr_t mem_end; // address of the end of linear memory.
-
WasmModule* module;
+ WasmModuleInstance* instance;
WasmLinker* linker;
- std::vector<Handle<Code>>* function_code;
- Handle<FixedArray> function_table;
- Handle<JSArrayBuffer> memory;
- Handle<Context> context;
bool asm_js; // true if the module originated from asm.js.
bool IsValidGlobal(uint32_t index) {
« no previous file with comments | « src/wasm/module-decoder.cc ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698