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

Side by Side Diff: runtime/vm/compiler.cc

Issue 1731743003: Move precompilation-related flags to flags list. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: make print_stop_message default false to fix build Created 4 years, 10 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 | « runtime/vm/code_generator.cc ('k') | runtime/vm/compiler_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 8
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/block_scheduler.h" 10 #include "vm/block_scheduler.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); 62 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis");
63 DEFINE_FLAG(bool, reorder_basic_blocks, true, "Enable basic-block reordering."); 63 DEFINE_FLAG(bool, reorder_basic_blocks, true, "Enable basic-block reordering.");
64 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); 64 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations.");
65 DEFINE_FLAG(bool, trace_optimizing_compiler, false, 65 DEFINE_FLAG(bool, trace_optimizing_compiler, false,
66 "Trace only optimizing compiler operations."); 66 "Trace only optimizing compiler operations.");
67 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); 67 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler.");
68 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); 68 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining");
69 DEFINE_FLAG(bool, verify_compiler, false, 69 DEFINE_FLAG(bool, verify_compiler, false,
70 "Enable compiler verification assertions"); 70 "Enable compiler verification assertions");
71 71
72 DECLARE_FLAG(bool, background_compilation);
73 DECLARE_FLAG(bool, huge_method_cutoff_in_code_size); 72 DECLARE_FLAG(bool, huge_method_cutoff_in_code_size);
74 DECLARE_FLAG(bool, load_deferred_eagerly);
75 DECLARE_FLAG(bool, trace_failed_optimization_attempts); 73 DECLARE_FLAG(bool, trace_failed_optimization_attempts);
76 DECLARE_FLAG(bool, trace_irregexp); 74 DECLARE_FLAG(bool, trace_irregexp);
77 DECLARE_FLAG(bool, precompilation);
78 75
79 76
80 #ifndef DART_PRECOMPILED_RUNTIME 77 #ifndef DART_PRECOMPILED_RUNTIME
81 78
82 void DartCompilationPipeline::ParseFunction(ParsedFunction* parsed_function) { 79 void DartCompilationPipeline::ParseFunction(ParsedFunction* parsed_function) {
83 Parser::ParseFunction(parsed_function); 80 Parser::ParseFunction(parsed_function);
84 parsed_function->AllocateVariables(); 81 parsed_function->AllocateVariables();
85 } 82 }
86 83
87 84
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 const uint32_t prefix_invalidation_gen_at_start_; 410 const uint32_t prefix_invalidation_gen_at_start_;
414 411
415 DISALLOW_COPY_AND_ASSIGN(CompileParsedFunctionHelper); 412 DISALLOW_COPY_AND_ASSIGN(CompileParsedFunctionHelper);
416 }; 413 };
417 414
418 415
419 void CompileParsedFunctionHelper::FinalizeCompilation( 416 void CompileParsedFunctionHelper::FinalizeCompilation(
420 Assembler* assembler, 417 Assembler* assembler,
421 FlowGraphCompiler* graph_compiler, 418 FlowGraphCompiler* graph_compiler,
422 FlowGraph* flow_graph) { 419 FlowGraph* flow_graph) {
423 ASSERT(!FLAG_precompilation); 420 ASSERT(!FLAG_precompiled_mode);
424 const Function& function = parsed_function()->function(); 421 const Function& function = parsed_function()->function();
425 Zone* const zone = thread()->zone(); 422 Zone* const zone = thread()->zone();
426 423
427 CSTAT_TIMER_SCOPE(thread(), codefinalizer_timer); 424 CSTAT_TIMER_SCOPE(thread(), codefinalizer_timer);
428 // CreateDeoptInfo uses the object pool and needs to be done before 425 // CreateDeoptInfo uses the object pool and needs to be done before
429 // FinalizeCode. 426 // FinalizeCode.
430 const Array& deopt_info_array = 427 const Array& deopt_info_array =
431 Array::Handle(zone, graph_compiler->CreateDeoptInfo(assembler)); 428 Array::Handle(zone, graph_compiler->CreateDeoptInfo(assembler));
432 INC_STAT(thread(), total_code_size, 429 INC_STAT(thread(), total_code_size,
433 deopt_info_array.Length() * sizeof(uword)); 430 deopt_info_array.Length() * sizeof(uword));
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 (*prefixes)[i]->RegisterDependentCode(code); 546 (*prefixes)[i]->RegisterDependentCode(code);
550 } 547 }
551 } 548 }
552 } 549 }
553 550
554 551
555 // Return false if bailed out. 552 // Return false if bailed out.
556 // If optimized_result_code is not NULL then it is caller's responsibility 553 // If optimized_result_code is not NULL then it is caller's responsibility
557 // to install code. 554 // to install code.
558 bool CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) { 555 bool CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
559 ASSERT(!FLAG_precompilation); 556 ASSERT(!FLAG_precompiled_mode);
560 const Function& function = parsed_function()->function(); 557 const Function& function = parsed_function()->function();
561 if (optimized() && !function.IsOptimizable()) { 558 if (optimized() && !function.IsOptimizable()) {
562 return false; 559 return false;
563 } 560 }
564 bool is_compiled = false; 561 bool is_compiled = false;
565 Zone* const zone = thread()->zone(); 562 Zone* const zone = thread()->zone();
566 NOT_IN_PRODUCT( 563 NOT_IN_PRODUCT(
567 TimelineStream* compiler_timeline = isolate()->GetCompilerStream()); 564 TimelineStream* compiler_timeline = isolate()->GetCompilerStream());
568 CSTAT_TIMER_SCOPE(thread(), codegen_timer); 565 CSTAT_TIMER_SCOPE(thread(), codegen_timer);
569 HANDLESCOPE(thread()); 566 HANDLESCOPE(thread());
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 ASSERT(inlined_functions[inlined_functions.length() - 1]->raw() == 1076 ASSERT(inlined_functions[inlined_functions.length() - 1]->raw() ==
1080 function.raw()); 1077 function.raw());
1081 } 1078 }
1082 } 1079 }
1083 ) 1080 )
1084 1081
1085 static RawError* CompileFunctionHelper(CompilationPipeline* pipeline, 1082 static RawError* CompileFunctionHelper(CompilationPipeline* pipeline,
1086 const Function& function, 1083 const Function& function,
1087 bool optimized, 1084 bool optimized,
1088 intptr_t osr_id) { 1085 intptr_t osr_id) {
1089 ASSERT(!FLAG_precompilation); 1086 ASSERT(!FLAG_precompiled_mode);
1090 LongJumpScope jump; 1087 LongJumpScope jump;
1091 if (setjmp(*jump.Set()) == 0) { 1088 if (setjmp(*jump.Set()) == 0) {
1092 Thread* const thread = Thread::Current(); 1089 Thread* const thread = Thread::Current();
1093 Isolate* const isolate = thread->isolate(); 1090 Isolate* const isolate = thread->isolate();
1094 StackZone stack_zone(thread); 1091 StackZone stack_zone(thread);
1095 Zone* const zone = stack_zone.GetZone(); 1092 Zone* const zone = stack_zone.GetZone();
1096 const bool trace_compiler = 1093 const bool trace_compiler =
1097 FLAG_trace_compiler || 1094 FLAG_trace_compiler ||
1098 (FLAG_trace_optimizing_compiler && optimized); 1095 (FLAG_trace_optimizing_compiler && optimized);
1099 Timer per_compile_timer(trace_compiler, "Compilation time"); 1096 Timer per_compile_timer(trace_compiler, "Compilation time");
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 return error.raw(); 1190 return error.raw();
1194 } 1191 }
1195 UNREACHABLE(); 1192 UNREACHABLE();
1196 return Error::null(); 1193 return Error::null();
1197 } 1194 }
1198 1195
1199 1196
1200 RawError* Compiler::CompileFunction(Thread* thread, 1197 RawError* Compiler::CompileFunction(Thread* thread,
1201 const Function& function) { 1198 const Function& function) {
1202 #ifdef DART_PRECOMPILER 1199 #ifdef DART_PRECOMPILER
1203 if (FLAG_precompilation) { 1200 if (FLAG_precompiled_mode) {
1204 return Precompiler::CompileFunction(thread, function); 1201 return Precompiler::CompileFunction(thread, function);
1205 } 1202 }
1206 #endif 1203 #endif
1207 Isolate* isolate = thread->isolate(); 1204 Isolate* isolate = thread->isolate();
1208 VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId); 1205 VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId);
1209 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, "Function", function); 1206 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, "Function", function);
1210 1207
1211 if (!isolate->compilation_allowed()) { 1208 if (!isolate->compilation_allowed()) {
1212 FATAL3("Precompilation missed function %s (%s, %s)\n", 1209 FATAL3("Precompilation missed function %s (%s, %s)\n",
1213 function.ToLibNamePrefixedQualifiedCString(), 1210 function.ToLibNamePrefixedQualifiedCString(),
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 func.ClearICDataArray(); 1350 func.ClearICDataArray();
1354 func.ClearCode(); 1351 func.ClearCode();
1355 } 1352 }
1356 } 1353 }
1357 return error.raw(); 1354 return error.raw();
1358 } 1355 }
1359 1356
1360 1357
1361 RawObject* Compiler::EvaluateStaticInitializer(const Field& field) { 1358 RawObject* Compiler::EvaluateStaticInitializer(const Field& field) {
1362 #ifdef DART_PRECOMPILER 1359 #ifdef DART_PRECOMPILER
1363 if (FLAG_precompilation) { 1360 if (FLAG_precompiled_mode) {
1364 return Precompiler::EvaluateStaticInitializer(field); 1361 return Precompiler::EvaluateStaticInitializer(field);
1365 } 1362 }
1366 #endif 1363 #endif
1367 ASSERT(field.is_static()); 1364 ASSERT(field.is_static());
1368 // The VM sets the field's value to transiton_sentinel prior to 1365 // The VM sets the field's value to transiton_sentinel prior to
1369 // evaluating the initializer value. 1366 // evaluating the initializer value.
1370 ASSERT(field.StaticValue() == Object::transition_sentinel().raw()); 1367 ASSERT(field.StaticValue() == Object::transition_sentinel().raw());
1371 LongJumpScope jump; 1368 LongJumpScope jump;
1372 if (setjmp(*jump.Set()) == 0) { 1369 if (setjmp(*jump.Set()) == 0) {
1373 // Under lazy compilation initializer has not yet been created, so create 1370 // Under lazy compilation initializer has not yet been created, so create
(...skipping 23 matching lines...) Expand all
1397 return error.raw(); 1394 return error.raw();
1398 } 1395 }
1399 UNREACHABLE(); 1396 UNREACHABLE();
1400 return Object::null(); 1397 return Object::null();
1401 } 1398 }
1402 1399
1403 1400
1404 1401
1405 RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) { 1402 RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) {
1406 #ifdef DART_PRECOMPILER 1403 #ifdef DART_PRECOMPILER
1407 if (FLAG_precompilation) { 1404 if (FLAG_precompiled_mode) {
1408 return Precompiler::ExecuteOnce(fragment); 1405 return Precompiler::ExecuteOnce(fragment);
1409 } 1406 }
1410 #endif 1407 #endif
1411 LongJumpScope jump; 1408 LongJumpScope jump;
1412 if (setjmp(*jump.Set()) == 0) { 1409 if (setjmp(*jump.Set()) == 0) {
1413 Thread* const thread = Thread::Current(); 1410 Thread* const thread = Thread::Current();
1414 1411
1415 // Don't allow message interrupts while executing constant 1412 // Don't allow message interrupts while executing constant
1416 // expressions. They can cause bogus recursive compilation. 1413 // expressions. They can cause bogus recursive compilation.
1417 NoOOBMessageScope no_msg_scope(thread); 1414 NoOOBMessageScope no_msg_scope(thread);
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 } 1834 }
1838 1835
1839 1836
1840 void BackgroundCompiler::EnsureInit(Thread* thread) { 1837 void BackgroundCompiler::EnsureInit(Thread* thread) {
1841 UNREACHABLE(); 1838 UNREACHABLE();
1842 } 1839 }
1843 1840
1844 #endif // DART_PRECOMPILED_RUNTIME 1841 #endif // DART_PRECOMPILED_RUNTIME
1845 1842
1846 } // namespace dart 1843 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/compiler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698