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

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

Issue 23589008: Clean up handling of guarded fields in the flow graph builder. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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 | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_optimizer.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/flow_graph_inliner.h" 5 #include "vm/flow_graph_inliner.h"
6 6
7 #include "vm/block_scheduler.h" 7 #include "vm/block_scheduler.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/flow_graph.h" 10 #include "vm/flow_graph.h"
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 Array& ic_data_array = Array::Handle(); 535 Array& ic_data_array = Array::Handle();
536 if (function.HasCode()) { 536 if (function.HasCode()) {
537 const Code& unoptimized_code = 537 const Code& unoptimized_code =
538 Code::Handle(function.unoptimized_code()); 538 Code::Handle(function.unoptimized_code());
539 ic_data_array = unoptimized_code.ExtractTypeFeedbackArray(); 539 ic_data_array = unoptimized_code.ExtractTypeFeedbackArray();
540 } 540 }
541 541
542 // Build the callee graph. 542 // Build the callee graph.
543 InlineExitCollector* exit_collector = 543 InlineExitCollector* exit_collector =
544 new InlineExitCollector(caller_graph_, call); 544 new InlineExitCollector(caller_graph_, call);
545 GrowableArray<const Field*> inlined_guarded_fields; 545 FlowGraphBuilder builder(parsed_function,
546 FlowGraphBuilder* builder = new FlowGraphBuilder(parsed_function, 546 ic_data_array,
547 ic_data_array, 547 exit_collector,
548 exit_collector, 548 Isolate::kNoDeoptId);
549 &inlined_guarded_fields, 549 builder.SetInitialBlockId(caller_graph_->max_block_id());
550 Isolate::kNoDeoptId);
551 builder->SetInitialBlockId(caller_graph_->max_block_id());
552 FlowGraph* callee_graph; 550 FlowGraph* callee_graph;
553 { 551 {
554 TimerScope timer(FLAG_compiler_stats, 552 TimerScope timer(FLAG_compiler_stats,
555 &CompilerStats::graphinliner_build_timer, 553 &CompilerStats::graphinliner_build_timer,
556 isolate); 554 isolate);
557 callee_graph = builder->BuildGraph(); 555 callee_graph = builder.BuildGraph();
558 } 556 }
559 557
560 // The parameter stubs are a copy of the actual arguments providing 558 // The parameter stubs are a copy of the actual arguments providing
561 // concrete information about the values, for example constant values, 559 // concrete information about the values, for example constant values,
562 // without linking between the caller and callee graphs. 560 // without linking between the caller and callee graphs.
563 // TODO(zerny): Put more information in the stubs, eg, type information. 561 // TODO(zerny): Put more information in the stubs, eg, type information.
564 ZoneGrowableArray<Definition*>* param_stubs = 562 ZoneGrowableArray<Definition*>* param_stubs =
565 new ZoneGrowableArray<Definition*>(function.NumParameters()); 563 new ZoneGrowableArray<Definition*>(function.NumParameters());
566 564
567 // Create a parameter stub for each fixed positional parameter. 565 // Create a parameter stub for each fixed positional parameter.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 inlined_size_ += size; 662 inlined_size_ += size;
665 isolate->set_long_jump_base(base); 663 isolate->set_long_jump_base(base);
666 isolate->set_deopt_id(prev_deopt_id); 664 isolate->set_deopt_id(prev_deopt_id);
667 665
668 call_data->callee_graph = callee_graph; 666 call_data->callee_graph = callee_graph;
669 call_data->parameter_stubs = param_stubs; 667 call_data->parameter_stubs = param_stubs;
670 call_data->exit_collector = exit_collector; 668 call_data->exit_collector = exit_collector;
671 669
672 // When inlined, we add the guarded fields of the callee to the caller's 670 // When inlined, we add the guarded fields of the callee to the caller's
673 // list of guarded fields. 671 // list of guarded fields.
674 for (intptr_t i = 0; i < inlined_guarded_fields.length(); ++i) { 672 for (intptr_t i = 0; i < callee_graph->guarded_fields()->length(); ++i) {
675 caller_graph_->builder().AddToGuardedFields(*inlined_guarded_fields[i]); 673 FlowGraph::AddToGuardedFields(caller_graph_->guarded_fields(),
674 (*callee_graph->guarded_fields())[i]);
676 } 675 }
677 676
678 TRACE_INLINING(OS::Print(" Success\n")); 677 TRACE_INLINING(OS::Print(" Success\n"));
679 return true; 678 return true;
680 } else { 679 } else {
681 Error& error = Error::Handle(); 680 Error& error = Error::Handle();
682 error = isolate->object_store()->sticky_error(); 681 error = isolate->object_store()->sticky_error();
683 isolate->object_store()->clear_sticky_error(); 682 isolate->object_store()->clear_sticky_error();
684 isolate->set_long_jump_base(base); 683 isolate->set_long_jump_base(base);
685 isolate->set_deopt_id(prev_deopt_id); 684 isolate->set_deopt_id(prev_deopt_id);
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 OS::Print("After Inlining of %s\n", flow_graph_-> 1490 OS::Print("After Inlining of %s\n", flow_graph_->
1492 parsed_function().function().ToFullyQualifiedCString()); 1491 parsed_function().function().ToFullyQualifiedCString());
1493 FlowGraphPrinter printer(*flow_graph_); 1492 FlowGraphPrinter printer(*flow_graph_);
1494 printer.PrintBlocks(); 1493 printer.PrintBlocks();
1495 } 1494 }
1496 } 1495 }
1497 } 1496 }
1498 } 1497 }
1499 1498
1500 } // namespace dart 1499 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698