| Index: src/heap/mark-compact.cc
|
| diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
|
| index 9f5ac52028ae2bda5a16c8cb8d2c62adb03a821c..06ab9d4b637ff9d4536faf09bd3d733d21f717c0 100644
|
| --- a/src/heap/mark-compact.cc
|
| +++ b/src/heap/mark-compact.cc
|
| @@ -1013,27 +1013,39 @@ void CodeFlusher::ProcessOptimizedCodeMaps() {
|
| STATIC_ASSERT(SharedFunctionInfo::kEntryLength == 4);
|
| Context* context =
|
| Context::cast(code_map->get(i + SharedFunctionInfo::kContextOffset));
|
| - Code* code =
|
| - Code::cast(code_map->get(i + SharedFunctionInfo::kCachedCodeOffset));
|
| - FixedArray* literals = FixedArray::cast(
|
| - code_map->get(i + SharedFunctionInfo::kLiteralsOffset));
|
| - Smi* ast_id =
|
| - Smi::cast(code_map->get(i + SharedFunctionInfo::kOsrAstIdOffset));
|
| if (Marking::IsWhite(Marking::MarkBitFrom(context))) continue;
|
| DCHECK(Marking::IsBlack(Marking::MarkBitFrom(context)));
|
| - if (Marking::IsWhite(Marking::MarkBitFrom(code))) continue;
|
| - DCHECK(Marking::IsBlack(Marking::MarkBitFrom(code)));
|
| +
|
| + FixedArray* literals = FixedArray::cast(
|
| + code_map->get(i + SharedFunctionInfo::kLiteralsOffset));
|
| if (Marking::IsWhite(Marking::MarkBitFrom(literals))) continue;
|
| DCHECK(Marking::IsBlack(Marking::MarkBitFrom(literals)));
|
| +
|
| + Object* code = code_map->get(i + SharedFunctionInfo::kCachedCodeOffset);
|
| + Smi* ast_id =
|
| + Smi::cast(code_map->get(i + SharedFunctionInfo::kOsrAstIdOffset));
|
| + if (code != nullptr) {
|
| + if (Marking::IsWhite(Marking::MarkBitFrom(Code::cast(code)))) {
|
| + BailoutId bailout_id(ast_id->value());
|
| + if (!bailout_id.IsNone()) continue;
|
| + // In case of non-OSR entry just clear the code in order to proceed
|
| + // sharing literals.
|
| + code = nullptr;
|
| + } else {
|
| + DCHECK(Marking::IsBlack(Marking::MarkBitFrom(Code::cast(code))));
|
| + }
|
| + }
|
| // Move every slot in the entry and record slots when needed.
|
| code_map->set(new_length + SharedFunctionInfo::kCachedCodeOffset, code);
|
| code_map->set(new_length + SharedFunctionInfo::kContextOffset, context);
|
| code_map->set(new_length + SharedFunctionInfo::kLiteralsOffset, literals);
|
| code_map->set(new_length + SharedFunctionInfo::kOsrAstIdOffset, ast_id);
|
| - Object** code_slot = code_map->RawFieldOfElementAt(
|
| - new_length + SharedFunctionInfo::kCachedCodeOffset);
|
| - isolate_->heap()->mark_compact_collector()->RecordSlot(
|
| - code_map, code_slot, *code_slot);
|
| + if (code != nullptr) {
|
| + Object** code_slot = code_map->RawFieldOfElementAt(
|
| + new_length + SharedFunctionInfo::kCachedCodeOffset);
|
| + isolate_->heap()->mark_compact_collector()->RecordSlot(
|
| + code_map, code_slot, *code_slot);
|
| + }
|
| Object** context_slot = code_map->RawFieldOfElementAt(
|
| new_length + SharedFunctionInfo::kContextOffset);
|
| isolate_->heap()->mark_compact_collector()->RecordSlot(
|
|
|