| Index: src/objects-inl.h
|
| diff --git a/src/objects-inl.h b/src/objects-inl.h
|
| index b1165b3ae7ea74daef4df6ec236d76fdc3b2eaf7..6a338b2f7c05dee67d13eb3ef1e0252fa0c332c1 100644
|
| --- a/src/objects-inl.h
|
| +++ b/src/objects-inl.h
|
| @@ -651,7 +651,7 @@ class Utf8StringKey : public HashTableKey {
|
|
|
|
|
| bool Object::IsNumber() const {
|
| - return IsSmi() || IsHeapNumber();
|
| + return IsSmi() || HeapObject::cast(this)->IsHeapNumber();
|
| }
|
|
|
|
|
| @@ -1081,6 +1081,35 @@ MaybeHandle<Object> Object::ToPrimitive(Handle<Object> input,
|
| return JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(input), hint);
|
| }
|
|
|
| +// static
|
| +MaybeHandle<Object> Object::ToNumber(Handle<Object> input) {
|
| + if (input->IsNumber()) return input;
|
| + return ConvertToNumber(HeapObject::cast(*input)->GetIsolate(), input);
|
| +}
|
| +
|
| +// static
|
| +MaybeHandle<Object> Object::ToInteger(Isolate* isolate, Handle<Object> input) {
|
| + if (input->IsSmi()) return input;
|
| + return ConvertToInteger(isolate, input);
|
| +}
|
| +
|
| +// static
|
| +MaybeHandle<Object> Object::ToInt32(Isolate* isolate, Handle<Object> input) {
|
| + if (input->IsSmi()) return input;
|
| + return ConvertToInt32(isolate, input);
|
| +}
|
| +
|
| +// static
|
| +MaybeHandle<Object> Object::ToUint32(Isolate* isolate, Handle<Object> input) {
|
| + if (input->IsSmi()) return handle(Smi::cast(*input)->ToUint32Smi(), isolate);
|
| + return ConvertToUint32(isolate, input);
|
| +}
|
| +
|
| +// static
|
| +MaybeHandle<String> Object::ToString(Isolate* isolate, Handle<Object> input) {
|
| + if (input->IsString()) return Handle<String>::cast(input);
|
| + return ConvertToString(isolate, input);
|
| +}
|
|
|
| bool Object::HasSpecificClassOf(String* name) {
|
| return this->IsJSObject() && (JSObject::cast(this)->class_name() == name);
|
|
|