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

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 3344 matching lines...) Expand 10 before | Expand all | Expand 10 after
6641 } 6647 }
6642 6648
6643 bool JSGeneratorObject::is_closed() const { 6649 bool JSGeneratorObject::is_closed() const {
6644 return continuation() == kGeneratorClosed; 6650 return continuation() == kGeneratorClosed;
6645 } 6651 }
6646 6652
6647 bool JSGeneratorObject::is_executing() const { 6653 bool JSGeneratorObject::is_executing() const {
6648 return continuation() == kGeneratorExecuting; 6654 return continuation() == kGeneratorExecuting;
6649 } 6655 }
6650 6656
6657 TYPE_CHECKER(JSModule, JS_MODULE_TYPE)
6658
6651 ACCESSORS(JSValue, value, Object, kValueOffset) 6659 ACCESSORS(JSValue, value, Object, kValueOffset)
6652 6660
6653 6661
6654 HeapNumber* HeapNumber::cast(Object* object) { 6662 HeapNumber* HeapNumber::cast(Object* object) {
6655 SLOW_DCHECK(object->IsHeapNumber() || object->IsMutableHeapNumber()); 6663 SLOW_DCHECK(object->IsHeapNumber() || object->IsMutableHeapNumber());
6656 return reinterpret_cast<HeapNumber*>(object); 6664 return reinterpret_cast<HeapNumber*>(object);
6657 } 6665 }
6658 6666
6659 6667
6660 const HeapNumber* HeapNumber::cast(const Object* object) { 6668 const HeapNumber* HeapNumber::cast(const Object* object) {
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after
7913 int ScopeInfo::name() { \ 7921 int ScopeInfo::name() { \
7914 if (length() > 0) { \ 7922 if (length() > 0) { \
7915 return Smi::cast(get(k##name))->value(); \ 7923 return Smi::cast(get(k##name))->value(); \
7916 } else { \ 7924 } else { \
7917 return 0; \ 7925 return 0; \
7918 } \ 7926 } \
7919 } 7927 }
7920 FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(SCOPE_INFO_FIELD_ACCESSORS) 7928 FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(SCOPE_INFO_FIELD_ACCESSORS)
7921 #undef SCOPE_INFO_FIELD_ACCESSORS 7929 #undef SCOPE_INFO_FIELD_ACCESSORS
7922 7930
7931 Object* ModuleInfoEntry::export_name() const { return get(kExportNameIndex); }
7932
7933 Object* ModuleInfoEntry::local_name() const { return get(kLocalNameIndex); }
7934
7935 Object* ModuleInfoEntry::import_name() const { return get(kImportNameIndex); }
7936
7937 Object* ModuleInfoEntry::module_request() const {
7938 return get(kModuleRequestIndex);
7939 }
7940
7923 FixedArray* ModuleInfo::special_exports() const { 7941 FixedArray* ModuleInfo::special_exports() const {
7924 return FixedArray::cast(get(kSpecialExportsIndex)); 7942 return FixedArray::cast(get(kSpecialExportsIndex));
7925 } 7943 }
7926 7944
7927 FixedArray* ModuleInfo::regular_exports() const { 7945 FixedArray* ModuleInfo::regular_exports() const {
7928 return FixedArray::cast(get(kRegularExportsIndex)); 7946 return FixedArray::cast(get(kRegularExportsIndex));
7929 } 7947 }
7930 7948
7931 void Map::ClearCodeCache(Heap* heap) { 7949 void Map::ClearCodeCache(Heap* heap) {
7932 // No write barrier is needed since empty_fixed_array is not in new space. 7950 // 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
8256 #undef WRITE_INT64_FIELD 8274 #undef WRITE_INT64_FIELD
8257 #undef READ_BYTE_FIELD 8275 #undef READ_BYTE_FIELD
8258 #undef WRITE_BYTE_FIELD 8276 #undef WRITE_BYTE_FIELD
8259 #undef NOBARRIER_READ_BYTE_FIELD 8277 #undef NOBARRIER_READ_BYTE_FIELD
8260 #undef NOBARRIER_WRITE_BYTE_FIELD 8278 #undef NOBARRIER_WRITE_BYTE_FIELD
8261 8279
8262 } // namespace internal 8280 } // namespace internal
8263 } // namespace v8 8281 } // namespace v8
8264 8282
8265 #endif // V8_OBJECTS_INL_H_ 8283 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698