From 592c0fe7b68b182d21ecb9ee2689c872e4c5c83e Mon Sep 17 00:00:00 2001 From: "paul.lind" Date: Tue, 14 Apr 2015 09:39:49 -0700 Subject: [PATCH] MIPS: [turbofan] Load immortal heap objects from the heap roots. Port 5d2de78a771b8ff1ac59fbdf634bffd01709b554 BUG= Review URL: https://codereview.chromium.org/1085693003 Cr-Commit-Position: refs/heads/master@{#27825} --- src/compiler/mips/code-generator-mips.cc | 17 ++++++----------- src/compiler/mips64/code-generator-mips64.cc | 17 ++++++----------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/compiler/mips/code-generator-mips.cc b/src/compiler/mips/code-generator-mips.cc index 7647d24ae9..98115b46e7 100644 --- a/src/compiler/mips/code-generator-mips.cc +++ b/src/compiler/mips/code-generator-mips.cc @@ -1140,17 +1140,12 @@ void CodeGenerator::AssembleMove(InstructionOperand* source, break; case Constant::kHeapObject: { Handle 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); } diff --git a/src/compiler/mips64/code-generator-mips64.cc b/src/compiler/mips64/code-generator-mips64.cc index 756cb632da..643483a4d0 100644 --- a/src/compiler/mips64/code-generator-mips64.cc +++ b/src/compiler/mips64/code-generator-mips64.cc @@ -1206,17 +1206,12 @@ void CodeGenerator::AssembleMove(InstructionOperand* source, break; case Constant::kHeapObject: { Handle 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); }