OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // lookups. | 46 // lookups. |
47 Context* context_; | 47 Context* context_; |
48 Object* pending_exception_; | 48 Object* pending_exception_; |
49 // Use a separate value for scheduled exceptions to preserve the | 49 // Use a separate value for scheduled exceptions to preserve the |
50 // invariants that hold about pending_exception. We may want to | 50 // invariants that hold about pending_exception. We may want to |
51 // unify them later. | 51 // unify them later. |
52 Object* scheduled_exception_; | 52 Object* scheduled_exception_; |
53 bool external_caught_exception_; | 53 bool external_caught_exception_; |
54 v8::TryCatch* try_catch_handler_; | 54 v8::TryCatch* try_catch_handler_; |
55 SaveContext* save_context_; | 55 SaveContext* save_context_; |
56 v8::TryCatch* catcher_; | 56 // Flag indicating that the try_catch_handler_ contains an exception to be |
| 57 // caught. |
| 58 bool pending_external_caught_exception_; |
57 | 59 |
58 // Stack. | 60 // Stack. |
59 Address c_entry_fp_; // the frame pointer of the top c entry frame | 61 Address c_entry_fp_; // the frame pointer of the top c entry frame |
60 Address handler_; // try-blocks are chained through the stack | 62 Address handler_; // try-blocks are chained through the stack |
61 bool stack_is_cooked_; | 63 bool stack_is_cooked_; |
62 inline bool stack_is_cooked() { return stack_is_cooked_; } | 64 inline bool stack_is_cooked() { return stack_is_cooked_; } |
63 inline void set_stack_is_cooked(bool value) { stack_is_cooked_ = value; } | 65 inline void set_stack_is_cooked(bool value) { stack_is_cooked_ = value; } |
64 | 66 |
65 // Generated code scratch locations. | 67 // Generated code scratch locations. |
66 int32_t formal_count_; | 68 int32_t formal_count_; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 ASSERT(has_scheduled_exception()); | 139 ASSERT(has_scheduled_exception()); |
138 return thread_local_.scheduled_exception_; | 140 return thread_local_.scheduled_exception_; |
139 } | 141 } |
140 static bool has_scheduled_exception() { | 142 static bool has_scheduled_exception() { |
141 return !thread_local_.scheduled_exception_->IsTheHole(); | 143 return !thread_local_.scheduled_exception_->IsTheHole(); |
142 } | 144 } |
143 static void clear_scheduled_exception() { | 145 static void clear_scheduled_exception() { |
144 thread_local_.scheduled_exception_ = Heap::the_hole_value(); | 146 thread_local_.scheduled_exception_ = Heap::the_hole_value(); |
145 } | 147 } |
146 | 148 |
147 static void setup_external_caught() { | 149 // Propagate the external caught exception flag. If there is no external |
148 thread_local_.external_caught_exception_ = | 150 // caught exception always clear the TryCatch handler as it might contain |
149 (thread_local_.catcher_ != NULL) && | 151 // an exception object from a throw which was bypassed by a finally block |
150 (Top::thread_local_.try_catch_handler_ == Top::thread_local_.catcher_); | 152 // doing an explicit return/break/continue. |
| 153 static void propagate_external_caught() { |
| 154 if (has_pending_exception()) { |
| 155 thread_local_.external_caught_exception_ = |
| 156 thread_local_.pending_external_caught_exception_; |
| 157 } else { |
| 158 if (thread_local_.try_catch_handler_ != NULL) { |
| 159 thread_local_.try_catch_handler_->Reset(); |
| 160 } |
| 161 } |
| 162 thread_local_.pending_external_caught_exception_ = false; |
151 } | 163 } |
152 | 164 |
153 // Tells whether the current context has experienced an out of memory | 165 // Tells whether the current context has experienced an out of memory |
154 // exception. | 166 // exception. |
155 static bool is_out_of_memory(); | 167 static bool is_out_of_memory(); |
156 | 168 |
157 // JS execution stack (see frames.h). | 169 // JS execution stack (see frames.h). |
158 static Address c_entry_fp(ThreadLocalTop* thread) { | 170 static Address c_entry_fp(ThreadLocalTop* thread) { |
159 return thread->c_entry_fp_; | 171 return thread->c_entry_fp_; |
160 } | 172 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 366 |
355 class ExecutionAccess BASE_EMBEDDED { | 367 class ExecutionAccess BASE_EMBEDDED { |
356 public: | 368 public: |
357 ExecutionAccess(); | 369 ExecutionAccess(); |
358 ~ExecutionAccess(); | 370 ~ExecutionAccess(); |
359 }; | 371 }; |
360 | 372 |
361 } } // namespace v8::internal | 373 } } // namespace v8::internal |
362 | 374 |
363 #endif // V8_TOP_H_ | 375 #endif // V8_TOP_H_ |
OLD | NEW |