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

Side by Side Diff: src/compiler/mips/code-generator-mips.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 | « src/compiler/machine-type.h ('k') | src/compiler/mips64/code-generator-mips64.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 #include "src/compiler/code-generator-impl.h" 6 #include "src/compiler/code-generator-impl.h"
7 #include "src/compiler/gap-resolver.h" 7 #include "src/compiler/gap-resolver.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/mips/macro-assembler-mips.h" 9 #include "src/mips/macro-assembler-mips.h"
10 #include "src/scopes.h" 10 #include "src/scopes.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 UNREACHABLE(); 99 UNREACHABLE();
100 } 100 }
101 UNREACHABLE(); 101 UNREACHABLE();
102 return MemOperand(no_reg); 102 return MemOperand(no_reg);
103 } 103 }
104 104
105 MemOperand MemoryOperand(size_t index = 0) { return MemoryOperand(&index); } 105 MemOperand MemoryOperand(size_t index = 0) { return MemoryOperand(&index); }
106 106
107 MemOperand ToMemOperand(InstructionOperand* op) const { 107 MemOperand ToMemOperand(InstructionOperand* op) const {
108 DCHECK(op != NULL); 108 DCHECK(op != NULL);
109 DCHECK(!op->IsRegister());
110 DCHECK(!op->IsDoubleRegister());
111 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); 109 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot());
112 // The linkage computes where all spill slots are located. 110 FrameOffset offset =
113 FrameOffset offset = linkage()->GetFrameOffset( 111 linkage()->GetFrameOffset(AllocatedOperand::cast(op)->index(), frame());
114 AllocatedOperand::cast(op)->index(), frame(), 0);
115 return MemOperand(offset.from_stack_pointer() ? sp : fp, offset.offset()); 112 return MemOperand(offset.from_stack_pointer() ? sp : fp, offset.offset());
116 } 113 }
117 }; 114 };
118 115
119 116
120 static inline bool HasRegisterInput(Instruction* instr, size_t index) { 117 static inline bool HasRegisterInput(Instruction* instr, size_t index) {
121 return instr->InputAt(index)->IsRegister(); 118 return instr->InputAt(index)->IsRegister();
122 } 119 }
123 120
124 121
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 if (descriptor->kind() == CallDescriptor::kCallAddress) { 1072 if (descriptor->kind() == CallDescriptor::kCallAddress) {
1076 __ Push(ra, fp); 1073 __ Push(ra, fp);
1077 __ mov(fp, sp); 1074 __ mov(fp, sp);
1078 1075
1079 const RegList saves = descriptor->CalleeSavedRegisters(); 1076 const RegList saves = descriptor->CalleeSavedRegisters();
1080 // Save callee-saved registers. 1077 // Save callee-saved registers.
1081 __ MultiPush(saves); 1078 __ MultiPush(saves);
1082 // kNumCalleeSaved includes the fp register, but the fp register 1079 // kNumCalleeSaved includes the fp register, but the fp register
1083 // is saved separately in TF. 1080 // is saved separately in TF.
1084 DCHECK(kNumCalleeSaved == base::bits::CountPopulation32(saves) + 1); 1081 DCHECK(kNumCalleeSaved == base::bits::CountPopulation32(saves) + 1);
1085 int register_save_area_size = kNumCalleeSaved * kPointerSize; 1082 int register_save_area_size =
1083 base::bits::CountPopulation32(saves) * kPointerSize;
1086 1084
1087 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); 1085 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters();
1088 // Save callee-saved FPU registers. 1086 // Save callee-saved FPU registers.
1089 __ MultiPushFPU(saves_fpu); 1087 __ MultiPushFPU(saves_fpu);
1090 DCHECK(kNumCalleeSavedFPU == base::bits::CountPopulation32(saves_fpu)); 1088 DCHECK(kNumCalleeSavedFPU == base::bits::CountPopulation32(saves_fpu));
1091 register_save_area_size += kNumCalleeSavedFPU * kDoubleSize * kPointerSize; 1089 register_save_area_size += kNumCalleeSavedFPU * kDoubleSize;
1092 1090
1093 frame()->SetRegisterSaveAreaSize(register_save_area_size); 1091 frame()->SetRegisterSaveAreaSize(register_save_area_size);
1094 } else if (descriptor->IsJSFunctionCall()) { 1092 } else if (descriptor->IsJSFunctionCall()) {
1095 CompilationInfo* info = this->info(); 1093 CompilationInfo* info = this->info();
1096 __ Prologue(info->IsCodePreAgingActive()); 1094 __ Prologue(info->IsCodePreAgingActive());
1097 frame()->SetRegisterSaveAreaSize( 1095 frame()->SetRegisterSaveAreaSize(
1098 StandardFrameConstants::kFixedFrameSizeFromFp); 1096 StandardFrameConstants::kFixedFrameSizeFromFp);
1099 } else if (needs_frame_) { 1097 } else if (needs_frame_) {
1100 __ StubPrologue(); 1098 __ StubPrologue();
1101 frame()->SetRegisterSaveAreaSize( 1099 frame()->SetRegisterSaveAreaSize(
1102 StandardFrameConstants::kFixedFrameSizeFromFp); 1100 StandardFrameConstants::kFixedFrameSizeFromFp);
1101 } else {
1102 frame()->SetPCOnStack(false);
1103 } 1103 }
1104 1104
1105 if (info()->is_osr()) { 1105 if (info()->is_osr()) {
1106 // TurboFan OSR-compiled functions cannot be entered directly. 1106 // TurboFan OSR-compiled functions cannot be entered directly.
1107 __ Abort(kShouldNotDirectlyEnterOsrFunction); 1107 __ Abort(kShouldNotDirectlyEnterOsrFunction);
1108 1108
1109 // Unoptimized code jumps directly to this entrypoint while the unoptimized 1109 // Unoptimized code jumps directly to this entrypoint while the unoptimized
1110 // frame is still on the stack. Optimized code uses OSR values directly from 1110 // frame is still on the stack. Optimized code uses OSR values directly from
1111 // the unoptimized frame. Thus, all that needs to be done is to allocate the 1111 // the unoptimized frame. Thus, all that needs to be done is to allocate the
1112 // remaining stack slots. 1112 // remaining stack slots.
1113 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); 1113 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
1114 osr_pc_offset_ = __ pc_offset(); 1114 osr_pc_offset_ = __ pc_offset();
1115 // TODO(titzer): cannot address target function == local #-1 1115 // TODO(titzer): cannot address target function == local #-1
1116 __ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1116 __ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1117 DCHECK(stack_slots >= frame()->GetOsrStackSlotCount()); 1117 DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
1118 stack_slots -= frame()->GetOsrStackSlotCount(); 1118 stack_slots -= frame()->GetOsrStackSlotCount();
1119 } 1119 }
1120 1120
1121 if (stack_slots > 0) { 1121 if (stack_slots > 0) {
1122 __ Subu(sp, sp, Operand(stack_slots * kPointerSize)); 1122 __ Subu(sp, sp, Operand(stack_slots * kPointerSize));
1123 } 1123 }
1124 } 1124 }
1125 1125
1126 1126
1127 void CodeGenerator::AssembleReturn() { 1127 void CodeGenerator::AssembleReturn() {
1128 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 1128 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
1129 int stack_slots = frame()->GetSpillSlotCount(); 1129 int stack_slots = frame()->GetSpillSlotCount();
1130 int pop_count = static_cast<int>(descriptor->StackParameterCount());
1130 if (descriptor->kind() == CallDescriptor::kCallAddress) { 1131 if (descriptor->kind() == CallDescriptor::kCallAddress) {
1131 if (frame()->GetRegisterSaveAreaSize() > 0) { 1132 if (frame()->GetRegisterSaveAreaSize() > 0) {
1132 // Remove this frame's spill slots first. 1133 // Remove this frame's spill slots first.
1133 if (stack_slots > 0) { 1134 if (stack_slots > 0) {
1134 __ Addu(sp, sp, Operand(stack_slots * kPointerSize)); 1135 __ Addu(sp, sp, Operand(stack_slots * kPointerSize));
1135 } 1136 }
1136 // Restore FPU registers. 1137 // Restore FPU registers.
1137 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); 1138 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters();
1138 __ MultiPopFPU(saves_fpu); 1139 __ MultiPopFPU(saves_fpu);
1139 1140
1140 // Restore GP registers. 1141 // Restore GP registers.
1141 const RegList saves = descriptor->CalleeSavedRegisters(); 1142 const RegList saves = descriptor->CalleeSavedRegisters();
1142 __ MultiPop(saves); 1143 __ MultiPop(saves);
1143 } 1144 }
1144 __ mov(sp, fp); 1145 __ mov(sp, fp);
1145 __ Pop(ra, fp); 1146 __ Pop(ra, fp);
1146 __ Ret();
1147 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { 1147 } else if (descriptor->IsJSFunctionCall() || needs_frame_) {
1148 // Canonicalize JSFunction return sites for now. 1148 // Canonicalize JSFunction return sites for now.
1149 if (return_label_.is_bound()) { 1149 if (return_label_.is_bound()) {
1150 __ Branch(&return_label_); 1150 __ Branch(&return_label_);
1151 return;
1151 } else { 1152 } else {
1152 __ bind(&return_label_); 1153 __ bind(&return_label_);
1153 __ mov(sp, fp); 1154 __ mov(sp, fp);
1154 __ Pop(ra, fp); 1155 __ Pop(ra, fp);
1155 int pop_count = static_cast<int>(descriptor->StackParameterCount());
1156 if (pop_count != 0) {
1157 __ DropAndRet(pop_count);
1158 } else {
1159 __ Ret();
1160 }
1161 } 1156 }
1157 }
1158 if (pop_count != 0) {
1159 __ DropAndRet(pop_count);
1162 } else { 1160 } else {
1163 __ Ret(); 1161 __ Ret();
1164 } 1162 }
1165 } 1163 }
1166 1164
1167 1165
1168 void CodeGenerator::AssembleMove(InstructionOperand* source, 1166 void CodeGenerator::AssembleMove(InstructionOperand* source,
1169 InstructionOperand* destination) { 1167 InstructionOperand* destination) {
1170 MipsOperandConverter g(this, NULL); 1168 MipsOperandConverter g(this, NULL);
1171 // Dispatch on the source and destination operand kinds. Not all 1169 // Dispatch on the source and destination operand kinds. Not all
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 } 1367 }
1370 } 1368 }
1371 } 1369 }
1372 } 1370 }
1373 1371
1374 #undef __ 1372 #undef __
1375 1373
1376 } // namespace compiler 1374 } // namespace compiler
1377 } // namespace internal 1375 } // namespace internal
1378 } // namespace v8 1376 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/machine-type.h ('k') | src/compiler/mips64/code-generator-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698