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

Unified Diff: src/objects.cc

Issue 1418453008: [heap] Separate out optimized code map processing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 5 years, 1 month 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/objects.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index cc6ae919a8a37927b840575a8ed9235b571bbdfb..a315bc9010ce119b454f8ca460ca18f872229848 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -11080,6 +11080,10 @@ void SharedFunctionInfo::AddToOptimizedCodeMap(
// Copy old optimized code map and append one new entry.
new_code_map = isolate->factory()->CopyFixedArrayAndGrow(
old_code_map, kEntryLength, TENURED);
+ // TODO(mstarzinger): Temporary workaround. The allocation above might have
+ // flushed the optimized code map and the copy we created is full of holes.
+ // For now we just give up on adding the entry and pretend it got flushed.
+ if (shared->optimized_code_map()->IsSmi()) return;
int old_length = old_code_map->length();
// Zap the old map to avoid any stale entries. Note that this is required
// for correctness because entries are being treated weakly by the GC.
@@ -11104,21 +11108,28 @@ void SharedFunctionInfo::AddToOptimizedCodeMap(
DCHECK(new_code_map->get(i + kOsrAstIdOffset)->IsSmi());
}
#endif
+
+ if (Heap::ShouldZapGarbage()) {
+ // Zap any old optimized code map for heap-verifier.
+ if (!shared->optimized_code_map()->IsSmi()) {
+ FixedArray* old_code_map = FixedArray::cast(shared->optimized_code_map());
+ old_code_map->FillWithHoles(0, old_code_map->length());
+ }
+ }
+
shared->set_optimized_code_map(*new_code_map);
}
void SharedFunctionInfo::ClearOptimizedCodeMap() {
- FixedArray* code_map = FixedArray::cast(optimized_code_map());
-
- // If the next map link slot is already used then the function was
- // enqueued with code flushing and we remove it now.
- if (!code_map->get(kNextMapIndex)->IsUndefined()) {
- CodeFlusher* flusher = GetHeap()->mark_compact_collector()->code_flusher();
- flusher->EvictOptimizedCodeMap(this);
+ if (Heap::ShouldZapGarbage()) {
+ // Zap any old optimized code map for heap-verifier.
+ if (!optimized_code_map()->IsSmi()) {
+ FixedArray* old_code_map = FixedArray::cast(optimized_code_map());
+ old_code_map->FillWithHoles(0, old_code_map->length());
+ }
}
- DCHECK(code_map->get(kNextMapIndex)->IsUndefined());
set_optimized_code_map(Smi::FromInt(0));
}
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698