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

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

Issue 372733003: Closure call inlining for constant closures. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 | « no previous file | runtime/vm/object.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 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 ClosureCallInstr* call = call_info[call_idx].call; 1012 ClosureCallInstr* call = call_info[call_idx].call;
1013 // Find the closure of the callee. 1013 // Find the closure of the callee.
1014 ASSERT(call->ArgumentCount() > 0); 1014 ASSERT(call->ArgumentCount() > 0);
1015 Function& target = Function::ZoneHandle(); 1015 Function& target = Function::ZoneHandle();
1016 AllocateObjectInstr* alloc = 1016 AllocateObjectInstr* alloc =
1017 call->ArgumentAt(0)->OriginalDefinition()->AsAllocateObject(); 1017 call->ArgumentAt(0)->OriginalDefinition()->AsAllocateObject();
1018 if ((alloc != NULL) && !alloc->closure_function().IsNull()) { 1018 if ((alloc != NULL) && !alloc->closure_function().IsNull()) {
1019 target ^= alloc->closure_function().raw(); 1019 target ^= alloc->closure_function().raw();
1020 ASSERT(target.signature_class() == alloc->cls().raw()); 1020 ASSERT(target.signature_class() == alloc->cls().raw());
1021 } 1021 }
1022 ConstantInstr* constant =
1023 call->ArgumentAt(0)->OriginalDefinition()->AsConstant();
1024 if ((constant != NULL) &&
1025 constant->value().IsInstance() &&
1026 Instance::Cast(constant->value()).IsClosure()) {
1027 target ^= Closure::function(Instance::Cast(constant->value()));
1028 }
1029
1022 if (target.IsNull()) { 1030 if (target.IsNull()) {
1023 TRACE_INLINING(OS::Print(" Bailout: non-closure operator\n")); 1031 TRACE_INLINING(OS::Print(" Bailout: non-closure operator\n"));
1024 continue; 1032 continue;
1025 } 1033 }
1026 GrowableArray<Value*> arguments(call->ArgumentCount()); 1034 GrowableArray<Value*> arguments(call->ArgumentCount());
1027 for (int i = 0; i < call->ArgumentCount(); ++i) { 1035 for (int i = 0; i < call->ArgumentCount(); ++i) {
1028 arguments.Add(call->PushArgumentAt(i)->value()); 1036 arguments.Add(call->PushArgumentAt(i)->value());
1029 } 1037 }
1030 InlinedCallData call_data(call, &arguments, *call_info[call_idx].caller); 1038 InlinedCallData call_data(call, &arguments, *call_info[call_idx].caller);
1031 if (TryInlining(target, 1039 if (TryInlining(target,
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 OS::Print("After Inlining of %s\n", flow_graph_-> 1726 OS::Print("After Inlining of %s\n", flow_graph_->
1719 parsed_function().function().ToFullyQualifiedCString()); 1727 parsed_function().function().ToFullyQualifiedCString());
1720 FlowGraphPrinter printer(*flow_graph_); 1728 FlowGraphPrinter printer(*flow_graph_);
1721 printer.PrintBlocks(); 1729 printer.PrintBlocks();
1722 } 1730 }
1723 } 1731 }
1724 } 1732 }
1725 } 1733 }
1726 1734
1727 } // namespace dart 1735 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698