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

Unified Diff: src/keys.h

Issue 1707743002: [key-accumulator] Starting to reimplement the key-accumulator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: use proper type 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/key-accumulator.cc ('k') | src/keys.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/keys.h
diff --git a/src/key-accumulator.h b/src/keys.h
similarity index 77%
rename from src/key-accumulator.h
rename to src/keys.h
index 9daee10cd357bf758340f143958b4d0862c45519..6f726cdbbe8578f6a958d69b1a14e5c4310e63b4 100644
--- a/src/key-accumulator.h
+++ b/src/keys.h
@@ -86,9 +86,40 @@ class KeyAccumulator final BASE_EMBEDDED {
DISALLOW_COPY_AND_ASSIGN(KeyAccumulator);
};
+// The FastKeyAccumulator handles the cases where there are no elements on the
+// prototype chain and forwords the complex/slow cases to the normal
+// KeyAccumulator.
+class FastKeyAccumulator {
+ public:
+ FastKeyAccumulator(Isolate* isolate, Handle<JSReceiver> receiver,
+ KeyCollectionType type, PropertyFilter filter)
+ : isolate_(isolate), receiver_(receiver), type_(type), filter_(filter) {
+ Prepare();
+ // TODO(cbruni): pass filter_ directly to the KeyAccumulator.
+ USE(filter_);
+ }
+
+ bool is_receiver_simple_enum() { return is_receiver_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_receiver_simple_enum_ = false;
+ bool has_empty_prototype_ = false;
+
+ DISALLOW_COPY_AND_ASSIGN(FastKeyAccumulator);
+};
} // namespace internal
} // namespace v8
-
#endif // V8_KEY_ACCUMULATOR_H_
« no previous file with comments | « src/key-accumulator.cc ('k') | src/keys.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698