summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/Identifier.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-18 14:03:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-18 14:03:11 +0200
commit8d473cf9743f1d30a16a27114e93bd5af5648d23 (patch)
treecdca40d0353886b3ca52f33a2d7b8f1c0011aafc /Source/JavaScriptCore/runtime/Identifier.cpp
parent1b914638db989aaa98631a1c1e02c7b2d44805d8 (diff)
downloadqtwebkit-8d473cf9743f1d30a16a27114e93bd5af5648d23.tar.gz
Imported WebKit commit 1350e72f7345ced9da2bd9980deeeb5a8d62fab4 (http://svn.webkit.org/repository/webkit/trunk@117578)
Weekly snapshot
Diffstat (limited to 'Source/JavaScriptCore/runtime/Identifier.cpp')
-rw-r--r--Source/JavaScriptCore/runtime/Identifier.cpp50
1 files changed, 0 insertions, 50 deletions
diff --git a/Source/JavaScriptCore/runtime/Identifier.cpp b/Source/JavaScriptCore/runtime/Identifier.cpp
index 182bcc462..20770928c 100644
--- a/Source/JavaScriptCore/runtime/Identifier.cpp
+++ b/Source/JavaScriptCore/runtime/Identifier.cpp
@@ -145,56 +145,6 @@ PassRefPtr<StringImpl> Identifier::add8(JSGlobalData* globalData, const UChar* s
return addResult.isNewEntry ? adoptRef(*addResult.iterator) : *addResult.iterator;
}
-template <typename CharType>
-ALWAYS_INLINE uint32_t Identifier::toUInt32FromCharacters(const CharType* characters, unsigned length, bool& ok)
-{
- // Get the first character, turning it into a digit.
- uint32_t value = characters[0] - '0';
- if (value > 9)
- return 0;
-
- // Check for leading zeros. If the first characher is 0, then the
- // length of the string must be one - e.g. "042" is not equal to "42".
- if (!value && length > 1)
- return 0;
-
- while (--length) {
- // Multiply value by 10, checking for overflow out of 32 bits.
- if (value > 0xFFFFFFFFU / 10)
- return 0;
- value *= 10;
-
- // Get the next character, turning it into a digit.
- uint32_t newValue = *(++characters) - '0';
- if (newValue > 9)
- return 0;
-
- // Add in the old value, checking for overflow out of 32 bits.
- newValue += value;
- if (newValue < value)
- return 0;
- value = newValue;
- }
-
- ok = true;
- return value;
-}
-
-uint32_t Identifier::toUInt32(const UString& string, bool& ok)
-{
- ok = false;
-
- unsigned length = string.length();
-
- // An empty string is not a number.
- if (!length)
- return 0;
-
- if (string.is8Bit())
- return toUInt32FromCharacters(string.characters8(), length, ok);
- return toUInt32FromCharacters(string.characters16(), length, ok);
-}
-
PassRefPtr<StringImpl> Identifier::addSlowCase(JSGlobalData* globalData, StringImpl* r)
{
ASSERT(!r->isIdentifier());