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

Side by Side Diff: src/compiler.cc

Issue 1904463002: [compiler] Rename "baseline" to "unoptimized" in pipeline. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-compiler-simplify-24
Patch Set: Addressed comments. Created 4 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler.h" 5 #include "src/compiler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/ast/ast-numbering.h" 9 #include "src/ast/ast-numbering.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 } else { 524 } else {
525 Handle<Code> code = info->code(); 525 Handle<Code> code = info->code();
526 size += code->CodeSize(); 526 size += code->CodeSize();
527 size += code->relocation_info()->Size(); 527 size += code->relocation_info()->Size();
528 size += code->deoptimization_data()->Size(); 528 size += code->deoptimization_data()->Size();
529 size += code->handler_table()->Size(); 529 size += code->handler_table()->Size();
530 } 530 }
531 return size; 531 return size;
532 } 532 }
533 533
534 bool GenerateBaselineCode(CompilationInfo* info) { 534 bool GenerateUnoptimizedCode(CompilationInfo* info) {
535 bool success; 535 bool success;
536 EnsureFeedbackVector(info); 536 EnsureFeedbackVector(info);
537 if (FLAG_ignition && UseIgnition(info)) { 537 if (FLAG_ignition && UseIgnition(info)) {
538 success = interpreter::Interpreter::MakeBytecode(info); 538 success = interpreter::Interpreter::MakeBytecode(info);
539 } else { 539 } else {
540 success = FullCodeGenerator::MakeCode(info); 540 success = FullCodeGenerator::MakeCode(info);
541 } 541 }
542 if (success) { 542 if (success) {
543 Isolate* isolate = info->isolate(); 543 Isolate* isolate = info->isolate();
544 Counters* counters = isolate->counters(); 544 Counters* counters = isolate->counters();
545 // TODO(4280): Rename counters from "baseline" to "unoptimized" eventually.
545 counters->total_baseline_code_size()->Increment(CodeAndMetadataSize(info)); 546 counters->total_baseline_code_size()->Increment(CodeAndMetadataSize(info));
546 counters->total_baseline_compile_count()->Increment(1); 547 counters->total_baseline_compile_count()->Increment(1);
547 } 548 }
548 return success; 549 return success;
549 } 550 }
550 551
551 bool CompileBaselineCode(CompilationInfo* info) { 552 bool CompileUnoptimizedCode(CompilationInfo* info) {
552 DCHECK(AllowCompilation::IsAllowed(info->isolate())); 553 DCHECK(AllowCompilation::IsAllowed(info->isolate()));
553 if (!Compiler::Analyze(info->parse_info()) || !GenerateBaselineCode(info)) { 554 if (!Compiler::Analyze(info->parse_info()) ||
555 !GenerateUnoptimizedCode(info)) {
554 Isolate* isolate = info->isolate(); 556 Isolate* isolate = info->isolate();
555 if (!isolate->has_pending_exception()) isolate->StackOverflow(); 557 if (!isolate->has_pending_exception()) isolate->StackOverflow();
556 return false; 558 return false;
557 } 559 }
558 return true; 560 return true;
559 } 561 }
560 562
561 void InstallSharedScopeInfo(CompilationInfo* info, 563 void InstallSharedScopeInfo(CompilationInfo* info,
562 Handle<SharedFunctionInfo> shared) { 564 Handle<SharedFunctionInfo> shared) {
563 Handle<ScopeInfo> scope_info = 565 Handle<ScopeInfo> scope_info =
(...skipping 16 matching lines...) Expand all
580 MUST_USE_RESULT MaybeHandle<Code> GetUnoptimizedCode(CompilationInfo* info) { 582 MUST_USE_RESULT MaybeHandle<Code> GetUnoptimizedCode(CompilationInfo* info) {
581 VMState<COMPILER> state(info->isolate()); 583 VMState<COMPILER> state(info->isolate());
582 PostponeInterruptsScope postpone(info->isolate()); 584 PostponeInterruptsScope postpone(info->isolate());
583 585
584 // Parse and update CompilationInfo with the results. 586 // Parse and update CompilationInfo with the results.
585 if (!Parser::ParseStatic(info->parse_info())) return MaybeHandle<Code>(); 587 if (!Parser::ParseStatic(info->parse_info())) return MaybeHandle<Code>();
586 Handle<SharedFunctionInfo> shared = info->shared_info(); 588 Handle<SharedFunctionInfo> shared = info->shared_info();
587 DCHECK_EQ(shared->language_mode(), info->literal()->language_mode()); 589 DCHECK_EQ(shared->language_mode(), info->literal()->language_mode());
588 590
589 // Compile either unoptimized code or bytecode for the interpreter. 591 // Compile either unoptimized code or bytecode for the interpreter.
590 if (!CompileBaselineCode(info)) return MaybeHandle<Code>(); 592 if (!CompileUnoptimizedCode(info)) return MaybeHandle<Code>();
591 RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info); 593 RecordFunctionCompilation(Logger::LAZY_COMPILE_TAG, info);
592 594
593 // Update the shared function info with the scope info. 595 // Update the shared function info with the scope info.
594 InstallSharedScopeInfo(info, shared); 596 InstallSharedScopeInfo(info, shared);
595 597
596 // Install compilation result on the shared function info 598 // Install compilation result on the shared function info
597 InstallSharedCompilationResult(info, shared); 599 InstallSharedCompilationResult(info, shared);
598 600
599 return info->code(); 601 return info->code();
600 } 602 }
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 DCHECK_EQ(RelocInfo::kNoPosition, lit->function_token_position()); 1007 DCHECK_EQ(RelocInfo::kNoPosition, lit->function_token_position());
1006 result = NewSharedFunctionInfoForLiteral(isolate, lit, script); 1008 result = NewSharedFunctionInfoForLiteral(isolate, lit, script);
1007 result->set_is_toplevel(true); 1009 result->set_is_toplevel(true);
1008 if (info->is_eval()) { 1010 if (info->is_eval()) {
1009 // Eval scripts cannot be (re-)compiled without context. 1011 // Eval scripts cannot be (re-)compiled without context.
1010 result->set_allows_lazy_compilation_without_context(false); 1012 result->set_allows_lazy_compilation_without_context(false);
1011 } 1013 }
1012 parse_info->set_shared_info(result); 1014 parse_info->set_shared_info(result);
1013 1015
1014 // Compile the code. 1016 // Compile the code.
1015 if (!CompileBaselineCode(info)) { 1017 if (!CompileUnoptimizedCode(info)) {
1016 return Handle<SharedFunctionInfo>::null(); 1018 return Handle<SharedFunctionInfo>::null();
1017 } 1019 }
1018 1020
1019 // Update the shared function info with the scope info. 1021 // Update the shared function info with the scope info.
1020 InstallSharedScopeInfo(info, result); 1022 InstallSharedScopeInfo(info, result);
1021 1023
1022 // Install compilation result on the shared function info 1024 // Install compilation result on the shared function info
1023 InstallSharedCompilationResult(info, result); 1025 InstallSharedCompilationResult(info, result);
1024 1026
1025 Handle<String> script_name = 1027 Handle<String> script_name =
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 1525
1524 // Consider compiling eagerly when compiling bytecode for Ignition. 1526 // Consider compiling eagerly when compiling bytecode for Ignition.
1525 lazy &= 1527 lazy &=
1526 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled()); 1528 !(FLAG_ignition && FLAG_ignition_eager && !isolate->serializer_enabled());
1527 1529
1528 // Generate code 1530 // Generate code
1529 TimerEventScope<TimerEventCompileCode> timer(isolate); 1531 TimerEventScope<TimerEventCompileCode> timer(isolate);
1530 TRACE_EVENT0("v8", "V8.CompileCode"); 1532 TRACE_EVENT0("v8", "V8.CompileCode");
1531 if (lazy) { 1533 if (lazy) {
1532 info.SetCode(isolate->builtins()->CompileLazy()); 1534 info.SetCode(isolate->builtins()->CompileLazy());
1533 } else if (Renumber(info.parse_info()) && GenerateBaselineCode(&info)) { 1535 } else if (Renumber(info.parse_info()) && GenerateUnoptimizedCode(&info)) {
1534 // Code generation will ensure that the feedback vector is present and 1536 // Code generation will ensure that the feedback vector is present and
1535 // appropriately sized. 1537 // appropriately sized.
1536 DCHECK(!info.code().is_null()); 1538 DCHECK(!info.code().is_null());
1537 if (literal->should_eager_compile() && 1539 if (literal->should_eager_compile() &&
1538 literal->should_be_used_once_hint()) { 1540 literal->should_be_used_once_hint()) {
1539 info.code()->MarkToBeExecutedOnce(isolate); 1541 info.code()->MarkToBeExecutedOnce(isolate);
1540 } 1542 }
1541 // Update the shared function info with the scope info. 1543 // Update the shared function info with the scope info.
1542 InstallSharedScopeInfo(&info, result); 1544 InstallSharedScopeInfo(&info, result);
1543 // Install compilation result on the shared function info. 1545 // Install compilation result on the shared function info.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1676 MaybeHandle<Code> code; 1678 MaybeHandle<Code> code;
1677 if (cached.code != nullptr) code = handle(cached.code); 1679 if (cached.code != nullptr) code = handle(cached.code);
1678 Handle<Context> native_context(function->context()->native_context()); 1680 Handle<Context> native_context(function->context()->native_context());
1679 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, 1681 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code,
1680 literals, BailoutId::None()); 1682 literals, BailoutId::None());
1681 } 1683 }
1682 } 1684 }
1683 1685
1684 } // namespace internal 1686 } // namespace internal
1685 } // namespace v8 1687 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698