Skip to content

Commit

Permalink
Revert "core: set PROVIDER type as Persistent class id"
Browse files Browse the repository at this point in the history
This reverts commit 3c44100.

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: #1827
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
  • Loading branch information
bnoordhuis committed May 28, 2015
1 parent a77c330 commit 3a1bc06
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/async-wrap-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ inline AsyncWrap::AsyncWrap(Environment* env,
v8::Handle<v8::Object> object,
ProviderType provider,
AsyncWrap* parent)
: BaseObject(env, object, provider),
bits_(static_cast<uint32_t>(provider) << 1) {
: BaseObject(env, object), bits_(static_cast<uint32_t>(provider) << 1) {
// Check user controlled flag to see if the init callback should run.
if (!env->using_asyncwrap())
return;
Expand Down
7 changes: 1 addition & 6 deletions src/base-object-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@

namespace node {

inline BaseObject::BaseObject(Environment* env,
v8::Local<v8::Object> handle,
const uint16_t class_id)
inline BaseObject::BaseObject(Environment* env, v8::Local<v8::Object> 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);
}


Expand Down
4 changes: 1 addition & 3 deletions src/base-object.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ class Environment;

class BaseObject {
public:
BaseObject(Environment* env,
v8::Local<v8::Object> handle,
const uint16_t class_id = 0);
BaseObject(Environment* env, v8::Local<v8::Object> handle);
virtual ~BaseObject();

// Returns the wrapped object. Returns an empty handle when
Expand Down

0 comments on commit 3a1bc06

Please sign in to comment.