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 9310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9321 | 9321 |
9322 void JSFunction::JSFunctionIterateBody(int object_size, ObjectVisitor* v) { | 9322 void JSFunction::JSFunctionIterateBody(int object_size, ObjectVisitor* v) { |
9323 // Iterate over all fields in the body but take care in dealing with | 9323 // Iterate over all fields in the body but take care in dealing with |
9324 // the code entry. | 9324 // the code entry. |
9325 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset); | 9325 IteratePointers(v, kPropertiesOffset, kCodeEntryOffset); |
9326 v->VisitCodeEntry(this->address() + kCodeEntryOffset); | 9326 v->VisitCodeEntry(this->address() + kCodeEntryOffset); |
9327 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size); | 9327 IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size); |
9328 } | 9328 } |
9329 | 9329 |
9330 | 9330 |
| 9331 bool JSFunction::Inlines(SharedFunctionInfo* candidate) { |
| 9332 DisallowHeapAllocation no_gc; |
| 9333 if (shared() == candidate) return true; |
| 9334 if (code()->kind() != Code::OPTIMIZED_FUNCTION) return false; |
| 9335 DeoptimizationInputData* const data = |
| 9336 DeoptimizationInputData::cast(code()->deoptimization_data()); |
| 9337 if (data->length() == 0) return false; |
| 9338 FixedArray* const literals = data->LiteralArray(); |
| 9339 int const inlined_count = data->InlinedFunctionCount()->value(); |
| 9340 for (int i = 0; i < inlined_count; ++i) { |
| 9341 if (SharedFunctionInfo::cast(literals->get(i)) == candidate) { |
| 9342 return true; |
| 9343 } |
| 9344 } |
| 9345 return false; |
| 9346 } |
| 9347 |
| 9348 |
9331 void JSFunction::MarkForOptimization() { | 9349 void JSFunction::MarkForOptimization() { |
9332 Isolate* isolate = GetIsolate(); | 9350 Isolate* isolate = GetIsolate(); |
| 9351 // Do not optimize if function contains break points. |
| 9352 if (shared()->HasDebugInfo()) return; |
9333 DCHECK(!IsOptimized()); | 9353 DCHECK(!IsOptimized()); |
9334 DCHECK(shared()->allows_lazy_compilation() || | 9354 DCHECK(shared()->allows_lazy_compilation() || |
9335 !shared()->optimization_disabled()); | 9355 !shared()->optimization_disabled()); |
| 9356 DCHECK(!shared()->HasDebugInfo()); |
9336 set_code_no_write_barrier( | 9357 set_code_no_write_barrier( |
9337 isolate->builtins()->builtin(Builtins::kCompileOptimized)); | 9358 isolate->builtins()->builtin(Builtins::kCompileOptimized)); |
9338 // No write barrier required, since the builtin is part of the root set. | 9359 // No write barrier required, since the builtin is part of the root set. |
9339 } | 9360 } |
9340 | 9361 |
9341 | 9362 |
9342 void JSFunction::AttemptConcurrentOptimization() { | 9363 void JSFunction::AttemptConcurrentOptimization() { |
9343 Isolate* isolate = GetIsolate(); | 9364 Isolate* isolate = GetIsolate(); |
9344 if (!isolate->concurrent_recompilation_enabled() || | 9365 if (!isolate->concurrent_recompilation_enabled() || |
9345 isolate->bootstrapper()->IsActive()) { | 9366 isolate->bootstrapper()->IsActive()) { |
(...skipping 6538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15884 Handle<Object> new_value) { | 15905 Handle<Object> new_value) { |
15885 if (cell->value() != *new_value) { | 15906 if (cell->value() != *new_value) { |
15886 cell->set_value(*new_value); | 15907 cell->set_value(*new_value); |
15887 Isolate* isolate = cell->GetIsolate(); | 15908 Isolate* isolate = cell->GetIsolate(); |
15888 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 15909 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
15889 isolate, DependentCode::kPropertyCellChangedGroup); | 15910 isolate, DependentCode::kPropertyCellChangedGroup); |
15890 } | 15911 } |
15891 } | 15912 } |
15892 } // namespace internal | 15913 } // namespace internal |
15893 } // namespace v8 | 15914 } // namespace v8 |
OLD | NEW |