| 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 int register_save_area_size = 0; |
| 1138 const RegList saves = descriptor->CalleeSavedRegisters(); | 1139 const RegList saves = descriptor->CalleeSavedRegisters(); |
| 1139 if (saves != 0) { // Save callee-saved registers. | 1140 if (saves != 0) { // Save callee-saved registers. |
| 1140 // TODO(plind): make callee save size const, possibly DCHECK it. | 1141 // TODO(plind): make callee save size const, possibly DCHECK it. |
| 1141 int register_save_area_size = 0; | |
| 1142 for (int i = Register::kNumRegisters - 1; i >= 0; i--) { | 1142 for (int i = Register::kNumRegisters - 1; i >= 0; i--) { |
| 1143 if (!((1 << i) & saves)) continue; | 1143 if (!((1 << i) & saves)) continue; |
| 1144 register_save_area_size += kPointerSize; | 1144 register_save_area_size += kPointerSize; |
| 1145 } | 1145 } |
| 1146 frame()->SetRegisterSaveAreaSize(register_save_area_size); | |
| 1147 __ MultiPush(saves); | 1146 __ MultiPush(saves); |
| 1148 } | 1147 } |
| 1148 const RegList saves_fpu = descriptor->CalleeSavedFPURegisters(); |
| 1149 if (saves_fpu != 0) { // Save callee-saved FPU registers. |
| 1150 // TODO(plind): make callee save size const, possibly DCHECK it. |
| 1151 for (int i = FPURegister::kMaxNumRegisters - 1; i >= 0; i--) { |
| 1152 if (!((1 << i) & saves_fpu)) continue; |
| 1153 register_save_area_size += kPointerSize; |
| 1154 } |
| 1155 __ MultiPushFPU(saves_fpu); |
| 1156 } |
| 1157 frame()->SetRegisterSaveAreaSize(register_save_area_size); |
| 1149 } else if (descriptor->IsJSFunctionCall()) { | 1158 } else if (descriptor->IsJSFunctionCall()) { |
| 1150 CompilationInfo* info = this->info(); | 1159 CompilationInfo* info = this->info(); |
| 1151 __ Prologue(info->IsCodePreAgingActive()); | 1160 __ Prologue(info->IsCodePreAgingActive()); |
| 1152 frame()->SetRegisterSaveAreaSize( | 1161 frame()->SetRegisterSaveAreaSize( |
| 1153 StandardFrameConstants::kFixedFrameSizeFromFp); | 1162 StandardFrameConstants::kFixedFrameSizeFromFp); |
| 1154 } else if (needs_frame_) { | 1163 } else if (needs_frame_) { |
| 1155 __ StubPrologue(); | 1164 __ StubPrologue(); |
| 1156 frame()->SetRegisterSaveAreaSize( | 1165 frame()->SetRegisterSaveAreaSize( |
| 1157 StandardFrameConstants::kFixedFrameSizeFromFp); | 1166 StandardFrameConstants::kFixedFrameSizeFromFp); |
| 1158 } | 1167 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1181 | 1190 |
| 1182 void CodeGenerator::AssembleReturn() { | 1191 void CodeGenerator::AssembleReturn() { |
| 1183 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1192 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
| 1184 int stack_slots = frame()->GetSpillSlotCount(); | 1193 int stack_slots = frame()->GetSpillSlotCount(); |
| 1185 if (descriptor->kind() == CallDescriptor::kCallAddress) { | 1194 if (descriptor->kind() == CallDescriptor::kCallAddress) { |
| 1186 if (frame()->GetRegisterSaveAreaSize() > 0) { | 1195 if (frame()->GetRegisterSaveAreaSize() > 0) { |
| 1187 // Remove this frame's spill slots first. | 1196 // Remove this frame's spill slots first. |
| 1188 if (stack_slots > 0) { | 1197 if (stack_slots > 0) { |
| 1189 __ Daddu(sp, sp, Operand(stack_slots * kPointerSize)); | 1198 __ Daddu(sp, sp, Operand(stack_slots * kPointerSize)); |
| 1190 } | 1199 } |
| 1191 // Restore registers. | 1200 // Restore FPU registers. |
| 1201 const RegList saves_fpu = descriptor->CalleeSavedFPURegisters(); |
| 1202 if (saves_fpu != 0) { |
| 1203 __ MultiPopFPU(saves_fpu); |
| 1204 } |
| 1205 // Restore GP registers. |
| 1192 const RegList saves = descriptor->CalleeSavedRegisters(); | 1206 const RegList saves = descriptor->CalleeSavedRegisters(); |
| 1193 if (saves != 0) { | 1207 if (saves != 0) { |
| 1194 __ MultiPop(saves); | 1208 __ MultiPop(saves); |
| 1195 } | 1209 } |
| 1196 } | 1210 } |
| 1197 __ mov(sp, fp); | 1211 __ mov(sp, fp); |
| 1198 __ Pop(ra, fp); | 1212 __ Pop(ra, fp); |
| 1199 __ Ret(); | 1213 __ Ret(); |
| 1200 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { | 1214 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { |
| 1201 __ mov(sp, fp); | 1215 __ mov(sp, fp); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1415 } | 1429 } |
| 1416 } | 1430 } |
| 1417 MarkLazyDeoptSite(); | 1431 MarkLazyDeoptSite(); |
| 1418 } | 1432 } |
| 1419 | 1433 |
| 1420 #undef __ | 1434 #undef __ |
| 1421 | 1435 |
| 1422 } // namespace compiler | 1436 } // namespace compiler |
| 1423 } // namespace internal | 1437 } // namespace internal |
| 1424 } // namespace v8 | 1438 } // namespace v8 |
| OLD | NEW |