Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: src/api.cc

Issue 390323002: Remove JSReceiver::GetPrototype and replace it with PrototypeIterator calls (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/accessors.cc ('k') | src/builtins.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index df66ea23861d5727b50ef937de90044bf57aadf2..f0af90945291801eaa7534a261d0598e855bc462 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3186,14 +3186,17 @@ Local<Object> v8::Object::FindInstanceInPrototypeChain(
"v8::Object::FindInstanceInPrototypeChain()",
return Local<v8::Object>());
ENTER_V8(isolate);
- i::JSObject* object = *Utils::OpenHandle(this);
+ i::PrototypeIterator iter(isolate, *Utils::OpenHandle(this),
+ i::PrototypeIterator::START_AT_RECEIVER);
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);
+ while (!tmpl_info->IsTemplateFor(iter.GetCurrent())) {
+ iter.Advance();
+ if (iter.IsAtEnd()) {
+ return Local<Object>();
+ }
}
- return Utils::ToLocal(i::Handle<i::JSObject>(object));
+ return Utils::ToLocal(
+ i::handle(i::JSObject::cast(iter.GetCurrent()), isolate));
}
« no previous file with comments | « src/accessors.cc ('k') | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698