| OLD | NEW |
| 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 22 matching lines...) Expand all Loading... |
| 33 #include "vm/object_store.h" | 33 #include "vm/object_store.h" |
| 34 #include "vm/os.h" | 34 #include "vm/os.h" |
| 35 #include "vm/parser.h" | 35 #include "vm/parser.h" |
| 36 #include "vm/precompiler.h" | 36 #include "vm/precompiler.h" |
| 37 #include "vm/redundancy_elimination.h" | 37 #include "vm/redundancy_elimination.h" |
| 38 #include "vm/regexp_parser.h" | 38 #include "vm/regexp_parser.h" |
| 39 #include "vm/regexp_assembler.h" | 39 #include "vm/regexp_assembler.h" |
| 40 #include "vm/symbols.h" | 40 #include "vm/symbols.h" |
| 41 #include "vm/tags.h" | 41 #include "vm/tags.h" |
| 42 #include "vm/thread_registry.h" | 42 #include "vm/thread_registry.h" |
| 43 #include "vm/timeline.h" |
| 43 #include "vm/timer.h" | 44 #include "vm/timer.h" |
| 44 | 45 |
| 45 namespace dart { | 46 namespace dart { |
| 46 | 47 |
| 47 DEFINE_FLAG(bool, allocation_sinking, true, | 48 DEFINE_FLAG(bool, allocation_sinking, true, |
| 48 "Attempt to sink temporary allocations to side exits"); | 49 "Attempt to sink temporary allocations to side exits"); |
| 49 DEFINE_FLAG(bool, common_subexpression_elimination, true, | 50 DEFINE_FLAG(bool, common_subexpression_elimination, true, |
| 50 "Do common subexpression elimination."); | 51 "Do common subexpression elimination."); |
| 51 DEFINE_FLAG(bool, constant_propagation, true, | 52 DEFINE_FLAG(bool, constant_propagation, true, |
| 52 "Do conditional constant propagation/unreachable code elimination."); | 53 "Do conditional constant propagation/unreachable code elimination."); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 thread->clear_sticky_error(); | 272 thread->clear_sticky_error(); |
| 272 return error.raw(); | 273 return error.raw(); |
| 273 } | 274 } |
| 274 } | 275 } |
| 275 | 276 |
| 276 Thread* const thread = Thread::Current(); | 277 Thread* const thread = Thread::Current(); |
| 277 StackZone zone(thread); | 278 StackZone zone(thread); |
| 278 NOT_IN_PRODUCT( | 279 NOT_IN_PRODUCT( |
| 279 VMTagScope tagScope(thread, VMTag::kCompileClassTagId); | 280 VMTagScope tagScope(thread, VMTag::kCompileClassTagId); |
| 280 TimelineDurationScope tds(thread, | 281 TimelineDurationScope tds(thread, |
| 281 thread->isolate()->GetCompilerStream(), | 282 Timeline::GetCompilerStream(), |
| 282 "CompileClass"); | 283 "CompileClass"); |
| 283 if (tds.enabled()) { | 284 if (tds.enabled()) { |
| 284 tds.SetNumArguments(1); | 285 tds.SetNumArguments(1); |
| 285 tds.CopyArgument(0, "class", cls.ToCString()); | 286 tds.CopyArgument(0, "class", cls.ToCString()); |
| 286 } | 287 } |
| 287 ) // !PRODUCT | 288 ) // !PRODUCT |
| 288 | 289 |
| 289 // We remember all the classes that are being compiled in these lists. This | 290 // We remember all the classes that are being compiled in these lists. This |
| 290 // also allows us to reset the marked_for_parsing state in case we see an | 291 // also allows us to reset the marked_for_parsing state in case we see an |
| 291 // error. | 292 // error. |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 // to install code. | 576 // to install code. |
| 576 bool CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) { | 577 bool CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) { |
| 577 ASSERT(!FLAG_precompiled_mode); | 578 ASSERT(!FLAG_precompiled_mode); |
| 578 const Function& function = parsed_function()->function(); | 579 const Function& function = parsed_function()->function(); |
| 579 if (optimized() && !function.IsOptimizable()) { | 580 if (optimized() && !function.IsOptimizable()) { |
| 580 return false; | 581 return false; |
| 581 } | 582 } |
| 582 bool is_compiled = false; | 583 bool is_compiled = false; |
| 583 Zone* const zone = thread()->zone(); | 584 Zone* const zone = thread()->zone(); |
| 584 NOT_IN_PRODUCT( | 585 NOT_IN_PRODUCT( |
| 585 TimelineStream* compiler_timeline = isolate()->GetCompilerStream()); | 586 TimelineStream* compiler_timeline = Timeline::GetCompilerStream()); |
| 586 CSTAT_TIMER_SCOPE(thread(), codegen_timer); | 587 CSTAT_TIMER_SCOPE(thread(), codegen_timer); |
| 587 HANDLESCOPE(thread()); | 588 HANDLESCOPE(thread()); |
| 588 | 589 |
| 589 // We may reattempt compilation if the function needs to be assembled using | 590 // We may reattempt compilation if the function needs to be assembled using |
| 590 // far branches on ARM and MIPS. In the else branch of the setjmp call, | 591 // far branches on ARM and MIPS. In the else branch of the setjmp call, |
| 591 // done is set to false, and use_far_branches is set to true if there is a | 592 // done is set to false, and use_far_branches is set to true if there is a |
| 592 // longjmp from the ARM or MIPS assemblers. In all other paths through this | 593 // longjmp from the ARM or MIPS assemblers. In all other paths through this |
| 593 // while loop, done is set to true. use_far_branches is always false on ia32 | 594 // while loop, done is set to true. use_far_branches is always false on ia32 |
| 594 // and x64. | 595 // and x64. |
| 595 volatile bool done = false; | 596 volatile bool done = false; |
| (...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1866 } | 1867 } |
| 1867 | 1868 |
| 1868 | 1869 |
| 1869 void BackgroundCompiler::EnsureInit(Thread* thread) { | 1870 void BackgroundCompiler::EnsureInit(Thread* thread) { |
| 1870 UNREACHABLE(); | 1871 UNREACHABLE(); |
| 1871 } | 1872 } |
| 1872 | 1873 |
| 1873 #endif // DART_PRECOMPILED_RUNTIME | 1874 #endif // DART_PRECOMPILED_RUNTIME |
| 1874 | 1875 |
| 1875 } // namespace dart | 1876 } // namespace dart |
| OLD | NEW |