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 574485abc7b1c7ae36c2cc04d1a2d2e663fa2921..ac9f944fe7e3ca0b4ed435740112efc052380487 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 a4300f5e7c43dfcf3c42120ad3f385b9fd15c201..21ef237107194d06a897110444c01710eae31bd0 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 099f5d187915b98f478d533883d6f9cc5bab5ad1..ede567a48574ede71132dcd405727dbfe2819452 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 a01c5dfae3aa40bce96ac62b0eb02b620479a0fc..0709704f5e624c70ec535c03ae1a9ced687dc17c 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