// and legal, HandleWrap::Close() deals with them the same way.
assert(!args.Holder().IsEmpty());
assert(args.Holder()->InternalFieldCount() > 0);
- void* ptr = args.Holder()->GetPointerFromInternalField(0);
+ void* ptr = args.Holder()->GetAlignedPointerFromInternalField(0);
FSEventWrap* wrap = static_cast<FSEventWrap*>(ptr);
if (wrap == NULL || wrap->initialized_ == false) return Undefined();
#define UNWRAP_NO_ABORT(type) \
assert(!args.Holder().IsEmpty()); \
assert(args.Holder()->InternalFieldCount() > 0); \
- type* wrap = \
- static_cast<type*>(args.Holder()->GetPointerFromInternalField(0));
+ type* wrap = static_cast<type*>( \
+ args.Holder()->GetAlignedPointerFromInternalField(0));
namespace node {
HandleScope scope;
HandleWrap *wrap = static_cast<HandleWrap*>(
- args.Holder()->GetPointerFromInternalField(0));
+ args.Holder()->GetAlignedPointerFromInternalField(0));
// guard against uninitialized handle or double close
if (wrap && wrap->handle__) {
assert(object_.IsEmpty());
assert(object->InternalFieldCount() > 0);
object_ = v8::Persistent<v8::Object>::New(object);
- object_->SetPointerInInternalField(0, this);
+ object_->SetAlignedPointerInInternalField(0, this);
ngx_queue_insert_tail(&handle_wrap_queue, &handle_wrap_queue_);
}
// But the handle pointer should be gone.
assert(wrap->handle__ == NULL);
- wrap->object_->SetPointerInInternalField(0, NULL);
+ wrap->object_->SetAlignedPointerInInternalField(0, NULL);
wrap->object_.Dispose();
wrap->object_.Clear();
#define UNWRAP(type) \
assert(!args.Holder().IsEmpty()); \
assert(args.Holder()->InternalFieldCount() > 0); \
- type* wrap = \
- static_cast<type*>(args.Holder()->GetPointerFromInternalField(0)); \
+ type* wrap = static_cast<type*>( \
+ args.Holder()->GetAlignedPointerFromInternalField(0)); \
if (!wrap) { \
fprintf(stderr, #type ": Aborting due to unwrap failure at %s:%d\n", \
__FILE__, __LINE__); \
static inline T* Unwrap (v8::Handle<v8::Object> handle) {
assert(!handle.IsEmpty());
assert(handle->InternalFieldCount() > 0);
- return static_cast<T*>(handle->GetPointerFromInternalField(0));
+ return static_cast<T*>(handle->GetAlignedPointerFromInternalField(0));
}
assert(handle_.IsEmpty());
assert(handle->InternalFieldCount() > 0);
handle_ = v8::Persistent<v8::Object>::New(handle);
- handle_->SetPointerInInternalField(0, this);
+ handle_->SetAlignedPointerInInternalField(0, this);
MakeWeak();
}
PipeWrap* PipeWrap::Unwrap(Local<Object> obj) {
assert(!obj.IsEmpty());
assert(obj->InternalFieldCount() > 0);
- return static_cast<PipeWrap*>(obj->GetPointerFromInternalField(0));
+ return static_cast<PipeWrap*>(obj->GetAlignedPointerFromInternalField(0));
}
// Unwrap the client javascript object.
assert(client_obj->InternalFieldCount() > 0);
PipeWrap* client_wrap =
- static_cast<PipeWrap*>(client_obj->GetPointerFromInternalField(0));
+ static_cast<PipeWrap*>(client_obj->GetAlignedPointerFromInternalField(0));
if (uv_accept(handle, (uv_stream_t*)&client_wrap->handle_)) return;
if (!pending_obj.IsEmpty()) {
assert(pending_obj->InternalFieldCount() > 0);
- StreamWrap* pending_wrap =
- static_cast<StreamWrap*>(pending_obj->GetPointerFromInternalField(0));
+ StreamWrap* pending_wrap = static_cast<StreamWrap*>(
+ pending_obj->GetAlignedPointerFromInternalField(0));
if (uv_accept(handle, pending_wrap->GetStream())) abort();
argv[3] = pending_obj;
argc++;
Local<Object> send_stream_obj = args[1]->ToObject();
assert(send_stream_obj->InternalFieldCount() > 0);
StreamWrap* send_stream_wrap = static_cast<StreamWrap*>(
- send_stream_obj->GetPointerFromInternalField(0));
+ send_stream_obj->GetAlignedPointerFromInternalField(0));
send_stream = send_stream_wrap->GetStream();
}
TCPWrap* TCPWrap::Unwrap(Local<Object> obj) {
assert(!obj.IsEmpty());
assert(obj->InternalFieldCount() > 0);
- return static_cast<TCPWrap*>(obj->GetPointerFromInternalField(0));
+ return static_cast<TCPWrap*>(obj->GetAlignedPointerFromInternalField(0));
}
// Unwrap the client javascript object.
assert(client_obj->InternalFieldCount() > 0);
- TCPWrap* client_wrap =
- static_cast<TCPWrap*>(client_obj->GetPointerFromInternalField(0));
+ TCPWrap* client_wrap = static_cast<TCPWrap*>(
+ client_obj->GetAlignedPointerFromInternalField(0));
if (uv_accept(handle, (uv_stream_t*)&client_wrap->handle_)) return;
TTYWrap* TTYWrap::Unwrap(Local<Object> obj) {
assert(!obj.IsEmpty());
assert(obj->InternalFieldCount() > 0);
- return static_cast<TTYWrap*>(obj->GetPointerFromInternalField(0));
+ return static_cast<TTYWrap*>(obj->GetAlignedPointerFromInternalField(0));
}
UDPWrap* UDPWrap::Unwrap(Local<Object> obj) {
assert(!obj.IsEmpty());
assert(obj->InternalFieldCount() > 0);
- return static_cast<UDPWrap*>(obj->GetPointerFromInternalField(0));
+ return static_cast<UDPWrap*>(obj->GetAlignedPointerFromInternalField(0));
}
if (!buf)
return ThrowError("Unable to allocate ArrayBuffer.");
- args.This()->SetPointerInInternalField(0, buf);
+ args.This()->SetAlignedPointerInInternalField(0, buf);
args.This()->Set(v8::String::New("byteLength"),
v8::Integer::NewFromUnsigned(num_bytes),
if (buffer.IsEmpty()) return v8::Undefined(); // constructor failed
- void* src = args.This()->GetPointerFromInternalField(0);
- void* dest = buffer->GetPointerFromInternalField(0);
+ void* src = args.This()->GetAlignedPointerFromInternalField(0);
+ void* dest = buffer->GetAlignedPointerFromInternalField(0);
memcpy(dest, static_cast<char*>(src) + begin, slice_length);
return buffer;
GetFunction()->NewInstance(1, argv);
if (buffer.IsEmpty()) return v8::Undefined(); // constructor failed
- void* buf = buffer->GetPointerFromInternalField(0);
+ void* buf = buffer->GetAlignedPointerFromInternalField(0);
args.This()->SetIndexedPropertiesToExternalArrayData(
buf, TEAType, length);
// TODO(deanm): check for failure.
GetFunction()->NewInstance(1, argv);
if (buffer.IsEmpty()) return v8::Undefined(); // constructor failed
- void* buf = buffer->GetPointerFromInternalField(0);
+ void* buf = buffer->GetAlignedPointerFromInternalField(0);
args.This()->SetIndexedPropertiesToExternalArrayData(
buf, TEAType, length);
// TODO(deanm): check for failure.