Join threads after stopping.
authoryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 2 Jul 2013 09:04:45 +0000 (09:04 +0000)
committeryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 2 Jul 2013 09:04:45 +0000 (09:04 +0000)
R=hpayer@chromium.org
BUG=

Review URL: https://codereview.chromium.org/18287003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15439 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/marking-thread.cc
src/optimizing-compiler-thread.cc
src/sweeper-thread.cc
test/cctest/test-mark-compact.cc

index 574485a..ac9f944 100644 (file)
@@ -73,6 +73,7 @@ void MarkingThread::Stop() {
   Release_Store(&stop_thread_, static_cast<AtomicWord>(true));
   start_marking_semaphore_->Signal();
   stop_semaphore_->Wait();
+  Join();
 }
 
 
index a4300f5..21ef237 100644 (file)
@@ -130,6 +130,8 @@ void OptimizingCompilerThread::Stop() {
     double percentage = (compile_time * 100) / total_time;
     PrintF("  ** Compiler thread did %.2f%% useful work\n", percentage);
   }
+
+  Join();
 }
 
 
index 099f5d1..ede567a 100644 (file)
@@ -93,6 +93,7 @@ void SweeperThread::Stop() {
   Release_Store(&stop_thread_, static_cast<AtomicWord>(true));
   start_sweeping_semaphore_->Signal();
   stop_semaphore_->Wait();
+  Join();
 }
 
 
index a01c5df..0709704 100644 (file)
@@ -566,4 +566,25 @@ TEST(BootUpMemoryUse) {
   }
 }
 
+
+intptr_t ShortLivingIsolate() {
+  v8::Isolate* isolate = v8::Isolate::New();
+  { v8::Isolate::Scope isolate_scope(isolate);
+    v8::Locker lock(isolate);
+    v8::HandleScope handle_scope;
+    v8::Local<v8::Context> context = v8::Context::New(isolate);
+    CHECK(!context.IsEmpty());
+  }
+  isolate->Dispose();
+  return MemoryInUse();
+}
+
+
+TEST(RegressJoinThreadsOnIsolateDeinit) {
+  intptr_t first_size = ShortLivingIsolate();
+  for (int i = 0; i < 10; i++) {
+    CHECK_EQ(first_size, ShortLivingIsolate());
+  }
+}
+
 #endif  // __linux__ and !USE_SIMULATOR