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 DisposeCompilationJob(CompilationJob* job, bool restore_function_code) { | 18 void DisposeCompilationJob(CompilationJob* job, bool restore_function_code) { |
19 // The recompile job is allocated in the CompilationInfo's zone. | |
20 CompilationInfo* info = job->info(); | |
21 if (restore_function_code) { | 19 if (restore_function_code) { |
22 Handle<JSFunction> function = info->closure(); | 20 Handle<JSFunction> function = job->info()->closure(); |
23 function->ReplaceCode(function->shared()->code()); | 21 function->ReplaceCode(function->shared()->code()); |
24 } | 22 } |
25 delete job; | 23 delete job; |
26 delete info; | |
27 } | 24 } |
28 | 25 |
29 } // namespace | 26 } // namespace |
30 | 27 |
31 | 28 |
32 class OptimizingCompileDispatcher::CompileTask : public v8::Task { | 29 class OptimizingCompileDispatcher::CompileTask : public v8::Task { |
33 public: | 30 public: |
34 explicit CompileTask(Isolate* isolate) : isolate_(isolate) { | 31 explicit CompileTask(Isolate* isolate) : isolate_(isolate) { |
35 OptimizingCompileDispatcher* dispatcher = | 32 OptimizingCompileDispatcher* dispatcher = |
36 isolate_->optimizing_compile_dispatcher(); | 33 isolate_->optimizing_compile_dispatcher(); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 while (blocked_jobs_ > 0) { | 213 while (blocked_jobs_ > 0) { |
217 V8::GetCurrentPlatform()->CallOnBackgroundThread( | 214 V8::GetCurrentPlatform()->CallOnBackgroundThread( |
218 new CompileTask(isolate_), v8::Platform::kShortRunningTask); | 215 new CompileTask(isolate_), v8::Platform::kShortRunningTask); |
219 blocked_jobs_--; | 216 blocked_jobs_--; |
220 } | 217 } |
221 } | 218 } |
222 | 219 |
223 | 220 |
224 } // namespace internal | 221 } // namespace internal |
225 } // namespace v8 | 222 } // namespace v8 |
OLD | NEW |