Chromium Code Reviews| Index: src/objects.cc |
| diff --git a/src/objects.cc b/src/objects.cc |
| index 244e22be3dc30eac1c866192a6acd73c70d7f907..ec95cad897d9b00225dac22abc8121e749bbe864 100644 |
| --- a/src/objects.cc |
| +++ b/src/objects.cc |
| @@ -4862,9 +4862,9 @@ Object* JSObject::LookupAccessor(String* name, AccessorComponent component) { |
| if (name->AsArrayIndex(&index)) { |
| for (Object* obj = this; |
| obj != heap->null_value(); |
|
rossberg
2012/07/10 11:08:14
While you're at it, can you replace this with !obj
Michael Starzinger
2012/07/10 11:24:50
As discussed offline: I'll keep the pointer compar
|
| - obj = JSObject::cast(obj)->GetPrototype()) { |
| - JSObject* js_object = JSObject::cast(obj); |
| - if (js_object->HasDictionaryElements()) { |
| + obj = JSReceiver::cast(obj)->GetPrototype()) { |
| + if (obj->IsJSObject() && JSObject::cast(obj)->HasDictionaryElements()) { |
| + JSObject* js_object = JSObject::cast(obj); |
| SeededNumberDictionary* dictionary = js_object->element_dictionary(); |
| int entry = dictionary->FindEntry(index); |
| if (entry != SeededNumberDictionary::kNotFound) { |
| @@ -4879,9 +4879,9 @@ Object* JSObject::LookupAccessor(String* name, AccessorComponent component) { |
| } else { |
| for (Object* obj = this; |
| obj != heap->null_value(); |
| - obj = JSObject::cast(obj)->GetPrototype()) { |
| + obj = JSReceiver::cast(obj)->GetPrototype()) { |
| LookupResult result(heap->isolate()); |
| - JSObject::cast(obj)->LocalLookup(name, &result); |
| + JSReceiver::cast(obj)->LocalLookup(name, &result); |
| if (result.IsProperty()) { |
| if (result.IsReadOnly()) return heap->undefined_value(); |
| if (result.IsPropertyCallbacks()) { |
| @@ -7796,24 +7796,39 @@ bool SharedFunctionInfo::CanGenerateInlineConstructor(Object* prototype) { |
| } |
| // If the prototype is null inline constructors cause no problems. |
| - if (!prototype->IsJSObject()) { |
| + if (!prototype->IsJSReceiver()) { |
|
rossberg
2012/07/10 11:08:14
Do we still need this conditional at all? AFAICS,
Michael Starzinger
2012/07/10 11:24:50
Done.
|
| ASSERT(prototype->IsNull()); |
| return true; |
| } |
| Heap* heap = GetHeap(); |
| - // Traverse the proposed prototype chain looking for setters for properties of |
| - // the same names as are set by the inline constructor. |
| + // Traverse the proposed prototype chain looking for properties of the |
| + // same names as are set by the inline constructor. |
| for (Object* obj = prototype; |
| obj != heap->null_value(); |
| obj = obj->GetPrototype()) { |
| - JSObject* js_object = JSObject::cast(obj); |
| + JSReceiver* receiver = JSReceiver::cast(obj); |
| for (int i = 0; i < this_property_assignments_count(); i++) { |
| LookupResult result(heap->isolate()); |
| String* name = GetThisPropertyAssignmentName(i); |
| - js_object->LocalLookupRealNamedProperty(name, &result); |
| - if (result.IsCallbacks()) return false; |
| + receiver->LocalLookup(name, &result); |
| + if (result.IsProperty()) { |
| + switch (result.type()) { |
| + case NORMAL: |
| + case FIELD: |
| + case CONSTANT_FUNCTION: |
| + break; |
| + case INTERCEPTOR: |
| + case CALLBACKS: |
| + case HANDLER: |
| + return false; |
| + case TRANSITION: |
| + case NONEXISTENT: |
| + UNREACHABLE(); |
| + break; |
| + } |
| + } |
| } |
| } |