From 15ab3a06123545993216f5d2052488271bbef2c0 Mon Sep 17 00:00:00 2001 From: "rossberg@chromium.org" Date: Thu, 28 Mar 2013 12:01:46 +0000 Subject: [PATCH] ES6 symbols: symbol properties should not cause going into slow mode. R=yangguo@chromium.org BUG= Review URL: https://codereview.chromium.org/13042013 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14089 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/objects.cc | 2 +- test/mjsunit/harmony/symbols.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/objects.cc b/src/objects.cc index acdc6bf..4192911 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -1733,7 +1733,7 @@ MaybeObject* JSObject::AddFastProperty(Name* name, // hidden strings) and is not a real identifier. // Normalize the object if it will have too many fast properties. Isolate* isolate = GetHeap()->isolate(); - if ((!IsIdentifier(isolate->unicode_cache(), name) + if ((!name->IsSymbol() && !IsIdentifier(isolate->unicode_cache(), name) && name != isolate->heap()->hidden_string()) || (map()->unused_property_fields() == 0 && TooManyFastProperties(properties()->length(), store_mode))) { diff --git a/test/mjsunit/harmony/symbols.js b/test/mjsunit/harmony/symbols.js index 5e1515e..c2002e6 100644 --- a/test/mjsunit/harmony/symbols.js +++ b/test/mjsunit/harmony/symbols.js @@ -213,9 +213,12 @@ TestCollections() function TestKeySet(obj) { + assertTrue(%HasFastProperties(obj)) // Set the even symbols via assignment. for (var i = 0; i < symbols.length; i += 2) { obj[symbols[i]] = i + // Object should remain in fast mode until too many properties were added. + assertTrue(%HasFastProperties(obj) || i >= 30) } } -- 2.7.4