OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_ISOLATE_H_ | 5 #ifndef V8_ISOLATE_H_ |
6 #define V8_ISOLATE_H_ | 6 #define V8_ISOLATE_H_ |
7 | 7 |
8 #include "include/v8-debug.h" | 8 #include "include/v8-debug.h" |
9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } \ | 127 } \ |
128 } while (false) | 128 } while (false) |
129 | 129 |
130 #define ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call) \ | 130 #define ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call) \ |
131 ASSIGN_RETURN_ON_EXCEPTION_VALUE( \ | 131 ASSIGN_RETURN_ON_EXCEPTION_VALUE( \ |
132 isolate, dst, call, isolate->heap()->exception()) | 132 isolate, dst, call, isolate->heap()->exception()) |
133 | 133 |
134 #define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T) \ | 134 #define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T) \ |
135 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, MaybeHandle<T>()) | 135 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, MaybeHandle<T>()) |
136 | 136 |
| 137 #define THROW_NEW_ERROR(isolate, call, T) \ |
| 138 do { \ |
| 139 Handle<Object> __error__; \ |
| 140 ASSIGN_RETURN_ON_EXCEPTION(isolate, __error__, isolate->factory()->call, \ |
| 141 T); \ |
| 142 return isolate->Throw<T>(__error__); \ |
| 143 } while (false) |
| 144 |
| 145 #define THROW_NEW_ERROR_RETURN_FAILURE(isolate, call) \ |
| 146 do { \ |
| 147 Handle<Object> __error__; \ |
| 148 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, __error__, \ |
| 149 isolate->factory()->call); \ |
| 150 return isolate->Throw(*__error__); \ |
| 151 } while (false) |
| 152 |
137 #define RETURN_ON_EXCEPTION_VALUE(isolate, call, value) \ | 153 #define RETURN_ON_EXCEPTION_VALUE(isolate, call, value) \ |
138 do { \ | 154 do { \ |
139 if ((call).is_null()) { \ | 155 if ((call).is_null()) { \ |
140 DCHECK((isolate)->has_pending_exception()); \ | 156 DCHECK((isolate)->has_pending_exception()); \ |
141 return value; \ | 157 return value; \ |
142 } \ | 158 } \ |
143 } while (false) | 159 } while (false) |
144 | 160 |
145 #define RETURN_FAILURE_ON_EXCEPTION(isolate, call) \ | 161 #define RETURN_FAILURE_ON_EXCEPTION(isolate, call) \ |
146 RETURN_ON_EXCEPTION_VALUE(isolate, call, isolate->heap()->exception()) | 162 RETURN_ON_EXCEPTION_VALUE(isolate, call, isolate->heap()->exception()) |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 void ScheduleThrow(Object* exception); | 771 void ScheduleThrow(Object* exception); |
756 // Re-set pending message, script and positions reported to the TryCatch | 772 // Re-set pending message, script and positions reported to the TryCatch |
757 // back to the TLS for re-use when rethrowing. | 773 // back to the TLS for re-use when rethrowing. |
758 void RestorePendingMessageFromTryCatch(v8::TryCatch* handler); | 774 void RestorePendingMessageFromTryCatch(v8::TryCatch* handler); |
759 // Un-schedule an exception that was caught by a TryCatch handler. | 775 // Un-schedule an exception that was caught by a TryCatch handler. |
760 void CancelScheduledExceptionFromTryCatch(v8::TryCatch* handler); | 776 void CancelScheduledExceptionFromTryCatch(v8::TryCatch* handler); |
761 void ReportPendingMessages(); | 777 void ReportPendingMessages(); |
762 // Return pending location if any or unfilled structure. | 778 // Return pending location if any or unfilled structure. |
763 MessageLocation GetMessageLocation(); | 779 MessageLocation GetMessageLocation(); |
764 Object* ThrowIllegalOperation(); | 780 Object* ThrowIllegalOperation(); |
765 Object* ThrowInvalidStringLength(); | |
766 | 781 |
767 // Promote a scheduled exception to pending. Asserts has_scheduled_exception. | 782 // Promote a scheduled exception to pending. Asserts has_scheduled_exception. |
768 Object* PromoteScheduledException(); | 783 Object* PromoteScheduledException(); |
769 void DoThrow(Object* exception, MessageLocation* location); | 784 void DoThrow(Object* exception, MessageLocation* location); |
770 // Checks if exception should be reported and finds out if it's | 785 // Checks if exception should be reported and finds out if it's |
771 // caught externally. | 786 // caught externally. |
772 bool ShouldReportException(bool* can_be_caught_externally, | 787 bool ShouldReportException(bool* can_be_caught_externally, |
773 bool catchable_by_javascript); | 788 bool catchable_by_javascript); |
774 | 789 |
775 // Attempts to compute the current source location, storing the | 790 // Attempts to compute the current source location, storing the |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 } | 1557 } |
1543 | 1558 |
1544 EmbeddedVector<char, 128> filename_; | 1559 EmbeddedVector<char, 128> filename_; |
1545 FILE* file_; | 1560 FILE* file_; |
1546 int scope_depth_; | 1561 int scope_depth_; |
1547 }; | 1562 }; |
1548 | 1563 |
1549 } } // namespace v8::internal | 1564 } } // namespace v8::internal |
1550 | 1565 |
1551 #endif // V8_ISOLATE_H_ | 1566 #endif // V8_ISOLATE_H_ |
OLD | NEW |