Author: [email protected]
Date: Tue Apr 14 02:58:42 2009
New Revision: 1698
Modified:
branches/bleeding_edge/src/heap.cc
branches/bleeding_edge/src/mark-compact.cc
Log:
Fixed issue 303 by not shortcutting cons-symbols and added
symbol table verification after mark-compact GCs.
Review URL: http://codereview.chromium.org/73029
Modified: branches/bleeding_edge/src/heap.cc
==============================================================================
--- branches/bleeding_edge/src/heap.cc (original)
+++ branches/bleeding_edge/src/heap.cc Tue Apr 14 02:58:42 2009
@@ -813,12 +813,20 @@
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();
}
Modified: branches/bleeding_edge/src/mark-compact.cc
==============================================================================
--- branches/bleeding_edge/src/mark-compact.cc (original)
+++ branches/bleeding_edge/src/mark-compact.cc Tue Apr 14 02:58:42 2009
@@ -183,6 +183,10 @@
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
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---