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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/harmony/object-entries.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 753c80e5bb4db517c0815dfee109e550448d3ad5..1b40b0b0442f84e2b9a04e515171dabb3be0cac2 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -7745,6 +7745,30 @@ static inline uint32_t ObjectAddressForHashing(void* object) {
return value & MemoryChunk::kAlignmentMask;
}
+static inline Handle<Object> MakeEntryPair(Isolate* isolate, uint32_t index,
+ Handle<Object> value) {
+ Handle<Object> key = isolate->factory()->Uint32ToString(index);
+ Handle<FixedArray> entry_storage =
+ isolate->factory()->NewUninitializedFixedArray(2);
+ {
+ entry_storage->set(0, *key, SKIP_WRITE_BARRIER);
+ entry_storage->set(1, *value, SKIP_WRITE_BARRIER);
+ }
+ return isolate->factory()->NewJSArrayWithElements(entry_storage,
+ FAST_ELEMENTS, 2);
+}
+
+static inline Handle<Object> MakeEntryPair(Isolate* isolate, Handle<Name> key,
+ Handle<Object> value) {
+ Handle<FixedArray> entry_storage =
+ isolate->factory()->NewUninitializedFixedArray(2);
+ {
+ entry_storage->set(0, *key, SKIP_WRITE_BARRIER);
+ entry_storage->set(1, *value, SKIP_WRITE_BARRIER);
+ }
+ return isolate->factory()->NewJSArrayWithElements(entry_storage,
+ FAST_ELEMENTS, 2);
+}
#undef TYPE_CHECKER
#undef CAST_ACCESSOR
« 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