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

Unified Diff: src/handles-inl.h

Issue 12832002: Parallel recompilation: fewer handle dereferences and tighter checks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 9 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
« no previous file with comments | « src/handles.h ('k') | src/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/handles-inl.h
diff --git a/src/handles-inl.h b/src/handles-inl.h
index c1daae284c6d599af1ccc0ccb1811b0e207ca95d..fd60a350d7b420116423981b0e381ebfaae43519 100644
--- a/src/handles-inl.h
+++ b/src/handles-inl.h
@@ -52,10 +52,26 @@ Handle<T>::Handle(T* obj, Isolate* isolate) {
template <typename T>
+inline bool Handle<T>::is_identical_to(const Handle<T> other) const {
+ ASSERT(location_ == NULL ||
+ reinterpret_cast<Address>(*location_) != kZapValue);
+#ifdef DEBUG
+ if (FLAG_enable_slow_asserts) {
+ Isolate* isolate = Isolate::Current();
+ CHECK(isolate->AllowHandleDereference() ||
+ Heap::RelocationLock::IsLocked(isolate->heap()) ||
+ !isolate->optimizing_compiler_thread()->IsOptimizerThread());
+ }
+#endif // DEBUG
+ return *location_ == *other.location_;
+}
+
+
+template <typename T>
inline T* Handle<T>::operator*() const {
ASSERT(location_ != NULL);
ASSERT(reinterpret_cast<Address>(*location_) != kHandleZapValue);
- SLOW_ASSERT(ISOLATE->allow_handle_deref());
+ SLOW_ASSERT(Isolate::Current()->AllowHandleDereference());
return *BitCast<T**>(location_);
}
@@ -63,7 +79,7 @@ template <typename T>
inline T** Handle<T>::location() const {
ASSERT(location_ == NULL ||
reinterpret_cast<Address>(*location_) != kZapValue);
- SLOW_ASSERT(ISOLATE->allow_handle_deref());
+ SLOW_ASSERT(Isolate::Current()->AllowHandleDereference());
return location_;
}
@@ -164,39 +180,19 @@ inline NoHandleAllocation::~NoHandleAllocation() {
}
-NoHandleDereference::NoHandleDereference(Isolate* isolate)
+HandleDereferenceGuard::HandleDereferenceGuard(Isolate* isolate, State state)
: isolate_(isolate) {
- // The guard is set on a per-isolate basis, so it affects all threads.
- // That's why we can only use it when running without parallel recompilation.
- if (FLAG_parallel_recompilation) return;
- old_state_ = isolate->allow_handle_deref();
- isolate_->set_allow_handle_deref(false);
+ old_state_ = isolate_->AllowHandleDereference();
+ isolate_->SetAllowHandleDereference(state == ALLOW);
}
-NoHandleDereference::~NoHandleDereference() {
- if (FLAG_parallel_recompilation) return;
- isolate_->set_allow_handle_deref(old_state_);
+HandleDereferenceGuard::~HandleDereferenceGuard() {
+ isolate_->SetAllowHandleDereference(old_state_);
}
-
-AllowHandleDereference::AllowHandleDereference(Isolate* isolate)
- : isolate_(isolate) {
- // The guard is set on a per-isolate basis, so it affects all threads.
- // That's why we can only use it when running without parallel recompilation.
- if (FLAG_parallel_recompilation) return;
- old_state_ = isolate->allow_handle_deref();
- isolate_->set_allow_handle_deref(true);
-}
-
-
-AllowHandleDereference::~AllowHandleDereference() {
- if (FLAG_parallel_recompilation) return;
- isolate_->set_allow_handle_deref(old_state_);
-}
#endif
-
} } // namespace v8::internal
#endif // V8_HANDLES_INL_H_
« no previous file with comments | « src/handles.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698