Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 7b954983af19a451f4a6d26710e81dca89c3d246..72a497d331485a6e078d50fc524a9dd531ffa060 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -436,7 +436,8 @@ class V8EXPORT HandleScope { |
/** |
* Creates a new handle with the given value. |
*/ |
- static internal::Object** CreateHandle(internal::Object* value); |
+ template <class T> |
+ static internal::Object** CreateHandle(T* value); |
private: |
// Make it impossible to create heap-allocated or illegal handle |
@@ -3499,8 +3500,7 @@ Local<T>::Local() : Handle<T>() { } |
template <class T> |
Local<T> Local<T>::New(Handle<T> that) { |
if (that.IsEmpty()) return Local<T>(); |
- internal::Object** p = reinterpret_cast<internal::Object**>(*that); |
- return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(*p))); |
+ return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(*that))); |
} |
@@ -3647,7 +3647,7 @@ Local<Value> Object::UncheckedGetInternalField(int index) { |
// value directly. |
int offset = I::kJSObjectHeaderSize + (internal::kPointerSize * index); |
O* value = I::ReadField<O*>(obj, offset); |
- O** result = HandleScope::CreateHandle(value); |
+ O** result = HandleScope::CreateHandle(reinterpret_cast<Value*>(&value)); |
return Local<Value>(reinterpret_cast<Value*>(result)); |
} else { |
return Local<Value>(); |