Reviewers: Toon Verwaest,

Message:
PTAL.

Description:
Allow all Names to be fast property names

Please review this at https://codereview.chromium.org/329393005/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+4, -35 lines):
  M src/ic.cc
  M src/objects.h
  M src/objects.cc
  M test/mjsunit/fast-non-keyed.js


Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index cd44f8831bbb941641e4e88640d0589698b744a5..cd92af11852c0f77c7140804cf6500e767087474 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -1326,8 +1326,7 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> 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<Code> stub = generic_stub();
       set_target(*stub);
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index bdfa23cde59d32626192b08ec182f5e2784550e6..d2873b11c918f5b26a0639625fa2ef8cc60783b5 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -1807,11 +1807,7 @@ MaybeHandle<Map> Map::CopyWithField(Handle<Map> map,
     return MaybeHandle<Map>();
   }

-  // 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<Map>();

   // Compute the new index for new field.
   int index = map->NextFreePropertyIndex();
@@ -8463,30 +8459,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;
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index c1ba60e972ab35b3c6b72e783a04cf91d099e8c3..ab13213edb58e0d14e68cf2e8c57d96ce5006007 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -8947,8 +8947,6 @@ class Name: public HeapObject {
   // Casting.
   static inline Name* cast(Object* obj);

-  bool IsCacheable(Isolate* isolate);
-
   DECLARE_PRINTER(Name)

   // Layout description.
Index: test/mjsunit/fast-non-keyed.js
diff --git a/test/mjsunit/fast-non-keyed.js b/test/mjsunit/fast-non-keyed.js
index c2f7fc7f968b9d771b34b05183740f3d648ba08e..6a300ab1e361e7c98c706a97ce8a34b42812ca3c 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));


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to