| 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/aot_optimizer.h" | 5 #include "vm/aot_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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 if (instr->IsInstanceCall()) { | 69 if (instr->IsInstanceCall()) { |
| 70 InstanceCallInstr* call = instr->AsInstanceCall(); | 70 InstanceCallInstr* call = instr->AsInstanceCall(); |
| 71 if (!call->HasICData()) { | 71 if (!call->HasICData()) { |
| 72 const Array& arguments_descriptor = | 72 const Array& arguments_descriptor = |
| 73 Array::Handle(zone(), | 73 Array::Handle(zone(), |
| 74 ArgumentsDescriptor::New(call->ArgumentCount(), | 74 ArgumentsDescriptor::New(call->ArgumentCount(), |
| 75 call->argument_names())); | 75 call->argument_names())); |
| 76 const ICData& ic_data = ICData::ZoneHandle(zone(), ICData::New( | 76 const ICData& ic_data = ICData::ZoneHandle(zone(), ICData::New( |
| 77 function(), call->function_name(), | 77 function(), call->function_name(), |
| 78 arguments_descriptor, call->deopt_id(), | 78 arguments_descriptor, call->deopt_id(), |
| 79 call->checked_argument_count())); | 79 call->checked_argument_count(), false)); |
| 80 call->set_ic_data(&ic_data); | 80 call->set_ic_data(&ic_data); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 current_iterator_ = NULL; | 84 current_iterator_ = NULL; |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 | 88 |
| 89 // Optimize instance calls using cid. This is called after optimizer | 89 // Optimize instance calls using cid. This is called after optimizer |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 const Function& function = | 249 const Function& function = |
| 250 Function::Handle(Z, ic_data.GetTargetForReceiverClassId(cid)); | 250 Function::Handle(Z, ic_data.GetTargetForReceiverClassId(cid)); |
| 251 // TODO(fschneider): Try looking up the function on the class if it is | 251 // TODO(fschneider): Try looking up the function on the class if it is |
| 252 // not found in the ICData. | 252 // not found in the ICData. |
| 253 if (!function.IsNull()) { | 253 if (!function.IsNull()) { |
| 254 const ICData& new_ic_data = ICData::ZoneHandle(Z, ICData::New( | 254 const ICData& new_ic_data = ICData::ZoneHandle(Z, ICData::New( |
| 255 Function::Handle(Z, ic_data.Owner()), | 255 Function::Handle(Z, ic_data.Owner()), |
| 256 String::Handle(Z, ic_data.target_name()), | 256 String::Handle(Z, ic_data.target_name()), |
| 257 Object::empty_array(), // Dummy argument descriptor. | 257 Object::empty_array(), // Dummy argument descriptor. |
| 258 ic_data.deopt_id(), | 258 ic_data.deopt_id(), |
| 259 ic_data.NumArgsTested())); | 259 ic_data.NumArgsTested(), false)); |
| 260 new_ic_data.SetDeoptReasons(ic_data.DeoptReasons()); | 260 new_ic_data.SetDeoptReasons(ic_data.DeoptReasons()); |
| 261 new_ic_data.AddReceiverCheck(cid, function); | 261 new_ic_data.AddReceiverCheck(cid, function); |
| 262 return new_ic_data; | 262 return new_ic_data; |
| 263 } | 263 } |
| 264 | 264 |
| 265 return ic_data; | 265 return ic_data; |
| 266 } | 266 } |
| 267 | 267 |
| 268 | 268 |
| 269 static BinarySmiOpInstr* AsSmiShiftLeftInstruction(Definition* d) { | 269 static BinarySmiOpInstr* AsSmiShiftLeftInstruction(Definition* d) { |
| (...skipping 2170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2440 "no overrides of '%s' '%s'\n", | 2440 "no overrides of '%s' '%s'\n", |
| 2441 instr->function_name().ToCString(), receiver_class.ToCString()); | 2441 instr->function_name().ToCString(), receiver_class.ToCString()); |
| 2442 } | 2442 } |
| 2443 | 2443 |
| 2444 // Create fake IC data with the resolved target. | 2444 // Create fake IC data with the resolved target. |
| 2445 const ICData& ic_data = ICData::Handle( | 2445 const ICData& ic_data = ICData::Handle( |
| 2446 ICData::New(flow_graph_->function(), | 2446 ICData::New(flow_graph_->function(), |
| 2447 instr->function_name(), | 2447 instr->function_name(), |
| 2448 args_desc_array, | 2448 args_desc_array, |
| 2449 Thread::kNoDeoptId, | 2449 Thread::kNoDeoptId, |
| 2450 /* args_tested = */ 1)); | 2450 /* args_tested = */ 1, |
| 2451 false)); |
| 2451 ic_data.AddReceiverCheck(receiver_class.id(), function); | 2452 ic_data.AddReceiverCheck(receiver_class.id(), function); |
| 2452 PolymorphicInstanceCallInstr* call = | 2453 PolymorphicInstanceCallInstr* call = |
| 2453 new(Z) PolymorphicInstanceCallInstr(instr, ic_data, | 2454 new(Z) PolymorphicInstanceCallInstr(instr, ic_data, |
| 2454 /* with_checks = */ false, | 2455 /* with_checks = */ false, |
| 2455 /* complete = */ true); | 2456 /* complete = */ true); |
| 2456 instr->ReplaceWith(call, current_iterator()); | 2457 instr->ReplaceWith(call, current_iterator()); |
| 2457 return; | 2458 return; |
| 2458 } | 2459 } |
| 2459 } | 2460 } |
| 2460 } | 2461 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2478 const Array& args_desc_array = Array::Handle(Z, | 2479 const Array& args_desc_array = Array::Handle(Z, |
| 2479 ArgumentsDescriptor::New(instr->ArgumentCount(), | 2480 ArgumentsDescriptor::New(instr->ArgumentCount(), |
| 2480 instr->argument_names())); | 2481 instr->argument_names())); |
| 2481 ArgumentsDescriptor args_desc(args_desc_array); | 2482 ArgumentsDescriptor args_desc(args_desc_array); |
| 2482 | 2483 |
| 2483 const ICData& ic_data = ICData::Handle( | 2484 const ICData& ic_data = ICData::Handle( |
| 2484 ICData::New(function, | 2485 ICData::New(function, |
| 2485 instr->function_name(), | 2486 instr->function_name(), |
| 2486 args_desc_array, | 2487 args_desc_array, |
| 2487 Thread::kNoDeoptId, | 2488 Thread::kNoDeoptId, |
| 2488 /* args_tested = */ 1)); | 2489 /* args_tested = */ 1, false)); |
| 2489 | 2490 |
| 2490 Function& target = Function::Handle(Z); | 2491 Function& target = Function::Handle(Z); |
| 2491 Class& cls = Class::Handle(Z); | 2492 Class& cls = Class::Handle(Z); |
| 2492 bool includes_dispatcher_case = false; | 2493 bool includes_dispatcher_case = false; |
| 2493 for (intptr_t i = 0; i < class_ids.length(); i++) { | 2494 for (intptr_t i = 0; i < class_ids.length(); i++) { |
| 2494 intptr_t cid = class_ids[i]; | 2495 intptr_t cid = class_ids[i]; |
| 2495 cls = isolate()->class_table()->At(cid); | 2496 cls = isolate()->class_table()->At(cid); |
| 2496 target = Resolver::ResolveDynamicForReceiverClass( | 2497 target = Resolver::ResolveDynamicForReceiverClass( |
| 2497 cls, | 2498 cls, |
| 2498 instr->function_name(), | 2499 instr->function_name(), |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2753 | 2754 |
| 2754 // Discard the environment from the original instruction because the store | 2755 // Discard the environment from the original instruction because the store |
| 2755 // can't deoptimize. | 2756 // can't deoptimize. |
| 2756 instr->RemoveEnvironment(); | 2757 instr->RemoveEnvironment(); |
| 2757 ReplaceCall(instr, store); | 2758 ReplaceCall(instr, store); |
| 2758 return true; | 2759 return true; |
| 2759 } | 2760 } |
| 2760 | 2761 |
| 2761 | 2762 |
| 2762 } // namespace dart | 2763 } // namespace dart |
| OLD | NEW |