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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 ASSERT(has_scheduled_exception()); | 242 ASSERT(has_scheduled_exception()); |
243 return thread_local_.scheduled_exception_; | 243 return thread_local_.scheduled_exception_; |
244 } | 244 } |
245 static bool has_scheduled_exception() { | 245 static bool has_scheduled_exception() { |
246 return !thread_local_.scheduled_exception_->IsTheHole(); | 246 return !thread_local_.scheduled_exception_->IsTheHole(); |
247 } | 247 } |
248 static void clear_scheduled_exception() { | 248 static void clear_scheduled_exception() { |
249 thread_local_.scheduled_exception_ = Heap::the_hole_value(); | 249 thread_local_.scheduled_exception_ = Heap::the_hole_value(); |
250 } | 250 } |
251 | 251 |
252 static void setup_external_caught() { | 252 static bool IsExternallyCaught(); |
253 thread_local_.external_caught_exception_ = | |
254 has_pending_exception() && | |
255 (thread_local_.catcher_ != NULL) && | |
256 (try_catch_handler() == thread_local_.catcher_); | |
257 } | |
258 | 253 |
259 static void SetCaptureStackTraceForUncaughtExceptions( | 254 static void SetCaptureStackTraceForUncaughtExceptions( |
260 bool capture, | 255 bool capture, |
261 int frame_limit, | 256 int frame_limit, |
262 StackTrace::StackTraceOptions options); | 257 StackTrace::StackTraceOptions options); |
263 | 258 |
264 // Tells whether the current context has experienced an out of memory | 259 // Tells whether the current context has experienced an out of memory |
265 // exception. | 260 // exception. |
266 static bool is_out_of_memory(); | 261 static bool is_out_of_memory(); |
267 | 262 |
| 263 static bool is_catchable_by_javascript(MaybeObject* exception) { |
| 264 return (exception != Failure::OutOfMemoryException()) && |
| 265 (exception != Heap::termination_exception()); |
| 266 } |
| 267 |
268 // JS execution stack (see frames.h). | 268 // JS execution stack (see frames.h). |
269 static Address c_entry_fp(ThreadLocalTop* thread) { | 269 static Address c_entry_fp(ThreadLocalTop* thread) { |
270 return thread->c_entry_fp_; | 270 return thread->c_entry_fp_; |
271 } | 271 } |
272 static Address handler(ThreadLocalTop* thread) { return thread->handler_; } | 272 static Address handler(ThreadLocalTop* thread) { return thread->handler_; } |
273 | 273 |
274 static inline Address* c_entry_fp_address() { | 274 static inline Address* c_entry_fp_address() { |
275 return &thread_local_.c_entry_fp_; | 275 return &thread_local_.c_entry_fp_; |
276 } | 276 } |
277 static inline Address* handler_address() { return &thread_local_.handler_; } | 277 static inline Address* handler_address() { return &thread_local_.handler_; } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 static void ReportPendingMessages(); | 390 static void ReportPendingMessages(); |
391 static Failure* ThrowIllegalOperation(); | 391 static Failure* ThrowIllegalOperation(); |
392 | 392 |
393 // Promote a scheduled exception to pending. Asserts has_scheduled_exception. | 393 // Promote a scheduled exception to pending. Asserts has_scheduled_exception. |
394 static Failure* PromoteScheduledException(); | 394 static Failure* PromoteScheduledException(); |
395 static void DoThrow(MaybeObject* exception, | 395 static void DoThrow(MaybeObject* exception, |
396 MessageLocation* location, | 396 MessageLocation* location, |
397 const char* message); | 397 const char* message); |
398 // Checks if exception should be reported and finds out if it's | 398 // Checks if exception should be reported and finds out if it's |
399 // caught externally. | 399 // caught externally. |
400 static bool ShouldReportException(bool* is_caught_externally, | 400 static bool ShouldReportException(bool* can_be_caught_externally, |
401 bool catchable_by_javascript); | 401 bool catchable_by_javascript); |
402 | 402 |
403 // Attempts to compute the current source location, storing the | 403 // Attempts to compute the current source location, storing the |
404 // result in the target out parameter. | 404 // result in the target out parameter. |
405 static void ComputeLocation(MessageLocation* target); | 405 static void ComputeLocation(MessageLocation* target); |
406 | 406 |
407 // Override command line flag. | 407 // Override command line flag. |
408 static void TraceException(bool flag); | 408 static void TraceException(bool flag); |
409 | 409 |
410 // Out of resource exception helpers. | 410 // Out of resource exception helpers. |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 static void Unlock() { Top::break_access_->Unlock(); } | 599 static void Unlock() { Top::break_access_->Unlock(); } |
600 | 600 |
601 static bool TryLock() { | 601 static bool TryLock() { |
602 return Top::break_access_->TryLock(); | 602 return Top::break_access_->TryLock(); |
603 } | 603 } |
604 }; | 604 }; |
605 | 605 |
606 } } // namespace v8::internal | 606 } } // namespace v8::internal |
607 | 607 |
608 #endif // V8_TOP_H_ | 608 #endif // V8_TOP_H_ |
OLD | NEW |