Reviewers: Hannes Payer,
Description:
Join threads after stopping.
[email protected]
BUG=
Please review this at https://codereview.chromium.org/18287003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/isolate.cc
M src/marking-thread.cc
M src/optimizing-compiler-thread.cc
M src/sweeper-thread.cc
M src/v8.cc
M test/cctest/test-mark-compact.cc
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index
fec3dc66ab4260b63b6e8a6023d34961e53536bc..b19cf40ef1de76f9d8b60a715085d8dfedea7bdc
100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -1873,7 +1873,9 @@ void Isolate::Deinit() {
if (state_ == INITIALIZED) {
TRACE_ISOLATE(deinit);
- if (FLAG_parallel_recompilation) optimizing_compiler_thread_.Stop();
+ if (FLAG_parallel_recompilation) {
+ optimizing_compiler_thread_.Stop();
+ }
if (FLAG_sweeper_threads > 0) {
for (int i = 0; i < FLAG_sweeper_threads; i++) {
@@ -1895,7 +1897,9 @@ void Isolate::Deinit() {
// We must stop the logger before we tear down other components.
Sampler* sampler = logger_->sampler();
- if (sampler && sampler->IsActive()) sampler->Stop();
+ if (sampler && sampler->IsActive()) {
+ sampler->Stop();
+ }
delete deoptimizer_data_;
deoptimizer_data_ = NULL;
Index: src/marking-thread.cc
diff --git a/src/marking-thread.cc b/src/marking-thread.cc
index
574485abc7b1c7ae36c2cc04d1a2d2e663fa2921..ac9f944fe7e3ca0b4ed435740112efc052380487
100644
--- a/src/marking-thread.cc
+++ b/src/marking-thread.cc
@@ -73,6 +73,7 @@ void MarkingThread::Stop() {
Release_Store(&stop_thread_, static_cast<AtomicWord>(true));
start_marking_semaphore_->Signal();
stop_semaphore_->Wait();
+ Join();
}
Index: src/optimizing-compiler-thread.cc
diff --git a/src/optimizing-compiler-thread.cc
b/src/optimizing-compiler-thread.cc
index
a4300f5e7c43dfcf3c42120ad3f385b9fd15c201..21ef237107194d06a897110444c01710eae31bd0
100644
--- a/src/optimizing-compiler-thread.cc
+++ b/src/optimizing-compiler-thread.cc
@@ -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: src/sweeper-thread.cc
diff --git a/src/sweeper-thread.cc b/src/sweeper-thread.cc
index
099f5d187915b98f478d533883d6f9cc5bab5ad1..ede567a48574ede71132dcd405727dbfe2819452
100644
--- a/src/sweeper-thread.cc
+++ b/src/sweeper-thread.cc
@@ -93,6 +93,7 @@ void SweeperThread::Stop() {
Release_Store(&stop_thread_, static_cast<AtomicWord>(true));
start_sweeping_semaphore_->Signal();
stop_semaphore_->Wait();
+ Join();
}
Index: src/v8.cc
diff --git a/src/v8.cc b/src/v8.cc
index
cb67105c3f55c08b4953b30d7b948e6823449d60..a3cfaa1b0615e56fef982ca55433f9a1c92dd38e
100644
--- a/src/v8.cc
+++ b/src/v8.cc
@@ -320,6 +320,7 @@ void V8::InitializeOncePerProcessImpl() {
LOperand::SetUpCaches();
SetUpJSCallerSavedCodeData();
ExternalReference::SetUp();
+
Bootstrapper::InitializeOncePerProcess();
}
Index: test/cctest/test-mark-compact.cc
diff --git a/test/cctest/test-mark-compact.cc
b/test/cctest/test-mark-compact.cc
index
a01c5dfae3aa40bce96ac62b0eb02b620479a0fc..cb5157f1e0d35b9ee72f89d203f38cff96acd6e1
100644
--- a/test/cctest/test-mark-compact.cc
+++ b/test/cctest/test-mark-compact.cc
@@ -566,4 +566,31 @@ TEST(BootUpMemoryUse) {
}
}
+
+intptr_t ShortLivingIsolate() {
+ v8::Isolate* isolate = v8::Isolate::New();
+ { v8::Isolate::Scope iscope(isolate);
+ v8::V8::Initialize();
+ v8::Locker l(isolate);
+
+ v8::HandleScope handle_scope;
+ v8::Local<v8::Context> context = v8::Context::New(isolate);
+ CHECK(!context.IsEmpty());
+ v8::Context::Scope context_scope(context);
+ v8::TryCatch try_catch;
+ CompileRun("Math.abs(2);");
+ }
+
+ 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
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.