Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: src/global-handles.cc

Issue 2798923004: Call PersistentHandleVisitor directly instead of using ObjectVisitor. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/global-handles.h ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/global-handles.cc
diff --git a/src/global-handles.cc b/src/global-handles.cc
index c749606a9d8428e89c51afae8a59ff333902b696..67cff7b0f5d227500d25d85a2e0a1e0cd94c4e98 100644
--- a/src/global-handles.cc
+++ b/src/global-handles.cc
@@ -949,34 +949,44 @@ void GlobalHandles::IterateAllRoots(ObjectVisitor* v) {
DISABLE_CFI_PERF
-void GlobalHandles::IterateAllRootsWithClassIds(ObjectVisitor* v) {
+void GlobalHandles::ApplyPersistentHandleVisitor(
+ v8::PersistentHandleVisitor* visitor, GlobalHandles::Node* node) {
+ v8::Value* value = ToApi<v8::Value>(Handle<Object>(node->location()));
+ visitor->VisitPersistentHandle(
+ reinterpret_cast<v8::Persistent<v8::Value>*>(&value),
+ node->wrapper_class_id());
+}
+
+DISABLE_CFI_PERF
+void GlobalHandles::IterateAllRootsWithClassIds(
+ v8::PersistentHandleVisitor* visitor) {
for (NodeIterator it(this); !it.done(); it.Advance()) {
if (it.node()->IsRetainer() && it.node()->has_wrapper_class_id()) {
- v->VisitEmbedderReference(it.node()->location(),
- it.node()->wrapper_class_id());
+ ApplyPersistentHandleVisitor(visitor, it.node());
}
}
}
DISABLE_CFI_PERF
-void GlobalHandles::IterateAllRootsInNewSpaceWithClassIds(ObjectVisitor* v) {
+void GlobalHandles::IterateAllRootsInNewSpaceWithClassIds(
+ v8::PersistentHandleVisitor* visitor) {
for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i];
if (node->IsRetainer() && node->has_wrapper_class_id()) {
- v->VisitEmbedderReference(node->location(),
- node->wrapper_class_id());
+ ApplyPersistentHandleVisitor(visitor, node);
}
}
}
DISABLE_CFI_PERF
-void GlobalHandles::IterateWeakRootsInNewSpaceWithClassIds(ObjectVisitor* v) {
+void GlobalHandles::IterateWeakRootsInNewSpaceWithClassIds(
+ v8::PersistentHandleVisitor* visitor) {
for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i];
if (node->has_wrapper_class_id() && node->IsWeak()) {
- v->VisitEmbedderReference(node->location(), node->wrapper_class_id());
+ ApplyPersistentHandleVisitor(visitor, node);
}
}
}
« no previous file with comments | « src/global-handles.h ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698