Index: src/lithium.cc |
diff --git a/src/lithium.cc b/src/lithium.cc |
index 7ad175ea7c68c5db9802b094f1ae86d28c76d793..81944b2c54f3ada96c3e340b0b717f7f1d09efc1 100644 |
--- a/src/lithium.cc |
+++ b/src/lithium.cc |
@@ -429,6 +429,7 @@ Handle<Code> LChunk::Codegen(Code::Kind kind) { |
Handle<Code> code = |
CodeGenerator::MakeCodeEpilogue(&assembler, flags, info()); |
generator.FinishCode(code); |
+ RegisterDependentCodeForEmbeddedMaps(code); |
CodeGenerator::PrintCode(code, info()); |
return code; |
} |
@@ -436,4 +437,22 @@ Handle<Code> LChunk::Codegen(Code::Kind kind) { |
} |
+void LChunk::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { |
+ ZoneList<Handle<Map> > maps(1, zone()); |
+ int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
+ for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { |
+ RelocInfo::Mode mode = it.rinfo()->rmode(); |
+ if (mode == RelocInfo::EMBEDDED_OBJECT && |
+ it.rinfo()->target_object()->IsMap()) { |
+ Handle<Map> map(Map::cast(it.rinfo()->target_object())); |
+ if (map->CanTransition()) { |
+ maps.Add(map, zone()); |
+ } |
+ } |
+ } |
+ for (int i = 0; i < maps.length(); i++) { |
+ maps.at(i)->AddDependentCode(code); |
+ } |
+} |
+ |
} } // namespace v8::internal |