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

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

Issue 1745863002: [wasm] Allocate WasmModule and WasmModuleInstance vectors inline. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 411b6e20d3a085c020a208c959c13b8c31543488..d18c301408fb83824aa70ce4964d741594e43e92 100644
--- a/src/wasm/wasm-module.h
+++ b/src/wasm/wasm-module.h
@@ -116,16 +116,15 @@ struct WasmModule {
int start_function_index; // start function, if any.
ModuleOrigin origin; // origin of the module
- std::vector<WasmGlobal>* globals; // globals in this module.
- std::vector<FunctionSig*>* signatures; // signatures in this module.
- std::vector<WasmFunction>* functions; // functions in this module.
- std::vector<WasmDataSegment>* data_segments; // data segments in this module.
- std::vector<uint16_t>* function_table; // function table.
- std::vector<WasmImport>* import_table; // import table.
- std::vector<WasmExport>* export_table; // export table.
+ std::vector<WasmGlobal> globals; // globals in this module.
+ std::vector<FunctionSig*> signatures; // signatures in this module.
+ std::vector<WasmFunction> functions; // functions in this module.
+ std::vector<WasmDataSegment> data_segments; // data segments in this module.
+ std::vector<uint16_t> function_table; // function table.
+ std::vector<WasmImport> import_table; // import table.
+ std::vector<WasmExport> export_table; // export table.
WasmModule();
- ~WasmModule();
// Get a pointer to a string stored in the module bytes representing a name.
const char* GetName(uint32_t offset) const {
@@ -154,8 +153,8 @@ struct WasmModuleInstance {
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.
- std::vector<Handle<Code>>* import_code; // code objects for each import.
+ std::vector<Handle<Code>> function_code; // code objects for each function.
+ std::vector<Handle<Code>> import_code; // code objects for each import.
// -- raw memory ------------------------------------------------------------
byte* mem_start; // start of linear memory.
size_t mem_size; // size of the linear memory.
@@ -165,7 +164,6 @@ struct WasmModuleInstance {
explicit WasmModuleInstance(WasmModule* m)
: module(m),
- function_code(nullptr),
mem_start(nullptr),
mem_size(0),
globals_start(nullptr),
@@ -184,36 +182,35 @@ struct ModuleEnv {
ModuleOrigin origin;
bool IsValidGlobal(uint32_t index) {
- return module && index < module->globals->size();
+ return module && index < module->globals.size();
}
bool IsValidFunction(uint32_t index) {
- return module && index < module->functions->size();
+ return module && index < module->functions.size();
}
bool IsValidSignature(uint32_t index) {
- return module && index < module->signatures->size();
+ return module && index < module->signatures.size();
}
bool IsValidImport(uint32_t index) {
- return module && index < module->import_table->size();
+ return module && index < module->import_table.size();
}
MachineType GetGlobalType(uint32_t index) {
DCHECK(IsValidGlobal(index));
- return module->globals->at(index).type;
+ return module->globals[index].type;
}
FunctionSig* GetFunctionSignature(uint32_t index) {
DCHECK(IsValidFunction(index));
- return module->functions->at(index).sig;
+ return module->functions[index].sig;
}
FunctionSig* GetImportSignature(uint32_t index) {
DCHECK(IsValidImport(index));
- return module->import_table->at(index).sig;
+ return module->import_table[index].sig;
}
FunctionSig* GetSignature(uint32_t index) {
DCHECK(IsValidSignature(index));
- return module->signatures->at(index);
+ return module->signatures[index];
}
size_t FunctionTableSize() {
- return module && module->function_table ? module->function_table->size()
- : 0;
+ return module ? module->function_table.size() : 0;
}
bool asm_js() { return origin == kAsmJsOrigin; }
« 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