OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 9186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9197 DCHECK(!IsOptimized()); | 9197 DCHECK(!IsOptimized()); |
9198 DCHECK(shared()->allows_lazy_compilation() || | 9198 DCHECK(shared()->allows_lazy_compilation() || |
9199 code()->optimizable()); | 9199 code()->optimizable()); |
9200 DCHECK(!shared()->is_generator()); | 9200 DCHECK(!shared()->is_generator()); |
9201 set_code_no_write_barrier( | 9201 set_code_no_write_barrier( |
9202 GetIsolate()->builtins()->builtin(Builtins::kCompileOptimized)); | 9202 GetIsolate()->builtins()->builtin(Builtins::kCompileOptimized)); |
9203 // No write barrier required, since the builtin is part of the root set. | 9203 // No write barrier required, since the builtin is part of the root set. |
9204 } | 9204 } |
9205 | 9205 |
9206 | 9206 |
9207 void JSFunction::MarkForConcurrentOptimization() { | 9207 void JSFunction::AttemptConcurrentOptimization() { |
9208 DCHECK(is_compiled() || GetIsolate()->DebuggerHasBreakPoints()); | 9208 Isolate* isolate = GetIsolate(); |
| 9209 if (!isolate->concurrent_recompilation_enabled() || |
| 9210 isolate->bootstrapper()->IsActive()) { |
| 9211 MarkForOptimization(); |
| 9212 return; |
| 9213 } |
| 9214 if (isolate->concurrent_osr_enabled() && |
| 9215 isolate->optimizing_compiler_thread()->IsQueuedForOSR(this)) { |
| 9216 // Do not attempt regular recompilation if we already queued this for OSR. |
| 9217 // TODO(yangguo): This is necessary so that we don't install optimized |
| 9218 // code on a function that is already optimized, since OSR and regular |
| 9219 // recompilation race. This goes away as soon as OSR becomes one-shot. |
| 9220 return; |
| 9221 } |
| 9222 DCHECK(!IsInOptimizationQueue()); |
| 9223 DCHECK(is_compiled() || isolate->DebuggerHasBreakPoints()); |
9209 DCHECK(!IsOptimized()); | 9224 DCHECK(!IsOptimized()); |
9210 DCHECK(shared()->allows_lazy_compilation() || code()->optimizable()); | 9225 DCHECK(shared()->allows_lazy_compilation() || code()->optimizable()); |
9211 DCHECK(!shared()->is_generator()); | 9226 DCHECK(!shared()->is_generator()); |
9212 DCHECK(GetIsolate()->concurrent_recompilation_enabled()); | 9227 DCHECK(isolate->concurrent_recompilation_enabled()); |
9213 if (FLAG_trace_concurrent_recompilation) { | 9228 if (FLAG_trace_concurrent_recompilation) { |
9214 PrintF(" ** Marking "); | 9229 PrintF(" ** Marking "); |
9215 ShortPrint(); | 9230 ShortPrint(); |
9216 PrintF(" for concurrent recompilation.\n"); | 9231 PrintF(" for concurrent recompilation.\n"); |
9217 } | 9232 } |
9218 set_code_no_write_barrier( | 9233 set_code_no_write_barrier( |
9219 GetIsolate()->builtins()->builtin(Builtins::kCompileOptimizedConcurrent)); | 9234 GetIsolate()->builtins()->builtin(Builtins::kCompileOptimizedConcurrent)); |
9220 // No write barrier required, since the builtin is part of the root set. | 9235 // No write barrier required, since the builtin is part of the root set. |
9221 } | 9236 } |
9222 | 9237 |
(...skipping 7344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16567 Handle<DependentCode> codes = | 16582 Handle<DependentCode> codes = |
16568 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16583 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
16569 DependentCode::kPropertyCellChangedGroup, | 16584 DependentCode::kPropertyCellChangedGroup, |
16570 info->object_wrapper()); | 16585 info->object_wrapper()); |
16571 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16586 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
16572 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16587 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
16573 cell, info->zone()); | 16588 cell, info->zone()); |
16574 } | 16589 } |
16575 | 16590 |
16576 } } // namespace v8::internal | 16591 } } // namespace v8::internal |
OLD | NEW |