From 3a1bc067d467c54853747e1697c7c1bcc010aae1 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 28 May 2015 21:11:12 +0200 Subject: [PATCH] Revert "core: set PROVIDER type as Persistent class id" This reverts commit 3c44100558b4e9e48e0e711e38acc91e0f870a9f. Reverted for breaking node-heapdump[0]. AsyncWrap assigns a class id but does not set a v8::RetainedObjectInfo provider callback with v8::HeapProfiler::SetWrapperClassInfoProvider(). The result is a null pointer dereference when taking a heap snapshot. It can probably be solved by setting a generic provider callback inside the AsyncWrap constructor but that may have performance ramifications that need to be investigated first. I move to revert it for now. [0] https://github.com/bnoordhuis/node-heapdump PR-URL: https://github.com/nodejs/io.js/pull/1827 Reviewed-By: Trevor Norris --- src/async-wrap-inl.h | 3 +-- src/base-object-inl.h | 7 +------ src/base-object.h | 4 +--- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/async-wrap-inl.h b/src/async-wrap-inl.h index 0518cd3b7ce002..bad634ddaf14b9 100644 --- a/src/async-wrap-inl.h +++ b/src/async-wrap-inl.h @@ -17,8 +17,7 @@ inline AsyncWrap::AsyncWrap(Environment* env, v8::Handle object, ProviderType provider, AsyncWrap* parent) - : BaseObject(env, object, provider), - bits_(static_cast(provider) << 1) { + : BaseObject(env, object), bits_(static_cast(provider) << 1) { // Check user controlled flag to see if the init callback should run. if (!env->using_asyncwrap()) return; diff --git a/src/base-object-inl.h b/src/base-object-inl.h index 775b07342edee9..db0daa1e82f559 100644 --- a/src/base-object-inl.h +++ b/src/base-object-inl.h @@ -10,15 +10,10 @@ namespace node { -inline BaseObject::BaseObject(Environment* env, - v8::Local handle, - const uint16_t class_id) +inline BaseObject::BaseObject(Environment* env, v8::Local handle) : handle_(env->isolate(), handle), env_(env) { CHECK_EQ(false, handle.IsEmpty()); - // Shift value 8 bits over to try avoiding conflict with anything else. - if (class_id != 0) - handle_.SetWrapperClassId(class_id << 8); } diff --git a/src/base-object.h b/src/base-object.h index 90abee4333fcb1..5a7b95827e8f11 100644 --- a/src/base-object.h +++ b/src/base-object.h @@ -9,9 +9,7 @@ class Environment; class BaseObject { public: - BaseObject(Environment* env, - v8::Local handle, - const uint16_t class_id = 0); + BaseObject(Environment* env, v8::Local handle); virtual ~BaseObject(); // Returns the wrapped object. Returns an empty handle when