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

Side by Side Diff: src/objects-inl.h

Issue 2302783002: [modules] Basic support of exports (Closed)
Patch Set: . Created 4 years, 3 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
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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 } 785 }
786 786
787 bool HeapObject::IsScriptContextTable() const { 787 bool HeapObject::IsScriptContextTable() const {
788 return map() == GetHeap()->script_context_table_map(); 788 return map() == GetHeap()->script_context_table_map();
789 } 789 }
790 790
791 bool HeapObject::IsScopeInfo() const { 791 bool HeapObject::IsScopeInfo() const {
792 return map() == GetHeap()->scope_info_map(); 792 return map() == GetHeap()->scope_info_map();
793 } 793 }
794 794
795 bool HeapObject::IsModuleInfoEntry() const {
796 return map() == GetHeap()->module_info_entry_map();
797 }
798
795 bool HeapObject::IsModuleInfo() const { 799 bool HeapObject::IsModuleInfo() const {
796 return map() == GetHeap()->module_info_map(); 800 return map() == GetHeap()->module_info_map();
797 } 801 }
798 802
799 TYPE_CHECKER(JSBoundFunction, JS_BOUND_FUNCTION_TYPE) 803 TYPE_CHECKER(JSBoundFunction, JS_BOUND_FUNCTION_TYPE)
800 TYPE_CHECKER(JSFunction, JS_FUNCTION_TYPE) 804 TYPE_CHECKER(JSFunction, JS_FUNCTION_TYPE)
801 805
802 806
803 template <> inline bool Is<JSFunction>(Object* obj) { 807 template <> inline bool Is<JSFunction>(Object* obj) {
804 return obj->IsJSFunction(); 808 return obj->IsJSFunction();
(...skipping 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after
3264 CAST_ACCESSOR(JSBoundFunction) 3268 CAST_ACCESSOR(JSBoundFunction)
3265 CAST_ACCESSOR(JSDataView) 3269 CAST_ACCESSOR(JSDataView)
3266 CAST_ACCESSOR(JSDate) 3270 CAST_ACCESSOR(JSDate)
3267 CAST_ACCESSOR(JSFunction) 3271 CAST_ACCESSOR(JSFunction)
3268 CAST_ACCESSOR(JSGeneratorObject) 3272 CAST_ACCESSOR(JSGeneratorObject)
3269 CAST_ACCESSOR(JSGlobalObject) 3273 CAST_ACCESSOR(JSGlobalObject)
3270 CAST_ACCESSOR(JSGlobalProxy) 3274 CAST_ACCESSOR(JSGlobalProxy)
3271 CAST_ACCESSOR(JSMap) 3275 CAST_ACCESSOR(JSMap)
3272 CAST_ACCESSOR(JSMapIterator) 3276 CAST_ACCESSOR(JSMapIterator)
3273 CAST_ACCESSOR(JSMessageObject) 3277 CAST_ACCESSOR(JSMessageObject)
3278 CAST_ACCESSOR(JSModule)
3274 CAST_ACCESSOR(JSObject) 3279 CAST_ACCESSOR(JSObject)
3275 CAST_ACCESSOR(JSProxy) 3280 CAST_ACCESSOR(JSProxy)
3276 CAST_ACCESSOR(JSReceiver) 3281 CAST_ACCESSOR(JSReceiver)
3277 CAST_ACCESSOR(JSRegExp) 3282 CAST_ACCESSOR(JSRegExp)
3278 CAST_ACCESSOR(JSSet) 3283 CAST_ACCESSOR(JSSet)
3279 CAST_ACCESSOR(JSSetIterator) 3284 CAST_ACCESSOR(JSSetIterator)
3280 CAST_ACCESSOR(JSTypedArray) 3285 CAST_ACCESSOR(JSTypedArray)
3281 CAST_ACCESSOR(JSValue) 3286 CAST_ACCESSOR(JSValue)
3282 CAST_ACCESSOR(JSWeakCollection) 3287 CAST_ACCESSOR(JSWeakCollection)
3283 CAST_ACCESSOR(JSWeakMap) 3288 CAST_ACCESSOR(JSWeakMap)
3284 CAST_ACCESSOR(JSWeakSet) 3289 CAST_ACCESSOR(JSWeakSet)
3285 CAST_ACCESSOR(LayoutDescriptor) 3290 CAST_ACCESSOR(LayoutDescriptor)
3286 CAST_ACCESSOR(Map) 3291 CAST_ACCESSOR(Map)
3292 CAST_ACCESSOR(ModuleInfoEntry)
3287 CAST_ACCESSOR(ModuleInfo) 3293 CAST_ACCESSOR(ModuleInfo)
3288 CAST_ACCESSOR(Name) 3294 CAST_ACCESSOR(Name)
3289 CAST_ACCESSOR(NameDictionary) 3295 CAST_ACCESSOR(NameDictionary)
3290 CAST_ACCESSOR(NormalizedMapCache) 3296 CAST_ACCESSOR(NormalizedMapCache)
3291 CAST_ACCESSOR(Object) 3297 CAST_ACCESSOR(Object)
3292 CAST_ACCESSOR(ObjectHashTable) 3298 CAST_ACCESSOR(ObjectHashTable)
3293 CAST_ACCESSOR(ObjectHashSet) 3299 CAST_ACCESSOR(ObjectHashSet)
3294 CAST_ACCESSOR(Oddball) 3300 CAST_ACCESSOR(Oddball)
3295 CAST_ACCESSOR(OrderedHashMap) 3301 CAST_ACCESSOR(OrderedHashMap)
3296 CAST_ACCESSOR(OrderedHashSet) 3302 CAST_ACCESSOR(OrderedHashSet)
(...skipping 3343 matching lines...) Expand 10 before | Expand all | Expand 10 after
6640 } 6646 }
6641 6647
6642 bool JSGeneratorObject::is_closed() const { 6648 bool JSGeneratorObject::is_closed() const {
6643 return continuation() == kGeneratorClosed; 6649 return continuation() == kGeneratorClosed;
6644 } 6650 }
6645 6651
6646 bool JSGeneratorObject::is_executing() const { 6652 bool JSGeneratorObject::is_executing() const {
6647 return continuation() == kGeneratorExecuting; 6653 return continuation() == kGeneratorExecuting;
6648 } 6654 }
6649 6655
6656 TYPE_CHECKER(JSModule, JS_MODULE_TYPE)
6657
6650 ACCESSORS(JSValue, value, Object, kValueOffset) 6658 ACCESSORS(JSValue, value, Object, kValueOffset)
6651 6659
6652 6660
6653 HeapNumber* HeapNumber::cast(Object* object) { 6661 HeapNumber* HeapNumber::cast(Object* object) {
6654 SLOW_DCHECK(object->IsHeapNumber() || object->IsMutableHeapNumber()); 6662 SLOW_DCHECK(object->IsHeapNumber() || object->IsMutableHeapNumber());
6655 return reinterpret_cast<HeapNumber*>(object); 6663 return reinterpret_cast<HeapNumber*>(object);
6656 } 6664 }
6657 6665
6658 6666
6659 const HeapNumber* HeapNumber::cast(const Object* object) { 6667 const HeapNumber* HeapNumber::cast(const Object* object) {
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after
7912 int ScopeInfo::name() { \ 7920 int ScopeInfo::name() { \
7913 if (length() > 0) { \ 7921 if (length() > 0) { \
7914 return Smi::cast(get(k##name))->value(); \ 7922 return Smi::cast(get(k##name))->value(); \
7915 } else { \ 7923 } else { \
7916 return 0; \ 7924 return 0; \
7917 } \ 7925 } \
7918 } 7926 }
7919 FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(SCOPE_INFO_FIELD_ACCESSORS) 7927 FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(SCOPE_INFO_FIELD_ACCESSORS)
7920 #undef SCOPE_INFO_FIELD_ACCESSORS 7928 #undef SCOPE_INFO_FIELD_ACCESSORS
7921 7929
7930 Object* ModuleInfoEntry::export_name() const { return get(kExportNameIndex); }
7931
7932 Object* ModuleInfoEntry::local_name() const { return get(kLocalNameIndex); }
7933
7934 Object* ModuleInfoEntry::import_name() const { return get(kImportNameIndex); }
7935
7936 Object* ModuleInfoEntry::module_request() const {
7937 return get(kModuleRequestIndex);
7938 }
7939
7922 FixedArray* ModuleInfo::special_exports() const { 7940 FixedArray* ModuleInfo::special_exports() const {
7923 return FixedArray::cast(get(kSpecialExportsIndex)); 7941 return FixedArray::cast(get(kSpecialExportsIndex));
7924 } 7942 }
7925 7943
7926 FixedArray* ModuleInfo::regular_exports() const { 7944 FixedArray* ModuleInfo::regular_exports() const {
7927 return FixedArray::cast(get(kRegularExportsIndex)); 7945 return FixedArray::cast(get(kRegularExportsIndex));
7928 } 7946 }
7929 7947
7930 void Map::ClearCodeCache(Heap* heap) { 7948 void Map::ClearCodeCache(Heap* heap) {
7931 // No write barrier is needed since empty_fixed_array is not in new space. 7949 // No write barrier is needed since empty_fixed_array is not in new space.
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
8255 #undef WRITE_INT64_FIELD 8273 #undef WRITE_INT64_FIELD
8256 #undef READ_BYTE_FIELD 8274 #undef READ_BYTE_FIELD
8257 #undef WRITE_BYTE_FIELD 8275 #undef WRITE_BYTE_FIELD
8258 #undef NOBARRIER_READ_BYTE_FIELD 8276 #undef NOBARRIER_READ_BYTE_FIELD
8259 #undef NOBARRIER_WRITE_BYTE_FIELD 8277 #undef NOBARRIER_WRITE_BYTE_FIELD
8260 8278
8261 } // namespace internal 8279 } // namespace internal
8262 } // namespace v8 8280 } // namespace v8
8263 8281
8264 #endif // V8_OBJECTS_INL_H_ 8282 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698