| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 // TODO(yangguo): Remove after we completely changed to MaybeHandles. | 137 // TODO(yangguo): Remove after we completely changed to MaybeHandles. |
| 138 #define CHECK_NOT_EMPTY_HANDLE(isolate, call) \ | 138 #define CHECK_NOT_EMPTY_HANDLE(isolate, call) \ |
| 139 do { \ | 139 do { \ |
| 140 ASSERT(!(isolate)->has_pending_exception()); \ | 140 ASSERT(!(isolate)->has_pending_exception()); \ |
| 141 CHECK(!(call).is_null()); \ | 141 CHECK(!(call).is_null()); \ |
| 142 } while (false) | 142 } while (false) |
| 143 | 143 |
| 144 // TODO(yangguo): Remove after we completely changed to MaybeHandles. | 144 // TODO(yangguo): Remove after we completely changed to MaybeHandles. |
| 145 #define RETURN_IF_EMPTY_HANDLE(isolate, call) \ | 145 #define RETURN_IF_EMPTY_HANDLE(isolate, call) \ |
| 146 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, call, Failure::Exception()) | 146 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, call, isolate->heap()->exception()) |
| 147 | 147 |
| 148 | 148 |
| 149 // Macros for MaybeHandle. | 149 // Macros for MaybeHandle. |
| 150 | 150 |
| 151 #define RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, T) \ | 151 #define RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, T) \ |
| 152 do { \ | 152 do { \ |
| 153 Isolate* __isolate__ = (isolate); \ | 153 Isolate* __isolate__ = (isolate); \ |
| 154 if (__isolate__->has_scheduled_exception()) { \ | 154 if (__isolate__->has_scheduled_exception()) { \ |
| 155 __isolate__->PromoteScheduledException(); \ | 155 __isolate__->PromoteScheduledException(); \ |
| 156 return MaybeHandle<T>(); \ | 156 return MaybeHandle<T>(); \ |
| 157 } \ | 157 } \ |
| 158 } while (false) | 158 } while (false) |
| 159 | 159 |
| 160 #define ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value) \ | 160 #define ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value) \ |
| 161 do { \ | 161 do { \ |
| 162 if (!(call).ToHandle(&dst)) { \ | 162 if (!(call).ToHandle(&dst)) { \ |
| 163 ASSERT((isolate)->has_pending_exception()); \ | 163 ASSERT((isolate)->has_pending_exception()); \ |
| 164 return value; \ | 164 return value; \ |
| 165 } \ | 165 } \ |
| 166 } while (false) | 166 } while (false) |
| 167 | 167 |
| 168 #define ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call) \ | 168 #define ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call) \ |
| 169 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, Failure::Exception()) | 169 ASSIGN_RETURN_ON_EXCEPTION_VALUE( \ |
| 170 isolate, dst, call, isolate->heap()->exception()) |
| 170 | 171 |
| 171 #define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T) \ | 172 #define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T) \ |
| 172 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, MaybeHandle<T>()) | 173 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, MaybeHandle<T>()) |
| 173 | 174 |
| 174 #define RETURN_ON_EXCEPTION_VALUE(isolate, call, value) \ | 175 #define RETURN_ON_EXCEPTION_VALUE(isolate, call, value) \ |
| 175 do { \ | 176 do { \ |
| 176 if ((call).is_null()) { \ | 177 if ((call).is_null()) { \ |
| 177 ASSERT((isolate)->has_pending_exception()); \ | 178 ASSERT((isolate)->has_pending_exception()); \ |
| 178 return value; \ | 179 return value; \ |
| 179 } \ | 180 } \ |
| 180 } while (false) | 181 } while (false) |
| 181 | 182 |
| 182 #define RETURN_FAILURE_ON_EXCEPTION(isolate, call) \ | 183 #define RETURN_FAILURE_ON_EXCEPTION(isolate, call) \ |
| 183 RETURN_ON_EXCEPTION_VALUE(isolate, call, Failure::Exception()) | 184 RETURN_ON_EXCEPTION_VALUE(isolate, call, isolate->heap()->exception()) |
| 184 | 185 |
| 185 #define RETURN_ON_EXCEPTION(isolate, call, T) \ | 186 #define RETURN_ON_EXCEPTION(isolate, call, T) \ |
| 186 RETURN_ON_EXCEPTION_VALUE(isolate, call, MaybeHandle<T>()) | 187 RETURN_ON_EXCEPTION_VALUE(isolate, call, MaybeHandle<T>()) |
| 187 | 188 |
| 188 | 189 |
| 189 #define FOR_EACH_ISOLATE_ADDRESS_NAME(C) \ | 190 #define FOR_EACH_ISOLATE_ADDRESS_NAME(C) \ |
| 190 C(Handler, handler) \ | 191 C(Handler, handler) \ |
| 191 C(CEntryFP, c_entry_fp) \ | 192 C(CEntryFP, c_entry_fp) \ |
| 192 C(Context, context) \ | 193 C(Context, context) \ |
| 193 C(PendingException, pending_exception) \ | 194 C(PendingException, pending_exception) \ |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 v8::AccessType type); | 769 v8::AccessType type); |
| 769 bool MayIndexedAccess(Handle<JSObject> receiver, | 770 bool MayIndexedAccess(Handle<JSObject> receiver, |
| 770 uint32_t index, | 771 uint32_t index, |
| 771 v8::AccessType type); | 772 v8::AccessType type); |
| 772 | 773 |
| 773 void SetFailedAccessCheckCallback(v8::FailedAccessCheckCallback callback); | 774 void SetFailedAccessCheckCallback(v8::FailedAccessCheckCallback callback); |
| 774 void ReportFailedAccessCheck(Handle<JSObject> receiver, v8::AccessType type); | 775 void ReportFailedAccessCheck(Handle<JSObject> receiver, v8::AccessType type); |
| 775 | 776 |
| 776 // Exception throwing support. The caller should use the result | 777 // Exception throwing support. The caller should use the result |
| 777 // of Throw() as its return value. | 778 // of Throw() as its return value. |
| 778 Failure* Throw(Object* exception, MessageLocation* location = NULL); | 779 Object* Throw(Object* exception, MessageLocation* location = NULL); |
| 779 | 780 |
| 780 template <typename T> | 781 template <typename T> |
| 781 MUST_USE_RESULT MaybeHandle<T> Throw(Handle<Object> exception, | 782 MUST_USE_RESULT MaybeHandle<T> Throw(Handle<Object> exception, |
| 782 MessageLocation* location = NULL) { | 783 MessageLocation* location = NULL) { |
| 783 Throw(*exception, location); | 784 Throw(*exception, location); |
| 784 return MaybeHandle<T>(); | 785 return MaybeHandle<T>(); |
| 785 } | 786 } |
| 786 | 787 |
| 787 // Re-throw an exception. This involves no error reporting since | 788 // Re-throw an exception. This involves no error reporting since |
| 788 // error reporting was handled when the exception was thrown | 789 // error reporting was handled when the exception was thrown |
| 789 // originally. | 790 // originally. |
| 790 Failure* ReThrow(Object* exception); | 791 Object* ReThrow(Object* exception); |
| 791 void ScheduleThrow(Object* exception); | 792 void ScheduleThrow(Object* exception); |
| 792 // Re-set pending message, script and positions reported to the TryCatch | 793 // Re-set pending message, script and positions reported to the TryCatch |
| 793 // back to the TLS for re-use when rethrowing. | 794 // back to the TLS for re-use when rethrowing. |
| 794 void RestorePendingMessageFromTryCatch(v8::TryCatch* handler); | 795 void RestorePendingMessageFromTryCatch(v8::TryCatch* handler); |
| 795 void ReportPendingMessages(); | 796 void ReportPendingMessages(); |
| 796 // Return pending location if any or unfilled structure. | 797 // Return pending location if any or unfilled structure. |
| 797 MessageLocation GetMessageLocation(); | 798 MessageLocation GetMessageLocation(); |
| 798 Failure* ThrowIllegalOperation(); | 799 Object* ThrowIllegalOperation(); |
| 799 Failure* ThrowInvalidStringLength(); | 800 Object* ThrowInvalidStringLength(); |
| 800 | 801 |
| 801 // Promote a scheduled exception to pending. Asserts has_scheduled_exception. | 802 // Promote a scheduled exception to pending. Asserts has_scheduled_exception. |
| 802 Failure* PromoteScheduledException(); | 803 Object* PromoteScheduledException(); |
| 803 void DoThrow(Object* exception, MessageLocation* location); | 804 void DoThrow(Object* exception, MessageLocation* location); |
| 804 // Checks if exception should be reported and finds out if it's | 805 // Checks if exception should be reported and finds out if it's |
| 805 // caught externally. | 806 // caught externally. |
| 806 bool ShouldReportException(bool* can_be_caught_externally, | 807 bool ShouldReportException(bool* can_be_caught_externally, |
| 807 bool catchable_by_javascript); | 808 bool catchable_by_javascript); |
| 808 | 809 |
| 809 // Attempts to compute the current source location, storing the | 810 // Attempts to compute the current source location, storing the |
| 810 // result in the target out parameter. | 811 // result in the target out parameter. |
| 811 void ComputeLocation(MessageLocation* target); | 812 void ComputeLocation(MessageLocation* target); |
| 812 | 813 |
| 813 // Out of resource exception helpers. | 814 // Out of resource exception helpers. |
| 814 Failure* StackOverflow(); | 815 Object* StackOverflow(); |
| 815 Failure* TerminateExecution(); | 816 Object* TerminateExecution(); |
| 816 void CancelTerminateExecution(); | 817 void CancelTerminateExecution(); |
| 817 | 818 |
| 818 // Administration | 819 // Administration |
| 819 void Iterate(ObjectVisitor* v); | 820 void Iterate(ObjectVisitor* v); |
| 820 void Iterate(ObjectVisitor* v, ThreadLocalTop* t); | 821 void Iterate(ObjectVisitor* v, ThreadLocalTop* t); |
| 821 char* Iterate(ObjectVisitor* v, char* t); | 822 char* Iterate(ObjectVisitor* v, char* t); |
| 822 void IterateThread(ThreadVisitor* v, char* t); | 823 void IterateThread(ThreadVisitor* v, char* t); |
| 823 | 824 |
| 824 | 825 |
| 825 // Returns the current native and global context. | 826 // Returns the current native and global context. |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1544 } | 1545 } |
| 1545 | 1546 |
| 1546 EmbeddedVector<char, 128> filename_; | 1547 EmbeddedVector<char, 128> filename_; |
| 1547 FILE* file_; | 1548 FILE* file_; |
| 1548 int scope_depth_; | 1549 int scope_depth_; |
| 1549 }; | 1550 }; |
| 1550 | 1551 |
| 1551 } } // namespace v8::internal | 1552 } } // namespace v8::internal |
| 1552 | 1553 |
| 1553 #endif // V8_ISOLATE_H_ | 1554 #endif // V8_ISOLATE_H_ |
| OLD | NEW |