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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 if (class_ids.length() > 1) { | 243 if (class_ids.length() > 1) { |
244 ic_data.AddCheck(class_ids, function); | 244 ic_data.AddCheck(class_ids, function); |
245 } else { | 245 } else { |
246 ASSERT(class_ids.length() == 1); | 246 ASSERT(class_ids.length() == 1); |
247 ic_data.AddReceiverCheck(class_ids[0], function); | 247 ic_data.AddReceiverCheck(class_ids[0], function); |
248 } | 248 } |
249 call->set_ic_data(&ic_data); | 249 call->set_ic_data(&ic_data); |
250 return true; | 250 return true; |
251 } | 251 } |
252 | 252 |
| 253 #ifdef DART_PRECOMPILER |
253 if (FLAG_precompilation && | 254 if (FLAG_precompilation && |
254 (isolate()->object_store()->unique_dynamic_targets() != Array::null())) { | 255 (isolate()->object_store()->unique_dynamic_targets() != Array::null())) { |
255 // Check if the target is unique. | 256 // Check if the target is unique. |
256 Function& target_function = Function::Handle(Z); | 257 Function& target_function = Function::Handle(Z); |
257 Precompiler::GetUniqueDynamicTarget( | 258 Precompiler::GetUniqueDynamicTarget( |
258 isolate(), call->function_name(), &target_function); | 259 isolate(), call->function_name(), &target_function); |
259 // Calls with named arguments must be resolved/checked at runtime. | 260 // Calls with named arguments must be resolved/checked at runtime. |
260 String& error_message = String::Handle(Z); | 261 String& error_message = String::Handle(Z); |
261 if (!target_function.IsNull() && | 262 if (!target_function.IsNull() && |
262 !target_function.HasOptionalNamedParameters() && | 263 !target_function.HasOptionalNamedParameters() && |
263 target_function.AreValidArgumentCounts(call->ArgumentCount(), 0, | 264 target_function.AreValidArgumentCounts(call->ArgumentCount(), 0, |
264 &error_message)) { | 265 &error_message)) { |
265 const intptr_t cid = Class::Handle(Z, target_function.Owner()).id(); | 266 const intptr_t cid = Class::Handle(Z, target_function.Owner()).id(); |
266 const ICData& ic_data = ICData::ZoneHandle(Z, | 267 const ICData& ic_data = ICData::ZoneHandle(Z, |
267 ICData::NewFrom(*call->ic_data(), 1)); | 268 ICData::NewFrom(*call->ic_data(), 1)); |
268 ic_data.AddReceiverCheck(cid, target_function); | 269 ic_data.AddReceiverCheck(cid, target_function); |
269 call->set_ic_data(&ic_data); | 270 call->set_ic_data(&ic_data); |
270 return true; | 271 return true; |
271 } | 272 } |
272 } | 273 } |
| 274 #endif |
273 | 275 |
274 // Check if getter or setter in function's class and class is currently leaf. | 276 // Check if getter or setter in function's class and class is currently leaf. |
275 if (FLAG_guess_icdata_cid && | 277 if (FLAG_guess_icdata_cid && |
276 ((call->token_kind() == Token::kGET) || | 278 ((call->token_kind() == Token::kGET) || |
277 (call->token_kind() == Token::kSET))) { | 279 (call->token_kind() == Token::kSET))) { |
278 const Class& owner_class = Class::Handle(Z, function().Owner()); | 280 const Class& owner_class = Class::Handle(Z, function().Owner()); |
279 if (!owner_class.is_abstract() && | 281 if (!owner_class.is_abstract() && |
280 !CHA::HasSubclasses(owner_class) && | 282 !CHA::HasSubclasses(owner_class) && |
281 !CHA::IsImplemented(owner_class)) { | 283 !CHA::IsImplemented(owner_class)) { |
282 const Array& args_desc_array = Array::Handle(Z, | 284 const Array& args_desc_array = Array::Handle(Z, |
(...skipping 4762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5045 // the code for this instruction, however, leaving the environment | 5047 // the code for this instruction, however, leaving the environment |
5046 // changes code. | 5048 // changes code. |
5047 current->RemoveEnvironment(); | 5049 current->RemoveEnvironment(); |
5048 } | 5050 } |
5049 } | 5051 } |
5050 } | 5052 } |
5051 } | 5053 } |
5052 | 5054 |
5053 | 5055 |
5054 } // namespace dart | 5056 } // namespace dart |
OLD | NEW |