Reviewers: Hannes Payer,
Description:
[turbofan] Support preserving of optimized code maps over GCs.
This extends the existing support for --noflush-optimized-code-cache
mechanism to the newly added context-independent code entry in the
optimized code map. Note that this machanism is still off by default.
[email protected]
Please review this at https://codereview.chromium.org/1220883002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+20, -6 lines):
M src/heap/mark-compact.cc
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index
e465977d4efcf26e8a252dbb05524a07913d4836..913d5abecbd97a1fef818349f361e2574af59ffe
100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -869,9 +869,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);
@@ -917,9 +916,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);
@@ -947,6 +945,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();
@@ -973,6 +972,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);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.