| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); | 61 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); |
| 62 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); | 62 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); |
| 63 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); | 63 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); |
| 64 DEFINE_FLAG(bool, verify_compiler, false, | 64 DEFINE_FLAG(bool, verify_compiler, false, |
| 65 "Enable compiler verification assertions"); | 65 "Enable compiler verification assertions"); |
| 66 | 66 |
| 67 DECLARE_FLAG(bool, load_deferred_eagerly); | 67 DECLARE_FLAG(bool, load_deferred_eagerly); |
| 68 DECLARE_FLAG(bool, trace_failed_optimization_attempts); | 68 DECLARE_FLAG(bool, trace_failed_optimization_attempts); |
| 69 DECLARE_FLAG(bool, trace_inlining_intervals); | 69 DECLARE_FLAG(bool, trace_inlining_intervals); |
| 70 DECLARE_FLAG(bool, trace_irregexp); | 70 DECLARE_FLAG(bool, trace_irregexp); |
| 71 DECLARE_FLAG(bool, trace_patching); | |
| 72 | 71 |
| 73 | 72 |
| 74 bool Compiler::always_optimize_ = false; | 73 bool Compiler::always_optimize_ = false; |
| 75 bool Compiler::allow_recompilation_ = true; | 74 bool Compiler::allow_recompilation_ = true; |
| 76 | 75 |
| 77 | 76 |
| 78 // TODO(zerny): Factor out unoptimizing/optimizing pipelines and remove | 77 // TODO(zerny): Factor out unoptimizing/optimizing pipelines and remove |
| 79 // separate helpers functions & `optimizing` args. | 78 // separate helpers functions & `optimizing` args. |
| 80 class CompilationPipeline : public ZoneAllocated { | 79 class CompilationPipeline : public ZoneAllocated { |
| 81 public: | 80 public: |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 code.set_deopt_info_array(deopt_info_array); | 750 code.set_deopt_info_array(deopt_info_array); |
| 752 | 751 |
| 753 graph_compiler.FinalizeStackmaps(code); | 752 graph_compiler.FinalizeStackmaps(code); |
| 754 graph_compiler.FinalizeVarDescriptors(code); | 753 graph_compiler.FinalizeVarDescriptors(code); |
| 755 graph_compiler.FinalizeExceptionHandlers(code); | 754 graph_compiler.FinalizeExceptionHandlers(code); |
| 756 graph_compiler.FinalizeStaticCallTargetsTable(code); | 755 graph_compiler.FinalizeStaticCallTargetsTable(code); |
| 757 | 756 |
| 758 if (optimized) { | 757 if (optimized) { |
| 759 // We may not have previous code if 'always_optimize' is set. | 758 // We may not have previous code if 'always_optimize' is set. |
| 760 if ((osr_id == Isolate::kNoDeoptId) && function.HasCode()) { | 759 if ((osr_id == Isolate::kNoDeoptId) && function.HasCode()) { |
| 761 CodePatcher::PatchEntry( | 760 Code::Handle(function.CurrentCode()).DisableDartCode(); |
| 762 Code::Handle(function.CurrentCode()), | |
| 763 Code::Handle(StubCode::FixCallersTarget_entry()->code())); | |
| 764 if (FLAG_trace_compiler || FLAG_trace_patching) { | |
| 765 if (FLAG_trace_compiler) { | |
| 766 THR_Print(" "); | |
| 767 } | |
| 768 THR_Print("Patch unoptimized '%s' entry point %#" Px "\n", | |
| 769 function.ToFullyQualifiedCString(), | |
| 770 Code::Handle(function.unoptimized_code()).EntryPoint()); | |
| 771 } | |
| 772 } | 761 } |
| 773 function.AttachCode(code); | 762 function.AttachCode(code); |
| 774 | 763 |
| 775 // Register code with the classes it depends on because of CHA. | 764 // Register code with the classes it depends on because of CHA. |
| 776 for (intptr_t i = 0; | 765 for (intptr_t i = 0; |
| 777 i < thread->cha()->leaf_classes().length(); | 766 i < thread->cha()->leaf_classes().length(); |
| 778 ++i) { | 767 ++i) { |
| 779 thread->cha()->leaf_classes()[i]->RegisterCHACode(code); | 768 thread->cha()->leaf_classes()[i]->RegisterCHACode(code); |
| 780 } | 769 } |
| 781 | 770 |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 const Object& result = | 1397 const Object& result = |
| 1409 PassiveObject::Handle(isolate->object_store()->sticky_error()); | 1398 PassiveObject::Handle(isolate->object_store()->sticky_error()); |
| 1410 isolate->object_store()->clear_sticky_error(); | 1399 isolate->object_store()->clear_sticky_error(); |
| 1411 return result.raw(); | 1400 return result.raw(); |
| 1412 } | 1401 } |
| 1413 UNREACHABLE(); | 1402 UNREACHABLE(); |
| 1414 return Object::null(); | 1403 return Object::null(); |
| 1415 } | 1404 } |
| 1416 | 1405 |
| 1417 } // namespace dart | 1406 } // namespace dart |
| OLD | NEW |