Diff
Modified: trunk/Source/WebCore/ChangeLog (200555 => 200556)
--- trunk/Source/WebCore/ChangeLog 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/ChangeLog 2016-05-08 18:29:04 UTC (rev 200556)
@@ -1,3 +1,77 @@
+2016-05-08 Chris Dumez <[email protected]>
+
+ [Bindings] Add convert<>() template specializations for integer types
+ https://bugs.webkit.org/show_bug.cgi?id=157458
+
+ Reviewed by Darin Adler.
+
+ Add convert<>() template specializations for integer types and use them
+ in the JS bindings. Also, treat non-32bit types the same way as the
+ 32bit ones, allowing the compiler to optimize out branching based on
+ the IntegerConversionConfiguration.
+
+ * bindings/js/JSCryptoAlgorithmDictionary.cpp:
+
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::enforceRange):
+ (WebCore::toSmallerInt):
+ (WebCore::toSmallerUInt):
+ (WebCore::toInt8EnforceRange):
+ (WebCore::toUInt8EnforceRange):
+ (WebCore::toInt8Clamp):
+ (WebCore::toUInt8Clamp):
+ (WebCore::toInt8):
+ (WebCore::toUInt8):
+ (WebCore::toInt16EnforceRange):
+ (WebCore::toUInt16EnforceRange):
+ (WebCore::toInt16Clamp):
+ (WebCore::toUInt16Clamp):
+ (WebCore::toInt16):
+ (WebCore::toUInt16):
+ (WebCore::toInt32EnforceRange):
+ (WebCore::toInt32Clamp):
+ (WebCore::toUInt32Clamp):
+ (WebCore::toUInt32EnforceRange):
+ (WebCore::toInt64EnforceRange):
+ (WebCore::toUInt64EnforceRange):
+ (WebCore::toInt64Clamp):
+ (WebCore::toUInt64Clamp):
+ (WebCore::toInt64):
+ (WebCore::toUInt64):
+ * bindings/js/JSDOMBinding.h:
+ - Splt some integer conversion functions into 3 Normal / Clamp /
+ Enforce versions, similarly to what was done for 32bit types already.
+ This is so that these can be called from the inline functions in
+ JSDOMConvert.h, allowing the compiler to optimize out the branches.
+ - Get rid of some unnecessary state.hadException() checks.
+
+ * bindings/js/JSDOMConvert.h:
+ Add convert<> specializations for integer types.
+
+ * bindings/js/JSNodeFilterCustom.cpp:
+ (WebCore::JSNodeFilter::acceptNode):
+
+ * bindings/scripts/CodeGenerator.pm:
+ - Add utility function to distinguish integer types.
+ - Have IsNumericType() using the integerType / floatingPointType
+ hashes to avoid duplication.
+ - Stop int / unsigned int from integer types as those are not
+ in Web IDL and they are not used.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GetIntegerConversionType):
+ (JSValueToNative):
+ Use convert<>() for converting JSValue to integer types.
+
+ * bindings/scripts/IDLParser.pm:
+ Stop allowing int / unsigned int types as those are not in Web IDL.
+
+ * bindings/scripts/test/JS/JSTestEventTarget.cpp:
+ * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+ Rebaseline bindings tests.
+
2016-05-08 Darin Adler <[email protected]>
Correct dictionary bindings handling of optional, null, and undefined
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp (200555 => 200556)
--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp 2016-05-08 18:29:04 UTC (rev 200556)
@@ -76,7 +76,7 @@
{
}
-RefPtr<IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext& context, const String& name, Optional<unsigned long long> version, ExceptionCodeWithMessage& ec)
+RefPtr<IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext& context, const String& name, Optional<uint64_t> version, ExceptionCodeWithMessage& ec)
{
LOG(IndexedDB, "IDBFactory::open");
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h (200555 => 200556)
--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h 2016-05-08 18:29:04 UTC (rev 200556)
@@ -56,7 +56,7 @@
static Ref<IDBFactory> create(IDBClient::IDBConnectionProxy&);
~IDBFactory();
- RefPtr<IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, Optional<unsigned long long> version, ExceptionCodeWithMessage&);
+ RefPtr<IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, Optional<uint64_t> version, ExceptionCodeWithMessage&);
RefPtr<IDBOpenDBRequest> deleteDatabase(ScriptExecutionContext&, const String& name, ExceptionCodeWithMessage&);
short cmp(ScriptExecutionContext&, JSC::JSValue first, JSC::JSValue second, ExceptionCodeWithMessage&);
Modified: trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp (200555 => 200556)
--- trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp 2016-05-08 18:29:04 UTC (rev 200556)
@@ -40,6 +40,7 @@
#include "ExceptionCode.h"
#include "JSCryptoOperationData.h"
#include "JSDOMBinding.h"
+#include "JSDOMConvert.h"
#include "JSDictionary.h"
using namespace JSC;
@@ -154,90 +155,90 @@
return WTFMove(result);
}
-static std::unique_ptr<CryptoAlgorithmParameters> createAesKeyGenParams(ExecState* exec, JSValue value)
+static std::unique_ptr<CryptoAlgorithmParameters> createAesKeyGenParams(ExecState& state, JSValue value)
{
if (!value.isObject()) {
- throwTypeError(exec);
+ throwTypeError(&state);
return nullptr;
}
auto result = std::make_unique<CryptoAlgorithmAesKeyGenParams>();
- JSValue lengthValue = getProperty(exec, value.getObject(), "length");
- if (exec->hadException())
+ JSValue lengthValue = getProperty(&state, value.getObject(), "length");
+ if (state.hadException())
return nullptr;
- result->length = toUInt16(exec, lengthValue, EnforceRange);
+ result->length = convert<uint16_t>(state, lengthValue, EnforceRange);
return WTFMove(result);
}
-static std::unique_ptr<CryptoAlgorithmParameters> createHmacParams(ExecState* exec, JSValue value)
+static std::unique_ptr<CryptoAlgorithmParameters> createHmacParams(ExecState& state, JSValue value)
{
if (!value.isObject()) {
- throwTypeError(exec);
+ throwTypeError(&state);
return nullptr;
}
- JSDictionary jsDictionary(exec, value.getObject());
+ JSDictionary jsDictionary(&state, value.getObject());
auto result = std::make_unique<CryptoAlgorithmHmacParams>();
if (!getHashAlgorithm(jsDictionary, result->hash, HashRequirement::Required)) {
- ASSERT(exec->hadException());
+ ASSERT(state.hadException());
return nullptr;
}
return WTFMove(result);
}
-static std::unique_ptr<CryptoAlgorithmParameters> createHmacKeyParams(ExecState* exec, JSValue value)
+static std::unique_ptr<CryptoAlgorithmParameters> createHmacKeyParams(ExecState& state, JSValue value)
{
if (!value.isObject()) {
- throwTypeError(exec);
+ throwTypeError(&state);
return nullptr;
}
- JSDictionary jsDictionary(exec, value.getObject());
+ JSDictionary jsDictionary(&state, value.getObject());
auto result = std::make_unique<CryptoAlgorithmHmacKeyParams>();
if (!getHashAlgorithm(jsDictionary, result->hash, HashRequirement::Required)) {
- ASSERT(exec->hadException());
+ ASSERT(state.hadException());
return nullptr;
}
result->hasLength = jsDictionary.get("length", result->length);
- if (exec->hadException())
+ if (state.hadException())
return nullptr;
return WTFMove(result);
}
-static std::unique_ptr<CryptoAlgorithmParameters> createRsaKeyGenParams(ExecState* exec, JSValue value)
+static std::unique_ptr<CryptoAlgorithmParameters> createRsaKeyGenParams(ExecState& state, JSValue value)
{
if (!value.isObject()) {
- throwTypeError(exec);
+ throwTypeError(&state);
return nullptr;
}
- JSDictionary jsDictionary(exec, value.getObject());
+ JSDictionary jsDictionary(&state, value.getObject());
auto result = std::make_unique<CryptoAlgorithmRsaKeyGenParams>();
- JSValue modulusLengthValue = getProperty(exec, value.getObject(), "modulusLength");
- if (exec->hadException())
+ JSValue modulusLengthValue = getProperty(&state, value.getObject(), "modulusLength");
+ if (state.hadException())
return nullptr;
// FIXME: Why no EnforceRange? Filed as <https://www.w3.org/Bugs/Public/show_bug.cgi?id=23779>.
- result->modulusLength = toUInt32(exec, modulusLengthValue, NormalConversion);
- if (exec->hadException())
+ result->modulusLength = convert<uint32_t>(state, modulusLengthValue, NormalConversion);
+ if (state.hadException())
return nullptr;
- JSValue publicExponentValue = getProperty(exec, value.getObject(), "publicExponent");
- if (exec->hadException())
+ JSValue publicExponentValue = getProperty(&state, value.getObject(), "publicExponent");
+ if (state.hadException())
return nullptr;
RefPtr<Uint8Array> publicExponentArray = toUint8Array(publicExponentValue);
if (!publicExponentArray) {
- throwTypeError(exec, "Expected a Uint8Array in publicExponent");
+ throwTypeError(&state, "Expected a Uint8Array in publicExponent");
return nullptr;
}
result->publicExponent.append(publicExponentArray->data(), publicExponentArray->byteLength());
@@ -247,7 +248,7 @@
return WTFMove(result);
}
-static std::unique_ptr<CryptoAlgorithmParameters> createRsaKeyParamsWithHash(ExecState*, JSValue)
+static std::unique_ptr<CryptoAlgorithmParameters> createRsaKeyParamsWithHash(ExecState&, JSValue)
{
// WebCrypto RSA algorithms currently do not take any parameters to importKey.
return std::make_unique<CryptoAlgorithmRsaKeyParamsWithHash>();
@@ -287,18 +288,18 @@
return WTFMove(result);
}
-static std::unique_ptr<CryptoAlgorithmParameters> createRsaSsaParams(ExecState* exec, JSValue value)
+static std::unique_ptr<CryptoAlgorithmParameters> createRsaSsaParams(ExecState& state, JSValue value)
{
if (!value.isObject()) {
- throwTypeError(exec);
+ throwTypeError(&state);
return nullptr;
}
- JSDictionary jsDictionary(exec, value.getObject());
+ JSDictionary jsDictionary(&state, value.getObject());
auto result = std::make_unique<CryptoAlgorithmRsaSsaParams>();
if (!getHashAlgorithm(jsDictionary, result->hash, HashRequirement::Required)) {
- ASSERT(exec->hadException());
+ ASSERT(state.hadException());
return nullptr;
}
@@ -396,7 +397,7 @@
setDOMException(exec, NOT_SUPPORTED_ERR);
return nullptr;
case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5:
- return createRsaSsaParams(exec, value);
+ return createRsaSsaParams(*exec, value);
case CryptoAlgorithmIdentifier::RSA_PSS:
case CryptoAlgorithmIdentifier::RSA_OAEP:
case CryptoAlgorithmIdentifier::ECDSA:
@@ -410,7 +411,7 @@
setDOMException(exec, NOT_SUPPORTED_ERR);
return nullptr;
case CryptoAlgorithmIdentifier::HMAC:
- return createHmacParams(exec, value);
+ return createHmacParams(*exec, value);
case CryptoAlgorithmIdentifier::DH:
case CryptoAlgorithmIdentifier::SHA_1:
case CryptoAlgorithmIdentifier::SHA_224:
@@ -434,7 +435,7 @@
setDOMException(exec, NOT_SUPPORTED_ERR);
return nullptr;
case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5:
- return createRsaSsaParams(exec, value);
+ return createRsaSsaParams(*exec, value);
case CryptoAlgorithmIdentifier::RSA_PSS:
case CryptoAlgorithmIdentifier::RSA_OAEP:
case CryptoAlgorithmIdentifier::ECDSA:
@@ -448,7 +449,7 @@
setDOMException(exec, NOT_SUPPORTED_ERR);
return nullptr;
case CryptoAlgorithmIdentifier::HMAC:
- return createHmacParams(exec, value);
+ return createHmacParams(*exec, value);
case CryptoAlgorithmIdentifier::DH:
case CryptoAlgorithmIdentifier::SHA_1:
case CryptoAlgorithmIdentifier::SHA_224:
@@ -507,7 +508,7 @@
case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5:
case CryptoAlgorithmIdentifier::RSA_PSS:
case CryptoAlgorithmIdentifier::RSA_OAEP:
- return createRsaKeyGenParams(exec, value);
+ return createRsaKeyGenParams(*exec, value);
case CryptoAlgorithmIdentifier::ECDSA:
case CryptoAlgorithmIdentifier::ECDH:
setDOMException(exec, NOT_SUPPORTED_ERR);
@@ -518,9 +519,9 @@
case CryptoAlgorithmIdentifier::AES_GCM:
case CryptoAlgorithmIdentifier::AES_CFB:
case CryptoAlgorithmIdentifier::AES_KW:
- return createAesKeyGenParams(exec, value);
+ return createAesKeyGenParams(*exec, value);
case CryptoAlgorithmIdentifier::HMAC:
- return createHmacKeyParams(exec, value);
+ return createHmacKeyParams(*exec, value);
case CryptoAlgorithmIdentifier::DH:
case CryptoAlgorithmIdentifier::SHA_1:
case CryptoAlgorithmIdentifier::SHA_224:
@@ -608,7 +609,7 @@
case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5:
case CryptoAlgorithmIdentifier::RSA_PSS:
case CryptoAlgorithmIdentifier::RSA_OAEP:
- return createRsaKeyParamsWithHash(exec, value);
+ return createRsaKeyParamsWithHash(*exec, value);
case CryptoAlgorithmIdentifier::ECDSA:
case CryptoAlgorithmIdentifier::ECDH:
case CryptoAlgorithmIdentifier::AES_CTR:
@@ -619,7 +620,7 @@
case CryptoAlgorithmIdentifier::AES_KW:
return std::make_unique<CryptoAlgorithmParameters>();
case CryptoAlgorithmIdentifier::HMAC:
- return createHmacParams(exec, value);
+ return createHmacParams(*exec, value);
case CryptoAlgorithmIdentifier::DH:
return std::make_unique<CryptoAlgorithmParameters>();
case CryptoAlgorithmIdentifier::SHA_1:
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (200555 => 200556)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp 2016-05-08 18:29:04 UTC (rev 200556)
@@ -366,15 +366,15 @@
return makeString("Value ", String::numberToStringECMAScript(value), " is outside the range [", String::numberToStringECMAScript(min), ", ", String::numberToStringECMAScript(max), "]");
}
-static double enforceRange(ExecState* exec, double x, double minimum, double maximum)
+static double enforceRange(ExecState& state, double x, double minimum, double maximum)
{
if (std::isnan(x) || std::isinf(x)) {
- exec->vm().throwException(exec, createTypeError(exec, rangeErrorString(x, minimum, maximum)));
+ state.vm().throwException(&state, createTypeError(&state, rangeErrorString(x, minimum, maximum)));
return 0;
}
x = trunc(x);
if (x < minimum || x > maximum) {
- exec->vm().throwException(exec, createTypeError(exec, rangeErrorString(x, minimum, maximum)));
+ state.vm().throwException(&state, createTypeError(&state, rangeErrorString(x, minimum, maximum)));
return 0;
}
return x;
@@ -411,8 +411,10 @@
};
template <typename T>
-static inline T toSmallerInt(ExecState* exec, JSValue value, IntegerConversionConfiguration configuration)
+static inline T toSmallerInt(ExecState& state, JSValue value, IntegerConversionConfiguration configuration)
{
+ static_assert(std::is_signed<T>::value && std::is_integral<T>::value, "Should only be used for signed integral types");
+
typedef IntTypeLimits<T> LimitsTrait;
// Fast path if the value is already a 32-bit signed integer in the right range.
if (value.isInt32()) {
@@ -423,7 +425,7 @@
case NormalConversion:
break;
case EnforceRange:
- throwTypeError(exec);
+ throwTypeError(&state);
return 0;
case Clamp:
return d < LimitsTrait::minValue ? LimitsTrait::minValue : LimitsTrait::maxValue;
@@ -432,15 +434,15 @@
return static_cast<T>(d > LimitsTrait::maxValue ? d - LimitsTrait::numberOfValues : d);
}
- double x = value.toNumber(exec);
- if (UNLIKELY(exec->hadException()))
+ double x = value.toNumber(&state);
+ if (UNLIKELY(state.hadException()))
return 0;
switch (configuration) {
case NormalConversion:
break;
case EnforceRange:
- return enforceRange(exec, x, LimitsTrait::minValue, LimitsTrait::maxValue);
+ return enforceRange(state, x, LimitsTrait::minValue, LimitsTrait::maxValue);
case Clamp:
return std::isnan(x) ? 0 : clampTo<T>(x);
}
@@ -455,8 +457,10 @@
}
template <typename T>
-static inline T toSmallerUInt(ExecState* exec, JSValue value, IntegerConversionConfiguration configuration)
+static inline T toSmallerUInt(ExecState& state, JSValue value, IntegerConversionConfiguration configuration)
{
+ static_assert(std::is_unsigned<T>::value && std::is_integral<T>::value, "Should only be used for unsigned integral types");
+
typedef IntTypeLimits<T> LimitsTrait;
// Fast path if the value is already a 32-bit unsigned integer in the right range.
if (value.isUInt32()) {
@@ -467,22 +471,22 @@
case NormalConversion:
return static_cast<T>(d);
case EnforceRange:
- throwTypeError(exec);
+ throwTypeError(&state);
return 0;
case Clamp:
return LimitsTrait::maxValue;
}
}
- double x = value.toNumber(exec);
- if (UNLIKELY(exec->hadException()))
+ double x = value.toNumber(&state);
+ if (UNLIKELY(state.hadException()))
return 0;
switch (configuration) {
case NormalConversion:
break;
case EnforceRange:
- return enforceRange(exec, x, 0, LimitsTrait::maxValue);
+ return enforceRange(state, x, 0, LimitsTrait::maxValue);
case Clamp:
return std::isnan(x) ? 0 : clampTo<T>(x);
}
@@ -494,95 +498,145 @@
return static_cast<T>(fmod(x, LimitsTrait::numberOfValues));
}
+int8_t toInt8EnforceRange(JSC::ExecState& state, JSValue value)
+{
+ return toSmallerInt<int8_t>(state, value, EnforceRange);
+}
+
+uint8_t toUInt8EnforceRange(JSC::ExecState& state, JSValue value)
+{
+ return toSmallerUInt<uint8_t>(state, value, EnforceRange);
+}
+
+int8_t toInt8Clamp(JSC::ExecState& state, JSValue value)
+{
+ return toSmallerInt<int8_t>(state, value, Clamp);
+}
+
+uint8_t toUInt8Clamp(JSC::ExecState& state, JSValue value)
+{
+ return toSmallerUInt<uint8_t>(state, value, Clamp);
+}
+
// http://www.w3.org/TR/WebIDL/#es-byte
-int8_t toInt8(ExecState* exec, JSValue value, IntegerConversionConfiguration configuration)
+int8_t toInt8(ExecState& state, JSValue value)
{
- return toSmallerInt<int8_t>(exec, value, configuration);
+ return toSmallerInt<int8_t>(state, value, NormalConversion);
}
// http://www.w3.org/TR/WebIDL/#es-octet
-uint8_t toUInt8(ExecState* exec, JSValue value, IntegerConversionConfiguration configuration)
+uint8_t toUInt8(ExecState& state, JSValue value)
{
- return toSmallerUInt<uint8_t>(exec, value, configuration);
+ return toSmallerUInt<uint8_t>(state, value, NormalConversion);
}
+int16_t toInt16EnforceRange(ExecState& state, JSValue value)
+{
+ return toSmallerInt<int16_t>(state, value, EnforceRange);
+}
+
+uint16_t toUInt16EnforceRange(ExecState& state, JSValue value)
+{
+ return toSmallerUInt<uint16_t>(state, value, EnforceRange);
+}
+
+int16_t toInt16Clamp(ExecState& state, JSValue value)
+{
+ return toSmallerInt<int16_t>(state, value, Clamp);
+}
+
+uint16_t toUInt16Clamp(ExecState& state, JSValue value)
+{
+ return toSmallerUInt<uint16_t>(state, value, Clamp);
+}
+
// http://www.w3.org/TR/WebIDL/#es-short
-int16_t toInt16(ExecState* exec, JSValue value, IntegerConversionConfiguration configuration)
+int16_t toInt16(ExecState& state, JSValue value)
{
- return toSmallerInt<int16_t>(exec, value, configuration);
+ return toSmallerInt<int16_t>(state, value, NormalConversion);
}
// http://www.w3.org/TR/WebIDL/#es-unsigned-short
-uint16_t toUInt16(ExecState* exec, JSValue value, IntegerConversionConfiguration configuration)
+uint16_t toUInt16(ExecState& state, JSValue value)
{
- return toSmallerUInt<uint16_t>(exec, value, configuration);
+ return toSmallerUInt<uint16_t>(state, value, NormalConversion);
}
// http://www.w3.org/TR/WebIDL/#es-long
-int32_t toInt32EnforceRange(ExecState* exec, JSValue value)
+int32_t toInt32EnforceRange(ExecState& state, JSValue value)
{
if (value.isInt32())
return value.asInt32();
- double x = value.toNumber(exec);
- if (UNLIKELY(exec->hadException()))
+ double x = value.toNumber(&state);
+ if (UNLIKELY(state.hadException()))
return 0;
- return enforceRange(exec, x, kMinInt32, kMaxInt32);
+ return enforceRange(state, x, kMinInt32, kMaxInt32);
}
-int32_t toInt32Clamp(ExecState* exec, JSValue value)
+int32_t toInt32Clamp(ExecState& state, JSValue value)
{
if (value.isInt32())
return value.asInt32();
- double x = value.toNumber(exec);
- if (UNLIKELY(exec->hadException()))
- return 0;
+ double x = value.toNumber(&state);
return std::isnan(x) ? 0 : clampTo<int32_t>(x);
}
-uint32_t toUInt32Clamp(ExecState* exec, JSValue value)
+uint32_t toUInt32Clamp(ExecState& state, JSValue value)
{
if (value.isUInt32())
return value.asUInt32();
- double x = value.toNumber(exec);
- if (UNLIKELY(exec->hadException()))
- return 0;
+ double x = value.toNumber(&state);
return std::isnan(x) ? 0 : clampTo<uint32_t>(x);
}
// http://www.w3.org/TR/WebIDL/#es-unsigned-long
-uint32_t toUInt32EnforceRange(ExecState* exec, JSValue value)
+uint32_t toUInt32EnforceRange(ExecState& state, JSValue value)
{
if (value.isUInt32())
return value.asUInt32();
- double x = value.toNumber(exec);
- if (UNLIKELY(exec->hadException()))
+ double x = value.toNumber(&state);
+ if (UNLIKELY(state.hadException()))
return 0;
- return enforceRange(exec, x, 0, kMaxUInt32);
+ return enforceRange(state, x, 0, kMaxUInt32);
}
-// http://www.w3.org/TR/WebIDL/#es-long-long
-int64_t toInt64(ExecState* exec, JSValue value, IntegerConversionConfiguration configuration)
+int64_t toInt64EnforceRange(ExecState& state, JSC::JSValue value)
{
- if (value.isInt32())
- return value.asInt32();
+ double x = value.toNumber(&state);
+ if (UNLIKELY(state.hadException()))
+ return 0;
+ return enforceRange(state, x, -kJSMaxInteger, kJSMaxInteger);
+}
- double x = value.toNumber(exec);
- if (UNLIKELY(exec->hadException()))
+uint64_t toUInt64EnforceRange(ExecState& state, JSC::JSValue value)
+{
+ double x = value.toNumber(&state);
+ if (UNLIKELY(state.hadException()))
return 0;
+ return enforceRange(state, x, 0, kJSMaxInteger);
+}
- switch (configuration) {
- case NormalConversion:
- break;
- case EnforceRange:
- return enforceRange(exec, x, -kJSMaxInteger, kJSMaxInteger);
- case Clamp:
- return std::isnan(x) ? 0 : static_cast<int64_t>(std::min<double>(std::max<double>(x, -kJSMaxInteger), kJSMaxInteger));
- }
+int64_t toInt64Clamp(ExecState& state, JSC::JSValue value)
+{
+ double x = value.toNumber(&state);
+ return std::isnan(x) ? 0 : static_cast<int64_t>(std::min<double>(std::max<double>(x, -kJSMaxInteger), kJSMaxInteger));
+}
+uint64_t toUInt64Clamp(ExecState& state, JSC::JSValue value)
+{
+ double x = value.toNumber(&state);
+ return std::isnan(x) ? 0 : static_cast<uint64_t>(std::min<double>(std::max<double>(x, 0), kJSMaxInteger));
+}
+
+// http://www.w3.org/TR/WebIDL/#es-long-long
+int64_t toInt64(ExecState& state, JSValue value)
+{
+ double x = value.toNumber(&state);
+
// Map NaNs and +/-Infinity to 0; convert finite values modulo 2^64.
unsigned long long n;
doubleToInteger(x, n);
@@ -590,24 +644,10 @@
}
// http://www.w3.org/TR/WebIDL/#es-unsigned-long-long
-uint64_t toUInt64(ExecState* exec, JSValue value, IntegerConversionConfiguration configuration)
+uint64_t toUInt64(ExecState& state, JSValue value)
{
- if (value.isUInt32())
- return value.asUInt32();
+ double x = value.toNumber(&state);
- double x = value.toNumber(exec);
- if (UNLIKELY(exec->hadException()))
- return 0;
-
- switch (configuration) {
- case NormalConversion:
- break;
- case EnforceRange:
- return enforceRange(exec, x, 0, kJSMaxInteger);
- case Clamp:
- return std::isnan(x) ? 0 : static_cast<uint64_t>(std::min<double>(std::max<double>(x, 0), kJSMaxInteger));
- }
-
// Map NaNs and +/-Infinity to 0; convert finite values modulo 2^64.
unsigned long long n;
doubleToInteger(x, n);
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (200555 => 200556)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2016-05-08 18:29:04 UTC (rev 200556)
@@ -211,24 +211,31 @@
enum IntegerConversionConfiguration { NormalConversion, EnforceRange, Clamp };
-WEBCORE_EXPORT int32_t toInt32EnforceRange(JSC::ExecState*, JSC::JSValue);
-WEBCORE_EXPORT uint32_t toUInt32EnforceRange(JSC::ExecState*, JSC::JSValue);
+WEBCORE_EXPORT int8_t toInt8EnforceRange(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT uint8_t toUInt8EnforceRange(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT int16_t toInt16EnforceRange(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT uint16_t toUInt16EnforceRange(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT int32_t toInt32EnforceRange(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT uint32_t toUInt32EnforceRange(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT int64_t toInt64EnforceRange(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT uint64_t toUInt64EnforceRange(JSC::ExecState&, JSC::JSValue);
-WEBCORE_EXPORT int32_t toInt32Clamp(JSC::ExecState*, JSC::JSValue);
-WEBCORE_EXPORT uint32_t toUInt32Clamp(JSC::ExecState*, JSC::JSValue);
+WEBCORE_EXPORT int8_t toInt8Clamp(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT uint8_t toUInt8Clamp(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT int16_t toInt16Clamp(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT uint16_t toUInt16Clamp(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT int32_t toInt32Clamp(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT uint32_t toUInt32Clamp(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT int64_t toInt64Clamp(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT uint64_t toUInt64Clamp(JSC::ExecState&, JSC::JSValue);
-WEBCORE_EXPORT int8_t toInt8(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration);
-WEBCORE_EXPORT uint8_t toUInt8(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration);
+WEBCORE_EXPORT int8_t toInt8(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT uint8_t toUInt8(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT int16_t toInt16(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT uint16_t toUInt16(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT int64_t toInt64(JSC::ExecState&, JSC::JSValue);
+WEBCORE_EXPORT uint64_t toUInt64(JSC::ExecState&, JSC::JSValue);
-WEBCORE_EXPORT int16_t toInt16(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration);
-WEBCORE_EXPORT uint16_t toUInt16(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration);
-
-int32_t toInt32(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration);
-uint32_t toUInt32(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration);
-
-WEBCORE_EXPORT int64_t toInt64(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration);
-WEBCORE_EXPORT uint64_t toUInt64(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration);
-
// Returns a Date instance for the specified value, or NaN if the date is not a number.
JSC::JSValue jsDateOrNaN(JSC::ExecState*, double);
@@ -481,38 +488,6 @@
return JSC::toInt32(number);
}
-/*
- Convert a value to an integer as per <http://www.w3.org/TR/WebIDL/>.
- The conversion fails if the value cannot be converted to a number or,
- if EnforceRange is specified, the value is outside the range of the
- destination integer type.
-*/
-inline int32_t toInt32(JSC::ExecState* exec, JSC::JSValue value, IntegerConversionConfiguration configuration)
-{
- switch (configuration) {
- case NormalConversion:
- break;
- case EnforceRange:
- return toInt32EnforceRange(exec, value);
- case Clamp:
- return toInt32Clamp(exec, value);
- }
- return value.toInt32(exec);
-}
-
-inline uint32_t toUInt32(JSC::ExecState* exec, JSC::JSValue value, IntegerConversionConfiguration configuration)
-{
- switch (configuration) {
- case NormalConversion:
- break;
- case EnforceRange:
- return toUInt32EnforceRange(exec, value);
- case Clamp:
- return toUInt32Clamp(exec, value);
- }
- return value.toUInt32(exec);
-}
-
// Validates that the passed object is a sequence type per section 4.1.13 of the WebIDL spec.
inline JSC::JSObject* toJSSequence(JSC::ExecState* exec, JSC::JSValue value, unsigned& length)
{
Modified: trunk/Source/WebCore/bindings/js/JSDOMConvert.h (200555 => 200556)
--- trunk/Source/WebCore/bindings/js/JSDOMConvert.h 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvert.h 2016-05-08 18:29:04 UTC (rev 200556)
@@ -34,6 +34,7 @@
template<typename T> T convert(JSC::ExecState&, JSC::JSValue);
template<typename T> T convert(JSC::ExecState&, JSC::JSValue, ShouldAllowNonFinite);
+template<typename T> T convert(JSC::ExecState&, JSC::JSValue, IntegerConversionConfiguration);
template<typename T> Optional<T> convertOptional(JSC::ExecState&, JSC::JSValue);
template<typename T, typename U> T convertOptional(JSC::ExecState&, JSC::JSValue, U&& defaultValue);
@@ -73,4 +74,114 @@
return toNativeArray<String>(&state, value);
}
+template<> inline int8_t convert(JSC::ExecState& state, JSC::JSValue value, IntegerConversionConfiguration configuration)
+{
+ switch (configuration) {
+ case NormalConversion:
+ break;
+ case EnforceRange:
+ return toInt8EnforceRange(state, value);
+ case Clamp:
+ return toInt8Clamp(state, value);
+ }
+ return toInt8(state, value);
}
+
+template<> inline uint8_t convert(JSC::ExecState& state, JSC::JSValue value, IntegerConversionConfiguration configuration)
+{
+ switch (configuration) {
+ case NormalConversion:
+ break;
+ case EnforceRange:
+ return toUInt8EnforceRange(state, value);
+ case Clamp:
+ return toUInt8Clamp(state, value);
+ }
+ return toUInt8(state, value);
+}
+
+template<> inline int16_t convert(JSC::ExecState& state, JSC::JSValue value, IntegerConversionConfiguration configuration)
+{
+ switch (configuration) {
+ case NormalConversion:
+ break;
+ case EnforceRange:
+ return toInt16EnforceRange(state, value);
+ case Clamp:
+ return toInt16Clamp(state, value);
+ }
+ return toInt16(state, value);
+}
+
+template<> inline uint16_t convert(JSC::ExecState& state, JSC::JSValue value, IntegerConversionConfiguration configuration)
+{
+ switch (configuration) {
+ case NormalConversion:
+ break;
+ case EnforceRange:
+ return toUInt16EnforceRange(state, value);
+ case Clamp:
+ return toUInt16Clamp(state, value);
+ }
+ return toUInt16(state, value);
+}
+
+template<> inline int32_t convert(JSC::ExecState& state, JSC::JSValue value, IntegerConversionConfiguration configuration)
+{
+ switch (configuration) {
+ case NormalConversion:
+ break;
+ case EnforceRange:
+ return toInt32EnforceRange(state, value);
+ case Clamp:
+ return toInt32Clamp(state, value);
+ }
+ return value.toInt32(&state);
+}
+
+template<> inline uint32_t convert(JSC::ExecState& state, JSC::JSValue value, IntegerConversionConfiguration configuration)
+{
+ switch (configuration) {
+ case NormalConversion:
+ break;
+ case EnforceRange:
+ return toUInt32EnforceRange(state, value);
+ case Clamp:
+ return toUInt32Clamp(state, value);
+ }
+ return value.toUInt32(&state);
+}
+
+template<> inline int64_t convert(JSC::ExecState& state, JSC::JSValue value, IntegerConversionConfiguration configuration)
+{
+ if (value.isInt32())
+ return value.asInt32();
+
+ switch (configuration) {
+ case NormalConversion:
+ break;
+ case EnforceRange:
+ return toInt64EnforceRange(state, value);
+ case Clamp:
+ return toInt64Clamp(state, value);
+ }
+ return toInt64(state, value);
+}
+
+template<> inline uint64_t convert(JSC::ExecState& state, JSC::JSValue value, IntegerConversionConfiguration configuration)
+{
+ if (value.isUInt32())
+ return value.asUInt32();
+
+ switch (configuration) {
+ case NormalConversion:
+ break;
+ case EnforceRange:
+ return toUInt64EnforceRange(state, value);
+ case Clamp:
+ return toUInt64Clamp(state, value);
+ }
+ return toUInt64(state, value);
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/js/JSMockContentFilterSettingsCustom.cpp (200555 => 200556)
--- trunk/Source/WebCore/bindings/js/JSMockContentFilterSettingsCustom.cpp 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/js/JSMockContentFilterSettingsCustom.cpp 2016-05-08 18:29:04 UTC (rev 200556)
@@ -29,6 +29,7 @@
#if ENABLE(CONTENT_FILTERING)
#include "JSDOMBinding.h"
+#include "JSDOMConvert.h"
#include "MockContentFilterSettings.h"
using namespace JSC;
@@ -57,7 +58,7 @@
void JSMockContentFilterSettings::setDecisionPoint(ExecState& state, JSValue value)
{
- uint8_t nativeValue { toUInt8(&state, value, EnforceRange) };
+ uint8_t nativeValue { convert<uint8_t>(state, value, EnforceRange) };
if (state.hadException())
return;
@@ -90,7 +91,7 @@
static inline Decision toDecision(ExecState& state, JSValue value)
{
- uint8_t nativeValue { toUInt8(&state, value, EnforceRange) };
+ uint8_t nativeValue { convert<uint8_t>(state, value, EnforceRange) };
if (state.hadException())
return Decision::Allow;
Modified: trunk/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp (200555 => 200556)
--- trunk/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp 2016-05-08 18:29:04 UTC (rev 200556)
@@ -27,6 +27,7 @@
#include "JSNodeFilter.h"
#include "JSCallbackData.h"
+#include "JSDOMConvert.h"
#include "JSNode.h"
#include "NodeFilter.h"
@@ -43,23 +44,23 @@
JSLockHolder lock(m_data->globalObject()->vm());
- ExecState* exec = m_data->globalObject()->globalExec();
+ ExecState* state = m_data->globalObject()->globalExec();
MarkedArgumentBuffer args;
- args.append(toJS(exec, m_data->globalObject(), node));
- if (exec->hadException())
+ args.append(toJS(state, m_data->globalObject(), node));
+ if (state->hadException())
return NodeFilter::FILTER_REJECT;
NakedPtr<Exception> returnedException;
- JSValue value = m_data->invokeCallback(args, JSCallbackData::CallbackType::FunctionOrObject, Identifier::fromString(exec, "acceptNode"), returnedException);
+ JSValue value = m_data->invokeCallback(args, JSCallbackData::CallbackType::FunctionOrObject, Identifier::fromString(state, "acceptNode"), returnedException);
if (returnedException) {
// Rethrow exception.
- exec->vm().throwException(exec, returnedException);
+ state->vm().throwException(state, returnedException);
return NodeFilter::FILTER_REJECT;
}
- uint16_t result = toUInt16(exec, value, NormalConversion);
- if (exec->hadException())
+ uint16_t result = convert<uint16_t>(*state, value, NormalConversion);
+ if (state->hadException())
return NodeFilter::FILTER_REJECT;
return result;
Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (200555 => 200556)
--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2016-05-08 18:29:04 UTC (rev 200556)
@@ -44,18 +44,12 @@
my $verbose = 0;
-my %numericTypeHash = (
+my %integerTypeHash = (
"byte" => 1,
- "double" => 1,
- "float" => 1,
- "int" => 1,
"long long" => 1,
"long" => 1,
"octet" => 1,
"short" => 1,
- "unrestricted double" => 1,
- "unrestricted float" => 1,
- "unsigned int" => 1,
"unsigned long long" => 1,
"unsigned long" => 1,
"unsigned short" => 1,
@@ -357,27 +351,35 @@
sub IsNumericType
{
- my $object = shift;
- my $type = shift;
+ my ($object, $type) = @_;
- return 1 if $numericTypeHash{$type};
+ return 1 if $integerTypeHash{$type};
+ return 1 if $floatingPointTypeHash{$type};
return 0;
}
+sub IsIntegerType
+{
+ my ($object, $type) = @_;
+
+ return 1 if $integerTypeHash{$type};
+ return 0;
+}
+
sub IsFloatingPointType
{
my ($object, $type) = @_;
+
return 1 if $floatingPointTypeHash{$type};
return 0;
}
sub IsPrimitiveType
{
- my $object = shift;
- my $type = shift;
+ my ($object, $type) = @_;
return 1 if $primitiveTypeHash{$type};
- return 1 if $numericTypeHash{$type};
+ return 1 if $object->IsNumericType($type);
return 0;
}
@@ -417,10 +419,10 @@
sub IsNonPointerType
{
- my $object = shift;
- my $type = shift;
+ my ($object, $type) = @_;
- return 1 if $nonPointerTypeHash{$type} or $primitiveTypeHash{$type} or $numericTypeHash{$type};
+ return 1 if $nonPointerTypeHash{$type};
+ return 1 if $object->IsPrimitiveType($type);
return 0;
}
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200555 => 200556)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-05-08 18:29:04 UTC (rev 200556)
@@ -4256,14 +4256,14 @@
"byte" => "int8_t",
"double" => "double",
"float" => "float",
- "long long" => "long long",
- "long" => "int",
+ "long long" => "int64_t",
+ "long" => "int32_t",
"octet" => "uint8_t",
"short" => "int16_t",
"unrestricted double" => "double",
"unrestricted float" => "float",
- "unsigned long long" => "unsigned long long",
- "unsigned long" => "unsigned",
+ "unsigned long long" => "uint64_t",
+ "unsigned long" => "uint32_t",
"unsigned short" => "uint16_t",
);
@@ -4364,17 +4364,15 @@
return exists $nativeType{$type};
}
-my %integerConversionFunction = (
- "byte" => "toInt8",
- "long long" => "toInt64",
- "long" => "toInt32",
- "octet" => "toUInt8",
- "short" => "toInt16",
- "unsigned long long" => "toUInt64",
- "unsigned long" => "toUInt32",
- "unsigned short" => "toUInt16",
-);
+sub GetIntegerConversionType
+{
+ my $signature = shift;
+ return "EnforceRange" if $signature->extendedAttributes->{"EnforceRange"};
+ return "Clamp" if $signature->extendedAttributes->{"Clamp"};
+ return "NormalConversion";
+}
+
# Returns (convertString, mayThrowException).
sub JSValueToNative
{
@@ -4382,12 +4380,11 @@
my $type = $signature->type;
- my $function = $integerConversionFunction{$type};
- if ($function) {
- my $conversionType = "NormalConversion";
- $conversionType = "EnforceRange" if $signature->extendedAttributes->{"EnforceRange"};
- $conversionType = "Clamp" if $signature->extendedAttributes->{"Clamp"};
- return ("$function(state, $value, $conversionType)", 1);
+ if ($codeGenerator->IsIntegerType($type)) {
+ my $nativeType = GetNativeType($interface, $type);
+ my $conversionType = GetIntegerConversionType($signature);
+ AddToImplIncludes("JSDOMConvert.h");
+ return ("convert<$nativeType>(*state, $value, $conversionType)", 1);
}
if ($type eq "DOMString") {
Modified: trunk/Source/WebCore/bindings/scripts/IDLParser.pm (200555 => 200556)
--- trunk/Source/WebCore/bindings/scripts/IDLParser.pm 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/scripts/IDLParser.pm 2016-05-08 18:29:04 UTC (rev 200556)
@@ -342,27 +342,27 @@
my $nextAttribute_1 = '^(attribute|inherit|readonly)$';
my $nextPrimitiveType_1 = '^(int|long|short|unsigned)$';
my $nextPrimitiveType_2 = '^(double|float|unrestricted)$';
-my $nextArgumentList_1 = '^(\(|::|ByteString|DOMString|Date|\[|any|boolean|byte|double|float|in|int|long|object|octet|optional|sequence|short|unrestricted|unsigned)$';
-my $nextNonAnyType_1 = '^(boolean|byte|double|float|int|long|octet|short|unrestricted|unsigned)$';
-my $nextInterfaceMember_1 = '^(\(|::|ByteString|DOMString|Date|any|attribute|boolean|byte|creator|deleter|double|float|getter|inherit|int|legacycaller|long|object|octet|readonly|sequence|serializer|setter|short|static|stringifier|unrestricted|unsigned|void)$';
+my $nextArgumentList_1 = '^(\(|::|ByteString|DOMString|Date|\[|any|boolean|byte|double|float|in|long|object|octet|optional|sequence|short|unrestricted|unsigned)$';
+my $nextNonAnyType_1 = '^(boolean|byte|double|float|long|octet|short|unrestricted|unsigned)$';
+my $nextInterfaceMember_1 = '^(\(|::|ByteString|DOMString|Date|any|attribute|boolean|byte|creator|deleter|double|float|getter|inherit|legacycaller|long|object|octet|readonly|sequence|serializer|setter|short|static|stringifier|unrestricted|unsigned|void)$';
my $nextAttributeOrOperation_1 = '^(static|stringifier)$';
-my $nextAttributeOrOperation_2 = '^(\(|::|ByteString|DOMString|Date|any|boolean|byte|creator|deleter|double|float|getter|int|legacycaller|long|object|octet|sequence|setter|short|unrestricted|unsigned|void)$';
+my $nextAttributeOrOperation_2 = '^(\(|::|ByteString|DOMString|Date|any|boolean|byte|creator|deleter|double|float|getter|legacycaller|long|object|octet|sequence|setter|short|unrestricted|unsigned|void)$';
my $nextUnrestrictedFloatType_1 = '^(double|float)$';
my $nextExtendedAttributeRest3_1 = '^(\,|::|\])$';
-my $nextExceptionField_1 = '^(\(|::|ByteString|DOMString|Date|any|boolean|byte|double|float|int|long|object|octet|sequence|short|unrestricted|unsigned)$';
-my $nextType_1 = '^(::|ByteString|DOMString|Date|any|boolean|byte|double|float|int|long|object|octet|sequence|short|unrestricted|unsigned)$';
+my $nextExceptionField_1 = '^(\(|::|ByteString|DOMString|Date|any|boolean|byte|double|float|long|object|octet|sequence|short|unrestricted|unsigned)$';
+my $nextType_1 = '^(::|ByteString|DOMString|Date|any|boolean|byte|double|float|long|object|octet|sequence|short|unrestricted|unsigned)$';
my $nextSpecials_1 = '^(creator|deleter|getter|legacycaller|setter)$';
my $nextDefinitions_1 = '^(::|callback|dictionary|enum|exception|interface|partial|typedef)$';
-my $nextExceptionMembers_1 = '^(\(|::|ByteString|DOMString|Date|\[|any|boolean|byte|const|double|float|int|long|object|octet|optional|sequence|short|unrestricted|unsigned)$';
+my $nextExceptionMembers_1 = '^(\(|::|ByteString|DOMString|Date|\[|any|boolean|byte|const|double|float|long|object|octet|optional|sequence|short|unrestricted|unsigned)$';
my $nextAttributeRest_1 = '^(attribute|readonly)$';
-my $nextInterfaceMembers_1 = '^(\(|::|ByteString|DOMString|Date|any|attribute|boolean|byte|const|creator|deleter|double|float|getter|inherit|int|legacycaller|long|object|octet|readonly|sequence|serializer|setter|short|static|stringifier|unrestricted|unsigned|void)$';
-my $nextSingleType_1 = '^(::|ByteString|DOMString|Date|boolean|byte|double|float|int|long|object|octet|sequence|short|unrestricted|unsigned)$';
+my $nextInterfaceMembers_1 = '^(\(|::|ByteString|DOMString|Date|any|attribute|boolean|byte|const|creator|deleter|double|float|getter|inherit|legacycaller|long|object|octet|readonly|sequence|serializer|setter|short|static|stringifier|unrestricted|unsigned|void)$';
+my $nextSingleType_1 = '^(::|ByteString|DOMString|Date|boolean|byte|double|float|long|object|octet|sequence|short|unrestricted|unsigned)$';
my $nextArgumentName_1 = '^(attribute|callback|const|creator|deleter|dictionary|enum|exception|getter|implements|inherit|interface|legacycaller|partial|serializer|setter|static|stringifier|typedef|unrestricted)$';
my $nextConstValue_1 = '^(false|true)$';
my $nextConstValue_2 = '^(-|Infinity|NaN)$';
my $nextDefinition_1 = '^(callback|interface)$';
-my $nextAttributeOrOperationRest_1 = '^(\(|::|ByteString|DOMString|Date|any|boolean|byte|double|float|int|long|object|octet|sequence|short|unrestricted|unsigned|void)$';
-my $nextUnsignedIntegerType_1 = '^(int|long|short)$';
+my $nextAttributeOrOperationRest_1 = '^(\(|::|ByteString|DOMString|Date|any|boolean|byte|double|float|long|object|octet|sequence|short|unrestricted|unsigned|void)$';
+my $nextUnsignedIntegerType_1 = '^(long|short)$';
my $nextDefaultValue_1 = '^(-|Infinity|NaN|false|null|true)$';
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp (200555 => 200556)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp 2016-05-08 18:29:04 UTC (rev 200556)
@@ -196,7 +196,7 @@
return !returnedException;
}
-bool JSTestCallback::callbackRequiresThisToPass(int longParam, TestNode* testNodeParam)
+bool JSTestCallback::callbackRequiresThisToPass(int32_t longParam, TestNode* testNodeParam)
{
if (!canInvokeCallback())
return true;
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h (200555 => 200556)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h 2016-05-08 18:29:04 UTC (rev 200556)
@@ -46,11 +46,11 @@
virtual bool callbackWithNoParam();
virtual bool callbackWithArrayParam(RefPtr<Float32Array> arrayParam);
virtual bool callbackWithSerializedScriptValueParam(PassRefPtr<SerializedScriptValue> srzParam, const String& strArg);
- virtual int callbackWithNonBoolReturnType(const String& strArg);
- virtual int customCallback(Class5* class5Param, Class6* class6Param);
+ virtual int32_t callbackWithNonBoolReturnType(const String& strArg);
+ virtual int32_t customCallback(Class5* class5Param, Class6* class6Param);
virtual bool callbackWithStringList(PassRefPtr<DOMStringList> listParam);
virtual bool callbackWithBoolean(bool boolParam);
- virtual bool callbackRequiresThisToPass(int longParam, TestNode* testNodeParam);
+ virtual bool callbackRequiresThisToPass(int32_t longParam, TestNode* testNodeParam);
private:
JSTestCallback(JSC::JSObject* callback, JSDOMGlobalObject*);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp (200555 => 200556)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp 2016-05-08 18:29:04 UTC (rev 200556)
@@ -165,7 +165,7 @@
return !returnedException;
}
-bool JSTestCallbackFunction::callbackRequiresThisToPass(int longParam, TestNode* testNodeParam)
+bool JSTestCallbackFunction::callbackRequiresThisToPass(int32_t longParam, TestNode* testNodeParam)
{
if (!canInvokeCallback())
return true;
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h (200555 => 200556)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h 2016-05-08 18:29:04 UTC (rev 200556)
@@ -45,11 +45,11 @@
virtual bool callbackWithNoParam();
virtual bool callbackWithArrayParam(RefPtr<Float32Array> arrayParam);
virtual bool callbackWithSerializedScriptValueParam(PassRefPtr<SerializedScriptValue> srzParam, const String& strArg);
- virtual int callbackWithNonBoolReturnType(const String& strArg);
- virtual int customCallback(Class5* class5Param, Class6* class6Param);
+ virtual int32_t callbackWithNonBoolReturnType(const String& strArg);
+ virtual int32_t customCallback(Class5* class5Param, Class6* class6Param);
virtual bool callbackWithStringList(PassRefPtr<DOMStringList> listParam);
virtual bool callbackWithBoolean(bool boolParam);
- virtual bool callbackRequiresThisToPass(int longParam, TestNode* testNodeParam);
+ virtual bool callbackRequiresThisToPass(int32_t longParam, TestNode* testNodeParam);
private:
JSTestCallbackFunction(JSC::JSObject* callback, JSDOMGlobalObject*);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp (200555 => 200556)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp 2016-05-08 18:29:04 UTC (rev 200556)
@@ -24,6 +24,7 @@
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
+#include "JSDOMConvert.h"
#include "JSNode.h"
#include "Node.h"
#include "wtf/text/AtomicString.h"
@@ -205,7 +206,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto index = toUInt32(state, state->argument(0), NormalConversion);
+ auto index = convert<uint32_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.item(WTFMove(index))));
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp (200555 => 200556)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp 2016-05-08 18:29:04 UTC (rev 200556)
@@ -24,6 +24,7 @@
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
+#include "JSDOMConvert.h"
#include "RuntimeEnabledFeatures.h"
#include "URL.h"
#include <runtime/Error.h>
@@ -294,7 +295,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto testParam = toInt32(state, state->argument(0), NormalConversion);
+ auto testParam = convert<int32_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.enabledAtRuntimeOperation(WTFMove(testParam));
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp (200555 => 200556)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp 2016-05-08 18:29:04 UTC (rev 200556)
@@ -158,16 +158,16 @@
InputCursor& cursor = globalObject->inputCursor();
static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicReadonlyAttr", AtomicString::ConstructFromLiteral);
if (cursor.isCapturing()) {
- int memoizedResult = castedThis->wrapped().nondeterministicReadonlyAttr();
- cursor.appendInput<MemoizedDOMResult<int>>(bindingName.get().string(), memoizedResult, 0);
+ int32_t memoizedResult = castedThis->wrapped().nondeterministicReadonlyAttr();
+ cursor.appendInput<MemoizedDOMResult<int32_t>>(bindingName.get().string(), memoizedResult, 0);
JSValue result = jsNumber(memoizedResult);
return JSValue::encode(result);
}
if (cursor.isReplaying()) {
- int memoizedResult;
+ int32_t memoizedResult;
MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
- if (input && input->convertTo<int>(memoizedResult)) {
+ if (input && input->convertTo<int32_t>(memoizedResult)) {
JSValue result = jsNumber(memoizedResult);
return JSValue::encode(result);
}
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (200555 => 200556)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-05-08 18:29:04 UTC (rev 200556)
@@ -2690,7 +2690,7 @@
return throwSetterTypeError(*state, "TestObj", "byteAttr");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt8(state, value, NormalConversion);
+ auto nativeValue = convert<int8_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setByteAttr(WTFMove(nativeValue));
@@ -2707,7 +2707,7 @@
return throwSetterTypeError(*state, "TestObj", "octetAttr");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toUInt8(state, value, NormalConversion);
+ auto nativeValue = convert<uint8_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setOctetAttr(WTFMove(nativeValue));
@@ -2724,7 +2724,7 @@
return throwSetterTypeError(*state, "TestObj", "shortAttr");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt16(state, value, NormalConversion);
+ auto nativeValue = convert<int16_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setShortAttr(WTFMove(nativeValue));
@@ -2741,7 +2741,7 @@
return throwSetterTypeError(*state, "TestObj", "clampedShortAttr");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt16(state, value, Clamp);
+ auto nativeValue = convert<int16_t>(*state, value, Clamp);
if (UNLIKELY(state->hadException()))
return false;
impl.setClampedShortAttr(WTFMove(nativeValue));
@@ -2758,7 +2758,7 @@
return throwSetterTypeError(*state, "TestObj", "enforceRangeShortAttr");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt16(state, value, EnforceRange);
+ auto nativeValue = convert<int16_t>(*state, value, EnforceRange);
if (UNLIKELY(state->hadException()))
return false;
impl.setEnforceRangeShortAttr(WTFMove(nativeValue));
@@ -2775,7 +2775,7 @@
return throwSetterTypeError(*state, "TestObj", "unsignedShortAttr");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toUInt16(state, value, NormalConversion);
+ auto nativeValue = convert<uint16_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setUnsignedShortAttr(WTFMove(nativeValue));
@@ -2792,7 +2792,7 @@
return throwSetterTypeError(*state, "TestObj", "longAttr");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setLongAttr(WTFMove(nativeValue));
@@ -2809,7 +2809,7 @@
return throwSetterTypeError(*state, "TestObj", "longLongAttr");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt64(state, value, NormalConversion);
+ auto nativeValue = convert<int64_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setLongLongAttr(WTFMove(nativeValue));
@@ -2826,7 +2826,7 @@
return throwSetterTypeError(*state, "TestObj", "unsignedLongLongAttr");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toUInt64(state, value, NormalConversion);
+ auto nativeValue = convert<uint64_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setUnsignedLongLongAttr(WTFMove(nativeValue));
@@ -2983,7 +2983,7 @@
return throwSetterTypeError(*state, "TestObj", "reflectedIntegralAttr");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, WTFMove(nativeValue));
@@ -3000,7 +3000,7 @@
return throwSetterTypeError(*state, "TestObj", "reflectedUnsignedIntegralAttr");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toUInt32(state, value, NormalConversion);
+ auto nativeValue = convert<uint32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, WTFMove(nativeValue));
@@ -3068,7 +3068,7 @@
return throwSetterTypeError(*state, "TestObj", "reflectedCustomIntegralAttr");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, WTFMove(nativeValue));
@@ -3159,7 +3159,7 @@
return throwSetterTypeError(*state, "TestObj", "attrWithGetterException");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setAttrWithGetterException(WTFMove(nativeValue));
@@ -3176,7 +3176,7 @@
return throwSetterTypeError(*state, "TestObj", "attrWithGetterExceptionWithMessage");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setAttrWithGetterExceptionWithMessage(WTFMove(nativeValue));
@@ -3194,7 +3194,7 @@
}
auto& impl = castedThis->wrapped();
ExceptionCode ec = 0;
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setAttrWithSetterException(WTFMove(nativeValue), ec);
@@ -3213,7 +3213,7 @@
}
auto& impl = castedThis->wrapped();
ExceptionCodeWithMessage ec;
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setAttrWithSetterExceptionWithMessage(WTFMove(nativeValue), ec);
@@ -3328,7 +3328,7 @@
return throwSetterTypeError(*state, "TestObj", "withScriptStateAttribute");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setWithScriptStateAttribute(*state, WTFMove(nativeValue));
@@ -3345,7 +3345,7 @@
return throwSetterTypeError(*state, "TestObj", "withCallWithAndSetterCallWithAttribute");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setWithCallWithAndSetterCallWithAttribute(*state, activeDOMWindow(state), firstDOMWindow(state), WTFMove(nativeValue));
@@ -3511,7 +3511,7 @@
return throwSetterTypeError(*state, "TestObj", "conditionalAttr1");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setConditionalAttr1(WTFMove(nativeValue));
@@ -3530,7 +3530,7 @@
return throwSetterTypeError(*state, "TestObj", "conditionalAttr2");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setConditionalAttr2(WTFMove(nativeValue));
@@ -3549,7 +3549,7 @@
return throwSetterTypeError(*state, "TestObj", "conditionalAttr3");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setConditionalAttr3(WTFMove(nativeValue));
@@ -3657,7 +3657,7 @@
return throwSetterTypeError(*state, "TestObj", "strawberry");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setBlueberry(WTFMove(nativeValue));
@@ -3691,7 +3691,7 @@
return throwSetterTypeError(*state, "TestObj", "id");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setId(WTFMove(nativeValue));
@@ -3721,7 +3721,7 @@
return throwSetterTypeError(*state, "TestObj", "nullableLongSettableAttribute");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setNullableLongSettableAttribute(WTFMove(nativeValue));
@@ -3755,7 +3755,7 @@
return throwSetterTypeError(*state, "TestObj", "nullableStringValue");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setNullableStringValue(WTFMove(nativeValue));
@@ -3865,7 +3865,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto testParam = toInt32(state, state->argument(0), NormalConversion);
+ auto testParam = convert<int32_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.enabledAtRuntimeOperation(WTFMove(testParam));
@@ -3914,7 +3914,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 3))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto longArg = toInt32(state, state->argument(0), NormalConversion);
+ auto longArg = convert<int32_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
auto strArg = state->argument(1).toWTFString(state);
@@ -3949,7 +3949,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 3))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto byteArg = toInt8(state, state->argument(0), NormalConversion);
+ auto byteArg = convert<int8_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
auto strArg = state->argument(1).toWTFString(state);
@@ -3984,7 +3984,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 3))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto octetArg = toUInt8(state, state->argument(0), NormalConversion);
+ auto octetArg = convert<uint8_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
auto strArg = state->argument(1).toWTFString(state);
@@ -4019,7 +4019,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 3))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto longArg = toInt32(state, state->argument(0), NormalConversion);
+ auto longArg = convert<int32_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
auto strArg = state->argument(1).toWTFString(state);
@@ -4054,7 +4054,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 3))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto longArg = toInt32(state, state->argument(0), NormalConversion);
+ auto longArg = convert<int32_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
auto strArg = state->argument(1).toWTFString(state);
@@ -4143,7 +4143,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto index = toUInt32(state, state->argument(0), NormalConversion);
+ auto index = convert<uint32_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
JSValue result = jsStringOrNull(state, impl.nullableStringSpecialMethod(WTFMove(index)));
@@ -4177,7 +4177,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto longArg = toInt32(state, state->argument(0), NormalConversion);
+ auto longArg = convert<int32_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
JSValue result = jsArray(state, castedThis->globalObject(), impl.methodReturningSequence(WTFMove(longArg)));
@@ -4543,7 +4543,7 @@
return throwThisTypeError(*state, "TestObj", "methodWithOptionalArg");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- auto opt = state->argument(0).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(0), NormalConversion);
+ auto opt = state->argument(0).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithOptionalArg(WTFMove(opt));
@@ -4558,7 +4558,7 @@
return throwThisTypeError(*state, "TestObj", "methodWithOptionalArgAndDefaultValue");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- auto opt = state->argument(0).isUndefined() ? 666 : toInt32(state, state->uncheckedArgument(0), NormalConversion);
+ auto opt = state->argument(0).isUndefined() ? 666 : convert<int32_t>(*state, state->uncheckedArgument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithOptionalArgAndDefaultValue(WTFMove(opt));
@@ -4575,10 +4575,10 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto nonOpt = toInt32(state, state->argument(0), NormalConversion);
+ auto nonOpt = convert<int32_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- auto opt = state->argument(1).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(1), NormalConversion);
+ auto opt = state->argument(1).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(1), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithNonOptionalArgAndOptionalArg(WTFMove(nonOpt), WTFMove(opt));
@@ -4595,13 +4595,13 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto nonOpt = toInt32(state, state->argument(0), NormalConversion);
+ auto nonOpt = convert<int32_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- auto opt1 = state->argument(1).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(1), NormalConversion);
+ auto opt1 = state->argument(1).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(1), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- auto opt2 = state->argument(2).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(2), NormalConversion);
+ auto opt2 = state->argument(2).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(2), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithNonOptionalArgAndTwoOptionalArgs(WTFMove(nonOpt), WTFMove(opt1), WTFMove(opt2));
@@ -4796,7 +4796,7 @@
return throwThisTypeError(*state, "TestObj", "methodWithOptionalLongLong");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- auto number = state->argument(0).isUndefined() ? Optional<long long>() : toInt64(state, state->uncheckedArgument(0), NormalConversion);
+ auto number = state->argument(0).isUndefined() ? Optional<int64_t>() : convert<int64_t>(*state, state->uncheckedArgument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithOptionalLongLong(WTFMove(number));
@@ -4811,7 +4811,7 @@
return throwThisTypeError(*state, "TestObj", "methodWithOptionalLongLongIsZero");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- auto number = toInt64(state, state->argument(0), NormalConversion);
+ auto number = convert<int64_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithOptionalLongLongIsZero(WTFMove(number));
@@ -4826,7 +4826,7 @@
return throwThisTypeError(*state, "TestObj", "methodWithOptionalUnsignedLongLong");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- auto number = state->argument(0).isUndefined() ? Optional<unsigned long long>() : toUInt64(state, state->uncheckedArgument(0), NormalConversion);
+ auto number = state->argument(0).isUndefined() ? Optional<uint64_t>() : convert<uint64_t>(*state, state->uncheckedArgument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithOptionalUnsignedLongLong(WTFMove(number));
@@ -4841,7 +4841,7 @@
return throwThisTypeError(*state, "TestObj", "methodWithOptionalUnsignedLongLongIsZero");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- auto number = toUInt64(state, state->argument(0), NormalConversion);
+ auto number = convert<uint64_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithOptionalUnsignedLongLongIsZero(WTFMove(number));
@@ -4989,7 +4989,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto nonCallback = toInt32(state, state->argument(0), NormalConversion);
+ auto nonCallback = convert<int32_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
if (UNLIKELY(!state->argument(1).isObject()))
@@ -5044,7 +5044,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto nonCallback = toInt32(state, state->argument(0), NormalConversion);
+ auto nonCallback = convert<int32_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
if (UNLIKELY(!state->argument(1).isFunction()))
@@ -5169,7 +5169,7 @@
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
auto objArg = JSTestObj::toWrapped(state->argument(0));
- auto longArg = state->argument(1).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(1), NormalConversion);
+ auto longArg = state->argument(1).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(1), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.overloadedMethod(WTFMove(objArg), WTFMove(longArg));
@@ -5203,7 +5203,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto longArg = toInt32(state, state->argument(0), NormalConversion);
+ auto longArg = convert<int32_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.overloadedMethod(WTFMove(longArg));
@@ -5305,7 +5305,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto arrayArg = toNativeArray<unsigned>(state, state->argument(0));
+ auto arrayArg = toNativeArray<uint32_t>(state, state->argument(0));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.overloadedMethod(WTFMove(arrayArg));
@@ -5408,7 +5408,7 @@
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
auto objArg = JSTestObj::toWrapped(state->argument(0));
- auto longArg = state->argument(1).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(1), NormalConversion);
+ auto longArg = state->argument(1).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(1), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.overloadedMethodWithOptionalParameter(WTFMove(objArg), WTFMove(longArg));
@@ -5437,7 +5437,7 @@
EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionClassMethodWithOptional(ExecState* state)
{
- auto arg = state->argument(0).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(0), NormalConversion);
+ auto arg = state->argument(0).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
JSValue result = jsNumber(TestObj::classMethodWithOptional(WTFMove(arg)));
@@ -5456,7 +5456,7 @@
{
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto arg = toInt32(state, state->argument(0), NormalConversion);
+ auto arg = convert<int32_t>(*state, state->argument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
TestObj::overloadedMethod1(WTFMove(arg));
@@ -5508,10 +5508,10 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto objArgsShort = toUInt16(state, state->argument(0), Clamp);
+ auto objArgsShort = convert<uint16_t>(*state, state->argument(0), Clamp);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- auto objArgsLong = toUInt32(state, state->argument(1), Clamp);
+ auto objArgsLong = convert<uint32_t>(*state, state->argument(1), Clamp);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.classMethodWithClamp(WTFMove(objArgsShort), WTFMove(objArgsLong));
@@ -5528,10 +5528,10 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto objArgsShort = toUInt16(state, state->argument(0), EnforceRange);
+ auto objArgsShort = convert<uint16_t>(*state, state->argument(0), EnforceRange);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- auto objArgsLong = toUInt32(state, state->argument(1), EnforceRange);
+ auto objArgsLong = convert<uint32_t>(*state, state->argument(1), EnforceRange);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.classMethodWithEnforceRange(WTFMove(objArgsShort), WTFMove(objArgsLong));
@@ -5548,7 +5548,7 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto unsignedLongSequence = toNativeArray<unsigned>(state, state->argument(0));
+ auto unsignedLongSequence = toNativeArray<uint32_t>(state, state->argument(0));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithUnsignedLongSequence(WTFMove(unsignedLongSequence));
@@ -5607,10 +5607,10 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto arrayArg = toNativeArray<unsigned>(state, state->argument(0));
+ auto arrayArg = toNativeArray<uint32_t>(state, state->argument(0));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- auto nullableArrayArg = toNativeArray<unsigned>(state, state->argument(1));
+ auto nullableArrayArg = toNativeArray<uint32_t>(state, state->argument(1));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithAndWithoutNullableSequence(WTFMove(arrayArg), WTFMove(nullableArrayArg));
@@ -5627,10 +5627,10 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto arrayArg = toNativeArray<unsigned>(state, state->argument(0));
+ auto arrayArg = toNativeArray<uint32_t>(state, state->argument(0));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- auto nullableArrayArg = toNativeArray<unsigned>(state, state->argument(1));
+ auto nullableArrayArg = toNativeArray<uint32_t>(state, state->argument(1));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.methodWithAndWithoutNullableSequence2(WTFMove(arrayArg), WTFMove(nullableArrayArg));
@@ -5773,7 +5773,7 @@
auto a = convert<float>(*state, state->argument(1), ShouldAllowNonFinite::Yes);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- auto b = toInt32(state, state->argument(2), NormalConversion);
+ auto b = convert<int32_t>(*state, state->argument(2), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
JSValue result = jsBoolean(impl.strictFunction(WTFMove(str), WTFMove(a), WTFMove(b), ec));
@@ -5798,7 +5798,7 @@
auto objArg = JSTestObj::toWrapped(state->argument(0));
if (UNLIKELY(!objArg))
return throwVMTypeError(state);
- auto a = toNativeArray<unsigned>(state, state->argument(1));
+ auto a = toNativeArray<uint32_t>(state, state->argument(1));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
JSValue result = jsBoolean(impl.strictFunctionWithSequence(*objArg, WTFMove(a), ec));
@@ -5823,7 +5823,7 @@
auto objArg = JSTestObj::toWrapped(state->argument(0));
if (UNLIKELY(!objArg))
return throwVMTypeError(state);
- auto array = toNativeArray<int>(state, state->argument(1));
+ auto array = toNativeArray<int32_t>(state, state->argument(1));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
JSValue result = jsBoolean(impl.strictFunctionWithArray(*objArg, WTFMove(array), ec));
@@ -5908,7 +5908,7 @@
auto a = convert<float>(*state, state->argument(0), ShouldAllowNonFinite::Yes);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- auto b = toInt32(state, state->argument(1), NormalConversion);
+ auto b = convert<int32_t>(*state, state->argument(1), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.any(WTFMove(a), WTFMove(b));
@@ -5990,7 +5990,7 @@
return throwThisTypeError(*state, "TestObj", "testPromiseFunctionWithOptionalIntArgument");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
auto& impl = castedThis->wrapped();
- auto a = state->argument(0).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(0), NormalConversion);
+ auto a = state->argument(0).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(0), NormalConversion);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.testPromiseFunctionWithOptionalIntArgument(WTFMove(a), DeferredWrapper(state, castedThis->globalObject(), promiseDeferred));
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp (200555 => 200556)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp 2016-05-08 18:29:04 UTC (rev 200556)
@@ -120,7 +120,7 @@
static inline EncodedJSValue constructJSTestOverloadedConstructors5(ExecState* state)
{
auto* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(state->callee());
- Vector<int> longArgs = toNativeArguments<int>(state, 0);
+ Vector<int32_t> longArgs = toNativeArguments<int32_t>(state, 0);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
RefPtr<TestOverloadedConstructors> object = TestOverloadedConstructors::create(longArgs);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (200555 => 200556)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2016-05-08 16:54:09 UTC (rev 200555)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2016-05-08 18:29:04 UTC (rev 200556)
@@ -354,7 +354,7 @@
return throwSetterTypeError(*state, "TestTypedefs", "unsignedLongLongAttr");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toUInt64(state, value, NormalConversion);
+ auto nativeValue = convert<uint64_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setUnsignedLongLongAttr(WTFMove(nativeValue));
@@ -388,7 +388,7 @@
return throwSetterTypeError(*state, "TestTypedefs", "attrWithGetterException");
}
auto& impl = castedThis->wrapped();
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setAttrWithGetterException(WTFMove(nativeValue));
@@ -406,7 +406,7 @@
}
auto& impl = castedThis->wrapped();
ExceptionCode ec = 0;
- auto nativeValue = toInt32(state, value, NormalConversion);
+ auto nativeValue = convert<int32_t>(*state, value, NormalConversion);
if (UNLIKELY(state->hadException()))
return false;
impl.setAttrWithSetterException(WTFMove(nativeValue), ec);
@@ -464,7 +464,7 @@
return throwThisTypeError(*state, "TestTypedefs", "func");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
auto& impl = castedThis->wrapped();
- auto x = toNativeArray<int>(state, state->argument(0));
+ auto x = toNativeArray<int32_t>(state, state->argument(0));
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.func(WTFMove(x));
@@ -544,10 +544,10 @@
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, createNotEnoughArgumentsError(state));
- auto arg1 = toUInt64(state, state->argument(0), Clamp);
+ auto arg1 = convert<uint64_t>(*state, state->argument(0), Clamp);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
- auto arg2 = state->argument(1).isUndefined() ? Optional<unsigned long long>() : toUInt64(state, state->uncheckedArgument(1), Clamp);
+ auto arg2 = state->argument(1).isUndefined() ? Optional<uint64_t>() : convert<uint64_t>(*state, state->uncheckedArgument(1), Clamp);
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
impl.funcWithClamp(WTFMove(arg1), WTFMove(arg2));