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 "src/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 12105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12116 // No write barrier required, since the builtin is part of the root set. | 12116 // No write barrier required, since the builtin is part of the root set. |
12117 } | 12117 } |
12118 | 12118 |
12119 | 12119 |
12120 void SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap( | 12120 void SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap( |
12121 Handle<SharedFunctionInfo> shared, Handle<Code> code) { | 12121 Handle<SharedFunctionInfo> shared, Handle<Code> code) { |
12122 Isolate* isolate = shared->GetIsolate(); | 12122 Isolate* isolate = shared->GetIsolate(); |
12123 if (isolate->serializer_enabled()) return; | 12123 if (isolate->serializer_enabled()) return; |
12124 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); | 12124 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); |
12125 // Empty code maps are unsupported. | 12125 // Empty code maps are unsupported. |
12126 if (shared->OptimizedCodeMapIsCleared()) return; | 12126 if (!shared->OptimizedCodeMapIsCleared()) { |
12127 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(code); | 12127 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(code); |
12128 shared->optimized_code_map()->set(kSharedCodeIndex, *cell); | 12128 // A collection may have occured and cleared the optimized code map in the |
| 12129 // allocation above. |
| 12130 if (!shared->OptimizedCodeMapIsCleared()) { |
| 12131 shared->optimized_code_map()->set(kSharedCodeIndex, *cell); |
| 12132 } |
| 12133 } |
12129 } | 12134 } |
12130 | 12135 |
12131 | 12136 |
12132 void SharedFunctionInfo::AddToOptimizedCodeMapInternal( | 12137 void SharedFunctionInfo::AddToOptimizedCodeMapInternal( |
12133 Handle<SharedFunctionInfo> shared, Handle<Context> native_context, | 12138 Handle<SharedFunctionInfo> shared, Handle<Context> native_context, |
12134 Handle<HeapObject> code, Handle<LiteralsArray> literals, | 12139 Handle<HeapObject> code, Handle<LiteralsArray> literals, |
12135 BailoutId osr_ast_id) { | 12140 BailoutId osr_ast_id) { |
12136 Isolate* isolate = shared->GetIsolate(); | 12141 Isolate* isolate = shared->GetIsolate(); |
12137 if (isolate->serializer_enabled()) return; | 12142 if (isolate->serializer_enabled()) return; |
12138 DCHECK(*code == isolate->heap()->undefined_value() || | 12143 DCHECK(*code == isolate->heap()->undefined_value() || |
(...skipping 7203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19342 if (cell->value() != *new_value) { | 19347 if (cell->value() != *new_value) { |
19343 cell->set_value(*new_value); | 19348 cell->set_value(*new_value); |
19344 Isolate* isolate = cell->GetIsolate(); | 19349 Isolate* isolate = cell->GetIsolate(); |
19345 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19350 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19346 isolate, DependentCode::kPropertyCellChangedGroup); | 19351 isolate, DependentCode::kPropertyCellChangedGroup); |
19347 } | 19352 } |
19348 } | 19353 } |
19349 | 19354 |
19350 } // namespace internal | 19355 } // namespace internal |
19351 } // namespace v8 | 19356 } // namespace v8 |
OLD | NEW |