From 64bcae30f9aef529e1438367105b00f07734ec69 Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Wed, 25 Sep 2013 15:14:12 +0000 Subject: [PATCH] Allocate optimizing compiler thread only when necessary. R=ulan@chromium.org BUG= Review URL: https://codereview.chromium.org/24568003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16946 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/isolate.cc | 14 ++++++++++---- src/isolate.h | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/isolate.cc b/src/isolate.cc index 6eb2960..5a80d3d 100644 --- a/src/isolate.cc +++ b/src/isolate.cc @@ -1803,7 +1803,7 @@ Isolate::Isolate() heap_profiler_(NULL), function_entry_hook_(NULL), deferred_handles_head_(NULL), - optimizing_compiler_thread_(this), + optimizing_compiler_thread_(NULL), marking_thread_(NULL), sweeper_thread_(NULL), stress_deopt_count_(0) { @@ -1898,7 +1898,10 @@ void Isolate::Deinit() { debugger()->UnloadDebugger(); #endif - if (FLAG_concurrent_recompilation) optimizing_compiler_thread_.Stop(); + if (FLAG_concurrent_recompilation) { + optimizing_compiler_thread_->Stop(); + delete optimizing_compiler_thread_; + } if (FLAG_sweeper_threads > 0) { for (int i = 0; i < FLAG_sweeper_threads; i++) { @@ -2240,6 +2243,11 @@ bool Isolate::Init(Deserializer* des) { deoptimizer_data_ = new DeoptimizerData(memory_allocator_); + if (FLAG_concurrent_recompilation) { + optimizing_compiler_thread_ = new OptimizingCompilerThread(this); + optimizing_compiler_thread_->Start(); + } + const bool create_heap_objects = (des == NULL); if (create_heap_objects && !heap_.CreateHeapObjects()) { V8::FatalProcessOutOfMemory("heap object creation"); @@ -2346,8 +2354,6 @@ bool Isolate::Init(Deserializer* des) { FastNewClosureStub::InstallDescriptors(this); } - if (FLAG_concurrent_recompilation) optimizing_compiler_thread_.Start(); - if (FLAG_marking_threads > 0) { marking_thread_ = new MarkingThread*[FLAG_marking_threads]; for (int i = 0; i < FLAG_marking_threads; i++) { diff --git a/src/isolate.h b/src/isolate.h index b7ea209..cfea075 100644 --- a/src/isolate.h +++ b/src/isolate.h @@ -1099,7 +1099,7 @@ class Isolate { #endif // DEBUG OptimizingCompilerThread* optimizing_compiler_thread() { - return &optimizing_compiler_thread_; + return optimizing_compiler_thread_; } // PreInits and returns a default isolate. Needed when a new thread tries @@ -1369,7 +1369,7 @@ class Isolate { #endif DeferredHandles* deferred_handles_head_; - OptimizingCompilerThread optimizing_compiler_thread_; + OptimizingCompilerThread* optimizing_compiler_thread_; MarkingThread** marking_thread_; SweeperThread** sweeper_thread_; -- 2.7.4