Skip to content

Commit 5e57bcc

Browse files
committed
bindings: update to new v8 apis
GetPointerFromInternalField() is deprecated now, we should use GetAlignedPointerFromInternalField().
1 parent 7b4d95a commit 5e57bcc

10 files changed

Lines changed: 25 additions & 25 deletions

src/fs_event_wrap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ Handle<Value> FSEventWrap::Close(const Arguments& args) {
171171
// and legal, HandleWrap::Close() deals with them the same way.
172172
assert(!args.Holder().IsEmpty());
173173
assert(args.Holder()->InternalFieldCount() > 0);
174-
void* ptr = args.Holder()->GetPointerFromInternalField(0);
174+
void* ptr = args.Holder()->GetAlignedPointerFromInternalField(0);
175175
FSEventWrap* wrap = static_cast<FSEventWrap*>(ptr);
176176

177177
if (wrap == NULL || wrap->initialized_ == false) return Undefined();

src/handle_wrap.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#define UNWRAP_NO_ABORT(type) \
2727
assert(!args.Holder().IsEmpty()); \
2828
assert(args.Holder()->InternalFieldCount() > 0); \
29-
type* wrap = \
30-
static_cast<type*>(args.Holder()->GetPointerFromInternalField(0));
29+
type* wrap = static_cast<type*>( \
30+
args.Holder()->GetAlignedPointerFromInternalField(0));
3131

3232
namespace node {
3333

@@ -88,7 +88,7 @@ Handle<Value> HandleWrap::Close(const Arguments& args) {
8888
HandleScope scope;
8989

9090
HandleWrap *wrap = static_cast<HandleWrap*>(
91-
args.Holder()->GetPointerFromInternalField(0));
91+
args.Holder()->GetAlignedPointerFromInternalField(0));
9292

9393
// guard against uninitialized handle or double close
9494
if (wrap && wrap->handle__) {
@@ -112,7 +112,7 @@ HandleWrap::HandleWrap(Handle<Object> object, uv_handle_t* h) {
112112
assert(object_.IsEmpty());
113113
assert(object->InternalFieldCount() > 0);
114114
object_ = v8::Persistent<v8::Object>::New(object);
115-
object_->SetPointerInInternalField(0, this);
115+
object_->SetAlignedPointerInInternalField(0, this);
116116
ngx_queue_insert_tail(&handle_wrap_queue, &handle_wrap_queue_);
117117
}
118118

@@ -138,7 +138,7 @@ void HandleWrap::OnClose(uv_handle_t* handle) {
138138
// But the handle pointer should be gone.
139139
assert(wrap->handle__ == NULL);
140140

141-
wrap->object_->SetPointerInInternalField(0, NULL);
141+
wrap->object_->SetAlignedPointerInInternalField(0, NULL);
142142
wrap->object_.Dispose();
143143
wrap->object_.Clear();
144144

src/node_internals.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ inline static v8::Handle<v8::Value> ThrowRangeError(const char* errmsg) {
8686
#define UNWRAP(type) \
8787
assert(!args.Holder().IsEmpty()); \
8888
assert(args.Holder()->InternalFieldCount() > 0); \
89-
type* wrap = \
90-
static_cast<type*>(args.Holder()->GetPointerFromInternalField(0)); \
89+
type* wrap = static_cast<type*>( \
90+
args.Holder()->GetAlignedPointerFromInternalField(0)); \
9191
if (!wrap) { \
9292
fprintf(stderr, #type ": Aborting due to unwrap failure at %s:%d\n", \
9393
__FILE__, __LINE__); \

src/node_object_wrap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class NODE_EXTERN ObjectWrap {
5959
static inline T* Unwrap (v8::Handle<v8::Object> handle) {
6060
assert(!handle.IsEmpty());
6161
assert(handle->InternalFieldCount() > 0);
62-
return static_cast<T*>(handle->GetPointerFromInternalField(0));
62+
return static_cast<T*>(handle->GetAlignedPointerFromInternalField(0));
6363
}
6464

6565

@@ -70,7 +70,7 @@ class NODE_EXTERN ObjectWrap {
7070
assert(handle_.IsEmpty());
7171
assert(handle->InternalFieldCount() > 0);
7272
handle_ = v8::Persistent<v8::Object>::New(handle);
73-
handle_->SetPointerInInternalField(0, this);
73+
handle_->SetAlignedPointerInInternalField(0, this);
7474
MakeWeak();
7575
}
7676

src/pipe_wrap.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Local<Object> PipeWrap::Instantiate() {
6868
PipeWrap* PipeWrap::Unwrap(Local<Object> obj) {
6969
assert(!obj.IsEmpty());
7070
assert(obj->InternalFieldCount() > 0);
71-
return static_cast<PipeWrap*>(obj->GetPointerFromInternalField(0));
71+
return static_cast<PipeWrap*>(obj->GetAlignedPointerFromInternalField(0));
7272
}
7373

7474

@@ -204,7 +204,7 @@ void PipeWrap::OnConnection(uv_stream_t* handle, int status) {
204204
// Unwrap the client javascript object.
205205
assert(client_obj->InternalFieldCount() > 0);
206206
PipeWrap* client_wrap =
207-
static_cast<PipeWrap*>(client_obj->GetPointerFromInternalField(0));
207+
static_cast<PipeWrap*>(client_obj->GetAlignedPointerFromInternalField(0));
208208

209209
if (uv_accept(handle, (uv_stream_t*)&client_wrap->handle_)) return;
210210

src/stream_wrap.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ void StreamWrap::OnReadCommon(uv_stream_t* handle, ssize_t nread,
220220

221221
if (!pending_obj.IsEmpty()) {
222222
assert(pending_obj->InternalFieldCount() > 0);
223-
StreamWrap* pending_wrap =
224-
static_cast<StreamWrap*>(pending_obj->GetPointerFromInternalField(0));
223+
StreamWrap* pending_wrap = static_cast<StreamWrap*>(
224+
pending_obj->GetAlignedPointerFromInternalField(0));
225225
if (uv_accept(handle, pending_wrap->GetStream())) abort();
226226
argv[3] = pending_obj;
227227
argc++;
@@ -408,7 +408,7 @@ Handle<Value> StreamWrap::WriteStringImpl(const Arguments& args) {
408408
Local<Object> send_stream_obj = args[1]->ToObject();
409409
assert(send_stream_obj->InternalFieldCount() > 0);
410410
StreamWrap* send_stream_wrap = static_cast<StreamWrap*>(
411-
send_stream_obj->GetPointerFromInternalField(0));
411+
send_stream_obj->GetAlignedPointerFromInternalField(0));
412412
send_stream = send_stream_wrap->GetStream();
413413
}
414414

src/tcp_wrap.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void TCPWrap::Initialize(Handle<Object> target) {
120120
TCPWrap* TCPWrap::Unwrap(Local<Object> obj) {
121121
assert(!obj.IsEmpty());
122122
assert(obj->InternalFieldCount() > 0);
123-
return static_cast<TCPWrap*>(obj->GetPointerFromInternalField(0));
123+
return static_cast<TCPWrap*>(obj->GetAlignedPointerFromInternalField(0));
124124
}
125125

126126

@@ -316,8 +316,8 @@ void TCPWrap::OnConnection(uv_stream_t* handle, int status) {
316316

317317
// Unwrap the client javascript object.
318318
assert(client_obj->InternalFieldCount() > 0);
319-
TCPWrap* client_wrap =
320-
static_cast<TCPWrap*>(client_obj->GetPointerFromInternalField(0));
319+
TCPWrap* client_wrap = static_cast<TCPWrap*>(
320+
client_obj->GetAlignedPointerFromInternalField(0));
321321

322322
if (uv_accept(handle, (uv_stream_t*)&client_wrap->handle_)) return;
323323

src/tty_wrap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void TTYWrap::Initialize(Handle<Object> target) {
7878
TTYWrap* TTYWrap::Unwrap(Local<Object> obj) {
7979
assert(!obj.IsEmpty());
8080
assert(obj->InternalFieldCount() > 0);
81-
return static_cast<TTYWrap*>(obj->GetPointerFromInternalField(0));
81+
return static_cast<TTYWrap*>(obj->GetAlignedPointerFromInternalField(0));
8282
}
8383

8484

src/udp_wrap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ void UDPWrap::OnRecv(uv_udp_t* handle,
388388
UDPWrap* UDPWrap::Unwrap(Local<Object> obj) {
389389
assert(!obj.IsEmpty());
390390
assert(obj->InternalFieldCount() > 0);
391-
return static_cast<UDPWrap*>(obj->GetPointerFromInternalField(0));
391+
return static_cast<UDPWrap*>(obj->GetAlignedPointerFromInternalField(0));
392392
}
393393

394394

src/v8_typed_array.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class ArrayBuffer {
106106
if (!buf)
107107
return ThrowError("Unable to allocate ArrayBuffer.");
108108

109-
args.This()->SetPointerInInternalField(0, buf);
109+
args.This()->SetAlignedPointerInInternalField(0, buf);
110110

111111
args.This()->Set(v8::String::New("byteLength"),
112112
v8::Integer::NewFromUnsigned(num_bytes),
@@ -157,8 +157,8 @@ class ArrayBuffer {
157157

158158
if (buffer.IsEmpty()) return v8::Undefined(); // constructor failed
159159

160-
void* src = args.This()->GetPointerFromInternalField(0);
161-
void* dest = buffer->GetPointerFromInternalField(0);
160+
void* src = args.This()->GetAlignedPointerFromInternalField(0);
161+
void* dest = buffer->GetAlignedPointerFromInternalField(0);
162162
memcpy(dest, static_cast<char*>(src) + begin, slice_length);
163163

164164
return buffer;
@@ -274,7 +274,7 @@ class TypedArray {
274274
GetFunction()->NewInstance(1, argv);
275275
if (buffer.IsEmpty()) return v8::Undefined(); // constructor failed
276276

277-
void* buf = buffer->GetPointerFromInternalField(0);
277+
void* buf = buffer->GetAlignedPointerFromInternalField(0);
278278
args.This()->SetIndexedPropertiesToExternalArrayData(
279279
buf, TEAType, length);
280280
// TODO(deanm): check for failure.
@@ -303,7 +303,7 @@ class TypedArray {
303303
GetFunction()->NewInstance(1, argv);
304304
if (buffer.IsEmpty()) return v8::Undefined(); // constructor failed
305305

306-
void* buf = buffer->GetPointerFromInternalField(0);
306+
void* buf = buffer->GetAlignedPointerFromInternalField(0);
307307
args.This()->SetIndexedPropertiesToExternalArrayData(
308308
buf, TEAType, length);
309309
// TODO(deanm): check for failure.

0 commit comments

Comments
 (0)