Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 836abe88776e64c9b5e67ea45bf7fe3c4cdd5ad2..d5024981283617d6aff29f1a167aae2f2e585504 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -89,9 +89,7 @@ void LCodeGen::FinishCode(Handle<Code> code) { |
ASSERT(is_done()); |
code->set_stack_slots(GetStackSlotCount()); |
code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); |
- if (FLAG_weak_embedded_maps_in_optimized_code) { |
Hannes Payer (out of office)
2013/10/01 13:13:50
Why did you remove that flag?
ulan
2013/10/01 14:50:29
This check is moved inside the function in IsWeakE
|
- RegisterDependentCodeForEmbeddedMaps(code); |
- } |
+ RegisterDependentCodeForEmbeddedMaps(code); |
PopulateDeoptimizationData(code); |
info()->CommitDependencies(code); |
} |
@@ -754,14 +752,16 @@ void LCodeGen::DeoptimizeIf(Condition cc, |
void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { |
ZoneList<Handle<Map> > maps(1, zone()); |
+ ZoneList<Handle<JSObject> > objects(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()) { |
+ if (Code::IsWeakEmbeddedObject(code->kind(), it.rinfo()->target_object())) { |
+ if (it.rinfo()->target_object()->IsMap()) { |
+ Handle<Map> map(Map::cast(it.rinfo()->target_object())); |
maps.Add(map, zone()); |
+ } else if (it.rinfo()->target_object()->IsJSObject()) { |
+ Handle<JSObject> object(JSObject::cast(it.rinfo()->target_object())); |
+ objects.Add(object, zone()); |
} |
} |
} |
@@ -774,6 +774,9 @@ void LCodeGen::RegisterDependentCodeForEmbeddedMaps(Handle<Code> code) { |
for (int i = 0; i < maps.length(); i++) { |
maps.at(i)->AddDependentCode(DependentCode::kWeaklyEmbeddedGroup, code); |
} |
+ for (int i = 0; i < objects.length(); i++) { |
+ AddWeakObjectToCodeDependency(isolate()->heap(), objects.at(i), code); |
+ } |
} |