Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 74f489d2ab7870bba38e7bb46dfd10b1bba93401..dccbd99204d28fe868828ec24ac8cf1b5647639b 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -305,6 +305,7 @@ template <class T> class Local : public Handle<T> { |
* the original handle is destroyed/disposed. |
*/ |
inline static Local<T> New(Handle<T> that); |
+ inline static Local<T> New(Isolate* isolate, Handle<T> that); |
}; |
@@ -486,6 +487,8 @@ class V8EXPORT HandleScope { |
* Creates a new handle with the given value. |
*/ |
static internal::Object** CreateHandle(internal::Object* value); |
+ static internal::Object** CreateHandle(internal::Isolate* isolate, |
+ internal::Object* value); |
// Faster version, uses HeapObject to obtain the current Isolate. |
static internal::Object** CreateHandle(internal::HeapObject* value); |
@@ -4275,6 +4278,16 @@ Local<T> Local<T>::New(Handle<T> that) { |
template <class T> |
+ Local<T> Local<T>::New(Isolate* isolate, Handle<T> that) { |
+ if (that.IsEmpty()) return Local<T>(); |
+ T* that_ptr = *that; |
+ internal::Object** p = reinterpret_cast<internal::Object**>(that_ptr); |
+ return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle( |
+ reinterpret_cast<internal::Isolate*>(isolate), *p))); |
+} |
+ |
+ |
+template <class T> |
Persistent<T> Persistent<T>::New(Handle<T> that) { |
if (that.IsEmpty()) return Persistent<T>(); |
internal::Object** p = reinterpret_cast<internal::Object**>(*that); |