Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: src/type-feedback-vector.cc

Issue 2031123003: Avoid creating weak cells for literal arrays that are empty of literals. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ports. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // static 272 // static
273 void TypeFeedbackVector::ClearAllKeyedStoreICs(Isolate* isolate) { 273 void TypeFeedbackVector::ClearAllKeyedStoreICs(Isolate* isolate) {
274 SharedFunctionInfo::Iterator iterator(isolate); 274 SharedFunctionInfo::Iterator iterator(isolate);
275 SharedFunctionInfo* shared; 275 SharedFunctionInfo* shared;
276 while ((shared = iterator.Next())) { 276 while ((shared = iterator.Next())) {
277 if (!shared->OptimizedCodeMapIsCleared()) { 277 if (!shared->OptimizedCodeMapIsCleared()) {
278 FixedArray* optimized_code_map = shared->optimized_code_map(); 278 FixedArray* optimized_code_map = shared->optimized_code_map();
279 int length = optimized_code_map->length(); 279 int length = optimized_code_map->length();
280 for (int i = SharedFunctionInfo::kEntriesStart; i < length; 280 for (int i = SharedFunctionInfo::kEntriesStart; i < length;
281 i += SharedFunctionInfo::kEntryLength) { 281 i += SharedFunctionInfo::kEntryLength) {
282 WeakCell* cell = WeakCell::cast( 282 Object* lits =
283 optimized_code_map->get(i + SharedFunctionInfo::kLiteralsOffset)); 283 optimized_code_map->get(i + SharedFunctionInfo::kLiteralsOffset);
284 if (cell->value()->IsLiteralsArray()) { 284 TypeFeedbackVector* vector = NULL;
Michael Starzinger 2016/06/07 09:41:37 nit: s/NULL/nullptr/
mvstanton 2016/06/07 11:35:33 Done.
285 TypeFeedbackVector* vector = 285 if (lits->IsWeakCell()) {
286 LiteralsArray::cast(cell->value())->feedback_vector(); 286 WeakCell* cell = WeakCell::cast(lits);
287 if (cell->value()->IsLiteralsArray()) {
288 vector = LiteralsArray::cast(cell->value())->feedback_vector();
289 }
290 } else {
291 DCHECK(lits->IsLiteralsArray());
292 vector = LiteralsArray::cast(lits)->feedback_vector();
293 }
294 if (vector != NULL) {
Michael Starzinger 2016/06/07 09:41:37 nit: s/NULL/nullptr/
mvstanton 2016/06/07 11:35:33 Done.
287 vector->ClearKeyedStoreICs(shared); 295 vector->ClearKeyedStoreICs(shared);
288 } 296 }
289 } 297 }
290 } 298 }
291 } 299 }
292 } 300 }
293 301
294 302
295 void TypeFeedbackVector::ClearKeyedStoreICs(SharedFunctionInfo* shared) { 303 void TypeFeedbackVector::ClearKeyedStoreICs(SharedFunctionInfo* shared) {
296 Isolate* isolate = GetIsolate(); 304 Isolate* isolate = GetIsolate();
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 895
888 IcCheckType KeyedStoreICNexus::GetKeyType() const { 896 IcCheckType KeyedStoreICNexus::GetKeyType() const {
889 Object* feedback = GetFeedback(); 897 Object* feedback = GetFeedback();
890 if (feedback == *TypeFeedbackVector::MegamorphicSentinel(GetIsolate())) { 898 if (feedback == *TypeFeedbackVector::MegamorphicSentinel(GetIsolate())) {
891 return static_cast<IcCheckType>(Smi::cast(GetFeedbackExtra())->value()); 899 return static_cast<IcCheckType>(Smi::cast(GetFeedbackExtra())->value());
892 } 900 }
893 return IsPropertyNameFeedback(feedback) ? PROPERTY : ELEMENT; 901 return IsPropertyNameFeedback(feedback) ? PROPERTY : ELEMENT;
894 } 902 }
895 } // namespace internal 903 } // namespace internal
896 } // namespace v8 904 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698