| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/code_index_table.h" | 7 #include "vm/code_index_table.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 const Instance& instance = Instance::CheckedHandle(arguments.At(0)); | 320 const Instance& instance = Instance::CheckedHandle(arguments.At(0)); |
| 321 const Type& type = Type::CheckedHandle(arguments.At(1)); | 321 const Type& type = Type::CheckedHandle(arguments.At(1)); |
| 322 const TypeArguments& type_instantiator = | 322 const TypeArguments& type_instantiator = |
| 323 TypeArguments::CheckedHandle(arguments.At(2)); | 323 TypeArguments::CheckedHandle(arguments.At(2)); |
| 324 ASSERT(type.IsFinalized()); | 324 ASSERT(type.IsFinalized()); |
| 325 ASSERT(!instance.IsNull()); | 325 ASSERT(!instance.IsNull()); |
| 326 const Bool& result = Bool::Handle( | 326 const Bool& result = Bool::Handle( |
| 327 instance.IsInstanceOf(type, type_instantiator) ? | 327 instance.IsInstanceOf(type, type_instantiator) ? |
| 328 Bool::True() : Bool::False()); | 328 Bool::True() : Bool::False()); |
| 329 if (FLAG_trace_type_checks) { | 329 if (FLAG_trace_type_checks) { |
| 330 Class& cls = Class::Handle(instance.clazz()); | 330 const Type& instance_type = Type::Handle(instance.GetType()); |
| 331 // TODO(regis): Remove once all classes finalized. | 331 Type& instantiated_type = Type::Handle(type.raw()); |
| 332 if (cls.is_finalized()) { | 332 if (!type.IsInstantiated()) { |
| 333 OS::Print("InstanceOf '%s' %s '%s'\n", | 333 // Instantiate type before printing. |
| 334 String::Handle(Type::Handle(instance.GetType()).Name()). | 334 instantiated_type = type.InstantiateFrom(type_instantiator, 0); |
| 335 ToCString(), | |
| 336 (result.raw() == Bool::True()) ? "is" : "is !", | |
| 337 String::Handle(type.Name()).ToCString()); | |
| 338 } | 335 } |
| 336 OS::Print("InstanceOf: '%s' %s '%s'\n", |
| 337 String::Handle(instance_type.Name()).ToCString(), |
| 338 (result.raw() == Bool::True()) ? "is" : "is !", |
| 339 String::Handle(instantiated_type.Name()).ToCString()); |
| 339 } | 340 } |
| 340 arguments.SetReturn(result); | 341 arguments.SetReturn(result); |
| 341 } | 342 } |
| 342 | 343 |
| 343 | 344 |
| 344 DEFINE_RUNTIME_ENTRY(Throw, 1) { | 345 DEFINE_RUNTIME_ENTRY(Throw, 1) { |
| 345 ASSERT(arguments.Count() == kThrowRuntimeEntry.argument_count()); | 346 ASSERT(arguments.Count() == kThrowRuntimeEntry.argument_count()); |
| 346 const Instance& exception = Instance::CheckedHandle(arguments.At(0)); | 347 const Instance& exception = Instance::CheckedHandle(arguments.At(0)); |
| 347 Exceptions::Throw(exception); | 348 Exceptions::Throw(exception); |
| 348 } | 349 } |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 } | 994 } |
| 994 } | 995 } |
| 995 } | 996 } |
| 996 // The cache is null terminated, therefore the loop above should never | 997 // The cache is null terminated, therefore the loop above should never |
| 997 // terminate by itself. | 998 // terminate by itself. |
| 998 UNREACHABLE(); | 999 UNREACHABLE(); |
| 999 return Code::null(); | 1000 return Code::null(); |
| 1000 } | 1001 } |
| 1001 | 1002 |
| 1002 } // namespace dart | 1003 } // namespace dart |
| OLD | NEW |