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

Unified Diff: src/objects-inl.h

Issue 2407183002: [modules] Don't unnecessarily keep function alive after evaluation. (Closed)
Patch Set: 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
« src/objects-debug.cc ('K') | « src/objects-debug.cc ('k') | no next file » | 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 6ea36440b69055a2f603e9e67154889a6467f65e..a6d5035806268bf531bb6245fa4a7bcc814bb511 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -5713,17 +5713,26 @@ 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)
ACCESSORS(Module, embedder_data, Object, kEmbedderDataOffset)
SMI_ACCESSORS(Module, hash, kHashOffset)
SharedFunctionInfo* Module::shared() const {
+ DCHECK(!evaluated());
adamk 2016/10/11 15:54:05 I think I'd prefer killing this method and inlinin
return code()->IsSharedFunctionInfo() ? SharedFunctionInfo::cast(code())
: JSFunction::cast(code())->shared();
}
+bool Module::evaluated() const { return code()->IsModuleInfo(); }
+
+void Module::set_evaluated() {
+ DCHECK(!evaluated());
+ return set_code(shared()->scope_info()->ModuleDescriptorInfo());
+}
+
+bool Module::instantiated() const { return !code()->IsSharedFunctionInfo(); }
+
ModuleInfo* Module::info() const {
+ if (evaluated()) return ModuleInfo::cast(code());
return shared()->scope_info()->ModuleDescriptorInfo();
}
« src/objects-debug.cc ('K') | « src/objects-debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698