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 Handle<Object> __error__; \ | |
Toon Verwaest
2014/09/01 08:20:26
What about putting a scope around this?
| |
139 ASSIGN_RETURN_ON_EXCEPTION(isolate, __error__, isolate->factory()->call, T); \ | |
140 return isolate->Throw<T>(__error__); | |
141 | |
142 #define THROW_NEW_ERROR_RETURN_FAILURE(isolate, call) \ | |
143 Handle<Object> __error__; \ | |
Toon Verwaest
2014/09/01 08:20:25
Same here
| |
144 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, __error__, \ | |
145 isolate->factory()->call); \ | |
146 return isolate->Throw(*__error__); | |
147 | |
137 #define RETURN_ON_EXCEPTION_VALUE(isolate, call, value) \ | 148 #define RETURN_ON_EXCEPTION_VALUE(isolate, call, value) \ |
138 do { \ | 149 do { \ |
139 if ((call).is_null()) { \ | 150 if ((call).is_null()) { \ |
140 DCHECK((isolate)->has_pending_exception()); \ | 151 DCHECK((isolate)->has_pending_exception()); \ |
141 return value; \ | 152 return value; \ |
142 } \ | 153 } \ |
143 } while (false) | 154 } while (false) |
144 | 155 |
145 #define RETURN_FAILURE_ON_EXCEPTION(isolate, call) \ | 156 #define RETURN_FAILURE_ON_EXCEPTION(isolate, call) \ |
146 RETURN_ON_EXCEPTION_VALUE(isolate, call, isolate->heap()->exception()) | 157 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); | 766 void ScheduleThrow(Object* exception); |
756 // Re-set pending message, script and positions reported to the TryCatch | 767 // Re-set pending message, script and positions reported to the TryCatch |
757 // back to the TLS for re-use when rethrowing. | 768 // back to the TLS for re-use when rethrowing. |
758 void RestorePendingMessageFromTryCatch(v8::TryCatch* handler); | 769 void RestorePendingMessageFromTryCatch(v8::TryCatch* handler); |
759 // Un-schedule an exception that was caught by a TryCatch handler. | 770 // Un-schedule an exception that was caught by a TryCatch handler. |
760 void CancelScheduledExceptionFromTryCatch(v8::TryCatch* handler); | 771 void CancelScheduledExceptionFromTryCatch(v8::TryCatch* handler); |
761 void ReportPendingMessages(); | 772 void ReportPendingMessages(); |
762 // Return pending location if any or unfilled structure. | 773 // Return pending location if any or unfilled structure. |
763 MessageLocation GetMessageLocation(); | 774 MessageLocation GetMessageLocation(); |
764 Object* ThrowIllegalOperation(); | 775 Object* ThrowIllegalOperation(); |
765 Object* ThrowInvalidStringLength(); | |
766 | 776 |
767 // Promote a scheduled exception to pending. Asserts has_scheduled_exception. | 777 // Promote a scheduled exception to pending. Asserts has_scheduled_exception. |
768 Object* PromoteScheduledException(); | 778 Object* PromoteScheduledException(); |
769 void DoThrow(Object* exception, MessageLocation* location); | 779 void DoThrow(Object* exception, MessageLocation* location); |
770 // Checks if exception should be reported and finds out if it's | 780 // Checks if exception should be reported and finds out if it's |
771 // caught externally. | 781 // caught externally. |
772 bool ShouldReportException(bool* can_be_caught_externally, | 782 bool ShouldReportException(bool* can_be_caught_externally, |
773 bool catchable_by_javascript); | 783 bool catchable_by_javascript); |
774 | 784 |
775 // Attempts to compute the current source location, storing the | 785 // Attempts to compute the current source location, storing the |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1551 } | 1561 } |
1552 | 1562 |
1553 EmbeddedVector<char, 128> filename_; | 1563 EmbeddedVector<char, 128> filename_; |
1554 FILE* file_; | 1564 FILE* file_; |
1555 int scope_depth_; | 1565 int scope_depth_; |
1556 }; | 1566 }; |
1557 | 1567 |
1558 } } // namespace v8::internal | 1568 } } // namespace v8::internal |
1559 | 1569 |
1560 #endif // V8_ISOLATE_H_ | 1570 #endif // V8_ISOLATE_H_ |
OLD | NEW |