Fixed issue 303 by not shortcutting cons-symbols and added
symbol table verification after mark-compact GCs. Review URL: http://codereview.chromium.org/73029 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1698 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
c77875113c
commit
850d5ed380
18
src/heap.cc
18
src/heap.cc
@ -813,12 +813,20 @@ void Heap::ScavengeObject(HeapObject** p, HeapObject* object) {
|
||||
|
||||
|
||||
static inline bool IsShortcutCandidate(HeapObject* object, Map* map) {
|
||||
// A ConsString object with Heap::empty_string() as the right side
|
||||
// is a candidate for being shortcut by the scavenger.
|
||||
// A ConsString with an empty string as the right side is a
|
||||
// candidate for being shortcut by the scavenger unless it is a
|
||||
// symbol. It's not common to have non-flat symbols, so we do not
|
||||
// shortcut them thereby avoiding turning symbols into strings.
|
||||
ASSERT(kNotStringTag != 0 && kSymbolTag != 0);
|
||||
static const uint32_t kShortcutTypeMask =
|
||||
kIsNotStringMask |
|
||||
kIsSymbolMask |
|
||||
kStringRepresentationMask;
|
||||
ASSERT(object->map() == map);
|
||||
if (map->instance_type() >= FIRST_NONSTRING_TYPE) return false;
|
||||
return (StringShape(map).representation_tag() == kConsStringTag) &&
|
||||
(ConsString::cast(object)->unchecked_second() == Heap::empty_string());
|
||||
InstanceType type = map->instance_type();
|
||||
if ((type & kShortcutTypeMask) != kConsStringTag) return false;
|
||||
ASSERT(object->IsString() && !object->IsSymbol());
|
||||
return ConsString::cast(object)->unchecked_second() == Heap::empty_string();
|
||||
}
|
||||
|
||||
|
||||
|
@ -183,6 +183,10 @@ void MarkCompactCollector::Prepare(GCTracer* tracer) {
|
||||
|
||||
void MarkCompactCollector::Finish() {
|
||||
#ifdef DEBUG
|
||||
SymbolTable* symbol_table = SymbolTable::cast(Heap::symbol_table());
|
||||
SymbolTableVerifier v;
|
||||
symbol_table->IterateElements(&v);
|
||||
|
||||
ASSERT(state_ == SWEEP_SPACES || state_ == REBUILD_RSETS);
|
||||
state_ = IDLE;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user