| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include "vm/exceptions.h" | 6 #include "vm/exceptions.h" |
| 7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
| 8 #include "vm/runtime_entry.h" | 8 #include "vm/runtime_entry.h" |
| 9 #include "vm/stack_frame.h" | 9 #include "vm/stack_frame.h" |
| 10 | 10 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks."); | |
| 14 | |
| 15 // Allocate and throw a new AssertionError. | 13 // Allocate and throw a new AssertionError. |
| 16 // Arg0: index of the first token of the failed assertion. | 14 // Arg0: index of the first token of the failed assertion. |
| 17 // Arg1: index of the first token after the failed assertion. | 15 // Arg1: index of the first token after the failed assertion. |
| 18 // Return value: none, throws an exception. | 16 // Return value: none, throws an exception. |
| 19 DEFINE_NATIVE_ENTRY(AssertionError_throwNew, 2) { | 17 DEFINE_NATIVE_ENTRY(AssertionError_throwNew, 2) { |
| 20 // No need to type check the arguments. This function can only be called | 18 // No need to type check the arguments. This function can only be called |
| 21 // internally from the VM. | 19 // internally from the VM. |
| 22 intptr_t assertion_start = | 20 intptr_t assertion_start = |
| 23 Smi::CheckedHandle(arguments->NativeArgAt(0)).Value(); | 21 Smi::CheckedHandle(arguments->NativeArgAt(0)).Value(); |
| 24 intptr_t assertion_end = | 22 intptr_t assertion_end = |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 intptr_t line; | 120 intptr_t line; |
| 123 script.GetTokenLocation(error_pos, &line, NULL); | 121 script.GetTokenLocation(error_pos, &line, NULL); |
| 124 args.SetAt(2, Smi::Handle(Smi::New(line))); | 122 args.SetAt(2, Smi::Handle(Smi::New(line))); |
| 125 | 123 |
| 126 Exceptions::ThrowByType(Exceptions::kAbstractClassInstantiation, args); | 124 Exceptions::ThrowByType(Exceptions::kAbstractClassInstantiation, args); |
| 127 UNREACHABLE(); | 125 UNREACHABLE(); |
| 128 return Object::null(); | 126 return Object::null(); |
| 129 } | 127 } |
| 130 | 128 |
| 131 } // namespace dart | 129 } // namespace dart |
| OLD | NEW |