Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

v8: (Get/Set)<Aligned>Pointer

  • Loading branch information...
commit 3a8a9cfe822dcd45ff585c033b56b04b67405af6 1 parent f3b04da
Fedor Indutny authored
2  src/fs_event_wrap.cc
View
@@ -172,7 +172,7 @@ Handle<Value> FSEventWrap::Close(const Arguments& args) {
// 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) {
8 src/handle_wrap.cc
View
@@ -27,7 +27,7 @@
assert(!args.Holder().IsEmpty()); \
assert(args.Holder()->InternalFieldCount() > 0); \
type* wrap = static_cast<type*>( \
- args.Holder()->GetPointerFromInternalField(0));
+ args.Holder()->GetAlignedPointerFromInternalField(0));
namespace node {
@@ -88,7 +88,7 @@ Handle<Value> HandleWrap::Close(const Arguments& args) {
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__) {
@@ -112,7 +112,7 @@ HandleWrap::HandleWrap(Handle<Object> object, uv_handle_t* h) {
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_);
}
@@ -138,7 +138,7 @@ void HandleWrap::OnClose(uv_handle_t* handle) {
// 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();
2  src/node_internals.h
View
@@ -90,7 +90,7 @@ inline static v8::Handle<v8::Value> ThrowRangeError(const char* errmsg) {
assert(!args.Holder().IsEmpty()); \
assert(args.Holder()->InternalFieldCount() > 0); \
type* wrap = static_cast<type*>( \
- args.Holder()->GetPointerFromInternalField(0)); \
+ args.Holder()->GetAlignedPointerFromInternalField(0)); \
if (!wrap) { \
fprintf(stderr, #type ": Aborting due to unwrap failure at %s:%d\n", \
__FILE__, __LINE__); \
4 src/node_object_wrap.h
View
@@ -59,7 +59,7 @@ class NODE_EXTERN ObjectWrap {
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));
}
@@ -70,7 +70,7 @@ class NODE_EXTERN ObjectWrap {
assert(handle_.IsEmpty());
assert(handle->InternalFieldCount() > 0);
handle_ = v8::Persistent<v8::Object>::New(handle);
- handle_->SetPointerInInternalField(0, this);
+ handle_->SetAlignedPointerInInternalField(0, this);
MakeWeak();
}
4 src/pipe_wrap.cc
View
@@ -69,7 +69,7 @@ Local<Object> PipeWrap::Instantiate() {
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));
}
@@ -214,7 +214,7 @@ void PipeWrap::OnConnection(uv_stream_t* handle, int status) {
// 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;
4 src/stream_wrap.cc
View
@@ -199,7 +199,7 @@ static Local<Object> AcceptHandle(uv_stream_t* pipe) {
return Local<Object>();
wrap = static_cast<WrapType*>(
- wrap_obj->GetPointerFromInternalField(0));
+ wrap_obj->GetAlignedPointerFromInternalField(0));
handle = wrap->UVHandle();
if (uv_accept(pipe, reinterpret_cast<uv_stream_t*>(handle)))
@@ -436,7 +436,7 @@ Handle<Value> StreamWrap::WriteStringImpl(const Arguments& args) {
Local<Object> send_handle_obj = args[1]->ToObject();
assert(send_handle_obj->InternalFieldCount() > 0);
HandleWrap* send_handle_wrap = static_cast<HandleWrap*>(
- send_handle_obj->GetPointerFromInternalField(0));
+ send_handle_obj->GetAlignedPointerFromInternalField(0));
send_handle = send_handle_wrap->GetHandle();
// Reference StreamWrap instance to prevent it from being garbage
4 src/tcp_wrap.cc
View
@@ -130,7 +130,7 @@ void TCPWrap::Initialize(Handle<Object> target) {
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));
}
@@ -327,7 +327,7 @@ void TCPWrap::OnConnection(uv_stream_t* handle, int status) {
// Unwrap the client javascript object.
assert(client_obj->InternalFieldCount() > 0);
TCPWrap* client_wrap = static_cast<TCPWrap*>(
- client_obj->GetPointerFromInternalField(0));
+ client_obj->GetAlignedPointerFromInternalField(0));
if (uv_accept(handle, (uv_stream_t*)&client_wrap->handle_)) return;
2  src/tty_wrap.cc
View
@@ -88,7 +88,7 @@ void TTYWrap::Initialize(Handle<Object> target) {
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));
}
2  src/udp_wrap.cc
View
@@ -427,7 +427,7 @@ void UDPWrap::OnRecv(uv_udp_t* handle,
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));
}
10 src/v8_typed_array.cc
View
@@ -108,7 +108,7 @@ class ArrayBuffer {
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),
@@ -159,8 +159,8 @@ class ArrayBuffer {
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;
@@ -298,7 +298,7 @@ class TypedArray {
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.
@@ -327,7 +327,7 @@ class TypedArray {
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.
Please sign in to comment.
Something went wrong with that request. Please try again.