OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/type-feedback-vector.h" | 5 #include "src/type-feedback-vector.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/ic/ic.h" | 8 #include "src/ic/ic.h" |
9 #include "src/ic/ic-state.h" | 9 #include "src/ic/ic-state.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // static | 277 // static |
278 void TypeFeedbackVector::ClearAllKeyedStoreICs(Isolate* isolate) { | 278 void TypeFeedbackVector::ClearAllKeyedStoreICs(Isolate* isolate) { |
279 SharedFunctionInfo::Iterator iterator(isolate); | 279 SharedFunctionInfo::Iterator iterator(isolate); |
280 SharedFunctionInfo* shared; | 280 SharedFunctionInfo* shared; |
281 while ((shared = iterator.Next())) { | 281 while ((shared = iterator.Next())) { |
282 if (!shared->OptimizedCodeMapIsCleared()) { | 282 if (!shared->OptimizedCodeMapIsCleared()) { |
283 FixedArray* optimized_code_map = shared->optimized_code_map(); | 283 FixedArray* optimized_code_map = shared->optimized_code_map(); |
284 int length = optimized_code_map->length(); | 284 int length = optimized_code_map->length(); |
285 for (int i = SharedFunctionInfo::kEntriesStart; i < length; | 285 for (int i = SharedFunctionInfo::kEntriesStart; i < length; |
286 i += SharedFunctionInfo::kEntryLength) { | 286 i += SharedFunctionInfo::kEntryLength) { |
287 WeakCell* cell = WeakCell::cast( | 287 Object* lits = |
288 optimized_code_map->get(i + SharedFunctionInfo::kLiteralsOffset)); | 288 optimized_code_map->get(i + SharedFunctionInfo::kLiteralsOffset); |
289 if (cell->value()->IsLiteralsArray()) { | 289 TypeFeedbackVector* vector = nullptr; |
290 TypeFeedbackVector* vector = | 290 if (lits->IsWeakCell()) { |
291 LiteralsArray::cast(cell->value())->feedback_vector(); | 291 WeakCell* cell = WeakCell::cast(lits); |
| 292 if (cell->value()->IsLiteralsArray()) { |
| 293 vector = LiteralsArray::cast(cell->value())->feedback_vector(); |
| 294 } |
| 295 } else { |
| 296 DCHECK(lits->IsLiteralsArray()); |
| 297 vector = LiteralsArray::cast(lits)->feedback_vector(); |
| 298 } |
| 299 if (vector != nullptr) { |
292 vector->ClearKeyedStoreICs(shared); | 300 vector->ClearKeyedStoreICs(shared); |
293 } | 301 } |
294 } | 302 } |
295 } | 303 } |
296 } | 304 } |
297 } | 305 } |
298 | 306 |
299 | 307 |
300 void TypeFeedbackVector::ClearKeyedStoreICs(SharedFunctionInfo* shared) { | 308 void TypeFeedbackVector::ClearKeyedStoreICs(SharedFunctionInfo* shared) { |
301 Isolate* isolate = GetIsolate(); | 309 Isolate* isolate = GetIsolate(); |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 | 900 |
893 IcCheckType KeyedStoreICNexus::GetKeyType() const { | 901 IcCheckType KeyedStoreICNexus::GetKeyType() const { |
894 Object* feedback = GetFeedback(); | 902 Object* feedback = GetFeedback(); |
895 if (feedback == *TypeFeedbackVector::MegamorphicSentinel(GetIsolate())) { | 903 if (feedback == *TypeFeedbackVector::MegamorphicSentinel(GetIsolate())) { |
896 return static_cast<IcCheckType>(Smi::cast(GetFeedbackExtra())->value()); | 904 return static_cast<IcCheckType>(Smi::cast(GetFeedbackExtra())->value()); |
897 } | 905 } |
898 return IsPropertyNameFeedback(feedback) ? PROPERTY : ELEMENT; | 906 return IsPropertyNameFeedback(feedback) ? PROPERTY : ELEMENT; |
899 } | 907 } |
900 } // namespace internal | 908 } // namespace internal |
901 } // namespace v8 | 909 } // namespace v8 |
OLD | NEW |