Revision: 22399
Author:   [email protected]
Date:     Tue Jul 15 09:19:22 2014 UTC
Log:      Unify the IsShortcutCandidate predicate.

[email protected]
BUG=v8:2803
LOG=N

Review URL: https://codereview.chromium.org/390193007
http://code.google.com/p/v8/source/detail?r=22399

Modified:
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/mark-compact.cc
 /branches/bleeding_edge/src/objects-visiting.cc
 /branches/bleeding_edge/src/objects.h

=======================================
--- /branches/bleeding_edge/src/heap.cc Tue Jul 15 08:24:44 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Tue Jul 15 09:19:22 2014 UTC
@@ -2193,10 +2193,6 @@
   }


-  static inline bool IsShortcutCandidate(int type) {
-    return ((type & kShortcutTypeMask) == kShortcutTypeTag);
-  }
-
   static inline void EvacuateShortcutCandidate(Map* map,
                                                HeapObject** slot,
                                                HeapObject* object) {
=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Tue Jul 15 08:24:44 2014 UTC
+++ /branches/bleeding_edge/src/mark-compact.cc Tue Jul 15 09:19:22 2014 UTC
@@ -1355,7 +1355,7 @@
   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();
=======================================
--- /branches/bleeding_edge/src/objects-visiting.cc Tue Jul 1 15:02:31 2014 UTC +++ /branches/bleeding_edge/src/objects-visiting.cc Tue Jul 15 09:19:22 2014 UTC
@@ -11,11 +11,6 @@
 namespace internal {


-static inline bool IsShortcutCandidate(int type) {
-  return ((type & kShortcutTypeMask) == kShortcutTypeTag);
-}
-
-
 StaticVisitorBase::VisitorId StaticVisitorBase::GetVisitorId(
     int instance_type,
     int instance_size) {
=======================================
--- /branches/bleeding_edge/src/objects.h       Tue Jul 15 08:46:47 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Tue Jul 15 09:19:22 2014 UTC
@@ -619,16 +619,21 @@


 // 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.

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to