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/accessors.cc

Issue 376233002: Introduce a PrototypeIterator class and use it for prototype access (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 | « BUILD.gn ('k') | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/accessors.cc
diff --git a/src/accessors.cc b/src/accessors.cc
index cfa2049aaeea253ca90b7cbef2f8cafe368ec686..13c28038875da867fc738222b6f66251fbd2d0d4 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.h"
namespace v8 {
namespace internal {
@@ -67,8 +68,10 @@ 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 iter(isolate, obj,
+ PrototypeIterator::START_AT_RECEIVER);
+ !iter.IsAtEnd(); iter.Advance()) {
+ if (Is<C>(iter.GetCurrent())) return C::cast(iter.GetCurrent());
}
return NULL;
}
« no previous file with comments | « BUILD.gn ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698