Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index d1e782f7d35af10bfb47e28b6e3f060449cbe06d..19b877823c339f24fc06fd59093d1007cff8f6a6 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -2829,8 +2829,8 @@ Local<Uint32> Value::ToArrayIndex() const { |
int32_t Value::Int32Value() const { |
i::Handle<i::Object> obj = Utils::OpenHandle(this); |
- if (obj->IsSmi()) { |
- return i::Smi::cast(*obj)->value(); |
+ if (obj->IsNumber()) { |
+ return NumberToInt32(*obj); |
} else { |
i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate(); |
LOG_API(isolate, "Int32Value (slow)"); |
@@ -2930,8 +2930,8 @@ bool Value::SameValue(Handle<Value> that) const { |
uint32_t Value::Uint32Value() const { |
i::Handle<i::Object> obj = Utils::OpenHandle(this); |
- if (obj->IsSmi()) { |
- return i::Smi::cast(*obj)->value(); |
+ if (obj->IsNumber()) { |
+ return NumberToUint32(*obj); |
} else { |
i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate(); |
LOG_API(isolate, "Uint32Value"); |