| Index: src/objects-inl.h
|
| diff --git a/src/objects-inl.h b/src/objects-inl.h
|
| index 779fd39ef96f9c9b78456d0c22a1cb87efc05a15..2781ccff2e0530643a5d87a1473afefd22bec920 100644
|
| --- a/src/objects-inl.h
|
| +++ b/src/objects-inl.h
|
| @@ -635,6 +635,26 @@ bool Object::IsNumber() const {
|
| }
|
|
|
|
|
| +bool Object::IsInt32() const {
|
| + if (IsSmi()) return true;
|
| + if (IsNumber()) {
|
| + return IsInt32Double(Number());
|
| + }
|
| + return false;
|
| +}
|
| +
|
| +
|
| +bool Object::IsUint32() const {
|
| + if (IsSmi()) return Smi::cast(this)->value() >= 0;
|
| + if (IsNumber()) {
|
| + double value = Number();
|
| + return !i::IsMinusZero(value) && value >= 0 && value <= kMaxUInt32 &&
|
| + value == FastUI2D(i::FastD2UI(value));
|
| + }
|
| + return false;
|
| +}
|
| +
|
| +
|
| TYPE_CHECKER(ByteArray, BYTE_ARRAY_TYPE)
|
| TYPE_CHECKER(FreeSpace, FREE_SPACE_TYPE)
|
|
|
| @@ -1091,11 +1111,11 @@ bool Object::IsArgumentsMarker() const {
|
| }
|
|
|
|
|
| -double Object::Number() {
|
| +double Object::Number() const {
|
| DCHECK(IsNumber());
|
| return IsSmi()
|
| - ? static_cast<double>(reinterpret_cast<Smi*>(this)->value())
|
| - : reinterpret_cast<HeapNumber*>(this)->value();
|
| + ? static_cast<double>(reinterpret_cast<const Smi*>(this)->value())
|
| + : reinterpret_cast<const HeapNumber*>(this)->value();
|
| }
|
|
|
|
|
|
|