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

Unified Diff: src/heap/heap.cc

Issue 2624203002: Version 5.7.440.1 (cherry-pick) (Closed)
Patch Set: Created 3 years, 11 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/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 62ec7f59371937efee1760864d4052515b0487a2..316c5772a04d5bd941fb8bf863769a7580e38a43 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -1733,21 +1733,12 @@ String* Heap::UpdateNewSpaceReferenceInExternalStringTableEntry(Heap* heap,
if (!first_word.IsForwardingAddress()) {
// Unreachable external string can be finalized.
- String* string = String::cast(*p);
- if (!string->IsExternalString()) {
- // Original external string has been internalized.
- DCHECK(string->IsThinString());
- return NULL;
- }
- heap->FinalizeExternalString(string);
+ heap->FinalizeExternalString(String::cast(*p));
return NULL;
}
// String is still reachable.
- String* string = String::cast(first_word.ToForwardingAddress());
- if (string->IsThinString()) string = ThinString::cast(string)->actual();
- // Internalization can replace external strings with non-external strings.
- return string->IsExternalString() ? string : nullptr;
+ return String::cast(first_word.ToForwardingAddress());
}
@@ -6405,19 +6396,14 @@ void Heap::ExternalStringTable::CleanUpNewSpaceStrings() {
int last = 0;
Isolate* isolate = heap_->isolate();
for (int i = 0; i < new_space_strings_.length(); ++i) {
- Object* o = new_space_strings_[i];
- if (o->IsTheHole(isolate)) {
+ if (new_space_strings_[i]->IsTheHole(isolate)) {
continue;
}
- if (o->IsThinString()) {
- o = ThinString::cast(o)->actual();
- if (!o->IsExternalString()) continue;
- }
- DCHECK(o->IsExternalString());
- if (heap_->InNewSpace(o)) {
- new_space_strings_[last++] = o;
+ DCHECK(new_space_strings_[i]->IsExternalString());
+ if (heap_->InNewSpace(new_space_strings_[i])) {
+ new_space_strings_[last++] = new_space_strings_[i];
} else {
- old_space_strings_.Add(o);
+ old_space_strings_.Add(new_space_strings_[i]);
}
}
new_space_strings_.Rewind(last);
@@ -6429,17 +6415,12 @@ void Heap::ExternalStringTable::CleanUpAll() {
int last = 0;
Isolate* isolate = heap_->isolate();
for (int i = 0; i < old_space_strings_.length(); ++i) {
- Object* o = old_space_strings_[i];
- if (o->IsTheHole(isolate)) {
+ if (old_space_strings_[i]->IsTheHole(isolate)) {
continue;
}
- if (o->IsThinString()) {
- o = ThinString::cast(o)->actual();
- if (!o->IsExternalString()) continue;
- }
- DCHECK(o->IsExternalString());
- DCHECK(!heap_->InNewSpace(o));
- old_space_strings_[last++] = o;
+ DCHECK(old_space_strings_[i]->IsExternalString());
+ DCHECK(!heap_->InNewSpace(old_space_strings_[i]));
+ old_space_strings_[last++] = old_space_strings_[i];
}
old_space_strings_.Rewind(last);
old_space_strings_.Trim();
@@ -6452,21 +6433,11 @@ void Heap::ExternalStringTable::CleanUpAll() {
void Heap::ExternalStringTable::TearDown() {
for (int i = 0; i < new_space_strings_.length(); ++i) {
- Object* o = new_space_strings_[i];
- if (o->IsThinString()) {
- o = ThinString::cast(o)->actual();
- if (!o->IsExternalString()) continue;
- }
- heap_->FinalizeExternalString(ExternalString::cast(o));
+ heap_->FinalizeExternalString(ExternalString::cast(new_space_strings_[i]));
}
new_space_strings_.Free();
for (int i = 0; i < old_space_strings_.length(); ++i) {
- Object* o = old_space_strings_[i];
- if (o->IsThinString()) {
- o = ThinString::cast(o)->actual();
- if (!o->IsExternalString()) continue;
- }
- heap_->FinalizeExternalString(ExternalString::cast(o));
+ heap_->FinalizeExternalString(ExternalString::cast(old_space_strings_[i]));
}
old_space_strings_.Free();
}
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698