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

Unified Diff: src/mark-compact.cc

Issue 12094036: Fix clearing of dead dependent codes and verify weak embedded maps on full GC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 7 years, 10 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/mark-compact.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index bfb4031f3e42831d0c381efa05f542f2117c56e9..f8261c28ff2c4c1bb5e000de1609bf3aa9810731 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -85,7 +85,7 @@ class VerifyMarkingVisitor: public ObjectVisitor {
void VisitEmbeddedPointer(RelocInfo* rinfo) {
ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT);
- if (!FLAG_weak_embedded_maps_in_optimized_code ||
+ if (!FLAG_weak_embedded_maps_in_optimized_code || !FLAG_collect_maps ||
rinfo->host()->kind() != Code::OPTIMIZED_FUNCTION ||
!rinfo->target_object()->IsMap() ||
!Map::cast(rinfo->target_object())->CanTransition()) {
@@ -412,6 +412,13 @@ void MarkCompactCollector::CollectGarbage() {
}
#endif
+#ifdef VERIFY_HEAP
+ if (FLAG_collect_maps && FLAG_weak_embedded_maps_in_optimized_code &&
+ heap()->weak_embedded_maps_verification_enabled()) {
+ VerifyWeakEmbeddedMapsInOptimizedCode();
+ }
+#endif
+
Finish();
if (marking_parity_ == EVEN_MARKING_PARITY) {
@@ -463,6 +470,19 @@ void MarkCompactCollector::VerifyMarkbitsAreClean() {
CHECK_EQ(0, Page::FromAddress(obj->address())->LiveBytes());
}
}
+
+
+void MarkCompactCollector::VerifyWeakEmbeddedMapsInOptimizedCode() {
+ HeapObjectIterator code_iterator(heap()->code_space());
+ for (HeapObject* obj = code_iterator.Next();
+ obj != NULL;
+ obj = code_iterator.Next()) {
+ Code* code = Code::cast(obj);
+ if (code->kind() != Code::OPTIMIZED_FUNCTION) continue;
+ if (code->marked_for_deoptimization()) continue;
+ code->VerifyEmbeddedMapsDependency();
+ }
+}
#endif // VERIFY_HEAP
@@ -833,6 +853,7 @@ void MarkCompactCollector::Prepare(GCTracer* tracer) {
#endif
}
+
class DeoptimizeMarkedCodeFilter : public OptimizedFunctionFilter {
public:
virtual bool TakeFunction(JSFunction* function) {
@@ -2310,10 +2331,10 @@ void MarkCompactCollector::ClearNonLiveDependentCodes(Map* map) {
if (IsMarked(code) && !code->marked_for_deoptimization()) {
if (new_number_of_codes != i) {
codes->set_code_at(new_number_of_codes, code);
- Object** slot = codes->code_slot_at(new_number_of_codes);
- RecordSlot(slot, slot, code);
- new_number_of_codes++;
}
+ Object** slot = codes->code_slot_at(new_number_of_codes);
+ RecordSlot(slot, slot, code);
+ new_number_of_codes++;
}
}
for (int i = new_number_of_codes; i < number_of_codes; i++) {
« no previous file with comments | « src/mark-compact.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698