| 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/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
| 6 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/exceptions.h" | 9 #include "vm/exceptions.h" |
| 10 #include "vm/heap.h" | 10 #include "vm/heap.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 OS::Print(" instance type: %s\n", | 192 OS::Print(" instance type: %s\n", |
| 193 String::Handle(zone, instance_type.Name()).ToCString()); | 193 String::Handle(zone, instance_type.Name()).ToCString()); |
| 194 OS::Print(" test type: %s\n", | 194 OS::Print(" test type: %s\n", |
| 195 String::Handle(zone, type.Name()).ToCString()); | 195 String::Handle(zone, type.Name()).ToCString()); |
| 196 if (!bound_error.IsNull()) { | 196 if (!bound_error.IsNull()) { |
| 197 OS::Print(" bound error: %s\n", bound_error.ToErrorCString()); | 197 OS::Print(" bound error: %s\n", bound_error.ToErrorCString()); |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 if (!is_instance_of && !bound_error.IsNull()) { | 200 if (!is_instance_of && !bound_error.IsNull()) { |
| 201 // Throw a dynamic type error only if the instanceof test fails. | 201 // Throw a dynamic type error only if the instanceof test fails. |
| 202 DartFrameIterator iterator; | 202 DartFrameIterator iterator(thread, false); |
| 203 StackFrame* caller_frame = iterator.NextFrame(); | 203 StackFrame* caller_frame = iterator.NextFrame(); |
| 204 ASSERT(caller_frame != NULL); | 204 ASSERT(caller_frame != NULL); |
| 205 const TokenPosition location = caller_frame->GetTokenPos(); | 205 const TokenPosition location = caller_frame->GetTokenPos(); |
| 206 String& bound_error_message = | 206 String& bound_error_message = |
| 207 String::Handle(zone, String::New(bound_error.ToErrorCString())); | 207 String::Handle(zone, String::New(bound_error.ToErrorCString())); |
| 208 Exceptions::CreateAndThrowTypeError(location, AbstractType::Handle(zone), | 208 Exceptions::CreateAndThrowTypeError(location, AbstractType::Handle(zone), |
| 209 AbstractType::Handle(zone), | 209 AbstractType::Handle(zone), |
| 210 Symbols::Empty(), bound_error_message); | 210 Symbols::Empty(), bound_error_message); |
| 211 UNREACHABLE(); | 211 UNREACHABLE(); |
| 212 } | 212 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 223 ASSERT(type.IsFinalized()); | 223 ASSERT(type.IsFinalized()); |
| 224 ASSERT(!type.IsMalformed()); | 224 ASSERT(!type.IsMalformed()); |
| 225 ASSERT(!type.IsMalbounded()); | 225 ASSERT(!type.IsMalbounded()); |
| 226 ASSERT(type.IsInstantiated()); | 226 ASSERT(type.IsInstantiated()); |
| 227 Error& bound_error = Error::Handle(zone, Error::null()); | 227 Error& bound_error = Error::Handle(zone, Error::null()); |
| 228 const bool is_instance_of = | 228 const bool is_instance_of = |
| 229 instance.IsInstanceOf(type, Object::null_type_arguments(), | 229 instance.IsInstanceOf(type, Object::null_type_arguments(), |
| 230 Object::null_type_arguments(), &bound_error); | 230 Object::null_type_arguments(), &bound_error); |
| 231 if (!is_instance_of && !bound_error.IsNull()) { | 231 if (!is_instance_of && !bound_error.IsNull()) { |
| 232 // Throw a dynamic type error only if the instanceof test fails. | 232 // Throw a dynamic type error only if the instanceof test fails. |
| 233 DartFrameIterator iterator; | 233 DartFrameIterator iterator(thread, false); |
| 234 StackFrame* caller_frame = iterator.NextFrame(); | 234 StackFrame* caller_frame = iterator.NextFrame(); |
| 235 ASSERT(caller_frame != NULL); | 235 ASSERT(caller_frame != NULL); |
| 236 const TokenPosition location = caller_frame->GetTokenPos(); | 236 const TokenPosition location = caller_frame->GetTokenPos(); |
| 237 String& bound_error_message = | 237 String& bound_error_message = |
| 238 String::Handle(zone, String::New(bound_error.ToErrorCString())); | 238 String::Handle(zone, String::New(bound_error.ToErrorCString())); |
| 239 Exceptions::CreateAndThrowTypeError(location, AbstractType::Handle(zone), | 239 Exceptions::CreateAndThrowTypeError(location, AbstractType::Handle(zone), |
| 240 AbstractType::Handle(zone), | 240 AbstractType::Handle(zone), |
| 241 Symbols::Empty(), bound_error_message); | 241 Symbols::Empty(), bound_error_message); |
| 242 UNREACHABLE(); | 242 UNREACHABLE(); |
| 243 } | 243 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 269 AbstractType::Handle(zone, instance.GetType(Heap::kNew)); | 269 AbstractType::Handle(zone, instance.GetType(Heap::kNew)); |
| 270 OS::Print(" instance type: %s\n", | 270 OS::Print(" instance type: %s\n", |
| 271 String::Handle(zone, instance_type.Name()).ToCString()); | 271 String::Handle(zone, instance_type.Name()).ToCString()); |
| 272 OS::Print(" cast type: %s\n", | 272 OS::Print(" cast type: %s\n", |
| 273 String::Handle(zone, type.Name()).ToCString()); | 273 String::Handle(zone, type.Name()).ToCString()); |
| 274 if (!bound_error.IsNull()) { | 274 if (!bound_error.IsNull()) { |
| 275 OS::Print(" bound error: %s\n", bound_error.ToErrorCString()); | 275 OS::Print(" bound error: %s\n", bound_error.ToErrorCString()); |
| 276 } | 276 } |
| 277 } | 277 } |
| 278 if (!is_instance_of) { | 278 if (!is_instance_of) { |
| 279 DartFrameIterator iterator; | 279 DartFrameIterator iterator(thread, false); |
| 280 StackFrame* caller_frame = iterator.NextFrame(); | 280 StackFrame* caller_frame = iterator.NextFrame(); |
| 281 ASSERT(caller_frame != NULL); | 281 ASSERT(caller_frame != NULL); |
| 282 const TokenPosition location = caller_frame->GetTokenPos(); | 282 const TokenPosition location = caller_frame->GetTokenPos(); |
| 283 const AbstractType& instance_type = | 283 const AbstractType& instance_type = |
| 284 AbstractType::Handle(zone, instance.GetType(Heap::kNew)); | 284 AbstractType::Handle(zone, instance.GetType(Heap::kNew)); |
| 285 if (!type.IsInstantiated()) { | 285 if (!type.IsInstantiated()) { |
| 286 // Instantiate type before reporting the error. | 286 // Instantiate type before reporting the error. |
| 287 type = type.InstantiateFrom(instantiator_type_arguments, | 287 type = type.InstantiateFrom(instantiator_type_arguments, |
| 288 function_type_arguments, NULL, NULL, NULL, | 288 function_type_arguments, NULL, NULL, NULL, |
| 289 Heap::kNew); | 289 Heap::kNew); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 351 |
| 352 DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) { | 352 DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) { |
| 353 #if defined(ARCH_IS_64_BIT) | 353 #if defined(ARCH_IS_64_BIT) |
| 354 return Bool::True().raw(); | 354 return Bool::True().raw(); |
| 355 #else | 355 #else |
| 356 return Bool::False().raw(); | 356 return Bool::False().raw(); |
| 357 #endif // defined(ARCH_IS_64_BIT) | 357 #endif // defined(ARCH_IS_64_BIT) |
| 358 } | 358 } |
| 359 | 359 |
| 360 } // namespace dart | 360 } // namespace dart |
| OLD | NEW |