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

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

Issue 2771803005: Hide WasmModule.origin field behind readable accessors. (Closed)
Patch Set: Use boolean accessors instead of get_origin. Created 3 years, 9 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 bfedbff61fb720e5c66da75fa5ed300544e19a63..ca0be798cc79dce8f22b3bc4853066beb77d48c8 100644
--- a/src/wasm/wasm-module.h
+++ b/src/wasm/wasm-module.h
@@ -154,7 +154,6 @@ struct V8_EXPORT_PRIVATE WasmModule {
// the fact that we index on uint32_t, so we may technically not be
// able to represent some start_function_index -es.
int start_function_index = -1; // start function, if any
- ModuleOrigin origin = kWasmOrigin; // origin of the module
std::vector<WasmGlobal> globals; // globals in this module.
uint32_t globals_size = 0; // size of globals table.
@@ -182,6 +181,15 @@ struct V8_EXPORT_PRIVATE WasmModule {
~WasmModule() {
if (owned_zone) delete owned_zone;
}
+
+ ModuleOrigin get_origin() const { return origin_; }
+ void set_origin(ModuleOrigin new_value) { origin_ = new_value; }
+ bool is_wasm() const { return origin_ == kWasmOrigin; }
+ bool is_asm_js() const { return origin_ == kAsmJsOrigin; }
+
+ private:
+ // TODO(kschimpf) - Encapsulate more fields.
+ ModuleOrigin origin_ = kWasmOrigin; // origin of the module
};
typedef Managed<WasmModule> WasmModuleWrapper;
@@ -318,7 +326,7 @@ struct V8_EXPORT_PRIVATE ModuleEnv {
return &module->function_tables[index];
}
- bool asm_js() { return module->origin == kAsmJsOrigin; }
+ bool asm_js() { return module->is_asm_js(); }
// Only used for testing.
Handle<Code> GetFunctionCode(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