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 <mlippautz@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51419}
This commit is contained in:
Dan Elphick 2018-02-21 09:37:37 +00:00 committed by Commit Bot
parent 3537bc6e81
commit d9e305d47c

View File

@ -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;