| 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_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/branch_optimizer.h" | 8 #include "vm/branch_optimizer.h" |
| 9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 return false; | 189 return false; |
| 190 } | 190 } |
| 191 const Array& args_desc_array = Array::Handle(Z, | 191 const Array& args_desc_array = Array::Handle(Z, |
| 192 ArgumentsDescriptor::New(call->ArgumentCount(), | 192 ArgumentsDescriptor::New(call->ArgumentCount(), |
| 193 call->argument_names())); | 193 call->argument_names())); |
| 194 ArgumentsDescriptor args_desc(args_desc_array); | 194 ArgumentsDescriptor args_desc(args_desc_array); |
| 195 const Function& function = Function::Handle(Z, | 195 const Function& function = Function::Handle(Z, |
| 196 Resolver::ResolveDynamicForReceiverClass( | 196 Resolver::ResolveDynamicForReceiverClass( |
| 197 receiver_class, | 197 receiver_class, |
| 198 call->function_name(), | 198 call->function_name(), |
| 199 args_desc)); | 199 args_desc, |
| 200 false /* allow add */)); |
| 200 if (function.IsNull()) { | 201 if (function.IsNull()) { |
| 201 return false; | 202 return false; |
| 202 } | 203 } |
| 203 | 204 |
| 204 // Create new ICData, do not modify the one attached to the instruction | 205 // Create new ICData, do not modify the one attached to the instruction |
| 205 // since it is attached to the assembly instruction itself. | 206 // since it is attached to the assembly instruction itself. |
| 206 // TODO(srdjan): Prevent modification of ICData object that is | 207 // TODO(srdjan): Prevent modification of ICData object that is |
| 207 // referenced in assembly code. | 208 // referenced in assembly code. |
| 208 const ICData& ic_data = ICData::ZoneHandle(Z, | 209 const ICData& ic_data = ICData::ZoneHandle(Z, |
| 209 ICData::NewFrom(*call->ic_data(), class_ids.length())); | 210 ICData::NewFrom(*call->ic_data(), class_ids.length())); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 if (!owner_class.is_abstract() && | 249 if (!owner_class.is_abstract() && |
| 249 !CHA::HasSubclasses(owner_class) && | 250 !CHA::HasSubclasses(owner_class) && |
| 250 !CHA::IsImplemented(owner_class)) { | 251 !CHA::IsImplemented(owner_class)) { |
| 251 const Array& args_desc_array = Array::Handle(Z, | 252 const Array& args_desc_array = Array::Handle(Z, |
| 252 ArgumentsDescriptor::New(call->ArgumentCount(), | 253 ArgumentsDescriptor::New(call->ArgumentCount(), |
| 253 call->argument_names())); | 254 call->argument_names())); |
| 254 ArgumentsDescriptor args_desc(args_desc_array); | 255 ArgumentsDescriptor args_desc(args_desc_array); |
| 255 const Function& function = Function::Handle(Z, | 256 const Function& function = Function::Handle(Z, |
| 256 Resolver::ResolveDynamicForReceiverClass(owner_class, | 257 Resolver::ResolveDynamicForReceiverClass(owner_class, |
| 257 call->function_name(), | 258 call->function_name(), |
| 258 args_desc)); | 259 args_desc, |
| 260 false /* allow_add */)); |
| 259 if (!function.IsNull()) { | 261 if (!function.IsNull()) { |
| 260 const ICData& ic_data = ICData::ZoneHandle(Z, | 262 const ICData& ic_data = ICData::ZoneHandle(Z, |
| 261 ICData::NewFrom(*call->ic_data(), class_ids.length())); | 263 ICData::NewFrom(*call->ic_data(), class_ids.length())); |
| 262 ic_data.AddReceiverCheck(owner_class.id(), function); | 264 ic_data.AddReceiverCheck(owner_class.id(), function); |
| 263 call->set_ic_data(&ic_data); | 265 call->set_ic_data(&ic_data); |
| 264 return true; | 266 return true; |
| 265 } | 267 } |
| 266 } | 268 } |
| 267 } | 269 } |
| 268 | 270 |
| (...skipping 3137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3406 | 3408 |
| 3407 // Discard the environment from the original instruction because the store | 3409 // Discard the environment from the original instruction because the store |
| 3408 // can't deoptimize. | 3410 // can't deoptimize. |
| 3409 instr->RemoveEnvironment(); | 3411 instr->RemoveEnvironment(); |
| 3410 ReplaceCall(instr, store); | 3412 ReplaceCall(instr, store); |
| 3411 return true; | 3413 return true; |
| 3412 } | 3414 } |
| 3413 | 3415 |
| 3414 | 3416 |
| 3415 } // namespace dart | 3417 } // namespace dart |
| OLD | NEW |