From 2e8b8d3ddf66e7f7272b8cc585c35ad5a6685419 Mon Sep 17 00:00:00 2001 From: "lrn@chromium.org" Date: Tue, 25 Jan 2011 07:48:19 +0000 Subject: [PATCH] Fix bad assumption in object literal interpretation. We allow symbols that are array indices. Review URL: http://codereview.chromium.org/6304016 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6447 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/ast.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ast.cc b/src/ast.cc index fa01be016c..0922d85056 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 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;