Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index dcadf52a6a64dcb2a6022fbbe80a10fff2d3ad33..426f53ebfdcba4e2d5a8d8b8425504c098419d24 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -648,6 +648,14 @@ void V8::MarkIndependent(i::Object** object) { |
} |
+bool V8::IsGlobalIndependent(i::Object** obj) { |
+ i::Isolate* isolate = i::Isolate::Current(); |
+ LOG_API(isolate, "IsGlobalIndependent"); |
+ if (!isolate->IsInitialized()) return false; |
+ return i::GlobalHandles::IsIndependent(obj); |
+} |
+ |
+ |
bool V8::IsGlobalNearDeath(i::Object** obj) { |
i::Isolate* isolate = i::Isolate::Current(); |
LOG_API(isolate, "IsGlobalNearDeath"); |
@@ -4336,6 +4344,30 @@ void v8::V8::VisitExternalResources(ExternalResourceVisitor* visitor) { |
} |
+void v8::V8::VisitHandlesWithClassIds(PersistentHandleVisitor* visitor) { |
+ i::Isolate* isolate = i::Isolate::Current(); |
+ IsDeadCheck(isolate, "v8::V8::VisitHandlesWithClassId"); |
+ |
+ i::AssertNoAllocation no_allocation; |
+ |
+ class VisitorAdapter : public i::ObjectVisitor { |
+ public: |
+ explicit VisitorAdapter(PersistentHandleVisitor* visitor) |
+ : visitor_(visitor) {} |
+ virtual void VisitPointers(i::Object** start, i::Object** end) { |
+ UNREACHABLE(); |
+ } |
+ virtual void VisitEmbedderReference(i::Object** p, uint16_t class_id) { |
+ visitor_->VisitPersistentHandle(ToApi<Value>(i::Handle<i::Object>(p)), |
+ class_id); |
+ } |
+ private: |
+ PersistentHandleVisitor* visitor_; |
+ } visitor_adapter(visitor); |
+ isolate->global_handles()->IterateAllRootsWithClassIds(&visitor_adapter); |
+} |
+ |
+ |
bool v8::V8::IdleNotification(int hint) { |
// Returning true tells the caller that it need not |
// continue to call IdleNotification. |
@@ -4620,6 +4652,11 @@ void V8::SetWrapperClassId(i::Object** global_handle, uint16_t class_id) { |
} |
+uint16_t V8::GetWrapperClassId(internal::Object** global_handle) { |
+ return i::GlobalHandles::GetWrapperClassId(global_handle); |
+} |
+ |
+ |
Local<v8::Object> ObjectTemplate::NewInstance() { |
i::Isolate* isolate = i::Isolate::Current(); |
ON_BAILOUT(isolate, "v8::ObjectTemplate::NewInstance()", |