| OLD | NEW |
| 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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 } | 679 } |
| 680 | 680 |
| 681 // Load IC data for the callee. | 681 // Load IC data for the callee. |
| 682 ZoneGrowableArray<const ICData*>* ic_data_array = | 682 ZoneGrowableArray<const ICData*>* ic_data_array = |
| 683 new(Z) ZoneGrowableArray<const ICData*>(); | 683 new(Z) ZoneGrowableArray<const ICData*>(); |
| 684 function.RestoreICDataMap(ic_data_array); | 684 function.RestoreICDataMap(ic_data_array); |
| 685 | 685 |
| 686 // Build the callee graph. | 686 // Build the callee graph. |
| 687 InlineExitCollector* exit_collector = | 687 InlineExitCollector* exit_collector = |
| 688 new(Z) InlineExitCollector(caller_graph_, call); | 688 new(Z) InlineExitCollector(caller_graph_, call); |
| 689 FlowGraphBuilder builder(parsed_function, | 689 FlowGraphBuilder builder(*parsed_function, |
| 690 *ic_data_array, | 690 *ic_data_array, |
| 691 exit_collector, | 691 exit_collector, |
| 692 Isolate::kNoDeoptId); | 692 Isolate::kNoDeoptId); |
| 693 builder.SetInitialBlockId(caller_graph_->max_block_id()); | 693 builder.SetInitialBlockId(caller_graph_->max_block_id()); |
| 694 FlowGraph* callee_graph; | 694 FlowGraph* callee_graph; |
| 695 { | 695 { |
| 696 TimerScope timer(FLAG_compiler_stats, | 696 TimerScope timer(FLAG_compiler_stats, |
| 697 &CompilerStats::graphinliner_build_timer, | 697 &CompilerStats::graphinliner_build_timer, |
| 698 isolate()); | 698 isolate()); |
| 699 callee_graph = builder.BuildGraph(); | 699 callee_graph = builder.BuildGraph(); |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1465 ReturnInstr* result = | 1465 ReturnInstr* result = |
| 1466 new(Z) ReturnInstr(call_->instance_call()->token_pos(), | 1466 new(Z) ReturnInstr(call_->instance_call()->token_pos(), |
| 1467 new(Z) Value(last)); | 1467 new(Z) Value(last)); |
| 1468 owner_->caller_graph()->AppendTo( | 1468 owner_->caller_graph()->AppendTo( |
| 1469 last, | 1469 last, |
| 1470 result, | 1470 result, |
| 1471 call_->env(), // Return can become deoptimization target. | 1471 call_->env(), // Return can become deoptimization target. |
| 1472 FlowGraph::kEffect); | 1472 FlowGraph::kEffect); |
| 1473 entry->set_last_instruction(result); | 1473 entry->set_last_instruction(result); |
| 1474 exit_collector->AddExit(result); | 1474 exit_collector->AddExit(result); |
| 1475 ParsedFunction* temp_parsed_function = |
| 1476 new ParsedFunction(Thread::Current(), target); |
| 1475 GraphEntryInstr* graph_entry = | 1477 GraphEntryInstr* graph_entry = |
| 1476 new(Z) GraphEntryInstr(NULL, // No parsed function. | 1478 new(Z) GraphEntryInstr(*temp_parsed_function, |
| 1477 entry, | 1479 entry, |
| 1478 Isolate::kNoDeoptId); // No OSR id. | 1480 Isolate::kNoDeoptId); // No OSR id. |
| 1479 // Update polymorphic inliner state. | 1481 // Update polymorphic inliner state. |
| 1480 inlined_entries_.Add(graph_entry); | 1482 inlined_entries_.Add(graph_entry); |
| 1481 exit_collector_->Union(exit_collector); | 1483 exit_collector_->Union(exit_collector); |
| 1482 return true; | 1484 return true; |
| 1483 } | 1485 } |
| 1484 return false; | 1486 return false; |
| 1485 } | 1487 } |
| 1486 | 1488 |
| 1487 | 1489 |
| 1488 // Build a DAG to dispatch to the inlined function bodies. Load the class | 1490 // Build a DAG to dispatch to the inlined function bodies. Load the class |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1826 | 1828 |
| 1827 | 1829 |
| 1828 intptr_t FlowGraphInliner::NextInlineId(const Function& function) { | 1830 intptr_t FlowGraphInliner::NextInlineId(const Function& function) { |
| 1829 const intptr_t id = inline_id_to_function_->length(); | 1831 const intptr_t id = inline_id_to_function_->length(); |
| 1830 inline_id_to_function_->Add(&function); | 1832 inline_id_to_function_->Add(&function); |
| 1831 return id; | 1833 return id; |
| 1832 } | 1834 } |
| 1833 | 1835 |
| 1834 | 1836 |
| 1835 } // namespace dart | 1837 } // namespace dart |
| OLD | NEW |