OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3805 | 3805 |
3806 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); | 3806 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); |
3807 | 3807 |
3808 | 3808 |
3809 /** | 3809 /** |
3810 * Create new error objects by calling the corresponding error object | 3810 * Create new error objects by calling the corresponding error object |
3811 * constructor with the message. | 3811 * constructor with the message. |
3812 */ | 3812 */ |
3813 class V8_EXPORT Exception { | 3813 class V8_EXPORT Exception { |
3814 public: | 3814 public: |
3815 static Local<Value> RangeError(Handle<String> message); | 3815 enum ErrorType { |
| 3816 kNoError, |
| 3817 // These errors are spec compliant. |
| 3818 kError, |
| 3819 kTypeError, |
| 3820 kRangeError, |
| 3821 kSyntaxError, |
| 3822 kReferenceError, |
| 3823 kURIError, |
| 3824 kEvalError, |
| 3825 // This is v8 specific, but is a native error type. |
| 3826 kStackOverflowError |
| 3827 }; |
| 3828 |
| 3829 /** |
| 3830 * Returns the type of error this object is. |
| 3831 * If it is not a native error, kNoError is returned. |
| 3832 */ |
| 3833 static ErrorType NativeErrorType(Local<Value> value); |
| 3834 |
| 3835 static Local<Value> StackOverflowError(Handle<String> message); |
3816 static Local<Value> ReferenceError(Handle<String> message); | 3836 static Local<Value> ReferenceError(Handle<String> message); |
3817 static Local<Value> SyntaxError(Handle<String> message); | 3837 static Local<Value> SyntaxError(Handle<String> message); |
| 3838 static Local<Value> RangeError(Handle<String> message); |
3818 static Local<Value> TypeError(Handle<String> message); | 3839 static Local<Value> TypeError(Handle<String> message); |
| 3840 static Local<Value> EvalError(Handle<String> message); |
| 3841 static Local<Value> URIError(Handle<String> message); |
3819 static Local<Value> Error(Handle<String> message); | 3842 static Local<Value> Error(Handle<String> message); |
3820 }; | 3843 }; |
3821 | 3844 |
3822 | 3845 |
3823 // --- Counters Callbacks --- | 3846 // --- Counters Callbacks --- |
3824 | 3847 |
3825 typedef int* (*CounterLookupCallback)(const char* name); | 3848 typedef int* (*CounterLookupCallback)(const char* name); |
3826 | 3849 |
3827 typedef void* (*CreateHistogramCallback)(const char* name, | 3850 typedef void* (*CreateHistogramCallback)(const char* name, |
3828 int min, | 3851 int min, |
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5407 static const int kStringEncodingMask = 0x4; | 5430 static const int kStringEncodingMask = 0x4; |
5408 static const int kExternalTwoByteRepresentationTag = 0x02; | 5431 static const int kExternalTwoByteRepresentationTag = 0x02; |
5409 static const int kExternalAsciiRepresentationTag = 0x06; | 5432 static const int kExternalAsciiRepresentationTag = 0x06; |
5410 | 5433 |
5411 static const int kIsolateEmbedderDataOffset = 0 * kApiPointerSize; | 5434 static const int kIsolateEmbedderDataOffset = 0 * kApiPointerSize; |
5412 static const int kIsolateRootsOffset = 5 * kApiPointerSize; | 5435 static const int kIsolateRootsOffset = 5 * kApiPointerSize; |
5413 static const int kUndefinedValueRootIndex = 5; | 5436 static const int kUndefinedValueRootIndex = 5; |
5414 static const int kNullValueRootIndex = 7; | 5437 static const int kNullValueRootIndex = 7; |
5415 static const int kTrueValueRootIndex = 8; | 5438 static const int kTrueValueRootIndex = 8; |
5416 static const int kFalseValueRootIndex = 9; | 5439 static const int kFalseValueRootIndex = 9; |
5417 static const int kEmptyStringRootIndex = 141; | 5440 static const int kEmptyStringRootIndex = 142; |
5418 | 5441 |
5419 static const int kNodeClassIdOffset = 1 * kApiPointerSize; | 5442 static const int kNodeClassIdOffset = 1 * kApiPointerSize; |
5420 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; | 5443 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; |
5421 static const int kNodeStateMask = 0xf; | 5444 static const int kNodeStateMask = 0xf; |
5422 static const int kNodeStateIsWeakValue = 2; | 5445 static const int kNodeStateIsWeakValue = 2; |
5423 static const int kNodeStateIsPendingValue = 3; | 5446 static const int kNodeStateIsPendingValue = 3; |
5424 static const int kNodeStateIsNearDeathValue = 4; | 5447 static const int kNodeStateIsNearDeathValue = 4; |
5425 static const int kNodeIsIndependentShift = 4; | 5448 static const int kNodeIsIndependentShift = 4; |
5426 static const int kNodeIsPartiallyDependentShift = 5; | 5449 static const int kNodeIsPartiallyDependentShift = 5; |
5427 | 5450 |
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6455 */ | 6478 */ |
6456 | 6479 |
6457 | 6480 |
6458 } // namespace v8 | 6481 } // namespace v8 |
6459 | 6482 |
6460 | 6483 |
6461 #undef TYPE_CHECK | 6484 #undef TYPE_CHECK |
6462 | 6485 |
6463 | 6486 |
6464 #endif // V8_H_ | 6487 #endif // V8_H_ |
OLD | NEW |