diff options
| author | 2018-08-02 07:58:51 +0000 | |
|---|---|---|
| committer | 2018-08-02 07:58:51 +0000 | |
| commit | 350b6a312222b9b27bfee0e72ce261a45cb60e1c (patch) | |
| tree | ca740698a94e6cdd106c52311430917ac68f16ec | |
| parent | 605339045d347074b9149c0185fe2ca7fafe470d (diff) | |
| parent | 759fea2974699e8dea2bcfbe319a932ff3654810 (diff) | |
Merge "ART: Improve IsValidMemberName"
| -rw-r--r-- | libdexfile/dex/descriptors_names.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libdexfile/dex/descriptors_names.cc b/libdexfile/dex/descriptors_names.cc index 206f7a09bb..1e8eb3349b 100644 --- a/libdexfile/dex/descriptors_names.cc +++ b/libdexfile/dex/descriptors_names.cc @@ -19,6 +19,7 @@ #include "android-base/stringprintf.h" #include "android-base/strings.h" +#include "base/macros.h" #include "dex/utf-inl.h" namespace art { @@ -162,7 +163,7 @@ std::string DescriptorToName(const char* descriptor) { } // Helper for IsValidPartOfMemberNameUtf8(), a bit vector indicating valid low ascii. -static uint32_t DEX_MEMBER_VALID_LOW_ASCII[4] = { +static constexpr uint32_t DEX_MEMBER_VALID_LOW_ASCII[4] = { 0x00000000, // 00..1f low control characters; nothing valid 0x03ff2010, // 20..3f digits and symbols; valid: '0'..'9', '$', '-' 0x87fffffe, // 40..5f uppercase etc.; valid: 'A'..'Z', '_' @@ -170,6 +171,7 @@ static uint32_t DEX_MEMBER_VALID_LOW_ASCII[4] = { }; // Helper for IsValidPartOfMemberNameUtf8(); do not call directly. +COLD_ATTR static bool IsValidPartOfMemberNameUtf8Slow(const char** pUtf8Ptr) { /* * It's a multibyte encoded character. Decode it and analyze. We @@ -244,6 +246,7 @@ static bool IsValidPartOfMemberNameUtf8Slow(const char** pUtf8Ptr) { * this function returns false, then the given pointer may only have * been partially advanced. */ +ALWAYS_INLINE static bool IsValidPartOfMemberNameUtf8(const char** pUtf8Ptr) { uint8_t c = (uint8_t) **pUtf8Ptr; if (LIKELY(c <= 0x7f)) { |