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 9786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9797 // the code entry. | 9797 // the code entry. |
9798 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset); | 9798 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset); |
9799 v->VisitCodeEntry(this->address() + kCodeEntryOffset); | 9799 v->VisitCodeEntry(this->address() + kCodeEntryOffset); |
9800 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size); | 9800 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size); |
9801 } | 9801 } |
9802 | 9802 |
9803 | 9803 |
9804 void JSFunction::MarkForOptimization() { | 9804 void JSFunction::MarkForOptimization() { |
9805 Isolate* isolate = GetIsolate(); | 9805 Isolate* isolate = GetIsolate(); |
9806 DCHECK(!IsOptimized()); | 9806 DCHECK(!IsOptimized()); |
9807 DCHECK(shared()->allows_lazy_compilation() || IsOptimizable()); | 9807 DCHECK(shared()->allows_lazy_compilation() || |
| 9808 !shared()->optimization_disabled()); |
9808 set_code_no_write_barrier( | 9809 set_code_no_write_barrier( |
9809 isolate->builtins()->builtin(Builtins::kCompileOptimized)); | 9810 isolate->builtins()->builtin(Builtins::kCompileOptimized)); |
9810 // No write barrier required, since the builtin is part of the root set. | 9811 // No write barrier required, since the builtin is part of the root set. |
9811 } | 9812 } |
9812 | 9813 |
9813 | 9814 |
9814 void JSFunction::AttemptConcurrentOptimization() { | 9815 void JSFunction::AttemptConcurrentOptimization() { |
9815 Isolate* isolate = GetIsolate(); | 9816 Isolate* isolate = GetIsolate(); |
9816 if (!isolate->concurrent_recompilation_enabled() || | 9817 if (!isolate->concurrent_recompilation_enabled() || |
9817 isolate->bootstrapper()->IsActive()) { | 9818 isolate->bootstrapper()->IsActive()) { |
9818 MarkForOptimization(); | 9819 MarkForOptimization(); |
9819 return; | 9820 return; |
9820 } | 9821 } |
9821 if (isolate->concurrent_osr_enabled() && | 9822 if (isolate->concurrent_osr_enabled() && |
9822 isolate->optimizing_compile_dispatcher()->IsQueuedForOSR(this)) { | 9823 isolate->optimizing_compile_dispatcher()->IsQueuedForOSR(this)) { |
9823 // Do not attempt regular recompilation if we already queued this for OSR. | 9824 // Do not attempt regular recompilation if we already queued this for OSR. |
9824 // TODO(yangguo): This is necessary so that we don't install optimized | 9825 // TODO(yangguo): This is necessary so that we don't install optimized |
9825 // code on a function that is already optimized, since OSR and regular | 9826 // code on a function that is already optimized, since OSR and regular |
9826 // recompilation race. This goes away as soon as OSR becomes one-shot. | 9827 // recompilation race. This goes away as soon as OSR becomes one-shot. |
9827 return; | 9828 return; |
9828 } | 9829 } |
9829 DCHECK(!IsInOptimizationQueue()); | 9830 DCHECK(!IsInOptimizationQueue()); |
9830 DCHECK(!IsOptimized()); | 9831 DCHECK(!IsOptimized()); |
9831 DCHECK(shared()->allows_lazy_compilation() || IsOptimizable()); | 9832 DCHECK(shared()->allows_lazy_compilation() || |
| 9833 !shared()->optimization_disabled()); |
9832 DCHECK(isolate->concurrent_recompilation_enabled()); | 9834 DCHECK(isolate->concurrent_recompilation_enabled()); |
9833 if (FLAG_trace_concurrent_recompilation) { | 9835 if (FLAG_trace_concurrent_recompilation) { |
9834 PrintF(" ** Marking "); | 9836 PrintF(" ** Marking "); |
9835 ShortPrint(); | 9837 ShortPrint(); |
9836 PrintF(" for concurrent recompilation.\n"); | 9838 PrintF(" for concurrent recompilation.\n"); |
9837 } | 9839 } |
9838 set_code_no_write_barrier( | 9840 set_code_no_write_barrier( |
9839 GetIsolate()->builtins()->builtin(Builtins::kCompileOptimizedConcurrent)); | 9841 isolate->builtins()->builtin(Builtins::kCompileOptimizedConcurrent)); |
9840 // No write barrier required, since the builtin is part of the root set. | 9842 // No write barrier required, since the builtin is part of the root set. |
9841 } | 9843 } |
9842 | 9844 |
9843 | 9845 |
9844 Handle<JSFunction> JSFunction::CloneClosure(Handle<JSFunction> function) { | 9846 Handle<JSFunction> JSFunction::CloneClosure(Handle<JSFunction> function) { |
9845 Isolate* isolate = function->GetIsolate(); | 9847 Isolate* isolate = function->GetIsolate(); |
9846 Handle<Map> map(function->map()); | 9848 Handle<Map> map(function->map()); |
9847 Handle<SharedFunctionInfo> shared(function->shared()); | 9849 Handle<SharedFunctionInfo> shared(function->shared()); |
9848 Handle<Context> context(function->context()); | 9850 Handle<Context> context(function->context()); |
9849 Handle<JSFunction> clone = | 9851 Handle<JSFunction> clone = |
(...skipping 7441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17291 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, | 17293 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, |
17292 Handle<Object> new_value) { | 17294 Handle<Object> new_value) { |
17293 if (cell->value() != *new_value) { | 17295 if (cell->value() != *new_value) { |
17294 cell->set_value(*new_value); | 17296 cell->set_value(*new_value); |
17295 Isolate* isolate = cell->GetIsolate(); | 17297 Isolate* isolate = cell->GetIsolate(); |
17296 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 17298 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
17297 isolate, DependentCode::kPropertyCellChangedGroup); | 17299 isolate, DependentCode::kPropertyCellChangedGroup); |
17298 } | 17300 } |
17299 } | 17301 } |
17300 } } // namespace v8::internal | 17302 } } // namespace v8::internal |
OLD | NEW |