diff --git a/src/smalloc.cc b/src/smalloc.cc index e35602ab57..8694d80c16 100644 --- a/src/smalloc.cc +++ b/src/smalloc.cc @@ -141,10 +141,7 @@ void SliceOnto(const FunctionCallbackInfo& args) { void Alloc(const FunctionCallbackInfo& args) { HandleScope scope(node_isolate); - if (!args[0]->IsObject()) - return ThrowTypeError("argument must be an Object"); - - Local obj = args[0]->ToObject(); + Local obj = args[0].As(); size_t length = args[1]->Uint32Value(); if (obj->HasIndexedPropertiesInExternalArrayData()) @@ -197,7 +194,7 @@ void TargetCallback(Isolate* isolate, // for internal use: dispose(obj); void AllocDispose(const FunctionCallbackInfo& args) { - AllocDispose(args[0]->ToObject()); + AllocDispose(args[0].As()); }