Chromium Code Reviews| Index: src/hydrogen.cc |
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
| index d700fd2e34c65ee621f470242e64b00b789aa9b3..69cec000447f3b55da2c75acc9427a044c6f40b1 100644 |
| --- a/src/hydrogen.cc |
| +++ b/src/hydrogen.cc |
| @@ -3917,8 +3917,6 @@ HValue* HGraphBuilder::HandlePolymorphicElementAccess(HValue* object, |
| todo_external_array = true; |
| } |
| } |
| - // We can't treat dictionary elements here (need to deopt instead). |
| - type_todo[JSObject::DICTIONARY_ELEMENTS] = false; |
| // Support for FAST_DOUBLE_ELEMENTS isn't implemented yet, so we deopt. |
| type_todo[JSObject::FAST_DOUBLE_ELEMENTS] = false; |
| @@ -3936,9 +3934,10 @@ HValue* HGraphBuilder::HandlePolymorphicElementAccess(HValue* object, |
| for (JSObject::ElementsKind elements_kind = JSObject::FAST_ELEMENTS; |
| elements_kind <= JSObject::LAST_ELEMENTS_KIND; |
| elements_kind = JSObject::ElementsKind(elements_kind + 1)) { |
| - // After having handled FAST_ELEMENTS in the first run of the loop, we |
| + // After having handled FAST_ELEMENTS and DICTIONARY_ELEMENTS, we |
| // need to add some code that's executed for all other cases. |
| - if (elements_kind == 1 && todo_external_array) { |
| + if (elements_kind == JSObject::DICTIONARY_ELEMENTS + 1 |
|
danno
2011/06/29 14:16:35
How about a static assert that verifies that DICTI
|
| + && todo_external_array) { |
| elements = AddInstruction(new(zone()) HLoadElements(object)); |
| // We need to forcibly prevent some ElementsKind-dependent instructions |
| // from being hoisted out of any loops they might occur in, because |
| @@ -4007,6 +4006,12 @@ HValue* HGraphBuilder::HandlePolymorphicElementAccess(HValue* object, |
| access = AddInstruction( |
| new(zone()) HLoadKeyedFastElement(elements, checked_key)); |
| } |
| + } else if (elements_kind == JSObject::DICTIONARY_ELEMENTS) { |
| + if (is_store) { |
| + access = BuildStoreKeyedGeneric(object, key, val); |
| + } else { |
| + access = BuildLoadKeyedGeneric(object, key); |
| + } |
| } else { // External array elements. |
| access = AddInstruction(BuildExternalArrayElementAccess( |
| external_elements, checked_key, val, elements_kind, is_store)); |