Index: Source/bindings/core/v8/V8Binding.h |
diff --git a/Source/bindings/core/v8/V8Binding.h b/Source/bindings/core/v8/V8Binding.h |
index 170c48bf19c394b3b7d9881dae81306670ba41cf..e07d5d9d6ed050f542f51f9e5b293df64a7b75cf 100644 |
--- a/Source/bindings/core/v8/V8Binding.h |
+++ b/Source/bindings/core/v8/V8Binding.h |
@@ -436,12 +436,24 @@ uint32_t toUInt32Slow(v8::Handle<v8::Value>, IntegerConversionConfiguration, Exc |
inline uint32_t toUInt32(v8::Handle<v8::Value> value, IntegerConversionConfiguration configuration, ExceptionState& exceptionState) |
{ |
// Fast case. The value is already a 32-bit unsigned integer. |
- if (value->IsUint32()) |
- return value->Uint32Value(); |
+ if (value->IsUint32()) { |
bashi
2015/03/11 10:30:37
Now this doesn't look 'fast case'. Should we remov
Jens Widell
2015/03/11 10:56:37
We might want to investigate the performance impac
Yuki
2015/03/11 13:11:53
This reminds me of the following comment on an iss
|
+ uint32_t result; |
+ if (!getValueFromMaybe(value->Uint32Value(exceptionState.isolate()->GetCurrentContext()), result)) { |
+ exceptionState.throwTypeError("Cannot convert to a 32 bit unsigned integer."); |
+ return 0; |
+ } |
+ return result; |
+ } |
// Fast case. The value is a 32-bit signed integer with NormalConversion configuration. |
- if (value->IsInt32() && configuration == NormalConversion) |
- return value->Int32Value(); |
+ if (value->IsInt32() && configuration == NormalConversion) { |
+ int32_t result; |
+ if (!getValueFromMaybe(value->Int32Value(exceptionState.isolate()->GetCurrentContext()), result)) { |
+ exceptionState.throwTypeError("Cannot convert to a 32 bit integer."); |
+ return 0; |
+ } |
+ return result; |
+ } |
return toUInt32Slow(value, configuration, exceptionState); |
} |
@@ -484,7 +496,7 @@ double toDoubleSlow(v8::Handle<v8::Value>, ExceptionState&); |
inline double toDouble(v8::Handle<v8::Value> value, ExceptionState& exceptionState) |
{ |
if (value->IsNumber()) |
- return value->NumberValue(); |
+ return value.As<v8::Number>()->Value(); |
return toDoubleSlow(value, exceptionState); |
} |
@@ -514,9 +526,9 @@ inline v8::Handle<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) |
inline double toCoreDate(v8::Handle<v8::Value> object) |
{ |
if (object->IsDate()) |
- return v8::Handle<v8::Date>::Cast(object)->ValueOf(); |
+ return object.As<v8::Date>()->ValueOf(); |
if (object->IsNumber()) |
- return object->NumberValue(); |
+ return object.As<v8::Number>()->Value(); |
return std::numeric_limits<double>::quiet_NaN(); |
} |