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 | 6 |
7 #include "src/arm64/macro-assembler-arm64.h" | 7 #include "src/arm64/macro-assembler-arm64.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 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1070 } | 1070 } |
1071 | 1071 |
1072 | 1072 |
1073 void CodeGenerator::AssemblePrologue() { | 1073 void CodeGenerator::AssemblePrologue() { |
1074 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1074 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1075 int stack_slots = frame()->GetSpillSlotCount(); | 1075 int stack_slots = frame()->GetSpillSlotCount(); |
1076 if (descriptor->kind() == CallDescriptor::kCallAddress) { | 1076 if (descriptor->kind() == CallDescriptor::kCallAddress) { |
1077 __ SetStackPointer(csp); | 1077 __ SetStackPointer(csp); |
1078 __ Push(lr, fp); | 1078 __ Push(lr, fp); |
1079 __ Mov(fp, csp); | 1079 __ Mov(fp, csp); |
1080 // TODO(dcarney): correct callee saved registers. | 1080 |
1081 __ PushCalleeSavedRegisters(); | 1081 // Save FP registers. |
1082 frame()->SetRegisterSaveAreaSize(20 * kPointerSize); | 1082 CPURegList callee_save_fp = |
paul.l...
2015/06/23 20:07:00
nit: change these vars to saves_fp, and saves, to
akos.palfi.imgtec
2015/06/23 20:33:18
Done.
| |
1083 CPURegList(CPURegister::kFPRegister, kDRegSizeInBits, | |
1084 descriptor->CalleeSavedFPRegisters()); | |
1085 DCHECK(callee_save_fp.list() == CPURegList::GetCalleeSavedFP().list()); | |
1086 int saved_count = callee_save_fp.Count(); | |
1087 __ PushCPURegList(callee_save_fp); | |
1088 // Save registers. | |
1089 CPURegList callee_save = CPURegList(CPURegister::kRegister, kXRegSizeInBits, | |
1090 descriptor->CalleeSavedRegisters()); | |
1091 // TODO(palfia): TF save list is not in sync with | |
1092 // CPURegList::GetCalleeSaved(): x30 is missing. | |
1093 // DCHECK(callee_save.list() == CPURegList::GetCalleeSaved().list()); | |
1094 saved_count += callee_save.Count(); | |
1095 __ PushCPURegList(callee_save); | |
1096 | |
1097 frame()->SetRegisterSaveAreaSize(saved_count * kPointerSize); | |
1083 } else if (descriptor->IsJSFunctionCall()) { | 1098 } else if (descriptor->IsJSFunctionCall()) { |
1084 CompilationInfo* info = this->info(); | 1099 CompilationInfo* info = this->info(); |
1085 __ SetStackPointer(jssp); | 1100 __ SetStackPointer(jssp); |
1086 __ Prologue(info->IsCodePreAgingActive()); | 1101 __ Prologue(info->IsCodePreAgingActive()); |
1087 frame()->SetRegisterSaveAreaSize( | 1102 frame()->SetRegisterSaveAreaSize( |
1088 StandardFrameConstants::kFixedFrameSizeFromFp); | 1103 StandardFrameConstants::kFixedFrameSizeFromFp); |
1089 } else if (needs_frame_) { | 1104 } else if (needs_frame_) { |
1090 __ SetStackPointer(jssp); | 1105 __ SetStackPointer(jssp); |
1091 __ StubPrologue(); | 1106 __ StubPrologue(); |
1092 frame()->SetRegisterSaveAreaSize( | 1107 frame()->SetRegisterSaveAreaSize( |
(...skipping 28 matching lines...) Expand all Loading... | |
1121 | 1136 |
1122 void CodeGenerator::AssembleReturn() { | 1137 void CodeGenerator::AssembleReturn() { |
1123 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1138 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1124 int stack_slots = frame()->GetSpillSlotCount(); | 1139 int stack_slots = frame()->GetSpillSlotCount(); |
1125 if (descriptor->kind() == CallDescriptor::kCallAddress) { | 1140 if (descriptor->kind() == CallDescriptor::kCallAddress) { |
1126 if (frame()->GetRegisterSaveAreaSize() > 0) { | 1141 if (frame()->GetRegisterSaveAreaSize() > 0) { |
1127 // Remove this frame's spill slots first. | 1142 // Remove this frame's spill slots first. |
1128 if (stack_slots > 0) { | 1143 if (stack_slots > 0) { |
1129 __ Add(csp, csp, AlignedStackSlots(stack_slots) * kPointerSize); | 1144 __ Add(csp, csp, AlignedStackSlots(stack_slots) * kPointerSize); |
1130 } | 1145 } |
1146 | |
1131 // Restore registers. | 1147 // Restore registers. |
1132 // TODO(dcarney): correct callee saved registers. | 1148 CPURegList callee_save = |
1133 __ PopCalleeSavedRegisters(); | 1149 CPURegList(CPURegister::kRegister, kXRegSizeInBits, |
1150 descriptor->CalleeSavedRegisters()); | |
1151 __ PopCPURegList(callee_save); | |
1152 | |
1153 CPURegList callee_save_fp = | |
paul.l...
2015/06/23 20:07:00
nit: same here.
akos.palfi.imgtec
2015/06/23 20:33:18
Done.
| |
1154 CPURegList(CPURegister::kFPRegister, kDRegSizeInBits, | |
1155 descriptor->CalleeSavedFPRegisters()); | |
1156 __ PopCPURegList(callee_save_fp); | |
1134 } | 1157 } |
1158 | |
1135 __ Mov(csp, fp); | 1159 __ Mov(csp, fp); |
1136 __ Pop(fp, lr); | 1160 __ Pop(fp, lr); |
1137 __ Ret(); | 1161 __ Ret(); |
1138 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { | 1162 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { |
1139 __ Mov(jssp, fp); | 1163 __ Mov(jssp, fp); |
1140 __ Pop(fp, lr); | 1164 __ Pop(fp, lr); |
1141 int pop_count = descriptor->IsJSFunctionCall() | 1165 int pop_count = descriptor->IsJSFunctionCall() |
1142 ? static_cast<int>(descriptor->JSParameterCount()) | 1166 ? static_cast<int>(descriptor->JSParameterCount()) |
1143 : 0; | 1167 : 0; |
1144 __ Drop(pop_count); | 1168 __ Drop(pop_count); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1329 } | 1353 } |
1330 } | 1354 } |
1331 } | 1355 } |
1332 } | 1356 } |
1333 | 1357 |
1334 #undef __ | 1358 #undef __ |
1335 | 1359 |
1336 } // namespace compiler | 1360 } // namespace compiler |
1337 } // namespace internal | 1361 } // namespace internal |
1338 } // namespace v8 | 1362 } // namespace v8 |
OLD | NEW |