| 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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 if (constant != NULL) { | 607 if (constant != NULL) { |
| 608 return new(Z) ConstantInstr(constant->value()); | 608 return new(Z) ConstantInstr(constant->value()); |
| 609 } else { | 609 } else { |
| 610 return new(Z) ParameterInstr(i, graph->graph_entry()); | 610 return new(Z) ParameterInstr(i, graph->graph_entry()); |
| 611 } | 611 } |
| 612 } | 612 } |
| 613 | 613 |
| 614 bool TryInlining(const Function& function, | 614 bool TryInlining(const Function& function, |
| 615 const Array& argument_names, | 615 const Array& argument_names, |
| 616 InlinedCallData* call_data) { | 616 InlinedCallData* call_data) { |
| 617 if (function.is_native()) { |
| 618 return false; |
| 619 } |
| 617 TRACE_INLINING(THR_Print(" => %s (deopt count %d)\n", | 620 TRACE_INLINING(THR_Print(" => %s (deopt count %d)\n", |
| 618 function.ToCString(), | 621 function.ToCString(), |
| 619 function.deoptimization_counter())); | 622 function.deoptimization_counter())); |
| 620 | 623 |
| 621 // Abort if the inlinable bit on the function is low. | 624 // Abort if the inlinable bit on the function is low. |
| 622 if (!function.CanBeInlined()) { | 625 if (!function.CanBeInlined()) { |
| 623 TRACE_INLINING(THR_Print(" Bailout: not inlinable\n")); | 626 TRACE_INLINING(THR_Print(" Bailout: not inlinable\n")); |
| 624 PRINT_INLINING_TREE("Not inlinable", | 627 PRINT_INLINING_TREE("Not inlinable", |
| 625 &call_data->caller, &function, call_data->call); | 628 &call_data->caller, &function, call_data->call); |
| 626 return false; | 629 return false; |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1378 return true; | 1381 return true; |
| 1379 } | 1382 } |
| 1380 } | 1383 } |
| 1381 | 1384 |
| 1382 return false; | 1385 return false; |
| 1383 } | 1386 } |
| 1384 | 1387 |
| 1385 | 1388 |
| 1386 bool PolymorphicInliner::TryInliningPoly(intptr_t receiver_cid, | 1389 bool PolymorphicInliner::TryInliningPoly(intptr_t receiver_cid, |
| 1387 const Function& target) { | 1390 const Function& target) { |
| 1391 if (target.is_native()) { |
| 1392 return false; |
| 1393 } |
| 1388 if (TryInlineRecognizedMethod(receiver_cid, target)) { | 1394 if (TryInlineRecognizedMethod(receiver_cid, target)) { |
| 1389 owner_->inlined_ = true; | 1395 owner_->inlined_ = true; |
| 1390 return true; | 1396 return true; |
| 1391 } | 1397 } |
| 1392 | 1398 |
| 1393 GrowableArray<Value*> arguments(call_->ArgumentCount()); | 1399 GrowableArray<Value*> arguments(call_->ArgumentCount()); |
| 1394 for (int i = 0; i < call_->ArgumentCount(); ++i) { | 1400 for (int i = 0; i < call_->ArgumentCount(); ++i) { |
| 1395 arguments.Add(call_->PushArgumentAt(i)->value()); | 1401 arguments.Add(call_->PushArgumentAt(i)->value()); |
| 1396 } | 1402 } |
| 1397 InlinedCallData call_data(call_, &arguments, | 1403 InlinedCallData call_data(call_, &arguments, |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1894 intptr_t FlowGraphInliner::NextInlineId(const Function& function, | 1900 intptr_t FlowGraphInliner::NextInlineId(const Function& function, |
| 1895 intptr_t parent_id) { | 1901 intptr_t parent_id) { |
| 1896 const intptr_t id = inline_id_to_function_->length(); | 1902 const intptr_t id = inline_id_to_function_->length(); |
| 1897 inline_id_to_function_->Add(&function); | 1903 inline_id_to_function_->Add(&function); |
| 1898 caller_inline_id_->Add(parent_id); | 1904 caller_inline_id_->Add(parent_id); |
| 1899 return id; | 1905 return id; |
| 1900 } | 1906 } |
| 1901 | 1907 |
| 1902 | 1908 |
| 1903 } // namespace dart | 1909 } // namespace dart |
| OLD | NEW |