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