From 9d43ff71b8693149a78bbd4057834d94f4c1d254 Mon Sep 17 00:00:00 2001 From: "danno@chromium.org" Date: Thu, 18 Oct 2012 12:01:36 +0000 Subject: [PATCH] Avoid unnecessary code target changes during code compaction. R=ulan@chromium.org Review URL: https://codereview.chromium.org/11198032 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12754 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/mark-compact.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mark-compact.cc b/src/mark-compact.cc index 0740ca04a8..7a25855d53 100644 --- a/src/mark-compact.cc +++ b/src/mark-compact.cc @@ -2315,8 +2315,13 @@ class PointersUpdatingVisitor: public ObjectVisitor { void VisitEmbeddedPointer(RelocInfo* rinfo) { ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); Object* target = rinfo->target_object(); + Object* old_target = target; VisitPointer(&target); - rinfo->set_target_object(target); + // Avoid unnecessary changes that might unnecessary flush the instruction + // cache. + if (target != old_target) { + rinfo->set_target_object(target); + } } void VisitCodeTarget(RelocInfo* rinfo) {