| 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 14 matching lines...) Expand all Loading... |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_TOP_H_ | 28 #ifndef V8_TOP_H_ |
| 29 #define V8_TOP_H_ | 29 #define V8_TOP_H_ |
| 30 | 30 |
| 31 #include "atomicops.h" | 31 #include "atomicops.h" |
| 32 #include "compilation-cache.h" | 32 #include "compilation-cache.h" |
| 33 #include "frames-inl.h" | 33 #include "frames-inl.h" |
| 34 #include "runtime-profiler.h" | 34 #include "runtime-profiler.h" |
| 35 #include "simulator.h" | |
| 36 | 35 |
| 37 namespace v8 { | 36 namespace v8 { |
| 38 namespace internal { | 37 namespace internal { |
| 39 | 38 |
| 39 class Simulator; |
| 40 | 40 |
| 41 #define RETURN_IF_SCHEDULED_EXCEPTION() \ | 41 #define RETURN_IF_SCHEDULED_EXCEPTION() \ |
| 42 if (Top::has_scheduled_exception()) return Top::PromoteScheduledException() | 42 if (Top::has_scheduled_exception()) return Top::PromoteScheduledException() |
| 43 | 43 |
| 44 #define RETURN_IF_EMPTY_HANDLE_VALUE(call, value) \ |
| 45 if (call.is_null()) { \ |
| 46 ASSERT(Top::has_pending_exception()); \ |
| 47 return value; \ |
| 48 } |
| 49 |
| 50 #define RETURN_IF_EMPTY_HANDLE(call) \ |
| 51 RETURN_IF_EMPTY_HANDLE_VALUE(call, Failure::Exception()) |
| 52 |
| 44 // Top has static variables used for JavaScript execution. | 53 // Top has static variables used for JavaScript execution. |
| 45 | 54 |
| 46 class SaveContext; // Forward declaration. | 55 class SaveContext; // Forward declaration. |
| 47 class ThreadVisitor; // Defined in v8threads.h | 56 class ThreadVisitor; // Defined in v8threads.h |
| 48 class VMState; // Defined in vm-state.h | 57 class VMState; // Defined in vm-state.h |
| 49 | 58 |
| 50 class ThreadLocalTop BASE_EMBEDDED { | 59 class ThreadLocalTop BASE_EMBEDDED { |
| 51 public: | 60 public: |
| 52 // Initialize the thread data. | 61 // Initialize the thread data. |
| 53 void Initialize(); | 62 void Initialize(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 bool external_caught_exception_; | 111 bool external_caught_exception_; |
| 103 SaveContext* save_context_; | 112 SaveContext* save_context_; |
| 104 v8::TryCatch* catcher_; | 113 v8::TryCatch* catcher_; |
| 105 | 114 |
| 106 // Stack. | 115 // Stack. |
| 107 Address c_entry_fp_; // the frame pointer of the top c entry frame | 116 Address c_entry_fp_; // the frame pointer of the top c entry frame |
| 108 Address handler_; // try-blocks are chained through the stack | 117 Address handler_; // try-blocks are chained through the stack |
| 109 | 118 |
| 110 #ifdef USE_SIMULATOR | 119 #ifdef USE_SIMULATOR |
| 111 #ifdef V8_TARGET_ARCH_ARM | 120 #ifdef V8_TARGET_ARCH_ARM |
| 112 assembler::arm::Simulator* simulator_; | 121 Simulator* simulator_; |
| 113 #elif V8_TARGET_ARCH_MIPS | 122 #elif V8_TARGET_ARCH_MIPS |
| 114 assembler::mips::Simulator* simulator_; | 123 assembler::mips::Simulator* simulator_; |
| 115 #endif | 124 #endif |
| 116 #endif // USE_SIMULATOR | 125 #endif // USE_SIMULATOR |
| 117 | 126 |
| 118 #ifdef ENABLE_LOGGING_AND_PROFILING | 127 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 119 Address js_entry_sp_; // the stack pointer of the bottom js entry frame | 128 Address js_entry_sp_; // the stack pointer of the bottom js entry frame |
| 120 Address external_callback_; // the external callback we're currently in | 129 Address external_callback_; // the external callback we're currently in |
| 121 #endif | 130 #endif |
| 122 | 131 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 MessageLocation* location = NULL); | 388 MessageLocation* location = NULL); |
| 380 static void ScheduleThrow(Object* exception); | 389 static void ScheduleThrow(Object* exception); |
| 381 static void ReportPendingMessages(); | 390 static void ReportPendingMessages(); |
| 382 static Failure* ThrowIllegalOperation(); | 391 static Failure* ThrowIllegalOperation(); |
| 383 | 392 |
| 384 // Promote a scheduled exception to pending. Asserts has_scheduled_exception. | 393 // Promote a scheduled exception to pending. Asserts has_scheduled_exception. |
| 385 static Failure* PromoteScheduledException(); | 394 static Failure* PromoteScheduledException(); |
| 386 static void DoThrow(MaybeObject* exception, | 395 static void DoThrow(MaybeObject* exception, |
| 387 MessageLocation* location, | 396 MessageLocation* location, |
| 388 const char* message); | 397 const char* message); |
| 389 static bool ShouldReturnException(bool* is_caught_externally, | 398 // Checks if exception should be reported and finds out if it's |
| 399 // caught externally. |
| 400 static bool ShouldReportException(bool* is_caught_externally, |
| 390 bool catchable_by_javascript); | 401 bool catchable_by_javascript); |
| 391 | 402 |
| 392 // Attempts to compute the current source location, storing the | 403 // Attempts to compute the current source location, storing the |
| 393 // result in the target out parameter. | 404 // result in the target out parameter. |
| 394 static void ComputeLocation(MessageLocation* target); | 405 static void ComputeLocation(MessageLocation* target); |
| 395 | 406 |
| 396 // Override command line flag. | 407 // Override command line flag. |
| 397 static void TraceException(bool flag); | 408 static void TraceException(bool flag); |
| 398 | 409 |
| 399 // Out of resource exception helpers. | 410 // Out of resource exception helpers. |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 static void Unlock() { Top::break_access_->Unlock(); } | 599 static void Unlock() { Top::break_access_->Unlock(); } |
| 589 | 600 |
| 590 static bool TryLock() { | 601 static bool TryLock() { |
| 591 return Top::break_access_->TryLock(); | 602 return Top::break_access_->TryLock(); |
| 592 } | 603 } |
| 593 }; | 604 }; |
| 594 | 605 |
| 595 } } // namespace v8::internal | 606 } } // namespace v8::internal |
| 596 | 607 |
| 597 #endif // V8_TOP_H_ | 608 #endif // V8_TOP_H_ |
| OLD | NEW |