| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index f076bdb481ff2348dcf49c586c9ef6c1dec13e1c..651205bf11199a150230715355acecc2fc8ea1b4 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -37,6 +37,7 @@
|
| #include "src/profile-generator-inl.h"
|
| #include "src/property.h"
|
| #include "src/property-details.h"
|
| +#include "src/prototype-iterator.h"
|
| #include "src/runtime.h"
|
| #include "src/runtime-profiler.h"
|
| #include "src/scanner-character-streams.h"
|
| @@ -3164,7 +3165,7 @@ Local<Value> v8::Object::GetPrototype() {
|
| ON_BAILOUT(isolate, "v8::Object::GetPrototype()", return Local<v8::Value>());
|
| ENTER_V8(isolate);
|
| i::Handle<i::Object> self = Utils::OpenHandle(this);
|
| - i::Handle<i::Object> result(self->GetPrototype(isolate), isolate);
|
| + i::Handle<i::Object> result(SAFE_GET_PROTOTYPE(isolate, *self), isolate);
|
| return Utils::ToLocal(result);
|
| }
|
|
|
| @@ -3196,12 +3197,15 @@ Local<Object> v8::Object::FindInstanceInPrototypeChain(
|
| ENTER_V8(isolate);
|
| i::JSObject* object = *Utils::OpenHandle(this);
|
| i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl);
|
| - while (!tmpl_info->IsTemplateFor(object)) {
|
| - i::Object* prototype = object->GetPrototype();
|
| - if (!prototype->IsJSObject()) return Local<Object>();
|
| - object = i::JSObject::cast(prototype);
|
| + for (i::PrototypeIterator<i::STORE_AS_POINTER, i::MAP_BASED_WALK,
|
| + i::END_AT_NULL_VALUE> iter(object);
|
| + !iter.IsAtEnd(); iter.Advance()) {
|
| + if (tmpl_info->IsTemplateFor(iter.GetCurrent())) {
|
| + return Utils::ToLocal(
|
| + i::Handle<i::JSObject>(i::JSObject::cast(iter.GetCurrent())));
|
| + }
|
| }
|
| - return Utils::ToLocal(i::Handle<i::JSObject>(object));
|
| + return Local<Object>();
|
| }
|
|
|
|
|
|
|