Reviewers: Yang,
Description:
Unify the IsShortcutCandidate predicate.
[email protected]
BUG=v8:2803
LOG=N
Please review this at https://codereview.chromium.org/390193007/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+10, -14 lines):
M src/heap.cc
M src/mark-compact.cc
M src/objects.h
M src/objects-visiting.cc
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index
d172ceb54d0d588fba6294024529c1d9174bae7a..72cbd6476c69987a78587e38b6a4fb199e4f625f
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -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) {
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index
2ff1ce98500e5aa6e9c03faad4bd07b3c3736a8b..51b023b70027426e8fdc10e7f604e9f23fee8965
100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -1350,7 +1350,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();
Index: src/objects-visiting.cc
diff --git a/src/objects-visiting.cc b/src/objects-visiting.cc
index
7d10fbd2791c0219cb6eb1e2a6a009ab0d504cd6..9ff97fcdbe646a15e893567cf4000ba210e32ce3
100644
--- a/src/objects-visiting.cc
+++ b/src/objects-visiting.cc
@@ -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) {
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.
--
--
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.