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

Side by Side Diff: src/heap/mark-compact.cc

Issue 2549773002: Internalize strings in-place (Closed)
Patch Set: forgot one Created 4 years 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/heap/mark-compact.h" 5 #include "src/heap/mark-compact.h"
6 6
7 #include "src/base/atomicops.h" 7 #include "src/base/atomicops.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/base/sys-info.h" 9 #include "src/base/sys-info.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 } 1439 }
1440 1440
1441 void VisitPointers(Object** start, Object** end) override { 1441 void VisitPointers(Object** start, Object** end) override {
1442 // Visit all HeapObject pointers in [start, end). 1442 // Visit all HeapObject pointers in [start, end).
1443 MarkCompactCollector* collector = heap_->mark_compact_collector(); 1443 MarkCompactCollector* collector = heap_->mark_compact_collector();
1444 for (Object** p = start; p < end; p++) { 1444 for (Object** p = start; p < end; p++) {
1445 Object* o = *p; 1445 Object* o = *p;
1446 if (o->IsHeapObject()) { 1446 if (o->IsHeapObject()) {
1447 if (Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(o)))) { 1447 if (Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(o)))) {
1448 if (finalize_external_strings) { 1448 if (finalize_external_strings) {
1449 DCHECK(o->IsExternalString()); 1449 if (o->IsExternalString()) {
1450 heap_->FinalizeExternalString(String::cast(*p)); 1450 heap_->FinalizeExternalString(String::cast(*p));
1451 } else {
1452 // The original external string may have been internalized.
1453 DCHECK(o->IsThinString());
1454 }
1451 } else { 1455 } else {
1452 pointers_removed_++; 1456 pointers_removed_++;
1453 } 1457 }
1454 // Set the entry to the_hole_value (as deleted). 1458 // Set the entry to the_hole_value (as deleted).
1455 *p = heap_->the_hole_value(); 1459 *p = heap_->the_hole_value();
1456 } else if (record_slots) { 1460 } else if (record_slots) {
1457 // StringTable contains only old space strings. 1461 // StringTable contains only old space strings.
1458 DCHECK(!heap_->InNewSpace(o)); 1462 DCHECK(!heap_->InNewSpace(o));
1459 collector->RecordSlot(table_, p, o); 1463 collector->RecordSlot(table_, p, o);
1460 } 1464 }
(...skipping 2627 matching lines...) Expand 10 before | Expand all | Expand 10 after
4088 // The target is always in old space, we don't have to record the slot in 4092 // The target is always in old space, we don't have to record the slot in
4089 // the old-to-new remembered set. 4093 // the old-to-new remembered set.
4090 DCHECK(!heap()->InNewSpace(target)); 4094 DCHECK(!heap()->InNewSpace(target));
4091 RecordRelocSlot(host, &rinfo, target); 4095 RecordRelocSlot(host, &rinfo, target);
4092 } 4096 }
4093 } 4097 }
4094 } 4098 }
4095 4099
4096 } // namespace internal 4100 } // namespace internal
4097 } // namespace v8 4101 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698