MIPS: [turbofan] Load immortal heap objects from the heap roots.
authorpaul.lind <paul.lind@imgtec.com>
Tue, 14 Apr 2015 16:39:49 +0000 (09:39 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 14 Apr 2015 16:39:48 +0000 (16:39 +0000)
Port 5d2de78a771b8ff1ac59fbdf634bffd01709b554

BUG=

Review URL: https://codereview.chromium.org/1085693003

Cr-Commit-Position: refs/heads/master@{#27825}

src/compiler/mips/code-generator-mips.cc
src/compiler/mips64/code-generator-mips64.cc

index 7647d24..98115b4 100644 (file)
@@ -1140,17 +1140,12 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
           break;
         case Constant::kHeapObject: {
           Handle<HeapObject> src_object = src.ToHeapObject();
-          if (info()->IsOptimizing() &&
-              src_object.is_identical_to(info()->context())) {
-            // Loading the context from the frame is way cheaper than
-            // materializing the actual context heap object address.
-            __ lw(dst, MemOperand(fp, StandardFrameConstants::kContextOffset));
-          } else if (info()->IsOptimizing() &&
-                     src_object.is_identical_to(info()->closure())) {
-            // Loading the JSFunction from the frame is way cheaper than
-            // materializing the actual JSFunction heap object address.
-            __ lw(dst,
-                  MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
+          Heap::RootListIndex index;
+          int offset;
+          if (IsMaterializableFromFrame(src_object, &offset)) {
+            __ lw(dst, MemOperand(fp, offset));
+          } else if (IsMaterializableFromRoot(src_object, &index)) {
+            __ LoadRoot(dst, index);
           } else {
             __ li(dst, src_object);
           }
index 756cb63..643483a 100644 (file)
@@ -1206,17 +1206,12 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
           break;
         case Constant::kHeapObject: {
           Handle<HeapObject> src_object = src.ToHeapObject();
-          if (info()->IsOptimizing() &&
-              src_object.is_identical_to(info()->context())) {
-            // Loading the context from the frame is way cheaper than
-            // materializing the actual context heap object address.
-            __ ld(dst, MemOperand(fp, StandardFrameConstants::kContextOffset));
-          } else if (info()->IsOptimizing() &&
-                     src_object.is_identical_to(info()->closure())) {
-            // Loading the JSFunction from the frame is way cheaper than
-            // materializing the actual JSFunction heap object address.
-            __ ld(dst,
-                  MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
+          Heap::RootListIndex index;
+          int offset;
+          if (IsMaterializableFromFrame(src_object, &offset)) {
+            __ ld(dst, MemOperand(fp, offset));
+          } else if (IsMaterializableFromRoot(src_object, &index)) {
+            __ LoadRoot(dst, index);
           } else {
             __ li(dst, src_object);
           }