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