| 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 #ifndef VM_EXCEPTIONS_H_ | 5 #ifndef VM_EXCEPTIONS_H_ |
| 6 #define VM_EXCEPTIONS_H_ | 6 #define VM_EXCEPTIONS_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/token_position.h" | 9 #include "vm/token_position.h" |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 kRange, | 54 kRange, |
| 55 kArgument, | 55 kArgument, |
| 56 kArgumentValue, | 56 kArgumentValue, |
| 57 kNoSuchMethod, | 57 kNoSuchMethod, |
| 58 kFormat, | 58 kFormat, |
| 59 kUnsupported, | 59 kUnsupported, |
| 60 kStackOverflow, | 60 kStackOverflow, |
| 61 kOutOfMemory, | 61 kOutOfMemory, |
| 62 kNullThrown, | 62 kNullThrown, |
| 63 kIsolateSpawn, | 63 kIsolateSpawn, |
| 64 kJavascriptIntegerOverflowError, | |
| 65 kJavascriptCompatibilityError, | |
| 66 kAssertion, | 64 kAssertion, |
| 67 kCast, | 65 kCast, |
| 68 kType, | 66 kType, |
| 69 kFallThrough, | 67 kFallThrough, |
| 70 kAbstractClassInstantiation, | 68 kAbstractClassInstantiation, |
| 71 kCyclicInitializationError, | 69 kCyclicInitializationError, |
| 72 }; | 70 }; |
| 73 | 71 |
| 74 static void ThrowByType(ExceptionType type, const Array& arguments); | 72 static void ThrowByType(ExceptionType type, const Array& arguments); |
| 75 // Uses the preallocated out of memory exception to avoid calling | 73 // Uses the preallocated out of memory exception to avoid calling |
| 76 // into Dart code or allocating any code. | 74 // into Dart code or allocating any code. |
| 77 static void ThrowOOM(); | 75 static void ThrowOOM(); |
| 78 static void ThrowStackOverflow(); | 76 static void ThrowStackOverflow(); |
| 79 static void ThrowArgumentError(const Instance& arg); | 77 static void ThrowArgumentError(const Instance& arg); |
| 80 static void ThrowRangeError(const char* argument_name, | 78 static void ThrowRangeError(const char* argument_name, |
| 81 const Integer& argument_value, | 79 const Integer& argument_value, |
| 82 intptr_t expected_from, | 80 intptr_t expected_from, |
| 83 intptr_t expected_to); | 81 intptr_t expected_to); |
| 84 static void ThrowJavascriptCompatibilityError(const char* msg); | |
| 85 | 82 |
| 86 // Returns a RawInstance if the exception is successfully created, | 83 // Returns a RawInstance if the exception is successfully created, |
| 87 // otherwise returns a RawError. | 84 // otherwise returns a RawError. |
| 88 static RawObject* Create(ExceptionType type, const Array& arguments); | 85 static RawObject* Create(ExceptionType type, const Array& arguments); |
| 89 | 86 |
| 90 static void PrintStackTraceAndAbort(const char* reason); | 87 static void PrintStackTraceAndAbort(const char* reason); |
| 91 | 88 |
| 92 private: | 89 private: |
| 93 DISALLOW_COPY_AND_ASSIGN(Exceptions); | 90 DISALLOW_COPY_AND_ASSIGN(Exceptions); |
| 94 }; | 91 }; |
| 95 | 92 |
| 96 } // namespace dart | 93 } // namespace dart |
| 97 | 94 |
| 98 #endif // VM_EXCEPTIONS_H_ | 95 #endif // VM_EXCEPTIONS_H_ |
| OLD | NEW |