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 9419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9430 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset); | 9430 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset); |
9431 v->VisitCodeEntry(this->address() + kCodeEntryOffset); | 9431 v->VisitCodeEntry(this->address() + kCodeEntryOffset); |
9432 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size); | 9432 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size); |
9433 } | 9433 } |
9434 | 9434 |
9435 | 9435 |
9436 void JSFunction::MarkForOptimization() { | 9436 void JSFunction::MarkForOptimization() { |
9437 Isolate* isolate = GetIsolate(); | 9437 Isolate* isolate = GetIsolate(); |
9438 DCHECK(isolate->use_crankshaft()); | 9438 DCHECK(isolate->use_crankshaft()); |
9439 DCHECK(!IsOptimized()); | 9439 DCHECK(!IsOptimized()); |
9440 DCHECK(shared()->allows_lazy_compilation() || | 9440 DCHECK(shared()->allows_lazy_compilation() || code()->optimizable()); |
9441 code()->optimizable()); | |
9442 DCHECK(!shared()->is_generator()); | |
9443 set_code_no_write_barrier( | 9441 set_code_no_write_barrier( |
9444 isolate->builtins()->builtin(Builtins::kCompileOptimized)); | 9442 isolate->builtins()->builtin(Builtins::kCompileOptimized)); |
9445 // No write barrier required, since the builtin is part of the root set. | 9443 // No write barrier required, since the builtin is part of the root set. |
9446 } | 9444 } |
9447 | 9445 |
9448 | 9446 |
9449 void JSFunction::AttemptConcurrentOptimization() { | 9447 void JSFunction::AttemptConcurrentOptimization() { |
9450 Isolate* isolate = GetIsolate(); | 9448 Isolate* isolate = GetIsolate(); |
9451 if (!isolate->concurrent_recompilation_enabled() || | 9449 if (!isolate->concurrent_recompilation_enabled() || |
9452 isolate->bootstrapper()->IsActive()) { | 9450 isolate->bootstrapper()->IsActive()) { |
9453 MarkForOptimization(); | 9451 MarkForOptimization(); |
9454 return; | 9452 return; |
9455 } | 9453 } |
9456 if (isolate->concurrent_osr_enabled() && | 9454 if (isolate->concurrent_osr_enabled() && |
9457 isolate->optimizing_compiler_thread()->IsQueuedForOSR(this)) { | 9455 isolate->optimizing_compiler_thread()->IsQueuedForOSR(this)) { |
9458 // Do not attempt regular recompilation if we already queued this for OSR. | 9456 // Do not attempt regular recompilation if we already queued this for OSR. |
9459 // TODO(yangguo): This is necessary so that we don't install optimized | 9457 // TODO(yangguo): This is necessary so that we don't install optimized |
9460 // code on a function that is already optimized, since OSR and regular | 9458 // code on a function that is already optimized, since OSR and regular |
9461 // recompilation race. This goes away as soon as OSR becomes one-shot. | 9459 // recompilation race. This goes away as soon as OSR becomes one-shot. |
9462 return; | 9460 return; |
9463 } | 9461 } |
9464 DCHECK(isolate->use_crankshaft()); | 9462 DCHECK(isolate->use_crankshaft()); |
9465 DCHECK(!IsInOptimizationQueue()); | 9463 DCHECK(!IsInOptimizationQueue()); |
9466 DCHECK(is_compiled() || isolate->DebuggerHasBreakPoints()); | 9464 DCHECK(is_compiled() || isolate->DebuggerHasBreakPoints()); |
9467 DCHECK(!IsOptimized()); | 9465 DCHECK(!IsOptimized()); |
9468 DCHECK(shared()->allows_lazy_compilation() || code()->optimizable()); | 9466 DCHECK(shared()->allows_lazy_compilation() || code()->optimizable()); |
9469 DCHECK(!shared()->is_generator()); | |
9470 DCHECK(isolate->concurrent_recompilation_enabled()); | 9467 DCHECK(isolate->concurrent_recompilation_enabled()); |
9471 if (FLAG_trace_concurrent_recompilation) { | 9468 if (FLAG_trace_concurrent_recompilation) { |
9472 PrintF(" ** Marking "); | 9469 PrintF(" ** Marking "); |
9473 ShortPrint(); | 9470 ShortPrint(); |
9474 PrintF(" for concurrent recompilation.\n"); | 9471 PrintF(" for concurrent recompilation.\n"); |
9475 } | 9472 } |
9476 set_code_no_write_barrier( | 9473 set_code_no_write_barrier( |
9477 GetIsolate()->builtins()->builtin(Builtins::kCompileOptimizedConcurrent)); | 9474 GetIsolate()->builtins()->builtin(Builtins::kCompileOptimizedConcurrent)); |
9478 // No write barrier required, since the builtin is part of the root set. | 9475 // No write barrier required, since the builtin is part of the root set. |
9479 } | 9476 } |
(...skipping 7349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16829 Handle<DependentCode> codes = | 16826 Handle<DependentCode> codes = |
16830 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16827 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
16831 DependentCode::kPropertyCellChangedGroup, | 16828 DependentCode::kPropertyCellChangedGroup, |
16832 info->object_wrapper()); | 16829 info->object_wrapper()); |
16833 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16830 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
16834 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16831 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
16835 cell, info->zone()); | 16832 cell, info->zone()); |
16836 } | 16833 } |
16837 | 16834 |
16838 } } // namespace v8::internal | 16835 } } // namespace v8::internal |
OLD | NEW |