Reviewers: Yury Semikhatsky,
Description:
[Isolates] Add isolate parameter to handle constructor.
Please review this at http://codereview.chromium.org/3418033/show
Affected files:
M src/api.cc
M src/handles-inl.h
M src/handles.h
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index
f2cd240219328d1386dd70201efc975c33ffb25b..63d92b0050c097cf9420c521a8f6485300bdd79a
100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -486,7 +486,7 @@ int HandleScope::NumberOfHandles() {
i::Object** v8::HandleScope::CreateHandle(i::Object* value) {
- return i::HandleScope::CreateHandle(value);
+ return i::HandleScope::CreateHandle(value, i::Isolate::Current());
}
Index: src/handles-inl.h
diff --git a/src/handles-inl.h b/src/handles-inl.h
index
4aeb37dcc0ba845d447629c0479bd20e78ccac7e..fa7f7b8609cd76c190f6f6baf9bc981c1d4391a4
100644
--- a/src/handles-inl.h
+++ b/src/handles-inl.h
@@ -40,7 +40,14 @@ namespace internal {
template<class T>
Handle<T>::Handle(T* obj) {
ASSERT(!obj->IsFailure());
- location_ = HandleScope::CreateHandle(obj);
+ location_ = HandleScope::CreateHandle(obj, Isolate::Current());
+}
+
+
+template<class T>
+Handle<T>::Handle(T* obj, Isolate* isolate) {
+ ASSERT(!obj->IsFailure());
+ location_ = HandleScope::CreateHandle(obj, isolate);
}
@@ -59,9 +66,10 @@ HandleScope::HandleScope()
template <typename T>
-T** HandleScope::CreateHandle(T* value) {
+T** HandleScope::CreateHandle(T* value, Isolate* isolate) {
+ ASSERT(isolate == Isolate::Current());
v8::ImplementationUtilities::HandleScopeData* current =
- Isolate::Current()->handle_scope_data();
+ isolate->handle_scope_data();
internal::Object** cur = current->next;
if (cur == current->limit) cur = Extend();
Index: src/handles.h
diff --git a/src/handles.h b/src/handles.h
index
b04c1e0240a04a31e544f5baa2a1018fb04a8b4d..254a0de043553bf515ffcc536eccde152a659474
100644
--- a/src/handles.h
+++ b/src/handles.h
@@ -44,6 +44,7 @@ class Handle {
public:
INLINE(explicit Handle(T** location)) { location_ = location; }
INLINE(explicit Handle(T* obj));
+ INLINE(Handle(T* obj, Isolate* isolate));
INLINE(Handle()) : location_(NULL) {}
@@ -118,7 +119,7 @@ class HandleScope {
// Creates a new handle with the given value.
template <typename T>
- static inline T** CreateHandle(T* value);
+ static inline T** CreateHandle(T* value, Isolate* isolate);
// Deallocates any extensions used by the current scope.
static void DeleteExtensions(Isolate* isolate);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev