Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 244e22be3dc30eac1c866192a6acd73c70d7f907..fbf3e1812acbd996789bfa746bdc1dcbec452c6a 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(); |
- 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()) { |
@@ -7795,25 +7795,34 @@ bool SharedFunctionInfo::CanGenerateInlineConstructor(Object* prototype) { |
return false; |
} |
- // If the prototype is null inline constructors cause no problems. |
- if (!prototype->IsJSObject()) { |
- 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; |
+ } |
+ } |
} |
} |