diff options
Diffstat (limited to 'JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp')
-rw-r--r-- | JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp index f625323..d88d6a9 100644 --- a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp +++ b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp @@ -141,6 +141,7 @@ static JSValue decode(ExecState* exec, const char* doNotUnescape, bool strict) bool isStrWhiteSpace(UChar c) { switch (c) { + // ECMA-262-5th 7.2 & 7.3 case 0x0009: case 0x000A: case 0x000B: @@ -150,6 +151,7 @@ bool isStrWhiteSpace(UChar c) case 0x00A0: case 0x2028: case 0x2029: + case 0xFEFF: return true; default: return c > 0xff && isSeparatorSpace(c); @@ -194,6 +196,28 @@ double parseIntOverflow(const char* s, int length, int radix) return number; } +double parseIntOverflow(const UChar* s, int length, int radix) +{ + double number = 0.0; + double radixMultiplier = 1.0; + + for (const UChar* p = s + length - 1; p >= s; p--) { + if (radixMultiplier == Inf) { + if (*p != '0') { + number = Inf; + break; + } + } else { + int digit = parseDigit(*p, radix); + number += digit * radixMultiplier; + } + + radixMultiplier *= radix; + } + + return number; +} + static double parseInt(const UString& s, int radix) { int length = s.size(); |