From d9e305d47cd6a35a82d2bb980d0a15127ac816fe Mon Sep 17 00:00:00 2001 From: Dan Elphick Date: Wed, 21 Feb 2018 09:37:37 +0000 Subject: [PATCH] Remove redundant logic in AllowedToBeMigrated Simplifies boolean logic since shortcuts mean most will never be executed and also replaces variables with constants to improve readability. Change-Id: Ic1678bc60c3e85daced758ce139f7d03c25632dc Reviewed-on: https://chromium-review.googlesource.com/928320 Reviewed-by: Michael Lippautz Commit-Queue: Dan Elphick Cr-Commit-Position: refs/heads/master@{#51419} --- src/heap/heap.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/heap/heap.cc b/src/heap/heap.cc index a4d2a223e8..de73dcff21 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc @@ -6644,12 +6644,11 @@ bool Heap::AllowedToBeMigrated(HeapObject* obj, AllocationSpace dst) { AllocationSpace src = chunk->owner()->identity(); switch (src) { case NEW_SPACE: - return dst == src || dst == OLD_SPACE; + return dst == NEW_SPACE || dst == OLD_SPACE; case OLD_SPACE: - return dst == src && - (dst == OLD_SPACE || obj->IsFiller() || obj->IsExternalString()); + return dst == OLD_SPACE; case CODE_SPACE: - return dst == src && type == CODE_TYPE; + return dst == CODE_SPACE && type == CODE_TYPE; case MAP_SPACE: case LO_SPACE: return false;