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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 String::Handle(instance_type.Name()).ToCString(), | 316 String::Handle(instance_type.Name()).ToCString(), |
317 Class::Handle(instance_type.type_class()).id(), | 317 Class::Handle(instance_type.type_class()).id(), |
318 (result.raw() == Bool::True().raw()) ? "is" : "is !", | 318 (result.raw() == Bool::True().raw()) ? "is" : "is !", |
319 String::Handle(type.Name()).ToCString(), | 319 String::Handle(type.Name()).ToCString(), |
320 Class::Handle(type.type_class()).id(), | 320 Class::Handle(type.type_class()).id(), |
321 caller_frame->pc()); | 321 caller_frame->pc()); |
322 } else { | 322 } else { |
323 // Instantiate type before printing. | 323 // Instantiate type before printing. |
324 Error& bound_error = Error::Handle(); | 324 Error& bound_error = Error::Handle(); |
325 const AbstractType& instantiated_type = AbstractType::Handle( | 325 const AbstractType& instantiated_type = AbstractType::Handle( |
326 type.InstantiateFrom(instantiator_type_arguments, &bound_error)); | 326 type.InstantiateFrom(instantiator_type_arguments, &bound_error, |
| 327 NULL, NULL, Heap::kOld)); |
327 OS::PrintErr("%s: '%s' %s '%s' instantiated from '%s' (pc: %#" Px ").\n", | 328 OS::PrintErr("%s: '%s' %s '%s' instantiated from '%s' (pc: %#" Px ").\n", |
328 message, | 329 message, |
329 String::Handle(instance_type.Name()).ToCString(), | 330 String::Handle(instance_type.Name()).ToCString(), |
330 (result.raw() == Bool::True().raw()) ? "is" : "is !", | 331 (result.raw() == Bool::True().raw()) ? "is" : "is !", |
331 String::Handle(instantiated_type.Name()).ToCString(), | 332 String::Handle(instantiated_type.Name()).ToCString(), |
332 String::Handle(type.Name()).ToCString(), | 333 String::Handle(type.Name()).ToCString(), |
333 caller_frame->pc()); | 334 caller_frame->pc()); |
334 if (!bound_error.IsNull()) { | 335 if (!bound_error.IsNull()) { |
335 OS::Print(" bound error: %s\n", bound_error.ToErrorCString()); | 336 OS::Print(" bound error: %s\n", bound_error.ToErrorCString()); |
336 } | 337 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 #endif | 417 #endif |
417 new_cache.AddCheck(instance_class_id_or_function, | 418 new_cache.AddCheck(instance_class_id_or_function, |
418 instance_type_arguments, | 419 instance_type_arguments, |
419 instantiator_type_arguments, | 420 instantiator_type_arguments, |
420 result); | 421 result); |
421 if (FLAG_trace_type_checks) { | 422 if (FLAG_trace_type_checks) { |
422 AbstractType& test_type = AbstractType::Handle(type.raw()); | 423 AbstractType& test_type = AbstractType::Handle(type.raw()); |
423 if (!test_type.IsInstantiated()) { | 424 if (!test_type.IsInstantiated()) { |
424 Error& bound_error = Error::Handle(); | 425 Error& bound_error = Error::Handle(); |
425 test_type = type.InstantiateFrom(instantiator_type_arguments, | 426 test_type = type.InstantiateFrom(instantiator_type_arguments, |
426 &bound_error); | 427 &bound_error, |
| 428 NULL, NULL, Heap::kNew); |
427 ASSERT(bound_error.IsNull()); // Malbounded types are not optimized. | 429 ASSERT(bound_error.IsNull()); // Malbounded types are not optimized. |
428 } | 430 } |
429 OS::PrintErr(" Updated test cache %p ix: %" Pd " with " | 431 OS::PrintErr(" Updated test cache %p ix: %" Pd " with " |
430 "(cid-or-fun: %p, type-args: %p, instantiator: %p, result: %s)\n" | 432 "(cid-or-fun: %p, type-args: %p, instantiator: %p, result: %s)\n" |
431 " instance [class: (%p '%s' cid: %" Pd "), type-args: %p %s]\n" | 433 " instance [class: (%p '%s' cid: %" Pd "), type-args: %p %s]\n" |
432 " test-type [class: (%p '%s' cid: %" Pd "), in-type-args: %p %s]\n", | 434 " test-type [class: (%p '%s' cid: %" Pd "), in-type-args: %p %s]\n", |
433 new_cache.raw(), | 435 new_cache.raw(), |
434 len, | 436 len, |
435 | 437 |
436 instance_class_id_or_function.raw(), | 438 instance_class_id_or_function.raw(), |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 if (!is_instance_of) { | 533 if (!is_instance_of) { |
532 // Throw a dynamic type error. | 534 // Throw a dynamic type error. |
533 const TokenPosition location = GetCallerLocation(); | 535 const TokenPosition location = GetCallerLocation(); |
534 const AbstractType& src_type = AbstractType::Handle(src_instance.GetType()); | 536 const AbstractType& src_type = AbstractType::Handle(src_instance.GetType()); |
535 String& src_type_name = String::Handle(src_type.UserVisibleName()); | 537 String& src_type_name = String::Handle(src_type.UserVisibleName()); |
536 String& dst_type_name = String::Handle(); | 538 String& dst_type_name = String::Handle(); |
537 Library& dst_type_lib = Library::Handle(); | 539 Library& dst_type_lib = Library::Handle(); |
538 if (!dst_type.IsInstantiated()) { | 540 if (!dst_type.IsInstantiated()) { |
539 // Instantiate dst_type before reporting the error. | 541 // Instantiate dst_type before reporting the error. |
540 const AbstractType& instantiated_dst_type = AbstractType::Handle( | 542 const AbstractType& instantiated_dst_type = AbstractType::Handle( |
541 dst_type.InstantiateFrom(instantiator_type_arguments, NULL)); | 543 dst_type.InstantiateFrom(instantiator_type_arguments, NULL, |
| 544 NULL, NULL, Heap::kNew)); |
542 // Note that instantiated_dst_type may be malbounded. | 545 // Note that instantiated_dst_type may be malbounded. |
543 dst_type_name = instantiated_dst_type.UserVisibleName(); | 546 dst_type_name = instantiated_dst_type.UserVisibleName(); |
544 dst_type_lib = | 547 dst_type_lib = |
545 Class::Handle(instantiated_dst_type.type_class()).library(); | 548 Class::Handle(instantiated_dst_type.type_class()).library(); |
546 } else { | 549 } else { |
547 dst_type_name = dst_type.UserVisibleName(); | 550 dst_type_name = dst_type.UserVisibleName(); |
548 dst_type_lib = Class::Handle(dst_type.type_class()).library(); | 551 dst_type_lib = Class::Handle(dst_type.type_class()).library(); |
549 } | 552 } |
550 String& bound_error_message = String::Handle(); | 553 String& bound_error_message = String::Handle(); |
551 if (!bound_error.IsNull()) { | 554 if (!bound_error.IsNull()) { |
(...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1907 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1910 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
1908 const TypedData& new_data = | 1911 const TypedData& new_data = |
1909 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1912 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
1910 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1913 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
1911 typed_data_cell.SetAt(0, new_data); | 1914 typed_data_cell.SetAt(0, new_data); |
1912 arguments.SetReturn(new_data); | 1915 arguments.SetReturn(new_data); |
1913 } | 1916 } |
1914 | 1917 |
1915 | 1918 |
1916 } // namespace dart | 1919 } // namespace dart |
OLD | NEW |