From: alexandre.rames@arm.com Date: Tue, 25 Mar 2014 10:33:50 +0000 (+0000) Subject: ARM64: Optimize RegList::IsValid() to speed up simulation in (opt)debug mode. X-Git-Tag: upstream/4.7.83~10026 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=25fd28827d973be8f7cf2db84446142d704e71c3;p=platform%2Fupstream%2Fv8.git ARM64: Optimize RegList::IsValid() to speed up simulation in (opt)debug mode. On my machine this improves the simulation speed noticeably. | test | base | patched | |--------------------|-------|---------| | optdebug | 15:37 | 11:07 | | debug --quickcheck | 33:53 | 26:14 | R=ulan@chromium.org Review URL: https://codereview.chromium.org/209353010 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20232 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/arm64/assembler-arm64.h b/src/arm64/assembler-arm64.h index 41eaaad..1aae2f2 100644 --- a/src/arm64/assembler-arm64.h +++ b/src/arm64/assembler-arm64.h @@ -588,22 +588,18 @@ class CPURegList { CPURegister::RegisterType type_; bool IsValid() const { - if ((type_ == CPURegister::kRegister) || - (type_ == CPURegister::kFPRegister)) { - bool is_valid = true; - // Try to create a CPURegister for each element in the list. - for (int i = 0; i < kRegListSizeInBits; i++) { - if (((list_ >> i) & 1) != 0) { - is_valid &= CPURegister::Create(i, size_, type_).IsValid(); - } - } - return is_valid; - } else if (type_ == CPURegister::kNoRegister) { - // The kNoRegister type is valid only for empty lists. - // We can't use IsEmpty here because that asserts IsValid(). - return list_ == 0; - } else { - return false; + const RegList kValidRegisters = 0x8000000ffffffff; + const RegList kValidFPRegisters = 0x0000000ffffffff; + switch (type_) { + case CPURegister::kRegister: + return (list_ & kValidRegisters) == list_; + case CPURegister::kFPRegister: + return (list_ & kValidFPRegisters) == list_; + case CPURegister::kNoRegister: + return list_ == 0; + default: + UNREACHABLE(); + return false; } } };