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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 // | | | next_ |--+ | 273 // | | | next_ |--+ |
274 // | | | | 274 // | | | |
275 // | JS handler |--+ <---------+ | | 275 // | JS handler |--+ <---------+ | |
276 // | next | | 276 // | next | |
277 // | 277 // |
278 // If the top-most JS try-catch handler is not equal to | 278 // If the top-most JS try-catch handler is not equal to |
279 // Top::thread_local_.try_catch_handler_.js_handler_, it means the JS handler | 279 // Top::thread_local_.try_catch_handler_.js_handler_, it means the JS handler |
280 // is on the top. Otherwise, it means the C try-catch handler is on the top. | 280 // is on the top. Otherwise, it means the C try-catch handler is on the top. |
281 // | 281 // |
282 void Top::RegisterTryCatchHandler(v8::TryCatch* that) { | 282 void Top::RegisterTryCatchHandler(v8::TryCatch* that) { |
283 that->js_handler_ = thread_local_.handler_; // casted to void* | 283 StackHandler* handler = |
| 284 reinterpret_cast<StackHandler*>(thread_local_.handler_); |
| 285 |
| 286 // Find the top-most try-catch handler. |
| 287 while (handler != NULL && !handler->is_try_catch()) { |
| 288 handler = handler->next(); |
| 289 } |
| 290 |
| 291 that->js_handler_ = handler; // casted to void* |
284 thread_local_.try_catch_handler_ = that; | 292 thread_local_.try_catch_handler_ = that; |
285 } | 293 } |
286 | 294 |
287 | 295 |
288 void Top::UnregisterTryCatchHandler(v8::TryCatch* that) { | 296 void Top::UnregisterTryCatchHandler(v8::TryCatch* that) { |
289 ASSERT(thread_local_.try_catch_handler_ == that); | 297 ASSERT(thread_local_.try_catch_handler_ == that); |
290 thread_local_.try_catch_handler_ = that->next_; | 298 thread_local_.try_catch_handler_ = that->next_; |
291 } | 299 } |
292 | 300 |
293 | 301 |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 Top::break_access_->Lock(); | 972 Top::break_access_->Lock(); |
965 } | 973 } |
966 | 974 |
967 | 975 |
968 ExecutionAccess::~ExecutionAccess() { | 976 ExecutionAccess::~ExecutionAccess() { |
969 Top::break_access_->Unlock(); | 977 Top::break_access_->Unlock(); |
970 } | 978 } |
971 | 979 |
972 | 980 |
973 } } // namespace v8::internal | 981 } } // namespace v8::internal |
OLD | NEW |