Chromium Code Reviews| Index: src/handles-inl.h |
| diff --git a/src/handles-inl.h b/src/handles-inl.h |
| index 130798647ba2d6be2c68a1c810fd57a3bf39d1e0..7b4ed7d50e3e443361e947b7a198e7dac7db114c 100644 |
| --- a/src/handles-inl.h |
| +++ b/src/handles-inl.h |
| @@ -63,6 +63,7 @@ template <typename T> |
| inline T* Handle<T>::operator*() const { |
| ASSERT(location_ != NULL); |
| ASSERT(reinterpret_cast<Address>(*location_) != kHandleZapValue); |
| + SLOW_ASSERT(ISOLATE->allow_handle_deref()); |
| return *BitCast<T**>(location_); |
| } |
| @@ -175,6 +176,36 @@ inline NoHandleAllocation::~NoHandleAllocation() { |
| data->level = level_; |
| } |
| } |
| + |
| + |
| +NoHandleDereference::NoHandleDereference() { |
| + Isolate* isolate = Isolate::Current(); |
| + active_ = !isolate->optimizing_compiler_thread()->IsOptimizerThread(); |
|
Jakob Kummerow
2013/01/23 12:09:18
I'd appreciate a comment here, something along the
Yang
2013/01/23 13:34:25
Done.
|
| + if (active_) { |
| + old_state_ = isolate->allow_handle_deref(); |
| + isolate->set_allow_handle_deref(false); |
| + } |
| +} |
| + |
| + |
| +NoHandleDereference::~NoHandleDereference() { |
| + if (active_) Isolate::Current()->set_allow_handle_deref(old_state_); |
| +} |
| + |
| + |
| +AllowHandleDereference::AllowHandleDereference() { |
| + Isolate* isolate = Isolate::Current(); |
| + active_ = !isolate->optimizing_compiler_thread()->IsOptimizerThread(); |
| + if (active_) { |
| + old_state_ = isolate->allow_handle_deref(); |
| + isolate->set_allow_handle_deref(true); |
| + } |
| +} |
| + |
| + |
| +AllowHandleDereference::~AllowHandleDereference() { |
| + if (active_) Isolate::Current()->set_allow_handle_deref(old_state_); |
| +} |
| #endif |