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

Unified Diff: src/objects-inl.h

Issue 2407183002: [modules] Don't unnecessarily keep function alive after evaluation. (Closed)
Patch Set: Remove stale offset. Created 4 years, 2 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/objects-debug.cc ('k') | test/cctest/interpreter/bytecode-expectations-printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 40cda3140eb36ba54872c3d6a213b00b497acb28..cdfe0d0a86b364881ebff34c7609ea6faf24d6c8 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -5786,17 +5786,25 @@ ACCESSORS(Module, code, Object, kCodeOffset)
ACCESSORS(Module, exports, ObjectHashTable, kExportsOffset)
ACCESSORS(Module, module_namespace, HeapObject, kModuleNamespaceOffset)
ACCESSORS(Module, requested_modules, FixedArray, kRequestedModulesOffset)
-SMI_ACCESSORS(Module, flags, kFlagsOffset)
-BOOL_ACCESSORS(Module, flags, evaluated, kEvaluatedBit)
SMI_ACCESSORS(Module, hash, kHashOffset)
-SharedFunctionInfo* Module::shared() const {
- return code()->IsSharedFunctionInfo() ? SharedFunctionInfo::cast(code())
- : JSFunction::cast(code())->shared();
+bool Module::evaluated() const { return code()->IsModuleInfo(); }
+
+void Module::set_evaluated() {
+ DCHECK(instantiated());
+ DCHECK(!evaluated());
+ return set_code(
+ JSFunction::cast(code())->shared()->scope_info()->ModuleDescriptorInfo());
}
+bool Module::instantiated() const { return !code()->IsSharedFunctionInfo(); }
+
ModuleInfo* Module::info() const {
- return shared()->scope_info()->ModuleDescriptorInfo();
+ if (evaluated()) return ModuleInfo::cast(code());
+ ScopeInfo* scope_info = instantiated()
+ ? JSFunction::cast(code())->shared()->scope_info()
+ : SharedFunctionInfo::cast(code())->scope_info();
+ return scope_info->ModuleDescriptorInfo();
}
ACCESSORS(AccessorPair, getter, Object, kGetterOffset)
« no previous file with comments | « src/objects-debug.cc ('k') | test/cctest/interpreter/bytecode-expectations-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698