Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: src/top.h

Issue 6397011: Make exception thrown via v8 public API propagate to v8::TryCatch as JS thrown exceptions do. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 ASSERT(has_scheduled_exception()); 233 ASSERT(has_scheduled_exception());
234 return thread_local_.scheduled_exception_; 234 return thread_local_.scheduled_exception_;
235 } 235 }
236 static bool has_scheduled_exception() { 236 static bool has_scheduled_exception() {
237 return !thread_local_.scheduled_exception_->IsTheHole(); 237 return !thread_local_.scheduled_exception_->IsTheHole();
238 } 238 }
239 static void clear_scheduled_exception() { 239 static void clear_scheduled_exception() {
240 thread_local_.scheduled_exception_ = Heap::the_hole_value(); 240 thread_local_.scheduled_exception_ = Heap::the_hole_value();
241 } 241 }
242 242
243 static void setup_external_caught() {
244 thread_local_.external_caught_exception_ =
245 has_pending_exception() &&
246 (thread_local_.catcher_ != NULL) &&
247 (try_catch_handler() == thread_local_.catcher_);
248 }
249
250 static void SetCaptureStackTraceForUncaughtExceptions( 243 static void SetCaptureStackTraceForUncaughtExceptions(
251 bool capture, 244 bool capture,
252 int frame_limit, 245 int frame_limit,
253 StackTrace::StackTraceOptions options); 246 StackTrace::StackTraceOptions options);
254 247
255 // Tells whether the current context has experienced an out of memory 248 // Tells whether the current context has experienced an out of memory
256 // exception. 249 // exception.
257 static bool is_out_of_memory(); 250 static bool is_out_of_memory();
258 251
259 // JS execution stack (see frames.h). 252 // JS execution stack (see frames.h).
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 438
446 static inline ThreadLocalTop* GetCurrentThread() { return &thread_local_; } 439 static inline ThreadLocalTop* GetCurrentThread() { return &thread_local_; }
447 static int ArchiveSpacePerThread() { return sizeof(ThreadLocalTop); } 440 static int ArchiveSpacePerThread() { return sizeof(ThreadLocalTop); }
448 static char* ArchiveThread(char* to); 441 static char* ArchiveThread(char* to);
449 static char* RestoreThread(char* from); 442 static char* RestoreThread(char* from);
450 static void FreeThreadResources() { thread_local_.Free(); } 443 static void FreeThreadResources() { thread_local_.Free(); }
451 444
452 static const char* kStackOverflowMessage; 445 static const char* kStackOverflowMessage;
453 446
454 private: 447 private:
448
449 static void setup_external_caught() {
450 thread_local_.external_caught_exception_ =
451 has_pending_exception() &&
452 (thread_local_.catcher_ != NULL) &&
453 (try_catch_handler() == thread_local_.catcher_);
454 }
455
456 // Attempts to propagate the pending exception to the proper v8::TryCatch.
457 static void PropagatePendingExceptionToExteranlTryCatch();
Mads Ager (chromium) 2011/01/28 11:39:18 Exteranl -> External
antonm 2011/01/28 13:37:25 Done.
458
455 #ifdef ENABLE_VMSTATE_TRACKING 459 #ifdef ENABLE_VMSTATE_TRACKING
456 // Set of states used when communicating with the runtime profiler. 460 // Set of states used when communicating with the runtime profiler.
457 // 461 //
458 // The set of possible transitions is divided between the VM and the 462 // The set of possible transitions is divided between the VM and the
459 // profiler threads. 463 // profiler threads.
460 // 464 //
461 // The VM thread can perform these transitions: 465 // The VM thread can perform these transitions:
462 // o IN_JS -> NOT_IN_JS 466 // o IN_JS -> NOT_IN_JS
463 // o NOT_IN_JS -> IN_JS 467 // o NOT_IN_JS -> IN_JS
464 // o NOT_IN_JS_WAITING_FOR_JS -> IN_JS notifying the profiler thread 468 // o NOT_IN_JS_WAITING_FOR_JS -> IN_JS notifying the profiler thread
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 static void Unlock() { Top::break_access_->Unlock(); } 594 static void Unlock() { Top::break_access_->Unlock(); }
591 595
592 static bool TryLock() { 596 static bool TryLock() {
593 return Top::break_access_->TryLock(); 597 return Top::break_access_->TryLock();
594 } 598 }
595 }; 599 };
596 600
597 } } // namespace v8::internal 601 } } // namespace v8::internal
598 602
599 #endif // V8_TOP_H_ 603 #endif // V8_TOP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698