#include #include #include using namespace v8; void Alloc(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); Local obj = Object::New(isolate); size_t len = args[0]->Uint32Value(); node::smalloc::Alloc(isolate, obj, len); args.GetReturnValue().Set(obj); } void Dispose(const FunctionCallbackInfo& args) { node::smalloc::AllocDispose(args.GetIsolate(), args[0].As()); } void HasExternalData(const FunctionCallbackInfo& args) { args.GetReturnValue().Set( node::smalloc::HasExternalData(args.GetIsolate(), args[0].As())); } void init(Handle target) { NODE_SET_METHOD(target, "alloc", Alloc); NODE_SET_METHOD(target, "dispose", Dispose); NODE_SET_METHOD(target, "hasExternalData", HasExternalData); } NODE_MODULE(binding, init);