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

Side by Side Diff: src/compiler/arm/code-generator-arm.cc

Issue 1284893002: Reland: [turbofan] Various fixes to allow unboxed doubles as arguments in registers and on the stac… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/arm64/code-generator-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/arm/macro-assembler-arm.h" 7 #include "src/arm/macro-assembler-arm.h"
8 #include "src/compiler/code-generator-impl.h" 8 #include "src/compiler/code-generator-impl.h"
9 #include "src/compiler/gap-resolver.h" 9 #include "src/compiler/gap-resolver.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 UNREACHABLE(); 140 UNREACHABLE();
141 return MemOperand(r0); 141 return MemOperand(r0);
142 } 142 }
143 143
144 MemOperand InputOffset(size_t first_index = 0) { 144 MemOperand InputOffset(size_t first_index = 0) {
145 return InputOffset(&first_index); 145 return InputOffset(&first_index);
146 } 146 }
147 147
148 MemOperand ToMemOperand(InstructionOperand* op) const { 148 MemOperand ToMemOperand(InstructionOperand* op) const {
149 DCHECK(op != NULL); 149 DCHECK(op != NULL);
150 DCHECK(!op->IsRegister());
151 DCHECK(!op->IsDoubleRegister());
152 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); 150 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot());
153 // The linkage computes where all spill slots are located. 151 FrameOffset offset =
154 FrameOffset offset = linkage()->GetFrameOffset( 152 linkage()->GetFrameOffset(AllocatedOperand::cast(op)->index(), frame());
155 AllocatedOperand::cast(op)->index(), frame(), 0);
156 return MemOperand(offset.from_stack_pointer() ? sp : fp, offset.offset()); 153 return MemOperand(offset.from_stack_pointer() ? sp : fp, offset.offset());
157 } 154 }
158 }; 155 };
159 156
160 157
161 namespace { 158 namespace {
162 159
163 class OutOfLineLoadFloat32 final : public OutOfLineCode { 160 class OutOfLineLoadFloat32 final : public OutOfLineCode {
164 public: 161 public:
165 OutOfLineLoadFloat32(CodeGenerator* gen, SwVfpRegister result) 162 OutOfLineLoadFloat32(CodeGenerator* gen, SwVfpRegister result)
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 } 982 }
986 } else if (descriptor->IsJSFunctionCall()) { 983 } else if (descriptor->IsJSFunctionCall()) {
987 CompilationInfo* info = this->info(); 984 CompilationInfo* info = this->info();
988 __ Prologue(info->IsCodePreAgingActive()); 985 __ Prologue(info->IsCodePreAgingActive());
989 frame()->SetRegisterSaveAreaSize( 986 frame()->SetRegisterSaveAreaSize(
990 StandardFrameConstants::kFixedFrameSizeFromFp); 987 StandardFrameConstants::kFixedFrameSizeFromFp);
991 } else if (needs_frame_) { 988 } else if (needs_frame_) {
992 __ StubPrologue(); 989 __ StubPrologue();
993 frame()->SetRegisterSaveAreaSize( 990 frame()->SetRegisterSaveAreaSize(
994 StandardFrameConstants::kFixedFrameSizeFromFp); 991 StandardFrameConstants::kFixedFrameSizeFromFp);
992 } else {
993 frame()->SetPCOnStack(false);
995 } 994 }
996 995
997 if (info()->is_osr()) { 996 if (info()->is_osr()) {
998 // TurboFan OSR-compiled functions cannot be entered directly. 997 // TurboFan OSR-compiled functions cannot be entered directly.
999 __ Abort(kShouldNotDirectlyEnterOsrFunction); 998 __ Abort(kShouldNotDirectlyEnterOsrFunction);
1000 999
1001 // Unoptimized code jumps directly to this entrypoint while the unoptimized 1000 // Unoptimized code jumps directly to this entrypoint while the unoptimized
1002 // frame is still on the stack. Optimized code uses OSR values directly from 1001 // frame is still on the stack. Optimized code uses OSR values directly from
1003 // the unoptimized frame. Thus, all that needs to be done is to allocate the 1002 // the unoptimized frame. Thus, all that needs to be done is to allocate the
1004 // remaining stack slots. 1003 // remaining stack slots.
1005 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); 1004 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
1006 osr_pc_offset_ = __ pc_offset(); 1005 osr_pc_offset_ = __ pc_offset();
1007 // TODO(titzer): cannot address target function == local #-1 1006 // TODO(titzer): cannot address target function == local #-1
1008 __ ldr(r1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1007 __ ldr(r1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1009 DCHECK(stack_slots >= frame()->GetOsrStackSlotCount()); 1008 DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
1010 stack_slots -= frame()->GetOsrStackSlotCount(); 1009 stack_slots -= frame()->GetOsrStackSlotCount();
1011 } 1010 }
1012 1011
1013 if (stack_slots > 0) { 1012 if (stack_slots > 0) {
1014 __ sub(sp, sp, Operand(stack_slots * kPointerSize)); 1013 __ sub(sp, sp, Operand(stack_slots * kPointerSize));
1015 } 1014 }
1016 } 1015 }
1017 1016
1018 1017
1019 void CodeGenerator::AssembleReturn() { 1018 void CodeGenerator::AssembleReturn() {
1020 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 1019 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
1021 int stack_slots = frame()->GetSpillSlotCount(); 1020 int stack_slots = frame()->GetSpillSlotCount();
1021 int pop_count = static_cast<int>(descriptor->StackParameterCount());
1022 if (descriptor->kind() == CallDescriptor::kCallAddress) { 1022 if (descriptor->kind() == CallDescriptor::kCallAddress) {
1023 if (frame()->GetRegisterSaveAreaSize() > 0) { 1023 if (frame()->GetRegisterSaveAreaSize() > 0) {
1024 // Remove this frame's spill slots first. 1024 // Remove this frame's spill slots first.
1025 if (stack_slots > 0) { 1025 if (stack_slots > 0) {
1026 __ add(sp, sp, Operand(stack_slots * kPointerSize)); 1026 __ add(sp, sp, Operand(stack_slots * kPointerSize));
1027 } 1027 }
1028 // Restore FP registers. 1028 // Restore FP registers.
1029 const RegList saves_fp = descriptor->CalleeSavedFPRegisters(); 1029 const RegList saves_fp = descriptor->CalleeSavedFPRegisters();
1030 if (saves_fp != 0) { 1030 if (saves_fp != 0) {
1031 STATIC_ASSERT(DwVfpRegister::kMaxNumRegisters == 32); 1031 STATIC_ASSERT(DwVfpRegister::kMaxNumRegisters == 32);
1032 uint32_t last = base::bits::CountLeadingZeros32(saves_fp) - 1; 1032 uint32_t last = base::bits::CountLeadingZeros32(saves_fp) - 1;
1033 uint32_t first = base::bits::CountTrailingZeros32(saves_fp); 1033 uint32_t first = base::bits::CountTrailingZeros32(saves_fp);
1034 __ vldm(ia_w, sp, DwVfpRegister::from_code(first), 1034 __ vldm(ia_w, sp, DwVfpRegister::from_code(first),
1035 DwVfpRegister::from_code(last)); 1035 DwVfpRegister::from_code(last));
1036 } 1036 }
1037 // Restore registers. 1037 // Restore registers.
1038 const RegList saves = descriptor->CalleeSavedRegisters(); 1038 const RegList saves = descriptor->CalleeSavedRegisters();
1039 if (saves != 0) { 1039 if (saves != 0) {
1040 __ ldm(ia_w, sp, saves); 1040 __ ldm(ia_w, sp, saves);
1041 } 1041 }
1042 } 1042 }
1043 __ LeaveFrame(StackFrame::MANUAL); 1043 __ LeaveFrame(StackFrame::MANUAL);
1044 __ Ret();
1045 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { 1044 } else if (descriptor->IsJSFunctionCall() || needs_frame_) {
1046 // Canonicalize JSFunction return sites for now. 1045 // Canonicalize JSFunction return sites for now.
1047 if (return_label_.is_bound()) { 1046 if (return_label_.is_bound()) {
1048 __ b(&return_label_); 1047 __ b(&return_label_);
1048 return;
1049 } else { 1049 } else {
1050 __ bind(&return_label_); 1050 __ bind(&return_label_);
1051 __ LeaveFrame(StackFrame::MANUAL); 1051 __ LeaveFrame(StackFrame::MANUAL);
1052 int pop_count = static_cast<int>(descriptor->StackParameterCount());
1053 if (pop_count != 0) {
1054 __ Drop(pop_count);
1055 }
1056 __ Ret();
1057 } 1052 }
1058 } else {
1059 __ Ret();
1060 } 1053 }
1054 __ Ret(pop_count);
1061 } 1055 }
1062 1056
1063 1057
1064 void CodeGenerator::AssembleMove(InstructionOperand* source, 1058 void CodeGenerator::AssembleMove(InstructionOperand* source,
1065 InstructionOperand* destination) { 1059 InstructionOperand* destination) {
1066 ArmOperandConverter g(this, NULL); 1060 ArmOperandConverter g(this, NULL);
1067 // Dispatch on the source and destination operand kinds. Not all 1061 // Dispatch on the source and destination operand kinds. Not all
1068 // combinations are possible. 1062 // combinations are possible.
1069 if (source->IsRegister()) { 1063 if (source->IsRegister()) {
1070 DCHECK(destination->IsRegister() || destination->IsStackSlot()); 1064 DCHECK(destination->IsRegister() || destination->IsStackSlot());
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 } 1258 }
1265 } 1259 }
1266 } 1260 }
1267 } 1261 }
1268 1262
1269 #undef __ 1263 #undef __
1270 1264
1271 } // namespace compiler 1265 } // namespace compiler
1272 } // namespace internal 1266 } // namespace internal
1273 } // namespace v8 1267 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/arm64/code-generator-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698