Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Unified Diff: src/handles-inl.h

Issue 12049012: Avoid handle dereference during graph optimization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698