Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index cb97e7fdcf77c6fc899359a8bf36bba48cbd3169..cf4ea188fbcf512f936acbd1dc077ebb1e3de888 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -1570,6 +1570,18 @@ bool Value::IsInt32() const { |
} |
+bool Value::IsUint32() const { |
+ if (IsDeadCheck("v8::Value::IsUint32()")) return false; |
+ 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::FastUI2D(i::FastD2UI(value)) == value; |
+ } |
+ return false; |
+} |
+ |
+ |
bool Value::IsDate() const { |
if (IsDeadCheck("v8::Value::IsDate()")) return false; |
i::Handle<i::Object> obj = Utils::OpenHandle(this); |
@@ -2728,6 +2740,17 @@ int32_t Int32::Value() const { |
} |
+uint32_t Uint32::Value() const { |
+ if (IsDeadCheck("v8::Uint32::Value()")) return 0; |
+ i::Handle<i::Object> obj = Utils::OpenHandle(this); |
+ if (obj->IsSmi()) { |
+ return i::Smi::cast(*obj)->value(); |
+ } else { |
+ return static_cast<uint32_t>(obj->Number()); |
+ } |
+} |
+ |
+ |
int v8::Object::InternalFieldCount() { |
if (IsDeadCheck("v8::Object::InternalFieldCount()")) return 0; |
i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |