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

Unified 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: REBASE. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/type-feedback-vector.cc
diff --git a/src/type-feedback-vector.cc b/src/type-feedback-vector.cc
index 789ac2ea77d726db01e9417069f9edeef0e7389d..723143db229afee07b000cfd4c7d1ba61221edac 100644
--- a/src/type-feedback-vector.cc
+++ b/src/type-feedback-vector.cc
@@ -284,11 +284,19 @@ void TypeFeedbackVector::ClearAllKeyedStoreICs(Isolate* isolate) {
int length = optimized_code_map->length();
for (int i = SharedFunctionInfo::kEntriesStart; i < length;
i += SharedFunctionInfo::kEntryLength) {
- WeakCell* cell = WeakCell::cast(
- optimized_code_map->get(i + SharedFunctionInfo::kLiteralsOffset));
- if (cell->value()->IsLiteralsArray()) {
- TypeFeedbackVector* vector =
- LiteralsArray::cast(cell->value())->feedback_vector();
+ Object* lits =
+ optimized_code_map->get(i + SharedFunctionInfo::kLiteralsOffset);
+ TypeFeedbackVector* vector = nullptr;
+ if (lits->IsWeakCell()) {
+ WeakCell* cell = WeakCell::cast(lits);
+ if (cell->value()->IsLiteralsArray()) {
+ vector = LiteralsArray::cast(cell->value())->feedback_vector();
+ }
+ } else {
+ DCHECK(lits->IsLiteralsArray());
+ vector = LiteralsArray::cast(lits)->feedback_vector();
+ }
+ if (vector != nullptr) {
vector->ClearKeyedStoreICs(shared);
}
}
« 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