Reviewers: Yang,
Description:
Fix data race on Debug::thread_local_.current_debug_scope_
BUG=v8:3614
[email protected]
LOG=n
Please review this at https://codereview.chromium.org/631223004/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+12, -6 lines):
M src/debug.h
M src/debug.cc
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index
cacc8e274a9d7b5f567b6c78a243ec8bec03e850..a9f29dd04a140dfbc506a5ada11ae78fe19625e9
100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -563,7 +563,7 @@ void Debug::ThreadInit() {
thread_local_.step_into_fp_ = 0;
thread_local_.step_out_fp_ = 0;
// TODO(isolates): frames_are_dropped_?
- thread_local_.current_debug_scope_ = NULL;
+ base::NoBarrier_Store(&thread_local_.current_debug_scope_, NULL);
thread_local_.restarter_frame_function_pointer_ = NULL;
}
@@ -3089,7 +3089,8 @@ DebugScope::DebugScope(Debug* debug)
no_termination_exceptons_(debug_->isolate_,
StackGuard::TERMINATE_EXECUTION) {
// Link recursive debugger entry.
- debug_->thread_local_.current_debug_scope_ = this;
+ base::NoBarrier_Store(&debug_->thread_local_.current_debug_scope_,
+ reinterpret_cast<base::AtomicWord>(this));
// Store the previous break id and frame id.
break_id_ = debug_->break_id();
@@ -3126,7 +3127,8 @@ DebugScope::~DebugScope() {
}
// Leaving this debugger entry.
- debug_->thread_local_.current_debug_scope_ = prev_;
+ base::NoBarrier_Store(&debug_->thread_local_.current_debug_scope_,
+ reinterpret_cast<base::AtomicWord>(prev_));
// Restore to the previous break state.
debug_->thread_local_.break_frame_id_ = break_frame_id_;
Index: src/debug.h
diff --git a/src/debug.h b/src/debug.h
index
9b14afcb34914b9c0d0c8741c965ab69b1c846be..f62f796b7523e09b2c24ee9b7aeaee27894de9d6
100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -8,6 +8,7 @@
#include "src/allocation.h"
#include "src/arguments.h"
#include "src/assembler.h"
+#include "src/base/atomicops.h"
#include "src/base/platform/platform.h"
#include "src/execution.h"
#include "src/factory.h"
@@ -459,7 +460,10 @@ class Debug {
}
// Flags and states.
- DebugScope* debugger_entry() { return
thread_local_.current_debug_scope_; }
+ DebugScope* debugger_entry() {
+ return reinterpret_cast<DebugScope*>(
+ base::NoBarrier_Load(&thread_local_.current_debug_scope_));
+ }
inline Handle<Context> debug_context() { return debug_context_; }
void set_live_edit_enabled(bool v) { live_edit_enabled_ = v; }
bool live_edit_enabled() const {
@@ -470,7 +474,7 @@ class Debug {
inline bool is_loaded() const { return !debug_context_.is_null(); }
inline bool has_break_points() const { return has_break_points_; }
inline bool in_debug_scope() const {
- return thread_local_.current_debug_scope_ != NULL;
+ return base::NoBarrier_Load(&thread_local_.current_debug_scope_) !=
NULL;
}
void set_disable_break(bool v) { break_disabled_ = v; }
@@ -599,7 +603,7 @@ class Debug {
class ThreadLocal {
public:
// Top debugger entry.
- DebugScope* current_debug_scope_;
+ base::AtomicWord current_debug_scope_;
// Counter for generating next break id.
int break_count_;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.