Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 5232ba1649c326afa88be54de16acd211b935fc0..e3e386b78525f28a0d210259e2297cfa9df12792 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -6219,7 +6219,7 @@ void DescriptorLookupCache::Clear() { |
for (int index = 0; index < kLength; index++) keys_[index].source = NULL; |
} |
- |
+template <Heap::ExternalStringTable::CleanupMode mode> |
void Heap::ExternalStringTable::CleanUp() { |
int last = 0; |
for (int i = 0; i < new_space_strings_.length(); ++i) { |
@@ -6236,17 +6236,19 @@ void Heap::ExternalStringTable::CleanUp() { |
new_space_strings_.Rewind(last); |
new_space_strings_.Trim(); |
- last = 0; |
- for (int i = 0; i < old_space_strings_.length(); ++i) { |
- if (old_space_strings_[i] == heap_->the_hole_value()) { |
- continue; |
+ if (mode == CleanupMode::kFull) { |
+ last = 0; |
+ for (int i = 0; i < old_space_strings_.length(); ++i) { |
+ if (old_space_strings_[i] == heap_->the_hole_value()) { |
+ continue; |
+ } |
+ DCHECK(old_space_strings_[i]->IsExternalString()); |
+ DCHECK(!heap_->InNewSpace(old_space_strings_[i])); |
+ old_space_strings_[last++] = old_space_strings_[i]; |
} |
- 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(); |
} |
- old_space_strings_.Rewind(last); |
- old_space_strings_.Trim(); |
#ifdef VERIFY_HEAP |
if (FLAG_verify_heap) { |
Verify(); |
@@ -6254,6 +6256,10 @@ void Heap::ExternalStringTable::CleanUp() { |
#endif |
} |
+template void Heap::ExternalStringTable::CleanUp< |
+ Heap::ExternalStringTable::CleanupMode::kFull>(); |
+template void Heap::ExternalStringTable::CleanUp< |
+ Heap::ExternalStringTable::CleanupMode::kPromoteOnly>(); |
void Heap::ExternalStringTable::TearDown() { |
for (int i = 0; i < new_space_strings_.length(); ++i) { |