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

Side by Side 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 unified diff | Download patch
« src/objects-debug.cc ('K') | « src/objects-debug.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 5695 matching lines...) Expand 10 before | Expand all | Expand 10 after
5706 5706
5707 ACCESSORS(ContextExtension, scope_info, ScopeInfo, kScopeInfoOffset) 5707 ACCESSORS(ContextExtension, scope_info, ScopeInfo, kScopeInfoOffset)
5708 ACCESSORS(ContextExtension, extension, Object, kExtensionOffset) 5708 ACCESSORS(ContextExtension, extension, Object, kExtensionOffset)
5709 5709
5710 ACCESSORS(JSModuleNamespace, module, Module, kModuleOffset) 5710 ACCESSORS(JSModuleNamespace, module, Module, kModuleOffset)
5711 5711
5712 ACCESSORS(Module, code, Object, kCodeOffset) 5712 ACCESSORS(Module, code, Object, kCodeOffset)
5713 ACCESSORS(Module, exports, ObjectHashTable, kExportsOffset) 5713 ACCESSORS(Module, exports, ObjectHashTable, kExportsOffset)
5714 ACCESSORS(Module, module_namespace, HeapObject, kModuleNamespaceOffset) 5714 ACCESSORS(Module, module_namespace, HeapObject, kModuleNamespaceOffset)
5715 ACCESSORS(Module, requested_modules, FixedArray, kRequestedModulesOffset) 5715 ACCESSORS(Module, requested_modules, FixedArray, kRequestedModulesOffset)
5716 SMI_ACCESSORS(Module, flags, kFlagsOffset)
5717 BOOL_ACCESSORS(Module, flags, evaluated, kEvaluatedBit)
5718 ACCESSORS(Module, embedder_data, Object, kEmbedderDataOffset) 5716 ACCESSORS(Module, embedder_data, Object, kEmbedderDataOffset)
5719 SMI_ACCESSORS(Module, hash, kHashOffset) 5717 SMI_ACCESSORS(Module, hash, kHashOffset)
5720 5718
5721 SharedFunctionInfo* Module::shared() const { 5719 SharedFunctionInfo* Module::shared() const {
5720 DCHECK(!evaluated());
adamk 2016/10/11 15:54:05 I think I'd prefer killing this method and inlinin
5722 return code()->IsSharedFunctionInfo() ? SharedFunctionInfo::cast(code()) 5721 return code()->IsSharedFunctionInfo() ? SharedFunctionInfo::cast(code())
5723 : JSFunction::cast(code())->shared(); 5722 : JSFunction::cast(code())->shared();
5724 } 5723 }
5725 5724
5725 bool Module::evaluated() const { return code()->IsModuleInfo(); }
5726
5727 void Module::set_evaluated() {
5728 DCHECK(!evaluated());
5729 return set_code(shared()->scope_info()->ModuleDescriptorInfo());
5730 }
5731
5732 bool Module::instantiated() const { return !code()->IsSharedFunctionInfo(); }
5733
5726 ModuleInfo* Module::info() const { 5734 ModuleInfo* Module::info() const {
5735 if (evaluated()) return ModuleInfo::cast(code());
5727 return shared()->scope_info()->ModuleDescriptorInfo(); 5736 return shared()->scope_info()->ModuleDescriptorInfo();
5728 } 5737 }
5729 5738
5730 ACCESSORS(AccessorPair, getter, Object, kGetterOffset) 5739 ACCESSORS(AccessorPair, getter, Object, kGetterOffset)
5731 ACCESSORS(AccessorPair, setter, Object, kSetterOffset) 5740 ACCESSORS(AccessorPair, setter, Object, kSetterOffset)
5732 5741
5733 ACCESSORS(AccessCheckInfo, callback, Object, kCallbackOffset) 5742 ACCESSORS(AccessCheckInfo, callback, Object, kCallbackOffset)
5734 ACCESSORS(AccessCheckInfo, named_interceptor, Object, kNamedInterceptorOffset) 5743 ACCESSORS(AccessCheckInfo, named_interceptor, Object, kNamedInterceptorOffset)
5735 ACCESSORS(AccessCheckInfo, indexed_interceptor, Object, 5744 ACCESSORS(AccessCheckInfo, indexed_interceptor, Object,
5736 kIndexedInterceptorOffset) 5745 kIndexedInterceptorOffset)
(...skipping 2589 matching lines...) Expand 10 before | Expand all | Expand 10 after
8326 #undef WRITE_INT64_FIELD 8335 #undef WRITE_INT64_FIELD
8327 #undef READ_BYTE_FIELD 8336 #undef READ_BYTE_FIELD
8328 #undef WRITE_BYTE_FIELD 8337 #undef WRITE_BYTE_FIELD
8329 #undef NOBARRIER_READ_BYTE_FIELD 8338 #undef NOBARRIER_READ_BYTE_FIELD
8330 #undef NOBARRIER_WRITE_BYTE_FIELD 8339 #undef NOBARRIER_WRITE_BYTE_FIELD
8331 8340
8332 } // namespace internal 8341 } // namespace internal
8333 } // namespace v8 8342 } // namespace v8
8334 8343
8335 #endif // V8_OBJECTS_INL_H_ 8344 #endif // V8_OBJECTS_INL_H_
OLDNEW
« 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