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

Unified Diff: src/key-accumulator.h

Issue 1707743002: [key-accumulator] Starting to reimplement the key-accumulator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: WIP fast path for collecting receiver-only elements Created 4 years, 10 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
Index: src/key-accumulator.h
diff --git a/src/key-accumulator.h b/src/key-accumulator.h
index 9daee10cd357bf758340f143958b4d0862c45519..0abc37b027f18661b0a2c7a6c16d9f9bb9381be7 100644
--- a/src/key-accumulator.h
+++ b/src/key-accumulator.h
@@ -86,6 +86,35 @@ class KeyAccumulator final BASE_EMBEDDED {
DISALLOW_COPY_AND_ASSIGN(KeyAccumulator);
};
+class FastKeyAccumulator {
+ public:
+ FastKeyAccumulator(Isolate* isolate, Handle<JSReceiver> receiver,
+ KeyCollectionType type, PropertyFilter filter)
+ : isolate_(isolate), receiver_(receiver), type_(type), filter_(filter) {
+ Prepare();
+ }
+
+ void UseVars();
+
+ bool is_simple_enum() { return is_simple_enum_; }
+ bool has_empty_prototype() { return has_empty_prototype_; }
+
+ MaybeHandle<FixedArray> GetKeys(GetKeysConversion convert = KEEP_NUMBERS);
+
+ private:
+ void Prepare();
+ MaybeHandle<FixedArray> GetKeysFast(GetKeysConversion convert);
+ MaybeHandle<FixedArray> GetKeysSlow(GetKeysConversion convert);
+
+ Isolate* isolate_;
+ Handle<JSReceiver> receiver_;
+ KeyCollectionType type_;
+ PropertyFilter filter_;
+ bool is_simple_enum_ = false;
+ bool has_empty_prototype_ = false;
+
+ DISALLOW_COPY_AND_ASSIGN(FastKeyAccumulator);
+};
} // namespace internal
} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698