Index: src/builtins.cc |
diff --git a/src/builtins.cc b/src/builtins.cc |
index 925e8a97b8029b4713adc5abc4cc15c402dadf51..cde6589ccb2a9d9db65e4bfcb933a587ac3bc302 100644 |
--- a/src/builtins.cc |
+++ b/src/builtins.cc |
@@ -254,12 +254,15 @@ static bool ArrayPrototypeHasNoElements(Heap* heap, |
// fields. |
if (array_proto->elements() != heap->empty_fixed_array()) return false; |
// Object.prototype |
- Object* proto = array_proto->GetPrototype(); |
- if (proto == heap->null_value()) return false; |
- array_proto = JSObject::cast(proto); |
+ PrototypeIterator iter(heap->isolate(), array_proto); |
+ if (iter.IsAtEnd()) { |
+ return false; |
+ } |
+ array_proto = JSObject::cast(iter.GetCurrent()); |
if (array_proto != native_context->initial_object_prototype()) return false; |
if (array_proto->elements() != heap->empty_fixed_array()) return false; |
- return array_proto->GetPrototype()->IsNull(); |
+ iter.Advance(); |
+ return iter.IsAtEnd(); |
} |
@@ -332,7 +335,8 @@ static inline bool IsJSArrayFastElementMovingAllowed(Heap* heap, |
Context* native_context = heap->isolate()->context()->native_context(); |
JSObject* array_proto = |
JSObject::cast(native_context->array_function()->prototype()); |
- return receiver->GetPrototype() == array_proto && |
+ PrototypeIterator iter(heap->isolate(), receiver); |
+ return iter.GetCurrent() == array_proto && |
ArrayPrototypeHasNoElements(heap, native_context, array_proto); |
} |
@@ -1000,9 +1004,9 @@ BUILTIN(ArrayConcat) { |
bool is_holey = false; |
for (int i = 0; i < n_arguments; i++) { |
Object* arg = args[i]; |
- if (!arg->IsJSArray() || |
- !JSArray::cast(arg)->HasFastElements() || |
- JSArray::cast(arg)->GetPrototype() != array_proto) { |
+ PrototypeIterator iter(isolate, arg); |
+ if (!arg->IsJSArray() || !JSArray::cast(arg)->HasFastElements() || |
+ iter.GetCurrent() != array_proto) { |
AllowHeapAllocation allow_allocation; |
return CallJsBuiltin(isolate, "ArrayConcatJS", args); |
} |