Reviewers: jarin,

Description:
[turbofan] Materialize all from non-writable roots from root array.

[email protected]

Please review this at https://codereview.chromium.org/1175113005/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+10, -19 lines):
  M src/compiler/code-generator.cc
  M src/heap/heap.h
  M src/heap/heap.cc


Index: src/compiler/code-generator.cc
diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc
index 6b9a8b86c6560794e57ab33cf8d4032389f69e0c..081dde913fc2b59c2a931b27e3ba98679343d249 100644
--- a/src/compiler/code-generator.cc
+++ b/src/compiler/code-generator.cc
@@ -221,7 +221,16 @@ bool CodeGenerator::IsMaterializableFromFrame(Handle<HeapObject> object,
 bool CodeGenerator::IsMaterializableFromRoot(
     Handle<HeapObject> object, Heap::RootListIndex* index_return) {
   if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) {
-    return isolate()->heap()->GetRootListIndex(object, index_return);
+    // Check if {object} is one of the non-smi roots that cannot be written
+    // after initialization.
+    for (int i = 0; i < Heap::kSmiRootsStart; ++i) {
+ Heap::RootListIndex const index = static_cast<Heap::RootListIndex>(i);
+      if (!Heap::RootCanBeWrittenAfterInitialization(index) &&
+          *object == isolate()->heap()->root(index)) {
+        *index_return = index;
+        return true;
+      }
+    }
   }
   return false;
 }
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 456fc34fc8cf8601d5902937d3451cc8a0205a58..bc46cc2cff46d51d2ebaed81bce29d7476d25560 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -4920,20 +4920,6 @@ 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());
Index: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index 1bc9a85b04b32759ea05a08a40b393035bb2556c..e30e40c121a607134596e0d7207037cd98900d4b 100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -1211,10 +1211,6 @@ class Heap {
     kSmiRootsStart = kStringTableRootIndex + 1
   };

-  // Get the root list index for {object} if such a root list index exists.
-  bool GetRootListIndex(Handle<HeapObject> object,
-                        Heap::RootListIndex* index_return);
-
   Object* root(RootListIndex index) { return roots_[index]; }

   STATIC_ASSERT(kUndefinedValueRootIndex ==


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to