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

Unified Diff: src/hydrogen.cc

Issue 348313002: Introduce a PrototypeIterator template and use it all over the place (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 6 years, 6 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/heap-snapshot-generator.cc ('k') | src/ic.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index a2f63202b3296d5a0f30538b4818d908c164036e..9224332324707ff6c2cd734a5d4c167bd1d700f2 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -6757,9 +6757,10 @@ HInstruction* HOptimizedGraphBuilder::BuildMonomorphicElementAccess(
// changes could allow callbacks on elements in the chain that
// aren't compatible with monomorphic keyed stores.
Handle<JSObject> prototype(JSObject::cast(map->prototype()));
- JSObject* holder = JSObject::cast(map->prototype());
- while (!holder->GetPrototype()->IsNull()) {
- holder = JSObject::cast(holder->GetPrototype());
+ JSObject* holder = NULL;
+ for (PrototypeIterator<STORE_AS_POINTER, MAP_BASED_WALK, END_AT_NULL_VALUE>
+ iter(*prototype); !iter.IsAtEnd(); iter.Advance()) {
+ holder = JSObject::cast(iter.GetCurrent());
}
BuildCheckPrototypeMaps(prototype,
@@ -7237,7 +7238,7 @@ HInstruction* HGraphBuilder::BuildCheckPrototypeMaps(Handle<JSObject> prototype,
Handle<JSObject> holder) {
while (holder.is_null() || !prototype.is_identical_to(holder)) {
BuildConstantMapCheck(prototype);
- Object* next_prototype = prototype->GetPrototype();
+ Object* next_prototype = SAFE_GET_PROTOTYPE_FAST(*prototype);
if (next_prototype->IsNull()) return NULL;
CHECK(next_prototype->IsJSObject());
prototype = handle(JSObject::cast(next_prototype));
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698