| 1 | /* |
| 2 | * Copyright (C) 1999-2002 Harri Porten ([email protected]) |
| 3 | * Copyright (C) 2001 Peter Kelly ([email protected]) |
| 4 | * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 5 | * Copyright (C) 2007 Cameron Zwarich ([email protected]) |
| 6 | * Copyright (C) 2007 Maks Orlovich |
| 7 | * |
| 8 | * This library is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU Library General Public |
| 10 | * License as published by the Free Software Foundation; either |
| 11 | * version 2 of the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This library is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * Library General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU Library General Public License |
| 19 | * along with this library; see the file COPYING.LIB. If not, write to |
| 20 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 | * Boston, MA 02110-1301, USA. |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #include "config.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/config.h`/ |
| 26 | #include "JSGlobalObjectFunctions.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.h`/ |
| 27 | |
| 28 | #include "CallFrame.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrame.h`/ |
| 29 | #include "GlobalEvalFunction.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/GlobalEvalFunction.h`/ |
| 30 | #include "Interpreter.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.h`/ |
| 31 | #include "JSGlobalObject.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.h`/ |
| 32 | #include "JSString.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSString.h`/ |
| 33 | #include "Lexer.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/parser/Lexer.h`/ |
| 34 | #include "LiteralParser.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/LiteralParser.h`/ |
| 35 | #include "Nodes.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/parser/Nodes.h`/ |
| 36 | #include "Parser.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/parser/Parser.h`/ |
| 37 | #include "StringBuilder.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringBuilder.h`/ |
| 38 | #include "StringExtras.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/StringExtras.h`/ |
| 39 | #include "dtoa.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/dtoa.h`/ |
| 40 | #include <stdio.h> |
| 41 | #include <stdlib.h> |
| 42 | #include <string.h> |
| 43 | #include <wtf/ASCIICType.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/ASCIICType.h`/ |
| 44 | #include <wtf/Assertions.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h`/ |
| 45 | #include <wtf/MathExtras.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h`/ |
| 46 | #include <wtf/unicode/UTF8.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/unicode/UTF8.h`/ |
| 47 | |
| 48 | using namespace WTFcxx . . $ `<built-in>:467:9`!; |
| 49 | using namespace Unicode; |
| 50 | |
| 51 | namespace JSCcxx . . $ `<built-in>:463:9`! { |
| 52 | |
| 53 | static JSValuecxx . . $ QTJSC/JSValue# encodecxx . . $ QTJSC/encode(84d1afc4958e7a3a).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const ArgListcxx . . $ QTJSC/ArgList#& args, const char* doNotEscape) |
| 54 | { |
| 55 | UStringcxx . . $ QTJSC/UString# str = argscxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d)..atcxx . . $ QTJSC/ArgList#at(e9dec2041b7a6b55).(0).toStringcxx . . $ QTJSC/JSValue#toString(9c94f5abb1995042).(exec); |
| 56 | CStringcxx . . $ QTJSC/CString# cstr = strcxx . . $ QTJSC/CString#CString(f113043c45ce5422)..UTF8Stringcxx . . $ QTJSC/UString#UTF8String(93ff631091aac352).(true); |
| 57 | if (!cstr.c_strcxx . . $ QTJSC/CString#c_str(a9f41ea0e82d88cf).()) |
| 58 | return throwErrorcxx . . $ QTJSC/throwError(c8108d54e75f502b).(exec, URIErrorcxx . . $ QTJSC/URIError., "String contained an illegal UTF-16 sequence."); |
| 59 | |
| 60 | StringBuildercxx . . $ QTJSC/StringBuilder# builder; |
| 61 | const char* p = cstr.c_strcxx . . $ QTJSC/CString#c_str(a9f41ea0e82d88cf).(); |
| 62 | for (size_t k = 0; k < cstr.sizecxx . . $ QTJSC/CString#size(fe4d2d262d4164a8).(); k++, p++) { |
| 63 | char c = *p; |
| 64 | if (c && strchr(doNotEscape, c)) |
| 65 | builder.appendcxx . . $ QTJSC/StringBuilder#append(ed53e3bbd3fa2f69).(c); |
| 66 | else { |
| 67 | char tmp[4]; |
| 68 | snprintf(tmp, 4, "%%%02X", static_cast<unsigned char>(c)); |
| 69 | builder.appendcxx . . $ QTJSC/StringBuilder#append(85c52e162fed56f9).((const char*)tmp); |
| 70 | } |
| 71 | } |
| 72 | return jsStringcxx . . $ QTJSC/jsString(edccc873576bddf5).(exec, builder.releasecxx . . $ QTJSC/StringBuilder#release(efe381e3afb22e2c).()); |
| 73 | } |
| 74 | |
| 75 | static JSValuecxx . . $ QTJSC/JSValue# decodecxx . . $ QTJSC/decode(9e218a8f256e8ebd).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const ArgListcxx . . $ QTJSC/ArgList#& args, const char* doNotUnescape, bool strict) |
| 76 | { |
| 77 | StringBuildercxx . . $ QTJSC/StringBuilder# builder; |
| 78 | UStringcxx . . $ QTJSC/UString# str = argscxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d)..atcxx . . $ QTJSC/ArgList#at(e9dec2041b7a6b55).(0).toStringcxx . . $ QTJSC/JSValue#toString(9c94f5abb1995042).(exec); |
| 79 | int k = 0; |
| 80 | int len = str.sizecxx . . $ QTJSC/UString#size(455f465bc33b4cdf).(); |
| 81 | const UCharcxx . . $ UChar#* d = str.datacxx . . $ QTJSC/UString#data(9865edf6270d80f8).(); |
| 82 | UCharcxx . . $ UChar# u = 0; |
| 83 | while (k < len) { |
| 84 | const UCharcxx . . $ UChar#* p = d + k; |
| 85 | UCharcxx . . $ UChar# c = *p; |
| 86 | if (c == '%') { |
| 87 | int charLen = 0; |
| 88 | if (k <= len - 3 && isASCIIHexDigitcxx . . $ isASCIIHexDigit(3c978dac0e5ee2ad).(p[1]) && isASCIIHexDigitcxx . . $ isASCIIHexDigit(3c978dac0e5ee2ad).(p[2])) { |
| 89 | const char b0 = Lexercxx . . $ QTJSC/Lexer#::convertHexcxx . . $ QTJSC/Lexer#convertHex(9b283c7f02910f2b).(p[1], p[2]); |
| 90 | const int sequenceLen = UTF8SequenceLengthcxx . . $ QTWTF/Unicode/UTF8SequenceLength(784f3405e7e545be).(b0); |
| 91 | if (sequenceLen != 0 && k <= len - sequenceLen * 3) { |
| 92 | charLen = sequenceLen * 3; |
| 93 | char sequence[5]; |
| 94 | sequence[0] = b0; |
| 95 | for (int i = 1; i < sequenceLen; ++i) { |
| 96 | const UCharcxx . . $ UChar#* q = p + i * 3; |
| 97 | if (q[0] == '%' && isASCIIHexDigitcxx . . $ isASCIIHexDigit(3c978dac0e5ee2ad).(q[1]) && isASCIIHexDigitcxx . . $ isASCIIHexDigit(3c978dac0e5ee2ad).(q[2])) |
| 98 | sequence[i] = Lexercxx . . $ QTJSC/Lexer#::convertHexcxx . . $ QTJSC/Lexer#convertHex(9b283c7f02910f2b).(q[1], q[2]); |
| 99 | else { |
| 100 | charLen = 0; |
| 101 | break; |
| 102 | } |
| 103 | } |
| 104 | if (charLen != 0) { |
| 105 | sequence[sequenceLen] = 0; |
| 106 | const int character = decodeUTF8Sequencecxx . . $ QTWTF/Unicode/decodeUTF8Sequence(5c4306d8553b3696).(sequence); |
| 107 | if (character < 0 || character >= 0x110000) |
| 108 | charLen = 0; |
| 109 | else if (character >= 0x10000) { |
| 110 | // Convert to surrogate pair. |
| 111 | builder.appendcxx . . $ QTJSC/StringBuilder#append(ed53e3bbd3fa2f69).(static_cast<UCharcxx . . $ UChar#>(0xD800 | ((character - 0x10000) >> 10))); |
| 112 | u = static_cast<UCharcxx . . $ UChar#>(0xDC00 | ((character - 0x10000) & 0x3FF)); |
| 113 | } else |
| 114 | u = static_cast<UCharcxx . . $ UChar#>(character); |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | if (charLen == 0) { |
| 119 | if (strict) |
| 120 | return throwErrorcxx . . $ QTJSC/throwError(47e9c750a9fd8762).(exec, URIErrorcxx . . $ QTJSC/URIError.); |
| 121 | // The only case where we don't use "strict" mode is the "unescape" function. |
| 122 | // For that, it's good to support the wonky "%u" syntax for compatibility with WinIE. |
| 123 | if (k <= len - 6 && p[1] == 'u' |
| 124 | && isASCIIHexDigitcxx . . $ isASCIIHexDigit(3c978dac0e5ee2ad).(p[2]) && isASCIIHexDigitcxx . . $ isASCIIHexDigit(3c978dac0e5ee2ad).(p[3]) |
| 125 | && isASCIIHexDigitcxx . . $ isASCIIHexDigit(3c978dac0e5ee2ad).(p[4]) && isASCIIHexDigitcxx . . $ isASCIIHexDigit(3c978dac0e5ee2ad).(p[5])) { |
| 126 | charLen = 6; |
| 127 | u = Lexercxx . . $ QTJSC/Lexer#::convertUnicodecxx . . $ QTJSC/Lexer#convertUnicode(9201b605cda5d4e5).(p[2], p[3], p[4], p[5]); |
| 128 | } |
| 129 | } |
| 130 | if (charLen && (u == 0 || u >= 128 || !strchr(doNotUnescape, u))) { |
| 131 | c = u; |
| 132 | k += charLen - 1; |
| 133 | } |
| 134 | } |
| 135 | k++; |
| 136 | builder.appendcxx . . $ QTJSC/StringBuilder#append(ed53e3bbd3fa2f69).(c); |
| 137 | } |
| 138 | return jsStringcxx . . $ QTJSC/jsString(edccc873576bddf5).(exec, builder.releasecxx . . $ QTJSC/StringBuilder#release(efe381e3afb22e2c).()); |
| 139 | } |
| 140 | |
| 141 | bool isStrWhiteSpacecxx . . $ QTJSC/isStrWhiteSpace(3c978dac0e5ee2ad).(UCharcxx . . $ UChar# c) |
| 142 | { |
| 143 | switch (c) { |
| 144 | case 0x0009: |
| 145 | case 0x000A: |
| 146 | case 0x000B: |
| 147 | case 0x000C: |
| 148 | case 0x000D: |
| 149 | case 0x0020: |
| 150 | case 0x00A0: |
| 151 | case 0x2028: |
| 152 | case 0x2029: |
| 153 | return true; |
| 154 | default: |
| 155 | return c > 0xff && isSeparatorSpacecxx . . $ QTWTF/Unicode/isSeparatorSpace(83c267b20bac841a).(c); |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | static int parseDigitcxx . . $ QTJSC/parseDigit(3727f65dc41d151e).(unsigned short c, int radix) |
| 160 | { |
| 161 | int digit = -1; |
| 162 | |
| 163 | if (c >= '0' && c <= '9') |
| 164 | digit = c - '0'; |
| 165 | else if (c >= 'A' && c <= 'Z') |
| 166 | digit = c - 'A' + 10; |
| 167 | else if (c >= 'a' && c <= 'z') |
| 168 | digit = c - 'a' + 10; |
| 169 | |
| 170 | if (digit >= radix) |
| 171 | return -1; |
| 172 | return digit; |
| 173 | } |
| 174 | |
| 175 | double parseIntOverflowcxx . . $ QTJSC/parseIntOverflow(aac88a90e076343c).(const char* s, int length, int radix) |
| 176 | { |
| 177 | double number = 0.0; |
| 178 | double radixMultiplier = 1.0; |
| 179 | |
| 180 | for (const char* p = s + length - 1; p >= s; p--) { |
| 181 | if (radixMultiplier == Infcxx . . $ QTJSC/Inf.) { |
| 182 | if (*p != '0') { |
| 183 | number = Infcxx . . $ QTJSC/Inf.; |
| 184 | break; |
| 185 | } |
| 186 | } else { |
| 187 | int digit = parseDigitcxx . . $ QTJSC/parseDigit(3727f65dc41d151e).(*p, radix); |
| 188 | number += digit * radixMultiplier; |
| 189 | } |
| 190 | |
| 191 | radixMultiplier *= radix; |
| 192 | } |
| 193 | |
| 194 | return number; |
| 195 | } |
| 196 | |
| 197 | static double parseIntcxx . . $ QTJSC/parseInt(31b2aed183f4d4d0).(const UStringcxx . . $ QTJSC/UString#& s, int radix) |
| 198 | { |
| 199 | int length = s.sizecxx . . $ QTJSC/UString#size(455f465bc33b4cdf).(); |
| 200 | const UCharcxx . . $ UChar#* data = s.datacxx . . $ QTJSC/UString#data(9865edf6270d80f8).(); |
| 201 | int p = 0; |
| 202 | |
| 203 | while (p < length && isStrWhiteSpacecxx . . $ QTJSC/isStrWhiteSpace(3c978dac0e5ee2ad).(data[p])) |
| 204 | ++p; |
| 205 | |
| 206 | double sign = 1; |
| 207 | if (p < length) { |
| 208 | if (data[p] == '+') |
| 209 | ++p; |
| 210 | else if (data[p] == '-') { |
| 211 | sign = -1; |
| 212 | ++p; |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | if ((radix == 0 || radix == 16) && length - p >= 2 && data[p] == '0' && (data[p + 1] == 'x' || data[p + 1] == 'X')) { |
| 217 | radix = 16; |
| 218 | p += 2; |
| 219 | } else if (radix == 0) { |
| 220 | if (p < length && data[p] == '0') |
| 221 | radix = 8; |
| 222 | else |
| 223 | radix = 10; |
| 224 | } |
| 225 | |
| 226 | if (radix < 2 || radix > 36) |
| 227 | return NaNcxx . . $ QTJSC/NaN.; |
| 228 | |
| 229 | int firstDigitPosition = p; |
| 230 | bool sawDigit = false; |
| 231 | double number = 0; |
| 232 | while (p < length) { |
| 233 | int digit = parseDigitcxx . . $ QTJSC/parseDigit(3727f65dc41d151e).(data[p], radix); |
| 234 | if (digit == -1) |
| 235 | break; |
| 236 | sawDigit = true; |
| 237 | number *= radix; |
| 238 | number += digit; |
| 239 | ++p; |
| 240 | } |
| 241 | |
| 242 | if (number >= mantissaOverflowLowerBoundcxx . . $ QTJSC/mantissaOverflowLowerBound.) { |
| 243 | if (radix == 10) |
| 244 | number = WTFcxx . . $ `<built-in>:467:9`!::strtodcxx . . $ QTWTF/strtod(3dfe5620a0d3160e).(s.substrcxx . . $ QTJSC/UString#substr(2aae7669e5263855).(firstDigitPosition, p - firstDigitPosition).asciicxx . . $ QTJSC/UString#ascii(e7e5aa338b9d5147).(), 0); |
| 245 | else if (radix == 2 || radix == 4 || radix == 8 || radix == 16 || radix == 32) |
| 246 | number = parseIntOverflowcxx . . $ QTJSC/parseIntOverflow(aac88a90e076343c).(s.substrcxx . . $ QTJSC/UString#substr(2aae7669e5263855).(firstDigitPosition, p - firstDigitPosition).asciicxx . . $ QTJSC/UString#ascii(e7e5aa338b9d5147).(), p - firstDigitPosition, radix); |
| 247 | } |
| 248 | |
| 249 | if (!sawDigit) |
| 250 | return NaNcxx . . $ QTJSC/NaN.; |
| 251 | |
| 252 | return sign * number; |
| 253 | } |
| 254 | |
| 255 | static double parseFloatcxx . . $ QTJSC/parseFloat(d5cf7e585ce90ae8).(const UStringcxx . . $ QTJSC/UString#& s) |
| 256 | { |
| 257 | // Check for 0x prefix here, because toDouble allows it, but we must treat it as 0. |
| 258 | // Need to skip any whitespace and then one + or - sign. |
| 259 | int length = s.sizecxx . . $ QTJSC/UString#size(455f465bc33b4cdf).(); |
| 260 | const UCharcxx . . $ UChar#* data = s.datacxx . . $ QTJSC/UString#data(9865edf6270d80f8).(); |
| 261 | int p = 0; |
| 262 | while (p < length && isStrWhiteSpacecxx . . $ QTJSC/isStrWhiteSpace(3c978dac0e5ee2ad).(data[p])) |
| 263 | ++p; |
| 264 | |
| 265 | if (p < length && (data[p] == '+' || data[p] == '-')) |
| 266 | ++p; |
| 267 | |
| 268 | if (length - p >= 2 && data[p] == '0' && (data[p + 1] == 'x' || data[p + 1] == 'X')) |
| 269 | return 0; |
| 270 | |
| 271 | return s.toDoublecxx . . $ QTJSC/UString#toDouble(b2da4fe40e23cdf4).(true /*tolerant*/, false /* NaN for empty string */); |
| 272 | } |
| 273 | |
| 274 | JSValuecxx . . $ QTJSC/JSValue# JSC_HOST_CALLcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:1060:9`! globalFuncEvalcxx . . $ QTJSC/globalFuncEval(cac2aec6ecb9506b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSObjectcxx . . $ QTJSC/JSObject#* function, JSValuecxx . . $ QTJSC/JSValue# thisValue, const ArgListcxx . . $ QTJSC/ArgList#& args) |
| 275 | { |
| 276 | JSObjectcxx . . $ QTJSC/JSObject#* thisObject = thisValue.toThisObjectcxx . . $ QTJSC/JSValue#toThisObject(8709ed4849a165ab).(exec); |
| 277 | JSObjectcxx . . $ QTJSC/JSObject#* unwrappedObject = thisObject->unwrappedObjectcxx . . $ QTJSC/JSObject#unwrappedObject(2eaa870b9a6c25e1).(); |
| 278 | if (!unwrappedObject->isGlobalObject() || static_cast<JSGlobalObject*>(unwrappedObject)->evalFunction() != function) |
| 279 | return throwErrorcxx . . $ QTJSC/throwError(c8108d54e75f502b).(exec, EvalErrorcxx . . $ QTJSC/EvalError., "The \"this\" value passed to eval must be the global object from which eval originated"); |
| 280 | |
| 281 | JSValuecxx . . $ QTJSC/JSValue# x = args.atcxx . . $ QTJSC/ArgList#at(e9dec2041b7a6b55).(0); |
| 282 | if (!x.isStringcxx . . $ QTJSC/JSValue#isString(50ce9a9e25b4a850).()) |
| 283 | return x; |
| 284 | |
| 285 | UStringcxx . . $ QTJSC/UString# s = xcxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d)..toStringcxx . . $ QTJSC/JSValue#toString(9c94f5abb1995042).(exec); |
| 286 | |
| 287 | LiteralParsercxx . . $ QTJSC/LiteralParser# preparsercxx . . $ QTJSC/LiteralParser#LiteralParser(6152e55db68c6).(exec, s, LiteralParsercxx . . $ QTJSC/LiteralParser#::NonStrictJSONcxx . . $ QTJSC/LiteralParser#NonStrictJSON.); |
| 288 | if (JSValuecxx . . $ QTJSC/JSValue# parsedObject = preparser.tryLiteralParsecxx . . $ QTJSC/LiteralParser#tryLiteralParse(ad9afe69d7bf6378).()) |
| 289 | return parsedObject; |
| 290 | |
| 291 | RefPtrcxx . . $ RefPtr#<EvalExecutablecxx . . $ QTJSC/EvalExecutable#> eval = EvalExecutable::create(exec, makeSource(s)); |
| 292 | JSObjectcxx . . $ QTJSC/JSObject#* error = eval->compile(exec, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node()); |
| 293 | if (error) |
| 294 | return throwErrorcxx . . $ QTJSC/throwError(83c597cc1bc7c78b).(exec, error); |
| 295 | |
| 296 | return exec->interpretercxx . . $ QTJSC/ExecState#interpreter(6574b75232d5177f).()->executecxx . . $ QTJSC/Interpreter#execute(7ce193c050309b77).(eval.get(), exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlotcxx . . $ QTJSC/ExecState#exceptionSlot(6880e523701d9eaa).()); |
| 297 | } |
| 298 | |
| 299 | JSValuecxx . . $ QTJSC/JSValue# JSC_HOST_CALLcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:1060:9`! globalFuncParseIntcxx . . $ QTJSC/globalFuncParseInt(cac2aec6ecb9506b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSObjectcxx . . $ QTJSC/JSObject#*, JSValuecxx . . $ QTJSC/JSValue#, const ArgListcxx . . $ QTJSC/ArgList#& args) |
| 300 | { |
| 301 | JSValuecxx . . $ QTJSC/JSValue# value = args.atcxx . . $ QTJSC/ArgList#at(e9dec2041b7a6b55).(0); |
| 302 | int32_tcxx . . $ int32_t# radix = args.atcxx . . $ QTJSC/ArgList#at(e9dec2041b7a6b55).(1).toInt32cxx . . $ QTJSC/JSValue#toInt32(895d7d37bda6b54c).(exec); |
| 303 | |
| 304 | if (radix != 0 && radix != 10) |
| 305 | return jsNumbercxx . . $ QTJSC/jsNumber(88e66938454912cb).(exec, parseIntcxx . . $ QTJSC/parseInt(31b2aed183f4d4d0).(value.toStringcxx . . $ QTJSC/JSValue#toString(9c94f5abb1995042).(exec), radix)); |
| 306 | |
| 307 | if (value.isInt32cxx . . $ QTJSC/JSValue#isInt32(50ce9a9e25b4a850).()) |
| 308 | return value; |
| 309 | |
| 310 | if (value.isDoublecxx . . $ QTJSC/JSValue#isDouble(50ce9a9e25b4a850).()) { |
| 311 | double d = value.asDoublecxx . . $ QTJSC/JSValue#asDouble(21b6c25e127938e2).(); |
| 312 | if (std::isfinite(d)) |
| 313 | return jsNumbercxx . . $ QTJSC/jsNumber(88e66938454912cb).(exec, (d > 0) ? floorcxx . . $ floor(447c67c6676f75c3).(d) : ceilcxx . . $ ceil(447c67c6676f75c3).(d)); |
| 314 | if (std::isnan(d) || std::isinf(d)) |
| 315 | return jsNaNcxx . . $ QTJSC/jsNaN(3fbe51058e39576a).(exec); |
| 316 | return jsNumbercxx . . $ QTJSC/jsNumber(1201607e1a2ad33d).(exec, 0); |
| 317 | } |
| 318 | |
| 319 | return jsNumbercxx . . $ QTJSC/jsNumber(88e66938454912cb).(exec, parseIntcxx . . $ QTJSC/parseInt(31b2aed183f4d4d0).(value.toStringcxx . . $ QTJSC/JSValue#toString(9c94f5abb1995042).(exec), radix)); |
| 320 | } |
| 321 | |
| 322 | JSValuecxx . . $ QTJSC/JSValue# JSC_HOST_CALLcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:1060:9`! globalFuncParseFloatcxx . . $ QTJSC/globalFuncParseFloat(cac2aec6ecb9506b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSObjectcxx . . $ QTJSC/JSObject#*, JSValuecxx . . $ QTJSC/JSValue#, const ArgListcxx . . $ QTJSC/ArgList#& args) |
| 323 | { |
| 324 | return jsNumbercxx . . $ QTJSC/jsNumber(88e66938454912cb).(exec, parseFloatcxx . . $ QTJSC/parseFloat(d5cf7e585ce90ae8).(args.atcxx . . $ QTJSC/ArgList#at(e9dec2041b7a6b55).(0).toStringcxx . . $ QTJSC/JSValue#toString(9c94f5abb1995042).(exec))); |
| 325 | } |
| 326 | |
| 327 | JSValuecxx . . $ QTJSC/JSValue# JSC_HOST_CALLcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:1060:9`! globalFuncIsNaNcxx . . $ QTJSC/globalFuncIsNaN(cac2aec6ecb9506b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSObjectcxx . . $ QTJSC/JSObject#*, JSValuecxx . . $ QTJSC/JSValue#, const ArgListcxx . . $ QTJSC/ArgList#& args) |
| 328 | { |
| 329 | return jsBooleancxx . . $ QTJSC/jsBoolean(b805946c4147dfe1).(std::isnan(args.atcxx . . $ QTJSC/ArgList#at(e9dec2041b7a6b55).(0).toNumbercxx . . $ QTJSC/JSValue#toNumber(1fd034e372fd1279).(exec))); |
| 330 | } |
| 331 | |
| 332 | JSValuecxx . . $ QTJSC/JSValue# JSC_HOST_CALLcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:1060:9`! globalFuncIsFinitecxx . . $ QTJSC/globalFuncIsFinite(cac2aec6ecb9506b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSObjectcxx . . $ QTJSC/JSObject#*, JSValuecxx . . $ QTJSC/JSValue#, const ArgListcxx . . $ QTJSC/ArgList#& args) |
| 333 | { |
| 334 | double n = args.atcxx . . $ QTJSC/ArgList#at(e9dec2041b7a6b55).(0).toNumbercxx . . $ QTJSC/JSValue#toNumber(1fd034e372fd1279).(exec); |
| 335 | return jsBooleancxx . . $ QTJSC/jsBoolean(b805946c4147dfe1).(!std::isnan(n) && !std::isinf(n)); |
| 336 | } |
| 337 | |
| 338 | JSValuecxx . . $ QTJSC/JSValue# JSC_HOST_CALLcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:1060:9`! globalFuncDecodeURIcxx . . $ QTJSC/globalFuncDecodeURI(cac2aec6ecb9506b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSObjectcxx . . $ QTJSC/JSObject#*, JSValuecxx . . $ QTJSC/JSValue#, const ArgListcxx . . $ QTJSC/ArgList#& args) |
| 339 | { |
| 340 | static const char do_not_unescape_when_decoding_URI[] = |
| 341 | "#$&+,/:;=?@"; |
| 342 | |
| 343 | return decodecxx . . $ QTJSC/decode(9e218a8f256e8ebd).(exec, args, do_not_unescape_when_decoding_URI, true); |
| 344 | } |
| 345 | |
| 346 | JSValuecxx . . $ QTJSC/JSValue# JSC_HOST_CALLcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:1060:9`! globalFuncDecodeURIComponentcxx . . $ QTJSC/globalFuncDecodeURIComponent(cac2aec6ecb9506b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSObjectcxx . . $ QTJSC/JSObject#*, JSValuecxx . . $ QTJSC/JSValue#, const ArgListcxx . . $ QTJSC/ArgList#& args) |
| 347 | { |
| 348 | return decodecxx . . $ QTJSC/decode(9e218a8f256e8ebd).(exec, args, "", true); |
| 349 | } |
| 350 | |
| 351 | JSValuecxx . . $ QTJSC/JSValue# JSC_HOST_CALLcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:1060:9`! globalFuncEncodeURIcxx . . $ QTJSC/globalFuncEncodeURI(cac2aec6ecb9506b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSObjectcxx . . $ QTJSC/JSObject#*, JSValuecxx . . $ QTJSC/JSValue#, const ArgListcxx . . $ QTJSC/ArgList#& args) |
| 352 | { |
| 353 | static const char do_not_escape_when_encoding_URI[] = |
| 354 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 355 | "abcdefghijklmnopqrstuvwxyz" |
| 356 | "0123456789" |
| 357 | "!#$&'()*+,-./:;=?@_~"; |
| 358 | |
| 359 | return encodecxx . . $ QTJSC/encode(84d1afc4958e7a3a).(exec, args, do_not_escape_when_encoding_URI); |
| 360 | } |
| 361 | |
| 362 | JSValuecxx . . $ QTJSC/JSValue# JSC_HOST_CALLcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:1060:9`! globalFuncEncodeURIComponentcxx . . $ QTJSC/globalFuncEncodeURIComponent(cac2aec6ecb9506b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSObjectcxx . . $ QTJSC/JSObject#*, JSValuecxx . . $ QTJSC/JSValue#, const ArgListcxx . . $ QTJSC/ArgList#& args) |
| 363 | { |
| 364 | static const char do_not_escape_when_encoding_URI_component[] = |
| 365 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 366 | "abcdefghijklmnopqrstuvwxyz" |
| 367 | "0123456789" |
| 368 | "!'()*-._~"; |
| 369 | |
| 370 | return encodecxx . . $ QTJSC/encode(84d1afc4958e7a3a).(exec, args, do_not_escape_when_encoding_URI_component); |
| 371 | } |
| 372 | |
| 373 | JSValuecxx . . $ QTJSC/JSValue# JSC_HOST_CALLcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:1060:9`! globalFuncEscapecxx . . $ QTJSC/globalFuncEscape(cac2aec6ecb9506b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSObjectcxx . . $ QTJSC/JSObject#*, JSValuecxx . . $ QTJSC/JSValue#, const ArgListcxx . . $ QTJSC/ArgList#& args) |
| 374 | { |
| 375 | static const char do_not_escape[] = |
| 376 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 377 | "abcdefghijklmnopqrstuvwxyz" |
| 378 | "0123456789" |
| 379 | "*+-./@_"; |
| 380 | |
| 381 | StringBuildercxx . . $ QTJSC/StringBuilder# builder; |
| 382 | UStringcxx . . $ QTJSC/UString# scxx . . $ QTJSC/UString#UString(49f6e7a06ebc5aa8).; |
| 383 | UStringcxx . . $ QTJSC/UString# str = argscxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d)..atcxx . . $ QTJSC/ArgList#at(e9dec2041b7a6b55).(0).toStringcxx . . $ QTJSC/JSValue#toString(9c94f5abb1995042).(exec); |
| 384 | const UCharcxx . . $ UChar#* c = str.datacxx . . $ QTJSC/UString#data(9865edf6270d80f8).(); |
| 385 | for (int k = 0; k < str.sizecxx . . $ QTJSC/UString#size(455f465bc33b4cdf).(); k++, c++) { |
| 386 | int u = c[0]; |
| 387 | if (u > 255) { |
| 388 | char tmp[7]; |
| 389 | sprintf(tmp, "%%u%04X", u); |
| 390 | s = UStringcxx . . $ QTJSC/UString#UString(85c52e162fed56f9).(tmp); |
| 391 | } else if (u != 0 && strchr(do_not_escape, static_cast<char>(u))) |
| 392 | s = UStringcxx . . $ QTJSC/UString#UString(280060e335061cbc).(c, 1); |
| 393 | else { |
| 394 | char tmp[4]; |
| 395 | sprintf(tmp, "%%%02X", u); |
| 396 | s = UStringcxx . . $ QTJSC/UString#UString(85c52e162fed56f9).(tmp); |
| 397 | } |
| 398 | builder.appendcxx . . $ QTJSC/StringBuilder#append(e6bad6cb9b63b14d).(s); |
| 399 | } |
| 400 | |
| 401 | return jsStringcxx . . $ QTJSC/jsString(edccc873576bddf5).(exec, builder.releasecxx . . $ QTJSC/StringBuilder#release(efe381e3afb22e2c).()); |
| 402 | } |
| 403 | |
| 404 | JSValuecxx . . $ QTJSC/JSValue# JSC_HOST_CALLcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:1060:9`! globalFuncUnescapecxx . . $ QTJSC/globalFuncUnescape(cac2aec6ecb9506b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSObjectcxx . . $ QTJSC/JSObject#*, JSValuecxx . . $ QTJSC/JSValue#, const ArgListcxx . . $ QTJSC/ArgList#& args) |
| 405 | { |
| 406 | StringBuildercxx . . $ QTJSC/StringBuilder# builder; |
| 407 | UStringcxx . . $ QTJSC/UString# str = argscxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d)..atcxx . . $ QTJSC/ArgList#at(e9dec2041b7a6b55).(0).toStringcxx . . $ QTJSC/JSValue#toString(9c94f5abb1995042).(exec); |
| 408 | int k = 0; |
| 409 | int len = str.sizecxx . . $ QTJSC/UString#size(455f465bc33b4cdf).(); |
| 410 | while (k < len) { |
| 411 | const UCharcxx . . $ UChar#* c = str.datacxx . . $ QTJSC/UString#data(9865edf6270d80f8).() + k; |
| 412 | UCharcxx . . $ UChar# u; |
| 413 | if (c[0] == '%' && k <= len - 6 && c[1] == 'u') { |
| 414 | if (isASCIIHexDigitcxx . . $ isASCIIHexDigit(3c978dac0e5ee2ad).(c[2]) && isASCIIHexDigitcxx . . $ isASCIIHexDigit(3c978dac0e5ee2ad).(c[3]) && isASCIIHexDigitcxx . . $ isASCIIHexDigit(3c978dac0e5ee2ad).(c[4]) && isASCIIHexDigitcxx . . $ isASCIIHexDigit(3c978dac0e5ee2ad).(c[5])) { |
| 415 | u = Lexercxx . . $ QTJSC/Lexer#::convertUnicodecxx . . $ QTJSC/Lexer#convertUnicode(9201b605cda5d4e5).(c[2], c[3], c[4], c[5]); |
| 416 | c = &u; |
| 417 | k += 5; |
| 418 | } |
| 419 | } else if (c[0] == '%' && k <= len - 3 && isASCIIHexDigitcxx . . $ isASCIIHexDigit(3c978dac0e5ee2ad).(c[1]) && isASCIIHexDigitcxx . . $ isASCIIHexDigit(3c978dac0e5ee2ad).(c[2])) { |
| 420 | u = UCharcxx . . $ UChar#(Lexercxx . . $ QTJSC/Lexer#::convertHexcxx . . $ QTJSC/Lexer#convertHex(9b283c7f02910f2b).(c[1], c[2])); |
| 421 | c = &u; |
| 422 | k += 2; |
| 423 | } |
| 424 | k++; |
| 425 | builder.appendcxx . . $ QTJSC/StringBuilder#append(ed53e3bbd3fa2f69).(*c); |
| 426 | } |
| 427 | |
| 428 | return jsStringcxx . . $ QTJSC/jsString(edccc873576bddf5).(exec, builder.releasecxx . . $ QTJSC/StringBuilder#release(efe381e3afb22e2c).()); |
| 429 | } |
| 430 | |
| 431 | #ifndef NDEBUGcxx . . $ `<built-in>:472:9`! |
| 432 | JSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState* exec, JSObject*, JSValue, const ArgList& args) |
| 433 | { |
| 434 | CStringBuffer string; |
| 435 | args.at(0).toString(exec).getCString(string); |
| 436 | puts(string.data()); |
| 437 | return jsUndefined(); |
| 438 | } |
| 439 | #endif |
| 440 | |
| 441 | } // namespace JSC |