Chromium Code Reviews| Index: src/isolate.cc |
| diff --git a/src/isolate.cc b/src/isolate.cc |
| index b5bd955de5c868e1e83eab3450c0f3bca6a47ef7..94b558c2a96bd61491b7951a63e94d28d403eab2 100644 |
| --- a/src/isolate.cc |
| +++ b/src/isolate.cc |
| @@ -507,6 +507,28 @@ void Isolate::IterateDeferredHandles(ObjectVisitor* visitor) { |
| } |
| +#ifdef DEBUG |
| +bool Isolate::IsDeferredHandle(Object** location) { |
|
Sven Panne
2013/04/23 06:42:13
Some comment would be very appropriate here: It is
|
| + for (DeferredHandles* deferred = deferred_handles_head_; |
| + deferred != NULL; |
| + deferred = deferred->next_) { |
| + List<Object**>* blocks = &deferred->blocks_; |
| + if (blocks->first() <= location && |
| + location < deferred->first_block_limit_) { |
| + return true; |
| + } |
| + for (int i = 1; i < blocks->length(); i++) { |
|
Sven Panne
2013/04/23 06:42:13
Why 1 and not 0? Could be correct, but I don't hav
|
| + if (blocks->at(i) <= location && |
| + location <= blocks->at(i) + kHandleBlockSize) { |
| + return true; |
| + } |
| + } |
| + } |
| + return false; |
| +} |
| +#endif // DEBUG |
| + |
| + |
| void Isolate::RegisterTryCatchHandler(v8::TryCatch* that) { |
| // The ARM simulator has a separate JS stack. We therefore register |
| // the C++ try catch handler with the simulator and get back an |
| @@ -1757,8 +1779,8 @@ Isolate::Isolate() |
| memset(code_kind_statistics_, 0, |
| sizeof(code_kind_statistics_[0]) * Code::NUMBER_OF_KINDS); |
| - allow_compiler_thread_handle_deref_ = true; |
| - allow_execution_thread_handle_deref_ = true; |
| + compiler_thread_handle_deref_state_ = HandleDereferenceGuard::ALLOW; |
| + execution_thread_handle_deref_state_ = HandleDereferenceGuard::ALLOW; |
| #endif |
| #ifdef ENABLE_DEBUGGER_SUPPORT |
| @@ -2379,27 +2401,28 @@ void Isolate::UnlinkDeferredHandles(DeferredHandles* deferred) { |
| #ifdef DEBUG |
| -bool Isolate::AllowHandleDereference() { |
| - if (allow_execution_thread_handle_deref_ && |
| - allow_compiler_thread_handle_deref_) { |
| +HandleDereferenceGuard::State Isolate::HandleDereferenceGuardState() { |
| + if (execution_thread_handle_deref_state_ == HandleDereferenceGuard::ALLOW && |
| + compiler_thread_handle_deref_state_ == HandleDereferenceGuard::ALLOW) { |
| // Short-cut to avoid polling thread id. |
| - return true; |
| + return HandleDereferenceGuard::ALLOW; |
| } |
| if (FLAG_parallel_recompilation && |
| optimizing_compiler_thread()->IsOptimizerThread()) { |
| - return allow_compiler_thread_handle_deref_; |
| + return compiler_thread_handle_deref_state_; |
| } else { |
| - return allow_execution_thread_handle_deref_; |
| + return execution_thread_handle_deref_state_; |
| } |
| } |
| -void Isolate::SetAllowHandleDereference(bool allow) { |
| +void Isolate::SetHandleDereferenceGuardState( |
| + HandleDereferenceGuard::State state) { |
| if (FLAG_parallel_recompilation && |
| optimizing_compiler_thread()->IsOptimizerThread()) { |
| - allow_compiler_thread_handle_deref_ = allow; |
| + compiler_thread_handle_deref_state_ = state; |
| } else { |
| - allow_execution_thread_handle_deref_ = allow; |
| + execution_thread_handle_deref_state_ = state; |
| } |
| } |
| #endif |