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

Side by Side Diff: src/debug.h

Issue 631223004: Fix data race on Debug::thread_local_.current_debug_scope_ (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_DEBUG_H_ 5 #ifndef V8_DEBUG_H_
6 #define V8_DEBUG_H_ 6 #define V8_DEBUG_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/assembler.h" 10 #include "src/assembler.h"
11 #include "src/base/atomicops.h"
11 #include "src/base/platform/platform.h" 12 #include "src/base/platform/platform.h"
12 #include "src/execution.h" 13 #include "src/execution.h"
13 #include "src/factory.h" 14 #include "src/factory.h"
14 #include "src/flags.h" 15 #include "src/flags.h"
15 #include "src/frames-inl.h" 16 #include "src/frames-inl.h"
16 #include "src/hashmap.h" 17 #include "src/hashmap.h"
17 #include "src/liveedit.h" 18 #include "src/liveedit.h"
18 #include "src/string-stream.h" 19 #include "src/string-stream.h"
19 #include "src/v8threads.h" 20 #include "src/v8threads.h"
20 21
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 void FreeThreadResources() { } 453 void FreeThreadResources() { }
453 454
454 // Record function from which eval was called. 455 // Record function from which eval was called.
455 static void RecordEvalCaller(Handle<Script> script); 456 static void RecordEvalCaller(Handle<Script> script);
456 457
457 bool CheckExecutionState(int id) { 458 bool CheckExecutionState(int id) {
458 return !debug_context().is_null() && break_id() != 0 && break_id() == id; 459 return !debug_context().is_null() && break_id() != 0 && break_id() == id;
459 } 460 }
460 461
461 // Flags and states. 462 // Flags and states.
462 DebugScope* debugger_entry() { return thread_local_.current_debug_scope_; } 463 DebugScope* debugger_entry() {
464 return reinterpret_cast<DebugScope*>(
465 base::NoBarrier_Load(&thread_local_.current_debug_scope_));
466 }
463 inline Handle<Context> debug_context() { return debug_context_; } 467 inline Handle<Context> debug_context() { return debug_context_; }
464 void set_live_edit_enabled(bool v) { live_edit_enabled_ = v; } 468 void set_live_edit_enabled(bool v) { live_edit_enabled_ = v; }
465 bool live_edit_enabled() const { 469 bool live_edit_enabled() const {
466 return FLAG_enable_liveedit && live_edit_enabled_ ; 470 return FLAG_enable_liveedit && live_edit_enabled_ ;
467 } 471 }
468 472
469 inline bool is_active() const { return is_active_; } 473 inline bool is_active() const { return is_active_; }
470 inline bool is_loaded() const { return !debug_context_.is_null(); } 474 inline bool is_loaded() const { return !debug_context_.is_null(); }
471 inline bool has_break_points() const { return has_break_points_; } 475 inline bool has_break_points() const { return has_break_points_; }
472 inline bool in_debug_scope() const { 476 inline bool in_debug_scope() const {
473 return thread_local_.current_debug_scope_ != NULL; 477 return !!base::NoBarrier_Load(&thread_local_.current_debug_scope_);
474 } 478 }
475 void set_disable_break(bool v) { break_disabled_ = v; } 479 void set_disable_break(bool v) { break_disabled_ = v; }
476 480
477 StackFrame::Id break_frame_id() { return thread_local_.break_frame_id_; } 481 StackFrame::Id break_frame_id() { return thread_local_.break_frame_id_; }
478 int break_id() { return thread_local_.break_id_; } 482 int break_id() { return thread_local_.break_id_; }
479 483
480 // Support for embedding into generated code. 484 // Support for embedding into generated code.
481 Address is_active_address() { 485 Address is_active_address() {
482 return reinterpret_cast<Address>(&is_active_); 486 return reinterpret_cast<Address>(&is_active_);
483 } 487 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 596
593 // Storage location for jump when exiting debug break calls. 597 // Storage location for jump when exiting debug break calls.
594 // Note that this address is not GC safe. It should be computed immediately 598 // Note that this address is not GC safe. It should be computed immediately
595 // before returning to the DebugBreakCallHelper. 599 // before returning to the DebugBreakCallHelper.
596 Address after_break_target_; 600 Address after_break_target_;
597 601
598 // Per-thread data. 602 // Per-thread data.
599 class ThreadLocal { 603 class ThreadLocal {
600 public: 604 public:
601 // Top debugger entry. 605 // Top debugger entry.
602 DebugScope* current_debug_scope_; 606 base::AtomicWord current_debug_scope_;
603 607
604 // Counter for generating next break id. 608 // Counter for generating next break id.
605 int break_count_; 609 int break_count_;
606 610
607 // Current break id. 611 // Current break id.
608 int break_id_; 612 int break_id_;
609 613
610 // Frame id for the frame of the current break. 614 // Frame id for the frame of the current break.
611 StackFrame::Id break_frame_id_; 615 StackFrame::Id break_frame_id_;
612 616
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 // several frames above. 746 // several frames above.
743 // There is no calling conventions here, because it never actually gets 747 // There is no calling conventions here, because it never actually gets
744 // called, it only gets returned to. 748 // called, it only gets returned to.
745 static void GenerateFrameDropperLiveEdit(MacroAssembler* masm); 749 static void GenerateFrameDropperLiveEdit(MacroAssembler* masm);
746 }; 750 };
747 751
748 752
749 } } // namespace v8::internal 753 } } // namespace v8::internal
750 754
751 #endif // V8_DEBUG_H_ 755 #endif // V8_DEBUG_H_
OLDNEW
« no previous file with comments | « no previous file | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698