Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index 4192d113c78c1a61bb21d94e5550b07209553725..fb9cab1d68a430acfef7e528129fcb188c36c789 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -1709,7 +1709,8 @@ Isolate::Isolate() |
memset(code_kind_statistics_, 0, |
sizeof(code_kind_statistics_[0]) * Code::NUMBER_OF_KINDS); |
- allow_handle_deref_ = true; |
+ allow_compiler_thread_handle_deref_ = true; |
+ allow_execution_thread_handle_deref_ = true; |
#endif |
#ifdef ENABLE_DEBUGGER_SUPPORT |
@@ -2317,6 +2318,33 @@ void Isolate::UnlinkDeferredHandles(DeferredHandles* deferred) { |
} |
+#ifdef DEBUG |
+bool Isolate::AllowHandleDereference() { |
+ if (allow_execution_thread_handle_deref_ && |
+ allow_compiler_thread_handle_deref_) { |
+ // Short-cut to avoid polling thread id. |
+ return true; |
+ } |
+ if (FLAG_parallel_recompilation && |
+ optimizing_compiler_thread()->IsOptimizerThread()) { |
+ return allow_compiler_thread_handle_deref_; |
+ } else { |
+ return allow_execution_thread_handle_deref_; |
+ } |
+} |
+ |
+ |
+void Isolate::SetAllowHandleDereference(bool allow) { |
+ if (FLAG_parallel_recompilation && |
+ optimizing_compiler_thread()->IsOptimizerThread()) { |
+ allow_compiler_thread_handle_deref_ = allow; |
+ } else { |
+ allow_execution_thread_handle_deref_ = allow; |
+ } |
+} |
+#endif |
+ |
+ |
HStatistics* Isolate::GetHStatistics() { |
if (hstatistics() == NULL) set_hstatistics(new HStatistics()); |
return hstatistics(); |