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/code_generator.h" | 5 #include "vm/code_generator.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 return; | 391 return; |
392 } | 392 } |
393 if (instance.IsSmi()) { | 393 if (instance.IsSmi()) { |
394 if (FLAG_trace_type_checks) { | 394 if (FLAG_trace_type_checks) { |
395 OS::Print("UpdateTypeTestCache: instance is Smi\n"); | 395 OS::Print("UpdateTypeTestCache: instance is Smi\n"); |
396 } | 396 } |
397 return; | 397 return; |
398 } | 398 } |
399 const Class& instance_class = Class::Handle(instance.clazz()); | 399 const Class& instance_class = Class::Handle(instance.clazz()); |
400 Object& instance_class_id_or_function = Object::Handle(); | 400 Object& instance_class_id_or_function = Object::Handle(); |
| 401 TypeArguments& instance_type_arguments = TypeArguments::Handle(); |
401 if (instance_class.IsClosureClass()) { | 402 if (instance_class.IsClosureClass()) { |
402 instance_class_id_or_function = Closure::Cast(instance).function(); | 403 instance_class_id_or_function = Closure::Cast(instance).function(); |
| 404 instance_type_arguments = Closure::Cast(instance).instantiator(); |
403 } else { | 405 } else { |
404 instance_class_id_or_function = Smi::New(instance_class.id()); | 406 instance_class_id_or_function = Smi::New(instance_class.id()); |
| 407 if (instance_class.NumTypeArguments() > 0) { |
| 408 instance_type_arguments = instance.GetTypeArguments(); |
| 409 } |
405 } | 410 } |
406 TypeArguments& instance_type_arguments = TypeArguments::Handle(); | |
407 if (instance_class.IsClosureClass() || | |
408 (instance_class.NumTypeArguments() > 0)) { | |
409 instance_type_arguments = instance.GetTypeArguments(); | |
410 } | |
411 | |
412 const intptr_t len = new_cache.NumberOfChecks(); | 411 const intptr_t len = new_cache.NumberOfChecks(); |
413 if (len >= FLAG_max_subtype_cache_entries) { | 412 if (len >= FLAG_max_subtype_cache_entries) { |
414 return; | 413 return; |
415 } | 414 } |
416 #if defined(DEBUG) | 415 #if defined(DEBUG) |
417 ASSERT(instance_type_arguments.IsNull() || | 416 ASSERT(instance_type_arguments.IsNull() || |
418 instance_type_arguments.IsCanonical()); | 417 instance_type_arguments.IsCanonical()); |
419 ASSERT(instantiator_type_arguments.IsNull() || | 418 ASSERT(instantiator_type_arguments.IsNull() || |
420 instantiator_type_arguments.IsCanonical()); | 419 instantiator_type_arguments.IsCanonical()); |
421 Object& last_instance_class_id_or_function = Object::Handle(); | 420 Object& last_instance_class_id_or_function = Object::Handle(); |
(...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2262 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 2261 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
2263 const TypedData& new_data = | 2262 const TypedData& new_data = |
2264 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 2263 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
2265 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 2264 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
2266 typed_data_cell.SetAt(0, new_data); | 2265 typed_data_cell.SetAt(0, new_data); |
2267 arguments.SetReturn(new_data); | 2266 arguments.SetReturn(new_data); |
2268 } | 2267 } |
2269 | 2268 |
2270 | 2269 |
2271 } // namespace dart | 2270 } // namespace dart |
OLD | NEW |