Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index ee87024ab0da804baf5f86e83b19fdffd5905eab..43b391f6b025a9a81041d53b280922f9bde13d58 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -2966,21 +2966,33 @@ class HCheckPrototypeMaps: public HTemplateInstruction<0> { |
public: |
HCheckPrototypeMaps(Handle<JSObject> prototype, |
Handle<JSObject> holder, |
- Zone* zone) |
+ Zone* zone, |
+ CompilationInfo* info) |
: prototypes_(2, zone), |
maps_(2, zone), |
first_prototype_unique_id_(), |
- last_prototype_unique_id_() { |
+ last_prototype_unique_id_(), |
+ can_omit_prototype_maps_(true) { |
SetFlag(kUseGVN); |
SetGVNFlag(kDependsOnMaps); |
// Keep a list of all objects on the prototype chain up to the holder |
// and the expected maps. |
while (true) { |
prototypes_.Add(prototype, zone); |
- maps_.Add(Handle<Map>(prototype->map()), zone); |
+ Handle<Map> map(prototype->map()); |
+ maps_.Add(map, zone); |
+ can_omit_prototype_maps_ &= map->CanOmitPrototypeChecks(); |
if (prototype.is_identical_to(holder)) break; |
prototype = Handle<JSObject>(JSObject::cast(prototype->GetPrototype())); |
} |
+ if (can_omit_prototype_maps_) { |
+ // Mark in-flight compilation as dependent on those maps. |
+ for (int i = 0; i < maps()->length(); i++) { |
+ Handle<Map> map = maps()->at(i); |
+ map->AddDependentCompilationInfo(DependentCode::kPrototypeCheckGroup, |
+ info); |
+ } |
+ } |
} |
ZoneList<Handle<JSObject> >* prototypes() { return &prototypes_; } |
@@ -3005,12 +3017,7 @@ class HCheckPrototypeMaps: public HTemplateInstruction<0> { |
last_prototype_unique_id_ = UniqueValueId(prototypes_.last()); |
} |
- bool CanOmitPrototypeChecks() { |
- for (int i = 0; i < maps()->length(); i++) { |
- if (!maps()->at(i)->CanOmitPrototypeChecks()) return false; |
- } |
- return true; |
- } |
+ bool CanOmitPrototypeChecks() { return can_omit_prototype_maps_; } |
protected: |
virtual bool DataEquals(HValue* other) { |
@@ -3024,6 +3031,7 @@ class HCheckPrototypeMaps: public HTemplateInstruction<0> { |
ZoneList<Handle<Map> > maps_; |
UniqueValueId first_prototype_unique_id_; |
UniqueValueId last_prototype_unique_id_; |
+ bool can_omit_prototype_maps_; |
}; |