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

Unified Diff: src/objects.h

Issue 1316213008: Speedup JSReceiver::GetKeys (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Removal of accidental changes Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/elements.cc ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index f547c8388cf9df637a2436ba64c4bd3342cbef7a..824ed402cd233d8e8937bd19478d60db72f92ff1 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -2468,11 +2468,6 @@ class FixedArray: public FixedArrayBase {
enum KeyFilter { ALL_KEYS, NON_SYMBOL_KEYS };
- // Add the elements of a JSArray to this FixedArray.
- MUST_USE_RESULT static MaybeHandle<FixedArray> AddKeysFromArrayLike(
- Handle<FixedArray> content, Handle<JSObject> array,
- KeyFilter filter = ALL_KEYS);
-
// Computes the union of keys and return the result.
// Used for implementing "for (n in object) { }"
MUST_USE_RESULT static MaybeHandle<FixedArray> UnionOfKeys(
@@ -3572,6 +3567,7 @@ class ObjectHashTable: public HashTable<ObjectHashTable,
Object* Lookup(Handle<Object> key);
Object* Lookup(Handle<Object> key, int32_t hash);
Object* Lookup(Isolate* isolate, Handle<Object> key, int32_t hash);
+ bool HasKey(Isolate* isolate, Handle<Object> key);
// Adds (or overwrites) the value associated with the given key.
static Handle<ObjectHashTable> Put(Handle<ObjectHashTable> table,
@@ -3580,6 +3576,13 @@ class ObjectHashTable: public HashTable<ObjectHashTable,
static Handle<ObjectHashTable> Put(Handle<ObjectHashTable> table,
Handle<Object> key, Handle<Object> value,
int32_t hash);
+ static Handle<ObjectHashTable> Put(Isolate* isolate,
+ Handle<ObjectHashTable> table,
+ Handle<Object> key, Handle<Object> value);
+ static Handle<ObjectHashTable> Put(Isolate* isolate,
+ Handle<ObjectHashTable> table,
+ Handle<Object> key, Handle<Object> value,
+ int32_t hash);
// Returns an ObjectHashTable (possibly |table|) where |key| has been removed.
static Handle<ObjectHashTable> Remove(Handle<ObjectHashTable> table,
@@ -10470,6 +10473,30 @@ class BooleanBit : public AllStatic {
}
};
+
+class KeyAccumulator final BASE_EMBEDDED {
+ public:
+ explicit KeyAccumulator(Isolate* isolate)
+ : isolate_(isolate), keys_(), set_(), length_(0) {}
+
+ void AddKeys(Handle<FixedArray> array, FixedArray::KeyFilter filter);
+ void AddKeys(Handle<JSObject> array, FixedArray::KeyFilter filter);
+ Handle<FixedArray> GetKeys();
+ int GetLength();
+ bool HasKey(Handle<Object> key, int limit);
+ void AddKey(Handle<Object> key);
+ void PrepareForComparisons(int count);
+
+ private:
+ void EnsureCapacity(int capacity);
+ void Grow();
+
+ Isolate* isolate_;
+ Handle<FixedArray> keys_;
+ Handle<ObjectHashTable> set_;
+ int length_;
+ DISALLOW_COPY_AND_ASSIGN(KeyAccumulator);
+};
} } // namespace v8::internal
#endif // V8_OBJECTS_H_
« no previous file with comments | « src/elements.cc ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698