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

Unified Diff: src/isolate.cc

Issue 14403015: Disallow dereferencing deferred handles when generating optimized code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 8 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/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index b5bd955de5c868e1e83eab3450c0f3bca6a47ef7..217b24849010c6cc00ec9c8f2464764025712020 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -507,6 +507,34 @@ void Isolate::IterateDeferredHandles(ObjectVisitor* visitor) {
}
+#ifdef DEBUG
+bool Isolate::IsDeferredHandle(Object** handle) {
+ // Each DeferredHandles instance keeps the handles to one job in the
+ // parallel recompilation queue, containing a list of blocks. Each block
+ // contains kHandleBlockSize handles except for the first block, which may
+ // not be fully filled.
+ // We iterate through all the blocks to see whether the argument handle
+ // belongs to one of the blocks. If so, it is deferred.
+ for (DeferredHandles* deferred = deferred_handles_head_;
+ deferred != NULL;
+ deferred = deferred->next_) {
+ List<Object**>* blocks = &deferred->blocks_;
+ if (blocks->first() <= handle &&
+ handle < deferred->first_block_limit_) {
+ return true;
+ }
+ for (int i = 1; i < blocks->length(); i++) {
+ if (blocks->at(i) <= handle &&
+ handle < blocks->at(i) + kHandleBlockSize) {
+ return true;
+ }
+ }
mvstanton 2013/04/23 08:58:50 Why can't the check of the first block in the list
Yang 2013/04/23 09:19:09 Works. Done.
+ }
+ 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 +1785,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 +2407,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
« src/ia32/lithium-codegen-ia32.cc ('K') | « src/isolate.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698