From 8334faa0e004fc6b0d8c1c9c071a66d272c4215b Mon Sep 17 00:00:00 2001 From: "jkummerow@chromium.org" Date: Fri, 13 Jun 2014 09:59:39 +0000 Subject: [PATCH] Allow all Names to be fast property names R=verwaest@chromium.org Review URL: https://codereview.chromium.org/329393005 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21834 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/ic.cc | 3 +-- src/objects.cc | 28 ---------------------------- src/objects.h | 2 -- test/mjsunit/fast-non-keyed.js | 6 +++--- 4 files changed, 4 insertions(+), 35 deletions(-) diff --git a/src/ic.cc b/src/ic.cc index cd44f88..cd92af1 100644 --- a/src/ic.cc +++ b/src/ic.cc @@ -1326,8 +1326,7 @@ MaybeHandle StoreIC::Store(Handle object, TRACE_IC("StoreIC", name); } else if (can_store) { UpdateCaches(&lookup, receiver, name, value); - } else if (!name->IsCacheable(isolate()) || - lookup.IsNormal() || + } else if (lookup.IsNormal() || (lookup.IsField() && lookup.CanHoldValue(value))) { Handle stub = generic_stub(); set_target(*stub); diff --git a/src/objects.cc b/src/objects.cc index 3d354b8..158a589 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -1802,11 +1802,7 @@ MaybeHandle Map::CopyWithField(Handle map, return MaybeHandle(); } - // Normalize the object if the name is an actual name (not the - // hidden strings) and is not a real identifier. - // Normalize the object if it will have too many fast properties. Isolate* isolate = map->GetIsolate(); - if (!name->IsCacheable(isolate)) return MaybeHandle(); // Compute the new index for new field. int index = map->NextFreePropertyIndex(); @@ -8403,30 +8399,6 @@ bool DescriptorArray::IsEqualTo(DescriptorArray* other) { #endif -static bool IsIdentifier(UnicodeCache* cache, Name* name) { - // Checks whether the buffer contains an identifier (no escape). - if (!name->IsString()) return false; - String* string = String::cast(name); - if (string->length() == 0) return true; - ConsStringIteratorOp op; - StringCharacterStream stream(string, &op); - if (!cache->IsIdentifierStart(stream.GetNext())) { - return false; - } - while (stream.HasMore()) { - if (!cache->IsIdentifierPart(stream.GetNext())) { - return false; - } - } - return true; -} - - -bool Name::IsCacheable(Isolate* isolate) { - return IsSymbol() || IsIdentifier(isolate->unicode_cache(), this); -} - - bool String::LooksValid() { if (!GetIsolate()->heap()->Contains(this)) return false; return true; diff --git a/src/objects.h b/src/objects.h index 6813dee..46661b6 100644 --- a/src/objects.h +++ b/src/objects.h @@ -8928,8 +8928,6 @@ class Name: public HeapObject { // Casting. static inline Name* cast(Object* obj); - bool IsCacheable(Isolate* isolate); - DECLARE_PRINTER(Name) // Layout description. diff --git a/test/mjsunit/fast-non-keyed.js b/test/mjsunit/fast-non-keyed.js index c2f7fc7..6a300ab 100644 --- a/test/mjsunit/fast-non-keyed.js +++ b/test/mjsunit/fast-non-keyed.js @@ -108,6 +108,6 @@ var obj3 = {}; AddProps3(obj3); assertTrue(%HasFastProperties(obj3)); -var bad_name = {}; -bad_name[".foo"] = 0; -assertFalse(%HasFastProperties(bad_name)); +var funny_name = {}; +funny_name[".foo"] = 0; +assertTrue(%HasFastProperties(funny_name)); -- 2.7.4