Reviewers: Lasse Reichstein, Kevin Millikin,

Description:
Removed normalization in AddFastProperty

We don't have to go to slow mode when we add a property has name which is not an
identifier, like e.g. '$*'.


Please review this at http://codereview.chromium.org/8414019/

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

Affected files:
  M src/objects.cc


Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 9a87ac57d6552d01df1d994fe33133cbbffd4288..c9df91744a3ebe46360b60740aa08c3e2c49d839 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -1540,41 +1540,11 @@ MaybeObject* JSObject::AddFastPropertyUsingMap(Map* new_map,
 }


-static bool IsIdentifier(UnicodeCache* cache,
-                         unibrow::CharacterStream* buffer) {
-  // Checks whether the buffer contains an identifier (no escape).
-  if (!buffer->has_more()) return false;
-  if (!cache->IsIdentifierStart(buffer->GetNext())) {
-    return false;
-  }
-  while (buffer->has_more()) {
-    if (!cache->IsIdentifierPart(buffer->GetNext())) {
-      return false;
-    }
-  }
-  return true;
-}
-
-
 MaybeObject* JSObject::AddFastProperty(String* name,
                                        Object* value,
                                        PropertyAttributes attributes) {
   ASSERT(!IsJSGlobalProxy());
-
-  // Normalize the object if the name is an actual string (not the
-  // hidden symbols) and is not a real identifier.
   Isolate* isolate = GetHeap()->isolate();
-  StringInputBuffer buffer(name);
-  if (!IsIdentifier(isolate->unicode_cache(), &buffer)
-      && name != isolate->heap()->hidden_symbol()) {
-    Object* obj;
-    { MaybeObject* maybe_obj =
-          NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0);
-      if (!maybe_obj->ToObject(&obj)) return maybe_obj;
-    }
-    return AddSlowProperty(name, value, attributes);
-  }
-
   DescriptorArray* old_descriptors = map()->instance_descriptors();
   // Compute the new index for new field.
   int index = map()->NextFreePropertyIndex();


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to