 Chromium Code Reviews
 Chromium Code Reviews Issue 2407183002:
  [modules] Don't unnecessarily keep function alive after evaluation.  (Closed)
    
  
    Issue 2407183002:
  [modules] Don't unnecessarily keep function alive after evaluation.  (Closed) 
  | Index: src/objects.h | 
| diff --git a/src/objects.h b/src/objects.h | 
| index f77ac4bc8ea3664643a20395b970e03ab8a6ece3..56ef30b0bd178ad0bcce23a875233c3cd9c509f0 100644 | 
| --- a/src/objects.h | 
| +++ b/src/objects.h | 
| @@ -7907,9 +7907,11 @@ class Module : public Struct { | 
| DECLARE_PRINTER(Module) | 
| // The code representing this Module, either a SharedFunctionInfo or a | 
| - // JSFunction depending on whether it's been instantiated. | 
| + // JSFunction or a ModuleInfo depending on whether it's been instantiated and | 
| + // evaluated. See Module::ModuleVerify() for the precise invariant. | 
| DECL_ACCESSORS(code, Object) | 
| 
adamk
2016/10/11 15:54:05
Some name ideas:
impl
internal
module
 | 
| + // The export table. | 
| DECL_ACCESSORS(exports, ObjectHashTable) | 
| // The namespace object (or undefined). | 
| @@ -7920,13 +7922,6 @@ class Module : public Struct { | 
| // ModuleInfo::module_requests. | 
| DECL_ACCESSORS(requested_modules, FixedArray) | 
| - // [[Evaluated]]: Whether this module has been evaluated. Modules | 
| - // are only evaluated a single time. | 
| - DECL_BOOLEAN_ACCESSORS(evaluated) | 
| - | 
| - // Storage for [[Evaluated]]. | 
| - DECL_INT_ACCESSORS(flags) | 
| - | 
| // Embedder-specified data | 
| DECL_ACCESSORS(embedder_data, Object) | 
| @@ -7939,6 +7934,10 @@ class Module : public Struct { | 
| // Get the ModuleInfo associated with the code. | 
| inline ModuleInfo* info() const; | 
| + inline bool instantiated() const; | 
| + inline bool evaluated() const; | 
| + inline void set_evaluated(); | 
| + | 
| // Implementation of spec operation ModuleDeclarationInstantiation. | 
| // Returns false if an exception occurred during instantiation, true | 
| // otherwise. | 
| @@ -7965,8 +7964,7 @@ class Module : public Struct { | 
| static const int kCodeOffset = HeapObject::kHeaderSize; | 
| static const int kExportsOffset = kCodeOffset + kPointerSize; | 
| static const int kRequestedModulesOffset = kExportsOffset + kPointerSize; | 
| - static const int kFlagsOffset = kRequestedModulesOffset + kPointerSize; | 
| - static const int kEmbedderDataOffset = kFlagsOffset + kPointerSize; | 
| + static const int kEmbedderDataOffset = kRequestedModulesOffset + kPointerSize; | 
| static const int kModuleNamespaceOffset = kEmbedderDataOffset + kPointerSize; | 
| static const int kHashOffset = kModuleNamespaceOffset + kPointerSize; | 
| static const int kSize = kHashOffset + kPointerSize; |