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 <iomanip> | 5 #include <iomanip> |
6 #include <sstream> | 6 #include <sstream> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 9584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9595 // Iterate over all fields in the body but take care in dealing with | 9595 // Iterate over all fields in the body but take care in dealing with |
9596 // the code entry. | 9596 // the code entry. |
9597 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset); | 9597 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset); |
9598 v->VisitCodeEntry(this->address() + kCodeEntryOffset); | 9598 v->VisitCodeEntry(this->address() + kCodeEntryOffset); |
9599 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size); | 9599 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size); |
9600 } | 9600 } |
9601 | 9601 |
9602 | 9602 |
9603 void JSFunction::MarkForOptimization() { | 9603 void JSFunction::MarkForOptimization() { |
9604 Isolate* isolate = GetIsolate(); | 9604 Isolate* isolate = GetIsolate(); |
9605 DCHECK(isolate->use_crankshaft()); | |
9606 DCHECK(!IsOptimized()); | 9605 DCHECK(!IsOptimized()); |
9607 DCHECK(shared()->allows_lazy_compilation() || code()->optimizable()); | 9606 DCHECK(shared()->allows_lazy_compilation() || code()->optimizable()); |
9608 set_code_no_write_barrier( | 9607 set_code_no_write_barrier( |
9609 isolate->builtins()->builtin(Builtins::kCompileOptimized)); | 9608 isolate->builtins()->builtin(Builtins::kCompileOptimized)); |
9610 // No write barrier required, since the builtin is part of the root set. | 9609 // No write barrier required, since the builtin is part of the root set. |
9611 } | 9610 } |
9612 | 9611 |
9613 | 9612 |
9614 void JSFunction::AttemptConcurrentOptimization() { | 9613 void JSFunction::AttemptConcurrentOptimization() { |
9615 Isolate* isolate = GetIsolate(); | 9614 Isolate* isolate = GetIsolate(); |
9616 if (!isolate->concurrent_recompilation_enabled() || | 9615 if (!isolate->concurrent_recompilation_enabled() || |
9617 isolate->bootstrapper()->IsActive()) { | 9616 isolate->bootstrapper()->IsActive()) { |
9618 MarkForOptimization(); | 9617 MarkForOptimization(); |
9619 return; | 9618 return; |
9620 } | 9619 } |
9621 if (isolate->concurrent_osr_enabled() && | 9620 if (isolate->concurrent_osr_enabled() && |
9622 isolate->optimizing_compiler_thread()->IsQueuedForOSR(this)) { | 9621 isolate->optimizing_compiler_thread()->IsQueuedForOSR(this)) { |
9623 // Do not attempt regular recompilation if we already queued this for OSR. | 9622 // Do not attempt regular recompilation if we already queued this for OSR. |
9624 // TODO(yangguo): This is necessary so that we don't install optimized | 9623 // TODO(yangguo): This is necessary so that we don't install optimized |
9625 // code on a function that is already optimized, since OSR and regular | 9624 // code on a function that is already optimized, since OSR and regular |
9626 // recompilation race. This goes away as soon as OSR becomes one-shot. | 9625 // recompilation race. This goes away as soon as OSR becomes one-shot. |
9627 return; | 9626 return; |
9628 } | 9627 } |
9629 DCHECK(isolate->use_crankshaft()); | |
9630 DCHECK(!IsInOptimizationQueue()); | 9628 DCHECK(!IsInOptimizationQueue()); |
9631 DCHECK(is_compiled() || isolate->debug()->has_break_points()); | 9629 DCHECK(is_compiled() || isolate->debug()->has_break_points()); |
9632 DCHECK(!IsOptimized()); | 9630 DCHECK(!IsOptimized()); |
9633 DCHECK(shared()->allows_lazy_compilation() || code()->optimizable()); | 9631 DCHECK(shared()->allows_lazy_compilation() || code()->optimizable()); |
9634 DCHECK(isolate->concurrent_recompilation_enabled()); | 9632 DCHECK(isolate->concurrent_recompilation_enabled()); |
9635 if (FLAG_trace_concurrent_recompilation) { | 9633 if (FLAG_trace_concurrent_recompilation) { |
9636 PrintF(" ** Marking "); | 9634 PrintF(" ** Marking "); |
9637 ShortPrint(); | 9635 ShortPrint(); |
9638 PrintF(" for concurrent recompilation.\n"); | 9636 PrintF(" for concurrent recompilation.\n"); |
9639 } | 9637 } |
(...skipping 7444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17084 CompilationInfo* info) { | 17082 CompilationInfo* info) { |
17085 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( | 17083 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( |
17086 handle(cell->dependent_code(), info->isolate()), | 17084 handle(cell->dependent_code(), info->isolate()), |
17087 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); | 17085 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); |
17088 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 17086 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
17089 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 17087 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
17090 cell, info->zone()); | 17088 cell, info->zone()); |
17091 } | 17089 } |
17092 | 17090 |
17093 } } // namespace v8::internal | 17091 } } // namespace v8::internal |
OLD | NEW |