Do not use out of range visitor ids.

BUG=

Review URL: https://codereview.chromium.org/822693002

Cr-Commit-Position: refs/heads/master@{#25920}
This commit is contained in:
hpayer 2014-12-22 03:11:50 -08:00 committed by Commit bot
parent c61abc1426
commit 892f6c7127

View File

@ -130,10 +130,11 @@ class StaticVisitorBase : public AllStatic {
if (has_unboxed_fields) return generic;
const VisitorId specialization = static_cast<VisitorId>(
base + (object_size >> kPointerSizeLog2) - kMinObjectSizeInWords);
int visitor_id =
Min(base + (object_size >> kPointerSizeLog2) - kMinObjectSizeInWords,
static_cast<int>(generic));
return Min(specialization, generic);
return static_cast<VisitorId>(visitor_id);
}
};