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

Side by Side Diff: src/futex-emulation.cc

Issue 1321543004: [futex] Allow debugger to break in the middle of a futexWait Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: feedback Created 5 years, 3 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
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #include "src/futex-emulation.h" 5 #include "src/futex-emulation.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/macros.h" 9 #include "src/base/macros.h"
10 #include "src/base/platform/time.h" 10 #include "src/base/platform/time.h"
11 #include "src/conversions.h" 11 #include "src/conversions.h"
12 #include "src/debug/debug.h"
12 #include "src/handles-inl.h" 13 #include "src/handles-inl.h"
13 #include "src/isolate.h" 14 #include "src/isolate.h"
14 #include "src/list-inl.h" 15 #include "src/list-inl.h"
15 16
16 namespace v8 { 17 namespace v8 {
17 namespace internal { 18 namespace internal {
18 19
19 base::LazyMutex FutexEmulation::mutex_ = LAZY_MUTEX_INITIALIZER; 20 base::LazyMutex FutexEmulation::mutex_ = LAZY_MUTEX_INITIALIZER;
20 base::LazyInstance<FutexWaitList>::type FutexEmulation::wait_list_ = 21 base::LazyInstance<FutexWaitList>::type FutexEmulation::wait_list_ =
21 LAZY_INSTANCE_INITIALIZER; 22 LAZY_INSTANCE_INITIALIZER;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // interrupted_ will be set to 1. This will be checked below. 135 // interrupted_ will be set to 1. This will be checked below.
135 // 2) After interrupted has been checked here, but before mutex_ is 136 // 2) After interrupted has been checked here, but before mutex_ is
136 // acquired: interrupted is checked again below, with mutex_ locked. 137 // acquired: interrupted is checked again below, with mutex_ locked.
137 // Because the wakeup signal also acquires mutex_, we know it will not 138 // Because the wakeup signal also acquires mutex_, we know it will not
138 // be able to notify until mutex_ is released below, when waiting on the 139 // be able to notify until mutex_ is released below, when waiting on the
139 // condition variable. 140 // condition variable.
140 // 3) After the mutex is released in the call to WaitFor(): this 141 // 3) After the mutex is released in the call to WaitFor(): this
141 // notification will wake up the condition variable. node->waiting() will 142 // notification will wake up the condition variable. node->waiting() will
142 // be false, so we'll loop and then check interrupts. 143 // be false, so we'll loop and then check interrupts.
143 if (interrupted) { 144 if (interrupted) {
145 EnableBreakInNonDebuggable enabler(isolate->debug(), true);
146
144 Object* interrupt_object = isolate->stack_guard()->HandleInterrupts(); 147 Object* interrupt_object = isolate->stack_guard()->HandleInterrupts();
145 if (interrupt_object->IsException()) { 148 if (interrupt_object->IsException()) {
146 result = interrupt_object; 149 result = interrupt_object;
147 mutex_.Pointer()->Lock(); 150 mutex_.Pointer()->Lock();
148 break; 151 break;
149 } 152 }
150 } 153 }
151 154
152 mutex_.Pointer()->Lock(); 155 mutex_.Pointer()->Lock();
153 156
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 270 }
268 271
269 node = node->next_; 272 node = node->next_;
270 } 273 }
271 274
272 return Smi::FromInt(waiters); 275 return Smi::FromInt(waiters);
273 } 276 }
274 277
275 } // namespace internal 278 } // namespace internal
276 } // namespace v8 279 } // namespace v8
OLDNEW
« no previous file with comments | « src/debug/debug.cc ('k') | test/cctest/test-debug.cc » ('j') | test/cctest/test-debug.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698