| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/optimizing-compile-dispatcher.h" | 5 #include "src/optimizing-compile-dispatcher.h" |
| 6 | 6 |
| 7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
| 8 #include "src/full-codegen/full-codegen.h" | 8 #include "src/full-codegen/full-codegen.h" |
| 9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
| 10 #include "src/tracing/trace-event.h" | 10 #include "src/tracing/trace-event.h" |
| 11 #include "src/v8.h" | 11 #include "src/v8.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 void DisposeOptimizedCompileJob(OptimizedCompileJob* job, | 18 void DisposeOptimizedCompileJob(OptimizedCompileJob* job, |
| 19 bool restore_function_code) { | 19 bool restore_function_code) { |
| 20 // The recompile job is allocated in the CompilationInfo's zone. | 20 // The recompile job is allocated in the CompilationInfo's zone. |
| 21 CompilationInfo* info = job->info(); | 21 CompilationInfo* info = job->info(); |
| 22 if (restore_function_code) { | 22 if (restore_function_code) { |
| 23 Handle<JSFunction> function = info->closure(); | 23 Handle<JSFunction> function = info->closure(); |
| 24 function->ReplaceCode(function->shared()->code()); | 24 function->ReplaceCode(function->shared()->code()); |
| 25 } | 25 } |
| 26 delete job; |
| 26 delete info; | 27 delete info; |
| 27 } | 28 } |
| 28 | 29 |
| 29 } // namespace | 30 } // namespace |
| 30 | 31 |
| 31 | 32 |
| 32 class OptimizingCompileDispatcher::CompileTask : public v8::Task { | 33 class OptimizingCompileDispatcher::CompileTask : public v8::Task { |
| 33 public: | 34 public: |
| 34 explicit CompileTask(Isolate* isolate) : isolate_(isolate) { | 35 explicit CompileTask(Isolate* isolate) : isolate_(isolate) { |
| 35 OptimizingCompileDispatcher* dispatcher = | 36 OptimizingCompileDispatcher* dispatcher = |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 while (blocked_jobs_ > 0) { | 223 while (blocked_jobs_ > 0) { |
| 223 V8::GetCurrentPlatform()->CallOnBackgroundThread( | 224 V8::GetCurrentPlatform()->CallOnBackgroundThread( |
| 224 new CompileTask(isolate_), v8::Platform::kShortRunningTask); | 225 new CompileTask(isolate_), v8::Platform::kShortRunningTask); |
| 225 blocked_jobs_--; | 226 blocked_jobs_--; |
| 226 } | 227 } |
| 227 } | 228 } |
| 228 | 229 |
| 229 | 230 |
| 230 } // namespace internal | 231 } // namespace internal |
| 231 } // namespace v8 | 232 } // namespace v8 |
| OLD | NEW |