Chromium Code Reviews| Index: src/runtime.cc |
| diff --git a/src/runtime.cc b/src/runtime.cc |
| index cfa0553b56e6faaca60f36f7a46fc6025a920843..a4f671804e0eed7dff64292f19174b9a26249adb 100644 |
| --- a/src/runtime.cc |
| +++ b/src/runtime.cc |
| @@ -4704,7 +4704,37 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsPropertyEnumerable) { |
| uint32_t index; |
| if (key->AsArrayIndex(&index)) { |
| - return isolate->heap()->ToBoolean(object->HasElement(index)); |
| + JSObject::LocalElementType type = object->HasLocalElement(index); |
| + switch (type) { |
| + case JSObject::UNDEFINED_ELEMENT: |
| + case JSObject::STRING_CHARACTER_ELEMENT: |
| + return isolate->heap()->false_value(); |
|
Rico
2011/10/03 09:08:00
Could we add a test to exercise this code path
Lasse Reichstein
2011/10/03 09:14:43
Will test both.
|
| + case JSObject::INTERCEPTED_ELEMENT: |
| + case JSObject::FAST_ELEMENT: |
| + return isolate->heap()->true_value(); |
|
Rico
2011/10/03 09:08:00
Same as above
Lasse Reichstein
2011/10/03 09:14:43
Will test fast elements. Interceptor will require
|
| + case JSObject::DICTIONARY_ELEMENT: { |
| + if (object->IsJSGlobalProxy()) { |
| + Object* proto = object->GetPrototype(); |
| + if (proto->IsNull()) { |
| + return isolate->heap()->false_value(); |
| + } |
| + ASSERT(proto->IsJSGlobalObject()); |
| + object = JSObject::cast(proto); |
| + } |
| + FixedArray* elements = FixedArray::cast(object->elements()); |
| + NumberDictionary* dictionary = NULL; |
| + if (elements->map() == |
| + isolate->heap()->non_strict_arguments_elements_map()) { |
| + dictionary = NumberDictionary::cast(elements->get(1)); |
| + } else { |
| + dictionary = NumberDictionary::cast(elements); |
| + } |
| + int entry = dictionary->FindEntry(index); |
| + ASSERT(entry != NumberDictionary::kNotFound); |
| + PropertyDetails details = dictionary->DetailsAt(entry); |
| + return isolate->heap()->ToBoolean(!details.IsDontEnum()); |
| + } |
| + } |
| } |
| PropertyAttributes att = object->GetLocalPropertyAttribute(key); |