| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2513 single_target = Function::null(); | 2514 single_target = Function::null(); |
| 2514 break; | 2515 break; |
| 2515 } | 2516 } |
| 2516 | 2517 |
| 2517 // Create an ICData and map all previously seen classes (< i) to | 2518 // Create an ICData and map all previously seen classes (< i) to |
| 2518 // the computed single_target. | 2519 // the computed single_target. |
| 2519 ic_data = ICData::New(function, | 2520 ic_data = ICData::New(function, |
| 2520 instr->function_name(), | 2521 instr->function_name(), |
| 2521 args_desc_array, | 2522 args_desc_array, |
| 2522 Thread::kNoDeoptId, | 2523 Thread::kNoDeoptId, |
| 2523 /* args_tested = */ 1); | 2524 /* args_tested = */ 1, false); |
| 2524 for (intptr_t j = 0; j < i; j++) { | 2525 for (intptr_t j = 0; j < i; j++) { |
| 2525 ic_data.AddReceiverCheck(class_ids[j], single_target); | 2526 ic_data.AddReceiverCheck(class_ids[j], single_target); |
| 2526 } | 2527 } |
| 2527 | 2528 |
| 2528 single_target = Function::null(); | 2529 single_target = Function::null(); |
| 2529 } | 2530 } |
| 2530 | 2531 |
| 2531 ASSERT(ic_data.raw() != ICData::null()); | 2532 ASSERT(ic_data.raw() != ICData::null()); |
| 2532 ASSERT(single_target.raw() == Function::null()); | 2533 ASSERT(single_target.raw() == Function::null()); |
| 2533 ic_data.AddReceiverCheck(cid, target); | 2534 ic_data.AddReceiverCheck(cid, target); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2799 | 2800 |
| 2800 // Discard the environment from the original instruction because the store | 2801 // Discard the environment from the original instruction because the store |
| 2801 // can't deoptimize. | 2802 // can't deoptimize. |
| 2802 instr->RemoveEnvironment(); | 2803 instr->RemoveEnvironment(); |
| 2803 ReplaceCall(instr, store); | 2804 ReplaceCall(instr, store); |
| 2804 return true; | 2805 return true; |
| 2805 } | 2806 } |
| 2806 | 2807 |
| 2807 | 2808 |
| 2808 } // namespace dart | 2809 } // namespace dart |
| OLD | NEW |