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

Unified Diff: src/heap/heap.cc

Issue 2626893005: Revert of Internalize strings in-place (Closed)
Patch Set: rebased 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 2e673bb4564673533bafe11dc96a667442314b83..ec2a470abb8268897290511a34ea60ec5be12c57 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -1738,21 +1738,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());
}
@@ -6422,19 +6413,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);
@@ -6446,17 +6432,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();
@@ -6469,21 +6450,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