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

Side by Side 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 unified diff | 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 »
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 5768 matching lines...) Expand 10 before | Expand all | Expand 10 after
5779 ACCESSORS(JSModuleNamespace, module, Module, kModuleOffset) 5779 ACCESSORS(JSModuleNamespace, module, Module, kModuleOffset)
5780 5780
5781 ACCESSORS(JSFixedArrayIterator, array, FixedArray, kArrayOffset) 5781 ACCESSORS(JSFixedArrayIterator, array, FixedArray, kArrayOffset)
5782 SMI_ACCESSORS(JSFixedArrayIterator, index, kIndexOffset) 5782 SMI_ACCESSORS(JSFixedArrayIterator, index, kIndexOffset)
5783 ACCESSORS(JSFixedArrayIterator, initial_next, JSFunction, kNextOffset) 5783 ACCESSORS(JSFixedArrayIterator, initial_next, JSFunction, kNextOffset)
5784 5784
5785 ACCESSORS(Module, code, Object, kCodeOffset) 5785 ACCESSORS(Module, code, Object, kCodeOffset)
5786 ACCESSORS(Module, exports, ObjectHashTable, kExportsOffset) 5786 ACCESSORS(Module, exports, ObjectHashTable, kExportsOffset)
5787 ACCESSORS(Module, module_namespace, HeapObject, kModuleNamespaceOffset) 5787 ACCESSORS(Module, module_namespace, HeapObject, kModuleNamespaceOffset)
5788 ACCESSORS(Module, requested_modules, FixedArray, kRequestedModulesOffset) 5788 ACCESSORS(Module, requested_modules, FixedArray, kRequestedModulesOffset)
5789 SMI_ACCESSORS(Module, flags, kFlagsOffset)
5790 BOOL_ACCESSORS(Module, flags, evaluated, kEvaluatedBit)
5791 SMI_ACCESSORS(Module, hash, kHashOffset) 5789 SMI_ACCESSORS(Module, hash, kHashOffset)
5792 5790
5793 SharedFunctionInfo* Module::shared() const { 5791 bool Module::evaluated() const { return code()->IsModuleInfo(); }
5794 return code()->IsSharedFunctionInfo() ? SharedFunctionInfo::cast(code()) 5792
5795 : JSFunction::cast(code())->shared(); 5793 void Module::set_evaluated() {
5794 DCHECK(instantiated());
5795 DCHECK(!evaluated());
5796 return set_code(
5797 JSFunction::cast(code())->shared()->scope_info()->ModuleDescriptorInfo());
5796 } 5798 }
5797 5799
5800 bool Module::instantiated() const { return !code()->IsSharedFunctionInfo(); }
5801
5798 ModuleInfo* Module::info() const { 5802 ModuleInfo* Module::info() const {
5799 return shared()->scope_info()->ModuleDescriptorInfo(); 5803 if (evaluated()) return ModuleInfo::cast(code());
5804 ScopeInfo* scope_info = instantiated()
5805 ? JSFunction::cast(code())->shared()->scope_info()
5806 : SharedFunctionInfo::cast(code())->scope_info();
5807 return scope_info->ModuleDescriptorInfo();
5800 } 5808 }
5801 5809
5802 ACCESSORS(AccessorPair, getter, Object, kGetterOffset) 5810 ACCESSORS(AccessorPair, getter, Object, kGetterOffset)
5803 ACCESSORS(AccessorPair, setter, Object, kSetterOffset) 5811 ACCESSORS(AccessorPair, setter, Object, kSetterOffset)
5804 5812
5805 ACCESSORS(AccessCheckInfo, callback, Object, kCallbackOffset) 5813 ACCESSORS(AccessCheckInfo, callback, Object, kCallbackOffset)
5806 ACCESSORS(AccessCheckInfo, named_interceptor, Object, kNamedInterceptorOffset) 5814 ACCESSORS(AccessCheckInfo, named_interceptor, Object, kNamedInterceptorOffset)
5807 ACCESSORS(AccessCheckInfo, indexed_interceptor, Object, 5815 ACCESSORS(AccessCheckInfo, indexed_interceptor, Object,
5808 kIndexedInterceptorOffset) 5816 kIndexedInterceptorOffset)
5809 ACCESSORS(AccessCheckInfo, data, Object, kDataOffset) 5817 ACCESSORS(AccessCheckInfo, data, Object, kDataOffset)
(...skipping 2588 matching lines...) Expand 10 before | Expand all | Expand 10 after
8398 #undef WRITE_INT64_FIELD 8406 #undef WRITE_INT64_FIELD
8399 #undef READ_BYTE_FIELD 8407 #undef READ_BYTE_FIELD
8400 #undef WRITE_BYTE_FIELD 8408 #undef WRITE_BYTE_FIELD
8401 #undef NOBARRIER_READ_BYTE_FIELD 8409 #undef NOBARRIER_READ_BYTE_FIELD
8402 #undef NOBARRIER_WRITE_BYTE_FIELD 8410 #undef NOBARRIER_WRITE_BYTE_FIELD
8403 8411
8404 } // namespace internal 8412 } // namespace internal
8405 } // namespace v8 8413 } // namespace v8
8406 8414
8407 #endif // V8_OBJECTS_INL_H_ 8415 #endif // V8_OBJECTS_INL_H_
OLDNEW
« 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