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

Unified Diff: src/key-accumulator.cc

Issue 1668853002: [proxies] allow duplicate keys for [[OwnPropertyKeys]] trap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressing nits 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
« no previous file with comments | « src/key-accumulator.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/key-accumulator.cc
diff --git a/src/key-accumulator.cc b/src/key-accumulator.cc
index e7a9c3ccebccd3ba56b7a87b6cc7c1f9148deae7..c2c49969229de3f603ea8494b4543696fef10855 100644
--- a/src/key-accumulator.cc
+++ b/src/key-accumulator.cc
@@ -29,6 +29,9 @@ Handle<FixedArray> KeyAccumulator::GetKeys(GetKeysConversion convert) {
// Make sure we have all the lengths collected.
NextPrototype();
+ if (type_ == OWN_ONLY && !ownProxyKeys_.is_null()) {
+ return ownProxyKeys_;
+ }
// Assemble the result array by first adding the element keys and then the
// property keys. We use the total number of String + Symbol keys per level in
// |level_lengths_| and the available element keys in the corresponding bucket
@@ -260,7 +263,13 @@ Maybe<bool> KeyAccumulator::AddKeysFromProxy(Handle<JSProxy> proxy,
// Proxies define a complete list of keys with no distinction of
// elements and properties, which breaks the normal assumption for the
// KeyAccumulator.
- AddKeys(keys, PROXY_MAGIC);
+ if (type_ == OWN_ONLY) {
+ ownProxyKeys_ = keys;
+ level_string_length_ = keys->length();
+ length_ = level_string_length_;
+ } else {
+ AddKeys(keys, PROXY_MAGIC);
+ }
// Invert the current length to indicate a present proxy, so we can ignore
// element keys for this level. Otherwise we would not fully respect the order
// given by the proxy.
« no previous file with comments | « src/key-accumulator.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698