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

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

Issue 2659083004: [SAB] Fix crash in Atomics.wake w/ infinite count. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | src/futex-emulation.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 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 #ifndef V8_FUTEX_EMULATION_H_ 5 #ifndef V8_FUTEX_EMULATION_H_
6 #define V8_FUTEX_EMULATION_H_ 6 #define V8_FUTEX_EMULATION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Check that array_buffer[addr] == value, and return "not-equal" if not. If 85 // Check that array_buffer[addr] == value, and return "not-equal" if not. If
86 // they are equal, block execution on |isolate|'s thread until woken via 86 // they are equal, block execution on |isolate|'s thread until woken via
87 // |Wake|, or when the time given in |rel_timeout_ms| elapses. Note that 87 // |Wake|, or when the time given in |rel_timeout_ms| elapses. Note that
88 // |rel_timeout_ms| can be Infinity. 88 // |rel_timeout_ms| can be Infinity.
89 // If woken, return "ok", otherwise return "timed-out". The initial check and 89 // If woken, return "ok", otherwise return "timed-out". The initial check and
90 // the decision to wait happen atomically. 90 // the decision to wait happen atomically.
91 static Object* Wait(Isolate* isolate, Handle<JSArrayBuffer> array_buffer, 91 static Object* Wait(Isolate* isolate, Handle<JSArrayBuffer> array_buffer,
92 size_t addr, int32_t value, double rel_timeout_ms); 92 size_t addr, int32_t value, double rel_timeout_ms);
93 93
94 // Wake |num_waiters_to_wake| threads that are waiting on the given |addr|. 94 // Wake |num_waiters_to_wake| threads that are waiting on the given |addr|.
95 // The rest of the waiters will continue to wait. The return value is the 95 // |num_waiters_to_wake| can be +infinity, in which case all waiters are
96 // number of woken waiters. 96 // woken. The rest of the waiters will continue to wait. The return value is
97 // the number of woken waiters.
97 static Object* Wake(Isolate* isolate, Handle<JSArrayBuffer> array_buffer, 98 static Object* Wake(Isolate* isolate, Handle<JSArrayBuffer> array_buffer,
98 size_t addr, int num_waiters_to_wake); 99 size_t addr, double num_waiters_to_wake);
Camillo Bruni 2017/01/30 19:09:17 Why not use -1 (or a separate flag and convert -1
binji 2017/01/31 22:36:06 Done.
99 100
100 // Return the number of threads waiting on |addr|. Should only be used for 101 // Return the number of threads waiting on |addr|. Should only be used for
101 // testing. 102 // testing.
102 static Object* NumWaitersForTesting(Isolate* isolate, 103 static Object* NumWaitersForTesting(Isolate* isolate,
103 Handle<JSArrayBuffer> array_buffer, 104 Handle<JSArrayBuffer> array_buffer,
104 size_t addr); 105 size_t addr);
105 106
106 private: 107 private:
107 friend class FutexWaitListNode; 108 friend class FutexWaitListNode;
108 109
109 static base::LazyMutex mutex_; 110 static base::LazyMutex mutex_;
110 static base::LazyInstance<FutexWaitList>::type wait_list_; 111 static base::LazyInstance<FutexWaitList>::type wait_list_;
111 }; 112 };
112 } // namespace internal 113 } // namespace internal
113 } // namespace v8 114 } // namespace v8
114 115
115 #endif // V8_FUTEX_EMULATION_H_ 116 #endif // V8_FUTEX_EMULATION_H_
OLDNEW
« no previous file with comments | « no previous file | src/futex-emulation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698