Fix valgrind warnings.
authoryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 26 Nov 2012 08:47:48 +0000 (08:47 +0000)
committeryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 26 Nov 2012 08:47:48 +0000 (08:47 +0000)
BUG=

Review URL: https://chromiumcodereview.appspot.com/11418138

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

src/compiler.h
src/optimizing-compiler-thread.cc
src/optimizing-compiler-thread.h

index af94595..62eedc2 100644 (file)
@@ -293,6 +293,8 @@ class CompilationInfo {
 // Zone on construction and deallocates it on exit.
 class CompilationInfoWithZone: public CompilationInfo {
  public:
+  INLINE(void* operator new(size_t size)) { return Malloced::New(size); }
+
   explicit CompilationInfoWithZone(Handle<Script> script)
       : CompilationInfo(script, &zone_),
         zone_(script->GetIsolate()),
index d93f671..0d4e4a6 100644 (file)
@@ -127,8 +127,9 @@ Handle<SharedFunctionInfo>
   output_queue_semaphore_->Wait();
   OptimizingCompiler* compiler = NULL;
   output_queue_.Dequeue(&compiler);
+  Handle<SharedFunctionInfo> shared = compiler->info()->shared_info();
   Compiler::InstallOptimizedCode(compiler);
-  return compiler->info()->shared_info();
+  return shared;
 }
 
 
index 8a39b39..2d56d1a 100644 (file)
@@ -44,6 +44,9 @@ class OptimizingCompilerThread : public Thread {
  public:
   explicit OptimizingCompilerThread(Isolate *isolate) :
       Thread("OptimizingCompilerThread"),
+#ifdef DEBUG
+      thread_id_(0),
+#endif
       isolate_(isolate),
       stop_semaphore_(OS::CreateSemaphore(0)),
       input_queue_semaphore_(OS::CreateSemaphore(0)),
@@ -81,12 +84,16 @@ class OptimizingCompilerThread : public Thread {
 #endif
 
   ~OptimizingCompilerThread() {
-    delete input_queue_semaphore_;
     delete output_queue_semaphore_;  // Only used for manual mode.
+    delete input_queue_semaphore_;
     delete stop_semaphore_;
   }
 
  private:
+#ifdef DEBUG
+  int thread_id_;
+#endif
+
   Isolate* isolate_;
   Semaphore* stop_semaphore_;
   Semaphore* input_queue_semaphore_;
@@ -97,10 +104,6 @@ class OptimizingCompilerThread : public Thread {
   volatile Atomic32 queue_length_;
   int64_t time_spent_compiling_;
   int64_t time_spent_total_;
-
-#ifdef DEBUG
-  int thread_id_;
-#endif
 };
 
 } }  // namespace v8::internal