| 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // Arg1: type. | 315 // Arg1: type. |
| 316 // Arg2: type arguments of the instantiator of the type. | 316 // Arg2: type arguments of the instantiator of the type. |
| 317 // Return value: true or false. | 317 // Return value: true or false. |
| 318 DEFINE_RUNTIME_ENTRY(Instanceof, 3) { | 318 DEFINE_RUNTIME_ENTRY(Instanceof, 3) { |
| 319 ASSERT(arguments.Count() == kInstanceofRuntimeEntry.argument_count()); | 319 ASSERT(arguments.Count() == kInstanceofRuntimeEntry.argument_count()); |
| 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()); | |
| 326 const Bool& result = Bool::Handle( | 325 const Bool& result = Bool::Handle( |
| 327 instance.IsInstanceOf(type, type_instantiator) ? | 326 instance.IsInstanceOf(type, type_instantiator) ? |
| 328 Bool::True() : Bool::False()); | 327 Bool::True() : Bool::False()); |
| 329 if (FLAG_trace_type_checks) { | 328 if (FLAG_trace_type_checks) { |
| 330 const Type& instance_type = Type::Handle(instance.GetType()); | 329 const Type& instance_type = Type::Handle(instance.GetType()); |
| 331 if (type.IsInstantiated()) { | 330 if (type.IsInstantiated()) { |
| 332 OS::Print("InstanceOf: '%s' %s '%s'\n", | 331 OS::Print("InstanceOf: '%s' %s '%s'\n", |
| 333 String::Handle(instance_type.Name()).ToCString(), | 332 String::Handle(instance_type.Name()).ToCString(), |
| 334 (result.raw() == Bool::True()) ? "is" : "is !", | 333 (result.raw() == Bool::True()) ? "is" : "is !", |
| 335 String::Handle(type.Name()).ToCString()); | 334 String::Handle(type.Name()).ToCString()); |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 } | 1012 } |
| 1014 } | 1013 } |
| 1015 } | 1014 } |
| 1016 // The cache is null terminated, therefore the loop above should never | 1015 // The cache is null terminated, therefore the loop above should never |
| 1017 // terminate by itself. | 1016 // terminate by itself. |
| 1018 UNREACHABLE(); | 1017 UNREACHABLE(); |
| 1019 return Code::null(); | 1018 return Code::null(); |
| 1020 } | 1019 } |
| 1021 | 1020 |
| 1022 } // namespace dart | 1021 } // namespace dart |
| OLD | NEW |