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

Unified Diff: test/cctest/test-api.cc

Issue 634523003: Fix data race in cctest/test-api/RegExpInterruption (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index fc0281a0bdf6f3375db2d1627d4fb4a661ac548a..c01ad143005f3e98d39adbc7b2d35f8b73382bb2 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -15400,7 +15400,7 @@ TEST(CompileExternalTwoByteSource) {
#ifndef V8_INTERPRETED_REGEXP
struct RegExpInterruptionData {
- int loop_count;
+ v8::base::Atomic32 loop_count;
UC16VectorResource* string_resource;
v8::Persistent<v8::String> string;
} regexp_interruption_data;
@@ -15412,9 +15412,10 @@ class RegExpInterruptionThread : public v8::base::Thread {
: Thread(Options("TimeoutThread")), isolate_(isolate) {}
virtual void Run() {
- for (regexp_interruption_data.loop_count = 0;
- regexp_interruption_data.loop_count < 7;
- regexp_interruption_data.loop_count++) {
+ for (v8::base::NoBarrier_Store(&regexp_interruption_data.loop_count, 0);
+ v8::base::NoBarrier_Load(&regexp_interruption_data.loop_count) < 7;
+ v8::base::NoBarrier_AtomicIncrement(
+ &regexp_interruption_data.loop_count, 1)) {
v8::base::OS::Sleep(50); // Wait a bit before requesting GC.
reinterpret_cast<i::Isolate*>(isolate_)->stack_guard()->RequestGC();
}
@@ -15428,7 +15429,9 @@ class RegExpInterruptionThread : public v8::base::Thread {
void RunBeforeGC(v8::GCType type, v8::GCCallbackFlags flags) {
- if (regexp_interruption_data.loop_count != 2) return;
+ if (v8::base::NoBarrier_Load(&regexp_interruption_data.loop_count) != 2) {
+ return;
+ }
v8::HandleScope scope(CcTest::isolate());
v8::Local<v8::String> string = v8::Local<v8::String>::New(
CcTest::isolate(), regexp_interruption_data.string);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698