| 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/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
| 6 | 6 |
| 7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
| 8 | 8 |
| 9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 Instruction* current = it.Current(); | 152 Instruction* current = it.Current(); |
| 153 if (current->IsBranch()) { | 153 if (current->IsBranch()) { |
| 154 current = current->AsBranch()->comparison(); | 154 current = current->AsBranch()->comparison(); |
| 155 } | 155 } |
| 156 // In optimized code, ICData is always set in the instructions. | 156 // In optimized code, ICData is always set in the instructions. |
| 157 const ICData* ic_data = NULL; | 157 const ICData* ic_data = NULL; |
| 158 if (current->IsInstanceCall()) { | 158 if (current->IsInstanceCall()) { |
| 159 ic_data = current->AsInstanceCall()->ic_data(); | 159 ic_data = current->AsInstanceCall()->ic_data(); |
| 160 ASSERT(ic_data != NULL); | 160 ASSERT(ic_data != NULL); |
| 161 } | 161 } |
| 162 if ((ic_data != NULL) && (ic_data->NumberOfChecks() == 0)) { | 162 if ((ic_data != NULL) && (ic_data->NumberOfUsedChecks() == 0)) { |
| 163 may_reoptimize_ = true; | 163 may_reoptimize_ = true; |
| 164 } | 164 } |
| 165 if (is_leaf && | 165 if (is_leaf && |
| 166 !current->IsCheckStackOverflow() && | 166 !current->IsCheckStackOverflow() && |
| 167 !current->IsParallelMove()) { | 167 !current->IsParallelMove()) { |
| 168 // Note that we do not care if the code contains instructions that | 168 // Note that we do not care if the code contains instructions that |
| 169 // can deoptimize. | 169 // can deoptimize. |
| 170 LocationSummary* locs = current->locs(); | 170 LocationSummary* locs = current->locs(); |
| 171 if ((locs != NULL) && locs->can_call()) { | 171 if ((locs != NULL) && locs->can_call()) { |
| 172 is_leaf = false; | 172 is_leaf = false; |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 } | 829 } |
| 830 | 830 |
| 831 | 831 |
| 832 void FlowGraphCompiler::GenerateInstanceCall( | 832 void FlowGraphCompiler::GenerateInstanceCall( |
| 833 intptr_t deopt_id, | 833 intptr_t deopt_id, |
| 834 intptr_t token_pos, | 834 intptr_t token_pos, |
| 835 intptr_t argument_count, | 835 intptr_t argument_count, |
| 836 LocationSummary* locs, | 836 LocationSummary* locs, |
| 837 const ICData& ic_data) { | 837 const ICData& ic_data) { |
| 838 ASSERT(!ic_data.IsNull()); | 838 ASSERT(!ic_data.IsNull()); |
| 839 ASSERT(FLAG_propagate_ic_data || (ic_data.NumberOfChecks() == 0)); | 839 ASSERT(FLAG_propagate_ic_data || (ic_data.NumberOfUsedChecks() == 0)); |
| 840 uword label_address = 0; | 840 uword label_address = 0; |
| 841 StubCode* stub_code = isolate()->stub_code(); | 841 StubCode* stub_code = isolate()->stub_code(); |
| 842 if (is_optimizing() && (ic_data.NumberOfChecks() == 0)) { | 842 if (is_optimizing() && (ic_data.NumberOfUsedChecks() == 0)) { |
| 843 if (ic_data.IsClosureCall()) { | 843 if (ic_data.IsClosureCall()) { |
| 844 // This IC call may be closure call only. | 844 // This IC call may be closure call only. |
| 845 label_address = stub_code->ClosureCallInlineCacheEntryPoint(); | 845 label_address = stub_code->ClosureCallInlineCacheEntryPoint(); |
| 846 ExternalLabel target_label(label_address); | 846 ExternalLabel target_label(label_address); |
| 847 EmitInstanceCall(&target_label, | 847 EmitInstanceCall(&target_label, |
| 848 ICData::ZoneHandle(ic_data.AsUnaryClassChecks()), | 848 ICData::ZoneHandle(ic_data.AsUnaryClassChecks()), |
| 849 argument_count, deopt_id, token_pos, locs); | 849 argument_count, deopt_id, token_pos, locs); |
| 850 return; | 850 return; |
| 851 } | 851 } |
| 852 // Emit IC call that will count and thus may need reoptimization at | 852 // Emit IC call that will count and thus may need reoptimization at |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 } | 1396 } |
| 1397 const ICData& ic_data = ICData::ZoneHandle(isolate(), ICData::New( | 1397 const ICData& ic_data = ICData::ZoneHandle(isolate(), ICData::New( |
| 1398 parsed_function().function(), String::Handle(isolate(), target.name()), | 1398 parsed_function().function(), String::Handle(isolate(), target.name()), |
| 1399 arguments_descriptor, deopt_id, num_args_tested)); | 1399 arguments_descriptor, deopt_id, num_args_tested)); |
| 1400 ic_data.AddTarget(target); | 1400 ic_data.AddTarget(target); |
| 1401 (*deopt_id_to_ic_data_)[deopt_id] = &ic_data; | 1401 (*deopt_id_to_ic_data_)[deopt_id] = &ic_data; |
| 1402 return &ic_data; | 1402 return &ic_data; |
| 1403 } | 1403 } |
| 1404 | 1404 |
| 1405 } // namespace dart | 1405 } // namespace dart |
| OLD | NEW |