Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1128 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 1128 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
| 1129 } | 1129 } |
| 1130 | 1130 |
| 1131 | 1131 |
| 1132 void CodeGenerator::AssemblePrologue() { | 1132 void CodeGenerator::AssemblePrologue() { |
| 1133 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1133 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
| 1134 int stack_slots = frame()->GetSpillSlotCount(); | 1134 int stack_slots = frame()->GetSpillSlotCount(); |
| 1135 if (descriptor->kind() == CallDescriptor::kCallAddress) { | 1135 if (descriptor->kind() == CallDescriptor::kCallAddress) { |
| 1136 __ Push(ra, fp); | 1136 __ Push(ra, fp); |
| 1137 __ mov(fp, sp); | 1137 __ mov(fp, sp); |
| 1138 | |
| 1139 int register_save_area_size = 0; | |
| 1138 const RegList saves = descriptor->CalleeSavedRegisters(); | 1140 const RegList saves = descriptor->CalleeSavedRegisters(); |
| 1139 if (saves != 0) { // Save callee-saved registers. | 1141 if (saves != 0) { // Save callee-saved registers. |
|
paul.l...
2015/06/23 02:15:02
I think we should remove this if clause, here and
akos.palfi.imgtec
2015/06/23 19:48:57
Done.
| |
| 1140 // TODO(plind): make callee save size const, possibly DCHECK it. | 1142 __ MultiPush(saves); |
| 1141 int register_save_area_size = 0; | 1143 DCHECK(kNumCalleeSaved == base::bits::CountPopulation32(saves)); |
| 1142 for (int i = Register::kNumRegisters - 1; i >= 0; i--) { | 1144 register_save_area_size += kNumCalleeSaved * kPointerSize; |
| 1143 if (!((1 << i) & saves)) continue; | 1145 } |
| 1144 register_save_area_size += kPointerSize; | 1146 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); |
| 1145 } | 1147 if (saves_fpu != 0) { // Save callee-saved FPU registers. |
| 1148 __ MultiPushFPU(saves_fpu); | |
| 1149 DCHECK(kNumCalleeSavedFPU == base::bits::CountPopulation32(saves_fp)); | |
| 1150 register_save_area_size += | |
| 1151 kNumCalleeSavedFPU * kDoubleSize * kPointerSize; | |
| 1152 } | |
| 1153 if (register_save_area_size > 0) { | |
| 1146 frame()->SetRegisterSaveAreaSize(register_save_area_size); | 1154 frame()->SetRegisterSaveAreaSize(register_save_area_size); |
| 1147 __ MultiPush(saves); | |
| 1148 } | 1155 } |
| 1149 } else if (descriptor->IsJSFunctionCall()) { | 1156 } else if (descriptor->IsJSFunctionCall()) { |
| 1150 CompilationInfo* info = this->info(); | 1157 CompilationInfo* info = this->info(); |
| 1151 __ Prologue(info->IsCodePreAgingActive()); | 1158 __ Prologue(info->IsCodePreAgingActive()); |
| 1152 frame()->SetRegisterSaveAreaSize( | 1159 frame()->SetRegisterSaveAreaSize( |
| 1153 StandardFrameConstants::kFixedFrameSizeFromFp); | 1160 StandardFrameConstants::kFixedFrameSizeFromFp); |
| 1154 } else if (needs_frame_) { | 1161 } else if (needs_frame_) { |
| 1155 __ StubPrologue(); | 1162 __ StubPrologue(); |
| 1156 frame()->SetRegisterSaveAreaSize( | 1163 frame()->SetRegisterSaveAreaSize( |
| 1157 StandardFrameConstants::kFixedFrameSizeFromFp); | 1164 StandardFrameConstants::kFixedFrameSizeFromFp); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1181 | 1188 |
| 1182 void CodeGenerator::AssembleReturn() { | 1189 void CodeGenerator::AssembleReturn() { |
| 1183 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1190 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
| 1184 int stack_slots = frame()->GetSpillSlotCount(); | 1191 int stack_slots = frame()->GetSpillSlotCount(); |
| 1185 if (descriptor->kind() == CallDescriptor::kCallAddress) { | 1192 if (descriptor->kind() == CallDescriptor::kCallAddress) { |
| 1186 if (frame()->GetRegisterSaveAreaSize() > 0) { | 1193 if (frame()->GetRegisterSaveAreaSize() > 0) { |
| 1187 // Remove this frame's spill slots first. | 1194 // Remove this frame's spill slots first. |
| 1188 if (stack_slots > 0) { | 1195 if (stack_slots > 0) { |
| 1189 __ Daddu(sp, sp, Operand(stack_slots * kPointerSize)); | 1196 __ Daddu(sp, sp, Operand(stack_slots * kPointerSize)); |
| 1190 } | 1197 } |
| 1191 // Restore registers. | 1198 // Restore FPU registers. |
| 1199 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); | |
| 1200 if (saves_fpu != 0) { | |
| 1201 __ MultiPopFPU(saves_fpu); | |
| 1202 } | |
| 1203 // Restore GP registers. | |
| 1192 const RegList saves = descriptor->CalleeSavedRegisters(); | 1204 const RegList saves = descriptor->CalleeSavedRegisters(); |
| 1193 if (saves != 0) { | 1205 if (saves != 0) { |
| 1194 __ MultiPop(saves); | 1206 __ MultiPop(saves); |
| 1195 } | 1207 } |
| 1196 } | 1208 } |
| 1197 __ mov(sp, fp); | 1209 __ mov(sp, fp); |
| 1198 __ Pop(ra, fp); | 1210 __ Pop(ra, fp); |
| 1199 __ Ret(); | 1211 __ Ret(); |
| 1200 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { | 1212 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { |
| 1201 __ mov(sp, fp); | 1213 __ mov(sp, fp); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1415 } | 1427 } |
| 1416 } | 1428 } |
| 1417 MarkLazyDeoptSite(); | 1429 MarkLazyDeoptSite(); |
| 1418 } | 1430 } |
| 1419 | 1431 |
| 1420 #undef __ | 1432 #undef __ |
| 1421 | 1433 |
| 1422 } // namespace compiler | 1434 } // namespace compiler |
| 1423 } // namespace internal | 1435 } // namespace internal |
| 1424 } // namespace v8 | 1436 } // namespace v8 |
| OLD | NEW |