Unify the IsShortcutCandidate predicate.

R=yangguo@chromium.org
BUG=v8:2803
LOG=N

Review URL: https://codereview.chromium.org/390193007

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22399 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent fd578116
......@@ -2193,10 +2193,6 @@ class ScavengingVisitor : public StaticVisitorBase {
}
static inline bool IsShortcutCandidate(int type) {
return ((type & kShortcutTypeMask) == kShortcutTypeTag);
}
static inline void EvacuateShortcutCandidate(Map* map,
HeapObject** slot,
HeapObject* object) {
......
......@@ -1355,7 +1355,7 @@ static inline HeapObject* ShortCircuitConsString(Object** p) {
if (!FLAG_clever_optimizations) return object;
Map* map = object->map();
InstanceType type = map->instance_type();
if ((type & kShortcutTypeMask) != kShortcutTypeTag) return object;
if (!IsShortcutCandidate(type)) return object;
Object* second = reinterpret_cast<ConsString*>(object)->second();
Heap* heap = map->GetHeap();
......
......@@ -11,11 +11,6 @@ namespace v8 {
namespace internal {
static inline bool IsShortcutCandidate(int type) {
return ((type & kShortcutTypeMask) == kShortcutTypeTag);
}
StaticVisitorBase::VisitorId StaticVisitorBase::GetVisitorId(
int instance_type,
int instance_size) {
......
......@@ -619,16 +619,21 @@ const uint32_t kShortExternalStringTag = 0x10;
// A ConsString with an empty string as the right side is a candidate
// for being shortcut by the garbage collector unless it is internalized.
// It's not common to have non-flat internalized strings, so we do not
// shortcut them thereby avoiding turning internalized strings into strings.
// See heap.cc and mark-compact.cc.
// for being shortcut by the garbage collector. We don't allocate any
// non-flat internalized strings, so we do not shortcut them thereby
// avoiding turning internalized strings into strings. The bit-masks
// below contain the internalized bit as additional safety.
// See heap.cc, mark-compact.cc and objects-visiting.cc.
const uint32_t kShortcutTypeMask =
kIsNotStringMask |
kIsNotInternalizedMask |
kStringRepresentationMask;
const uint32_t kShortcutTypeTag = kConsStringTag | kNotInternalizedTag;
static inline bool IsShortcutCandidate(int type) {
return ((type & kShortcutTypeMask) == kShortcutTypeTag);
}
enum InstanceType {
// String types.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment