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