Revision: 6447
Author: [email protected]
Date: Mon Jan 24 23:48:19 2011
Log: Fix bad assumption in object literal interpretation.
We allow symbols that are array indices.

Review URL: http://codereview.chromium.org/6304016
http://code.google.com/p/v8/source/detail?r=6447

Modified:
 /branches/bleeding_edge/src/ast.cc

=======================================
--- /branches/bleeding_edge/src/ast.cc  Wed Jan 19 12:05:22 2011
+++ /branches/bleeding_edge/src/ast.cc  Mon Jan 24 23:48:19 2011
@@ -239,12 +239,19 @@
     HashMap* table;
     void* key;
     uint32_t index;
+    Smi* smi_key_location;
     if (handle->IsSymbol()) {
       Handle<String> name(String::cast(*handle));
-      ASSERT(!name->AsArrayIndex(&index));
-      key = name.location();
-      hash = name->Hash();
-      table = &properties;
+      if (name->AsArrayIndex(&index)) {
+        smi_key_location = Smi::FromInt(index);
+        key = &smi_key_location;
+        hash = index;
+        table = &elements;
+      } else {
+        key = name.location();
+        hash = name->Hash();
+        table = &properties;
+      }
     } else if (handle->ToArrayIndex(&index)) {
       key = handle.location();
       hash = index;

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

Reply via email to