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

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

Issue 1767113004: [esnext] handle elements in FastObjectValuesOrEntries() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Make ElementsAccessor::GetCapacity() public, and use it Created 4 years, 9 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.cc ('k') | test/mjsunit/harmony/object-entries.js » ('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 7727 matching lines...) Expand 10 before | Expand all | Expand 10 after
7738 } 7738 }
7739 7739
7740 7740
7741 // Predictably converts HeapObject* or Address to uint32 by calculating 7741 // Predictably converts HeapObject* or Address to uint32 by calculating
7742 // offset of the address in respective MemoryChunk. 7742 // offset of the address in respective MemoryChunk.
7743 static inline uint32_t ObjectAddressForHashing(void* object) { 7743 static inline uint32_t ObjectAddressForHashing(void* object) {
7744 uint32_t value = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(object)); 7744 uint32_t value = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(object));
7745 return value & MemoryChunk::kAlignmentMask; 7745 return value & MemoryChunk::kAlignmentMask;
7746 } 7746 }
7747 7747
7748 static inline Handle<Object> MakeEntryPair(Isolate* isolate, uint32_t index,
7749 Handle<Object> value) {
7750 Handle<Object> key = isolate->factory()->Uint32ToString(index);
7751 Handle<FixedArray> entry_storage =
7752 isolate->factory()->NewUninitializedFixedArray(2);
7753 {
7754 entry_storage->set(0, *key, SKIP_WRITE_BARRIER);
7755 entry_storage->set(1, *value, SKIP_WRITE_BARRIER);
7756 }
7757 return isolate->factory()->NewJSArrayWithElements(entry_storage,
7758 FAST_ELEMENTS, 2);
7759 }
7760
7761 static inline Handle<Object> MakeEntryPair(Isolate* isolate, Handle<Name> key,
7762 Handle<Object> value) {
7763 Handle<FixedArray> entry_storage =
7764 isolate->factory()->NewUninitializedFixedArray(2);
7765 {
7766 entry_storage->set(0, *key, SKIP_WRITE_BARRIER);
7767 entry_storage->set(1, *value, SKIP_WRITE_BARRIER);
7768 }
7769 return isolate->factory()->NewJSArrayWithElements(entry_storage,
7770 FAST_ELEMENTS, 2);
7771 }
7748 7772
7749 #undef TYPE_CHECKER 7773 #undef TYPE_CHECKER
7750 #undef CAST_ACCESSOR 7774 #undef CAST_ACCESSOR
7751 #undef INT_ACCESSORS 7775 #undef INT_ACCESSORS
7752 #undef ACCESSORS 7776 #undef ACCESSORS
7753 #undef SMI_ACCESSORS 7777 #undef SMI_ACCESSORS
7754 #undef SYNCHRONIZED_SMI_ACCESSORS 7778 #undef SYNCHRONIZED_SMI_ACCESSORS
7755 #undef NOBARRIER_SMI_ACCESSORS 7779 #undef NOBARRIER_SMI_ACCESSORS
7756 #undef BOOL_GETTER 7780 #undef BOOL_GETTER
7757 #undef BOOL_ACCESSORS 7781 #undef BOOL_ACCESSORS
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
7789 #undef WRITE_INT64_FIELD 7813 #undef WRITE_INT64_FIELD
7790 #undef READ_BYTE_FIELD 7814 #undef READ_BYTE_FIELD
7791 #undef WRITE_BYTE_FIELD 7815 #undef WRITE_BYTE_FIELD
7792 #undef NOBARRIER_READ_BYTE_FIELD 7816 #undef NOBARRIER_READ_BYTE_FIELD
7793 #undef NOBARRIER_WRITE_BYTE_FIELD 7817 #undef NOBARRIER_WRITE_BYTE_FIELD
7794 7818
7795 } // namespace internal 7819 } // namespace internal
7796 } // namespace v8 7820 } // namespace v8
7797 7821
7798 #endif // V8_OBJECTS_INL_H_ 7822 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/harmony/object-entries.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698