Commit cd7c416d authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[serializer] Move clearing of optimized code map out of GC.

This avoids the need to clear optimized code maps within the GC by just
preventing entries being added in the first place, whenever a snapshot
is being constructed. The main goal here is to simplify the logic in the
already complex visitor for our shared function info objects.

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/1411513005

Cr-Commit-Position: refs/heads/master@{#31852}
parent 76277759
......@@ -443,8 +443,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfo(
if (FLAG_cleanup_code_caches_at_gc) {
shared->ClearTypeFeedbackInfoAtGCTime();
}
if ((FLAG_flush_optimized_code_cache ||
heap->isolate()->serializer_enabled()) &&
if (FLAG_flush_optimized_code_cache &&
!shared->optimized_code_map()->IsSmi()) {
// Always flush the optimized code map if requested by flag.
shared->ClearOptimizedCodeMap();
......
......@@ -11035,6 +11035,7 @@ void JSFunction::AttemptConcurrentOptimization() {
void SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap(
Handle<SharedFunctionInfo> shared, Handle<Code> code) {
Isolate* isolate = shared->GetIsolate();
if (isolate->serializer_enabled()) return;
DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION);
Handle<Object> value(shared->optimized_code_map(), isolate);
if (value->IsSmi()) return; // Empty code maps are unsupported.
......@@ -11048,6 +11049,7 @@ void SharedFunctionInfo::AddToOptimizedCodeMap(
Handle<HeapObject> code, Handle<LiteralsArray> literals,
BailoutId osr_ast_id) {
Isolate* isolate = shared->GetIsolate();
if (isolate->serializer_enabled()) return;
DCHECK(*code == isolate->heap()->undefined_value() ||
!shared->SearchOptimizedCodeMap(*native_context, osr_ast_id).code);
DCHECK(*code == isolate->heap()->undefined_value() ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment