Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index 3325024fd81a8697cd82fb1c7c89279a79c7464c..7dfa142ad76d48cdce1a4b9252bfea7ed6eb3a98 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -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. |