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

Unified Diff: src/heap/heap.cc

Issue 1095513003: Move GetRootListIndex into Heap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/heap/heap.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 29e875c11a1c41a8d68d83b8831fb61973e82908..ad62980a7924787c5851e59df73014cfe428f81f 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -4808,6 +4808,20 @@ bool Heap::RootIsImmortalImmovable(int root_index) {
}
+bool Heap::GetRootListIndex(Handle<HeapObject> object,
+ Heap::RootListIndex* index_return) {
+ Object* ptr = *object;
+#define IMMORTAL_IMMOVABLE_ROOT(Name) \
+ if (ptr == roots_[Heap::k##Name##RootIndex]) { \
+ *index_return = k##Name##RootIndex; \
+ return true; \
+ }
+ IMMORTAL_IMMOVABLE_ROOT_LIST(IMMORTAL_IMMOVABLE_ROOT)
+#undef IMMORTAL_IMMOVABLE_ROOT
+ return false;
+}
+
+
#ifdef VERIFY_HEAP
void Heap::Verify() {
CHECK(HasBeenSetUp());
« no previous file with comments | « src/heap/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698