| Index: src/accessors.cc
|
| diff --git a/src/accessors.cc b/src/accessors.cc
|
| index aeea430704d9f9956d7d9044fe51788a33be9996..cc755d98e9df74667c58cffab9da97a59ebb3795 100644
|
| --- a/src/accessors.cc
|
| +++ b/src/accessors.cc
|
| @@ -15,6 +15,7 @@
|
| #include "src/isolate.h"
|
| #include "src/list-inl.h"
|
| #include "src/property-details.h"
|
| +#include "src/prototype-iterator.h"
|
|
|
| namespace v8 {
|
| namespace internal {
|
| @@ -67,8 +68,9 @@ Handle<ExecutableAccessorInfo> Accessors::CloneAccessor(
|
|
|
| template <class C>
|
| static C* FindInstanceOf(Isolate* isolate, Object* obj) {
|
| - for (Object* cur = obj; !cur->IsNull(); cur = cur->GetPrototype(isolate)) {
|
| - if (Is<C>(cur)) return C::cast(cur);
|
| + for (PrototypeIterator<STORE_AS_POINTER, TYPE_BASED_WALK, END_AT_NULL_VALUE>
|
| + iter(isolate, obj); !iter.IsAtEnd(); iter.Advance()) {
|
| + if (Is<C>(iter.GetCurrent())) return C::cast(iter.GetCurrent());
|
| }
|
| return NULL;
|
| }
|
| @@ -774,8 +776,8 @@ static Handle<Object> GetFunctionPrototype(Isolate* isolate,
|
| JSFunction* function_raw = FindInstanceOf<JSFunction>(isolate, *receiver);
|
| if (function_raw == NULL) return isolate->factory()->undefined_value();
|
| while (!function_raw->should_have_prototype()) {
|
| - function_raw = FindInstanceOf<JSFunction>(isolate,
|
| - function_raw->GetPrototype());
|
| + function_raw = FindInstanceOf<JSFunction>(
|
| + isolate, SAFE_GET_PROTOTYPE_FAST(function_raw));
|
| // There has to be one because we hit the getter.
|
| ASSERT(function_raw != NULL);
|
| }
|
|
|