Revision: 17247
Author:   [email protected]
Date:     Wed Oct 16 16:27:17 2013 UTC
Log:      Fix leak in optimizing compiler thread.

[email protected]
BUG=

Review URL: https://codereview.chromium.org/27473006
http://code.google.com/p/v8/source/detail?r=17247

Modified:
 /branches/bleeding_edge/src/optimizing-compiler-thread.cc
 /branches/bleeding_edge/src/optimizing-compiler-thread.h

=======================================
--- /branches/bleeding_edge/src/optimizing-compiler-thread.cc Wed Oct 16 14:47:20 2013 UTC +++ /branches/bleeding_edge/src/optimizing-compiler-thread.cc Wed Oct 16 16:27:17 2013 UTC
@@ -37,6 +37,19 @@
 namespace v8 {
 namespace internal {

+OptimizingCompilerThread::~OptimizingCompilerThread() {
+  ASSERT_EQ(0, input_queue_length_);
+  DeleteArray(input_queue_);
+  if (FLAG_concurrent_osr) {
+#ifdef DEBUG
+    for (int i = 0; i < osr_buffer_capacity_; i++) {
+      CHECK_EQ(NULL, osr_buffer_[i]);
+    }
+#endif
+    DeleteArray(osr_buffer_);
+  }
+}
+

 void OptimizingCompilerThread::Run() {
 #ifdef DEBUG
=======================================
--- /branches/bleeding_edge/src/optimizing-compiler-thread.h Wed Oct 16 14:47:20 2013 UTC +++ /branches/bleeding_edge/src/optimizing-compiler-thread.h Wed Oct 16 16:27:17 2013 UTC
@@ -63,20 +63,14 @@
       blocked_jobs_(0) {
     NoBarrier_Store(&stop_thread_, static_cast<AtomicWord>(CONTINUE));
     input_queue_ = NewArray<RecompileJob*>(input_queue_capacity_);
-    osr_buffer_ = NewArray<RecompileJob*>(osr_buffer_capacity_);
-    // Mark OSR buffer slots as empty.
-    for (int i = 0; i < osr_buffer_capacity_; i++) osr_buffer_[i] = NULL;
-  }
-
-  ~OptimizingCompilerThread() {
-    ASSERT_EQ(0, input_queue_length_);
-#ifdef DEBUG
-    for (int i = 0; i < osr_buffer_capacity_; i++) {
-      CHECK_EQ(NULL, osr_buffer_[i]);
+    if (FLAG_concurrent_osr) {
+      // Allocate and mark OSR buffer slots as empty.
+      osr_buffer_ = NewArray<RecompileJob*>(osr_buffer_capacity_);
+      for (int i = 0; i < osr_buffer_capacity_; i++) osr_buffer_[i] = NULL;
     }
-#endif
-    DeleteArray(osr_buffer_);
   }
+
+  ~OptimizingCompilerThread();

   void Run();
   void Stop();

--
--
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.

Reply via email to