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 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 call_info.length())); | 1121 call_info.length())); |
1122 for (intptr_t call_idx = 0; call_idx < call_info.length(); ++call_idx) { | 1122 for (intptr_t call_idx = 0; call_idx < call_info.length(); ++call_idx) { |
1123 ClosureCallInstr* call = call_info[call_idx].call; | 1123 ClosureCallInstr* call = call_info[call_idx].call; |
1124 // Find the closure of the callee. | 1124 // Find the closure of the callee. |
1125 ASSERT(call->ArgumentCount() > 0); | 1125 ASSERT(call->ArgumentCount() > 0); |
1126 Function& target = Function::ZoneHandle(); | 1126 Function& target = Function::ZoneHandle(); |
1127 AllocateObjectInstr* alloc = | 1127 AllocateObjectInstr* alloc = |
1128 call->ArgumentAt(0)->OriginalDefinition()->AsAllocateObject(); | 1128 call->ArgumentAt(0)->OriginalDefinition()->AsAllocateObject(); |
1129 if ((alloc != NULL) && !alloc->closure_function().IsNull()) { | 1129 if ((alloc != NULL) && !alloc->closure_function().IsNull()) { |
1130 target ^= alloc->closure_function().raw(); | 1130 target ^= alloc->closure_function().raw(); |
1131 ASSERT(target.signature_class() == alloc->cls().raw()); | 1131 ASSERT(alloc->cls().IsClosureClass()); |
1132 } | 1132 } |
1133 ConstantInstr* constant = | 1133 ConstantInstr* constant = |
1134 call->ArgumentAt(0)->OriginalDefinition()->AsConstant(); | 1134 call->ArgumentAt(0)->OriginalDefinition()->AsConstant(); |
1135 if ((constant != NULL) && | 1135 if ((constant != NULL) && |
1136 constant->value().IsInstance() && | 1136 constant->value().IsClosure()) { |
1137 Instance::Cast(constant->value()).IsClosure()) { | 1137 target ^= Closure::Cast(constant->value()).function(); |
1138 target ^= Closure::function(Instance::Cast(constant->value())); | |
1139 } | 1138 } |
1140 | 1139 |
1141 if (target.IsNull()) { | 1140 if (target.IsNull()) { |
1142 TRACE_INLINING(THR_Print(" Bailout: non-closure operator\n")); | 1141 TRACE_INLINING(THR_Print(" Bailout: non-closure operator\n")); |
1143 continue; | 1142 continue; |
1144 } | 1143 } |
1145 GrowableArray<Value*> arguments(call->ArgumentCount()); | 1144 GrowableArray<Value*> arguments(call->ArgumentCount()); |
1146 for (int i = 0; i < call->ArgumentCount(); ++i) { | 1145 for (int i = 0; i < call->ArgumentCount(); ++i) { |
1147 arguments.Add(call->PushArgumentAt(i)->value()); | 1146 arguments.Add(call->PushArgumentAt(i)->value()); |
1148 } | 1147 } |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1935 intptr_t FlowGraphInliner::NextInlineId(const Function& function, | 1934 intptr_t FlowGraphInliner::NextInlineId(const Function& function, |
1936 intptr_t parent_id) { | 1935 intptr_t parent_id) { |
1937 const intptr_t id = inline_id_to_function_->length(); | 1936 const intptr_t id = inline_id_to_function_->length(); |
1938 inline_id_to_function_->Add(&function); | 1937 inline_id_to_function_->Add(&function); |
1939 caller_inline_id_->Add(parent_id); | 1938 caller_inline_id_->Add(parent_id); |
1940 return id; | 1939 return id; |
1941 } | 1940 } |
1942 | 1941 |
1943 | 1942 |
1944 } // namespace dart | 1943 } // namespace dart |
OLD | NEW |