[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}
This commit is contained in:
mstarzinger 2015-11-06 00:56:06 -08:00 committed by Commit bot
parent 7627775948
commit cd7c416da4
2 changed files with 3 additions and 2 deletions

View File

@ -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();

View File

@ -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() ||