Chromium Code Reviews| Index: src/api.cc |
| diff --git a/src/api.cc b/src/api.cc |
| index f285980f6b654d289e82f62bd4963b3c1ccab1a9..2658a8ebb950ef2d4f37fd58fcffb931ad054513 100644 |
| --- a/src/api.cc |
| +++ b/src/api.cc |
| @@ -2675,28 +2675,10 @@ bool Value::IsExternal() const { |
| } |
| -bool Value::IsInt32() const { |
| - i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| - if (obj->IsSmi()) return true; |
| - if (obj->IsNumber()) { |
| - return i::IsInt32Double(obj->Number()); |
| - } |
| - return false; |
| -} |
| +bool Value::IsInt32() const { return Utils::OpenHandle(this)->IsInt32(); } |
|
dcarney
2015/03/12 10:45:58
i don't think v8 cares internally about this disti
bashi
2015/03/12 12:19:19
Right. Reverted.
|
| -bool Value::IsUint32() const { |
| - i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| - if (obj->IsSmi()) return i::Smi::cast(*obj)->value() >= 0; |
| - if (obj->IsNumber()) { |
| - double value = obj->Number(); |
| - return !i::IsMinusZero(value) && |
| - value >= 0 && |
| - value <= i::kMaxUInt32 && |
| - value == i::FastUI2D(i::FastD2UI(value)); |
| - } |
| - return false; |
| -} |
| +bool Value::IsUint32() const { return Utils::OpenHandle(this)->IsUint32(); } |
|
dcarney
2015/03/12 10:45:58
same
|
| static bool CheckConstructor(i::Isolate* isolate, |
| @@ -2973,6 +2955,20 @@ void v8::Integer::CheckCast(v8::Value* that) { |
| } |
| +void v8::Int32::CheckCast(v8::Value* that) { |
| + i::Handle<i::Object> obj = Utils::OpenHandle(that); |
| + Utils::ApiCheck(obj->IsInt32(), "v8::Int32::Cast()", |
|
dcarney
2015/03/12 10:45:58
just use that->IsInt32()
bashi
2015/03/12 12:19:19
Done.
|
| + "Could not convert to 32-bit signed integer"); |
| +} |
| + |
| + |
| +void v8::Uint32::CheckCast(v8::Value* that) { |
| + i::Handle<i::Object> obj = Utils::OpenHandle(that); |
|
dcarney
2015/03/12 10:45:58
same
|
| + Utils::ApiCheck(obj->IsUint32(), "v8::Uint32::Cast()", |
| + "Could not convert to 32-bit unsigned integer"); |
| +} |
| + |
| + |
| void v8::Array::CheckCast(Value* that) { |
| i::Handle<i::Object> obj = Utils::OpenHandle(that); |
| Utils::ApiCheck(obj->IsJSArray(), |