diff options
Diffstat (limited to 'deps/v8/src/isolate.h')
-rw-r--r-- | deps/v8/src/isolate.h | 111 |
1 files changed, 32 insertions, 79 deletions
diff --git a/deps/v8/src/isolate.h b/deps/v8/src/isolate.h index 97c23bd99a..035b4b363c 100644 --- a/deps/v8/src/isolate.h +++ b/deps/v8/src/isolate.h @@ -544,10 +544,7 @@ class Isolate { // Access to top context (where the current function object was created). Context* context() { return thread_local_top_.context_; } - void set_context(Context* context) { - DCHECK(context == NULL || context->IsContext()); - thread_local_top_.context_ = context; - } + inline void set_context(Context* context); Context** context_address() { return &thread_local_top_.context_; } THREAD_LOCAL_TOP_ACCESSOR(SaveContext*, save_context) @@ -556,28 +553,13 @@ class Isolate { THREAD_LOCAL_TOP_ACCESSOR(ThreadId, thread_id) // Interface to pending exception. - Object* pending_exception() { - DCHECK(has_pending_exception()); - DCHECK(!thread_local_top_.pending_exception_->IsException()); - return thread_local_top_.pending_exception_; - } - - void set_pending_exception(Object* exception_obj) { - DCHECK(!exception_obj->IsException()); - thread_local_top_.pending_exception_ = exception_obj; - } - - void clear_pending_exception() { - DCHECK(!thread_local_top_.pending_exception_->IsException()); - thread_local_top_.pending_exception_ = heap_.the_hole_value(); - } + inline Object* pending_exception(); + inline void set_pending_exception(Object* exception_obj); + inline void clear_pending_exception(); THREAD_LOCAL_TOP_ADDRESS(Object*, pending_exception) - bool has_pending_exception() { - DCHECK(!thread_local_top_.pending_exception_->IsException()); - return !thread_local_top_.pending_exception_->IsTheHole(); - } + inline bool has_pending_exception(); THREAD_LOCAL_TOP_ADDRESS(Context*, pending_handler_context) THREAD_LOCAL_TOP_ADDRESS(Code*, pending_handler_code) @@ -587,9 +569,6 @@ class Isolate { THREAD_LOCAL_TOP_ACCESSOR(bool, external_caught_exception) - void clear_pending_message() { - thread_local_top_.pending_message_obj_ = heap_.the_hole_value(); - } v8::TryCatch* try_catch_handler() { return thread_local_top_.try_catch_handler(); } @@ -599,30 +578,19 @@ class Isolate { THREAD_LOCAL_TOP_ADDRESS(Object*, scheduled_exception) + inline void clear_pending_message(); Address pending_message_obj_address() { return reinterpret_cast<Address>(&thread_local_top_.pending_message_obj_); } - Object* scheduled_exception() { - DCHECK(has_scheduled_exception()); - DCHECK(!thread_local_top_.scheduled_exception_->IsException()); - return thread_local_top_.scheduled_exception_; - } - bool has_scheduled_exception() { - DCHECK(!thread_local_top_.scheduled_exception_->IsException()); - return thread_local_top_.scheduled_exception_ != heap_.the_hole_value(); - } - void clear_scheduled_exception() { - DCHECK(!thread_local_top_.scheduled_exception_->IsException()); - thread_local_top_.scheduled_exception_ = heap_.the_hole_value(); - } + inline Object* scheduled_exception(); + inline bool has_scheduled_exception(); + inline void clear_scheduled_exception(); bool IsJavaScriptHandlerOnTop(Object* exception); bool IsExternalHandlerOnTop(Object* exception); - bool is_catchable_by_javascript(Object* exception) { - return exception != heap()->termination_exception(); - } + inline bool is_catchable_by_javascript(Object* exception); // JS execution stack (see frames.h). static Address c_entry_fp(ThreadLocalTop* thread) { @@ -649,19 +617,13 @@ class Isolate { // Returns the global object of the current context. It could be // a builtin object, or a JS global object. - Handle<GlobalObject> global_object() { - return Handle<GlobalObject>(context()->global_object()); - } + inline Handle<GlobalObject> global_object(); // Returns the global proxy object of the current context. JSObject* global_proxy() { return context()->global_proxy(); } - Handle<JSBuiltinsObject> js_builtins_object() { - return Handle<JSBuiltinsObject>(thread_local_top_.context_->builtins()); - } - static int ArchiveSpacePerThread() { return sizeof(ThreadLocalTop); } void FreeThreadResources() { thread_local_top_.Free(); } @@ -680,13 +642,8 @@ class Isolate { public: // Scope currently can only be used for regular exceptions, // not termination exception. - explicit ExceptionScope(Isolate* isolate) - : isolate_(isolate), - pending_exception_(isolate_->pending_exception(), isolate_) {} - - ~ExceptionScope() { - isolate_->set_pending_exception(*pending_exception_); - } + inline explicit ExceptionScope(Isolate* isolate); + inline ~ExceptionScope(); private: Isolate* isolate_; @@ -698,9 +655,6 @@ class Isolate { int frame_limit, StackTrace::StackTraceOptions options); - void SetAbortOnUncaughtExceptionCallback( - v8::Isolate::AbortOnUncaughtExceptionCallback callback); - enum PrintStackMode { kPrintStackConcise, kPrintStackVerbose }; void PrintCurrentStackTrace(FILE* out); void PrintStack(StringStream* accumulator, @@ -775,7 +729,7 @@ class Isolate { // Attempts to compute the current source location, storing the // result in the target out parameter. - void ComputeLocation(MessageLocation* target); + bool ComputeLocation(MessageLocation* target); bool ComputeLocationFromException(MessageLocation* target, Handle<Object> exception); bool ComputeLocationFromStackTrace(MessageLocation* target, @@ -837,13 +791,9 @@ class Isolate { ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_ACCESSOR) #undef GLOBAL_ARRAY_ACCESSOR -#define NATIVE_CONTEXT_FIELD_ACCESSOR(index, type, name) \ - Handle<type> name() { \ - return Handle<type>(native_context()->name(), this); \ - } \ - bool is_##name(type* value) { \ - return native_context()->is_##name(value); \ - } +#define NATIVE_CONTEXT_FIELD_ACCESSOR(index, type, name) \ + inline Handle<type> name(); \ + inline bool is_##name(type* value); NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSOR) #undef NATIVE_CONTEXT_FIELD_ACCESSOR @@ -1074,6 +1024,10 @@ class Isolate { void* stress_deopt_count_address() { return &stress_deopt_count_; } + void* vector_store_virtual_register_address() { + return &vector_store_virtual_register_; + } + base::RandomNumberGenerator* random_number_generator(); // Given an address occupied by a live code object, return that object. @@ -1349,6 +1303,8 @@ class Isolate { // Counts deopt points if deopt_every_n_times is enabled. unsigned int stress_deopt_count_; + Address vector_store_virtual_register_; + int next_optimization_id_; #if TRACE_MAPS @@ -1369,9 +1325,6 @@ class Isolate { std::set<Cancelable*> cancelable_tasks_; - v8::Isolate::AbortOnUncaughtExceptionCallback - abort_on_uncaught_exception_callback_; - friend class ExecutionAccess; friend class HandleScopeImplementer; friend class OptimizingCompileDispatcher; @@ -1417,11 +1370,7 @@ class PromiseOnStack { class SaveContext BASE_EMBEDDED { public: explicit SaveContext(Isolate* isolate); - - ~SaveContext() { - isolate_->set_context(context_.is_null() ? NULL : *context_); - isolate_->set_save_context(prev_); - } + ~SaveContext(); Handle<Context> context() { return context_; } SaveContext* prev() { return prev_; } @@ -1442,9 +1391,7 @@ class SaveContext BASE_EMBEDDED { class AssertNoContextChange BASE_EMBEDDED { #ifdef DEBUG public: - explicit AssertNoContextChange(Isolate* isolate) - : isolate_(isolate), - context_(isolate->context(), isolate) { } + explicit AssertNoContextChange(Isolate* isolate); ~AssertNoContextChange() { DCHECK(isolate_->context() == *context_); } @@ -1484,11 +1431,17 @@ class StackLimitCheck BASE_EMBEDDED { explicit StackLimitCheck(Isolate* isolate) : isolate_(isolate) { } // Use this to check for stack-overflows in C++ code. - inline bool HasOverflowed() const { + bool HasOverflowed() const { StackGuard* stack_guard = isolate_->stack_guard(); return GetCurrentStackPosition() < stack_guard->real_climit(); } + // Use this to check for interrupt request in C++ code. + bool InterruptRequested() { + StackGuard* stack_guard = isolate_->stack_guard(); + return GetCurrentStackPosition() < stack_guard->climit(); + } + // Use this to check for stack-overflow when entering runtime from JS code. bool JsHasOverflowed(uintptr_t gap = 0) const; |