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

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

Issue 328663002: Version 1.5.0-dev.4.5 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « dart/runtime/vm/code_patcher.cc ('k') | dart/runtime/vm/flow_graph.h » ('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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 "Print the IR flow graph when optimizing."); 52 "Print the IR flow graph when optimizing.");
53 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); 53 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis");
54 DEFINE_FLAG(bool, reorder_basic_blocks, true, "Enable basic-block reordering."); 54 DEFINE_FLAG(bool, reorder_basic_blocks, true, "Enable basic-block reordering.");
55 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); 55 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations.");
56 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); 56 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler.");
57 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); 57 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining");
58 DEFINE_FLAG(bool, verify_compiler, false, 58 DEFINE_FLAG(bool, verify_compiler, false,
59 "Enable compiler verification assertions"); 59 "Enable compiler verification assertions");
60 60
61 DECLARE_FLAG(bool, trace_failed_optimization_attempts); 61 DECLARE_FLAG(bool, trace_failed_optimization_attempts);
62 DECLARE_FLAG(bool, trace_patching);
62 DECLARE_FLAG(bool, warn_on_javascript_compatibility); 63 DECLARE_FLAG(bool, warn_on_javascript_compatibility);
63 DECLARE_FLAG(bool, warning_as_error); 64 DECLARE_FLAG(bool, warning_as_error);
64 65
65 // Compile a function. Should call only if the function has not been compiled. 66 // Compile a function. Should call only if the function has not been compiled.
66 // Arg0: function object. 67 // Arg0: function object.
67 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { 68 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
68 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); 69 const Function& function = Function::CheckedHandle(arguments.ArgAt(0));
69 ASSERT(!function.HasCode()); 70 ASSERT(!function.HasCode());
70 const Error& error = Error::Handle(Compiler::CompileFunction(isolate, 71 const Error& error = Error::Handle(Compiler::CompileFunction(isolate,
71 function)); 72 function));
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 graph_compiler.FinalizePcDescriptors(code); 550 graph_compiler.FinalizePcDescriptors(code);
550 graph_compiler.FinalizeDeoptInfo(code); 551 graph_compiler.FinalizeDeoptInfo(code);
551 graph_compiler.FinalizeStackmaps(code); 552 graph_compiler.FinalizeStackmaps(code);
552 graph_compiler.FinalizeVarDescriptors(code); 553 graph_compiler.FinalizeVarDescriptors(code);
553 graph_compiler.FinalizeExceptionHandlers(code); 554 graph_compiler.FinalizeExceptionHandlers(code);
554 graph_compiler.FinalizeStaticCallTargetsTable(code); 555 graph_compiler.FinalizeStaticCallTargetsTable(code);
555 556
556 if (optimized) { 557 if (optimized) {
557 if (osr_id == Isolate::kNoDeoptId) { 558 if (osr_id == Isolate::kNoDeoptId) {
558 CodePatcher::PatchEntry(Code::Handle(function.CurrentCode())); 559 CodePatcher::PatchEntry(Code::Handle(function.CurrentCode()));
559 if (FLAG_trace_compiler) { 560 if (FLAG_trace_compiler || FLAG_trace_patching) {
560 OS::Print("--> patching entry %#" Px "\n", 561 if (FLAG_trace_compiler) {
562 OS::Print(" ");
563 }
564 OS::Print("Patch unoptimized '%s' entry point %#" Px "\n",
565 function.ToFullyQualifiedCString(),
561 Code::Handle(function.unoptimized_code()).EntryPoint()); 566 Code::Handle(function.unoptimized_code()).EntryPoint());
562 } 567 }
563 } 568 }
564 function.AttachCode(code); 569 function.AttachCode(code);
565 570
566 for (intptr_t i = 0; 571 for (intptr_t i = 0;
567 i < flow_graph->guarded_fields()->length(); 572 i < flow_graph->guarded_fields()->length();
568 i++) { 573 i++) {
569 const Field* field = (*flow_graph->guarded_fields())[i]; 574 const Field* field = (*flow_graph->guarded_fields())[i];
570 field->RegisterDependentCode(code); 575 field->RegisterDependentCode(code);
571 } 576 }
572 } else { 577 } else {
573 function.set_unoptimized_code(code); 578 function.set_unoptimized_code(code);
574 function.AttachCode(code); 579 function.AttachCode(code);
575 ASSERT(CodePatcher::CodeIsPatchable(code)); 580 ASSERT(CodePatcher::CodeIsPatchable(code));
576 } 581 }
577 if (parsed_function->HasDeferredPrefixes()) { 582 if (parsed_function->HasDeferredPrefixes()) {
578 GrowableObjectArray* prefixes = parsed_function->DeferredPrefixes(); 583 ZoneGrowableArray<const LibraryPrefix*>* prefixes =
579 LibraryPrefix& prefix = LibraryPrefix::Handle(); 584 parsed_function->deferred_prefixes();
580 for (intptr_t i = 0; i < prefixes->Length(); i++) { 585 for (intptr_t i = 0; i < prefixes->length(); i++) {
581 prefix ^= prefixes->At(i); 586 (*prefixes)[i]->RegisterDependentCode(code);
582 prefix.RegisterDependentCode(code);
583 } 587 }
584 } 588 }
585 } 589 }
586 is_compiled = true; 590 is_compiled = true;
587 done = true; 591 done = true;
588 } else { 592 } else {
589 // We bailed out or we encountered an error. 593 // We bailed out or we encountered an error.
590 const Error& error = Error::Handle( 594 const Error& error = Error::Handle(
591 isolate->object_store()->sticky_error()); 595 isolate->object_store()->sticky_error());
592 596
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 const Object& result = 975 const Object& result =
972 Object::Handle(isolate->object_store()->sticky_error()); 976 Object::Handle(isolate->object_store()->sticky_error());
973 isolate->object_store()->clear_sticky_error(); 977 isolate->object_store()->clear_sticky_error();
974 return result.raw(); 978 return result.raw();
975 } 979 }
976 UNREACHABLE(); 980 UNREACHABLE();
977 return Object::null(); 981 return Object::null();
978 } 982 }
979 983
980 } // namespace dart 984 } // namespace dart
OLDNEW
« no previous file with comments | « dart/runtime/vm/code_patcher.cc ('k') | dart/runtime/vm/flow_graph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698