Reviewers: fschneider,

Description:
Fix bad assumption in object literal interpretation.
We allow symbols that are array indices.

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

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

Affected files:
  M src/ast.cc


Index: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index fa01be016c038714976af27bb8c532ef39576bb5..0922d85056727d5cb001ed70eda5e5af22aaed36 100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -239,12 +239,19 @@ void ObjectLiteral::CalculateEmitStore() {
     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