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

Unified Diff: src/objects.cc

Issue 1534453002: Bugfix: Make sure not to overwrite the empty optimized code map root. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: altered loop, removed for ignition. Created 5 years 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 | test/mjsunit/mjsunit.status » ('j') | 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 1fe8fb4ff05f475f8b183979d5be5b2b07bca6d8..5bcf877f0bf1cde8c691146684c075e8420e915c 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -12123,9 +12123,14 @@ void SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap(
if (isolate->serializer_enabled()) return;
DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION);
// Empty code maps are unsupported.
- if (shared->OptimizedCodeMapIsCleared()) return;
- Handle<WeakCell> cell = isolate->factory()->NewWeakCell(code);
- shared->optimized_code_map()->set(kSharedCodeIndex, *cell);
+ if (!shared->OptimizedCodeMapIsCleared()) {
+ Handle<WeakCell> cell = isolate->factory()->NewWeakCell(code);
+ // A collection may have occured and cleared the optimized code map in the
+ // allocation above.
+ if (!shared->OptimizedCodeMapIsCleared()) {
+ shared->optimized_code_map()->set(kSharedCodeIndex, *cell);
+ }
+ }
}
« no previous file with comments | « no previous file | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698