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

Unified Diff: src/heap/mark-compact.cc

Issue 1220883002: [turbofan] Support preserving of optimized code maps over GCs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index dee8d9319fc03c5c5cbae6e008cdd1efb3d8d835..f9873b438f893cff4d0b1dc2c9fe7e7451bb0446 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -868,9 +868,8 @@ void CodeFlusher::ProcessJSFunctionCandidates() {
shared->ShortPrint();
PrintF(" - age: %d]\n", code->GetAge());
}
- // Always flush the optimized code map if requested by flag.
- if (FLAG_flush_optimized_code_cache &&
- !shared->optimized_code_map()->IsSmi()) {
+ // Always flush the optimized code map if there is one.
+ if (!shared->optimized_code_map()->IsSmi()) {
shared->ClearOptimizedCodeMap();
}
shared->set_code(lazy_compile);
@@ -916,9 +915,8 @@ void CodeFlusher::ProcessSharedFunctionInfoCandidates() {
candidate->ShortPrint();
PrintF(" - age: %d]\n", code->GetAge());
}
- // Always flush the optimized code map if requested by flag.
- if (FLAG_flush_optimized_code_cache &&
- !candidate->optimized_code_map()->IsSmi()) {
+ // Always flush the optimized code map if there is one.
+ if (!candidate->optimized_code_map()->IsSmi()) {
candidate->ClearOptimizedCodeMap();
}
candidate->set_code(lazy_compile);
@@ -946,6 +944,7 @@ void CodeFlusher::ProcessOptimizedCodeMaps() {
next_holder = GetNextCodeMap(holder);
ClearNextCodeMap(holder);
+ // Process context-dependent entries in the optimized code map.
FixedArray* code_map = FixedArray::cast(holder->optimized_code_map());
int new_length = SharedFunctionInfo::kEntriesStart;
int old_length = code_map->length();
@@ -972,6 +971,21 @@ void CodeFlusher::ProcessOptimizedCodeMaps() {
}
}
+ // Process context-independent entry in the optimized code map.
+ Object* shared_object = code_map->get(SharedFunctionInfo::kSharedCodeIndex);
+ if (shared_object->IsCode()) {
+ Code* shared_code = Code::cast(shared_object);
+ if (Marking::IsWhite(Marking::MarkBitFrom(shared_code))) {
+ code_map->set_undefined(SharedFunctionInfo::kSharedCodeIndex);
+ } else {
+ DCHECK(Marking::IsBlack(Marking::MarkBitFrom(shared_code)));
+ Object** slot =
+ code_map->RawFieldOfElementAt(SharedFunctionInfo::kSharedCodeIndex);
+ isolate_->heap()->mark_compact_collector()->RecordSlot(slot, slot,
+ *slot);
+ }
+ }
+
// Trim the optimized code map if entries have been removed.
if (new_length < old_length) {
holder->TrimOptimizedCodeMap(old_length - new_length);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698