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 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1087 } | 1087 } |
1088 | 1088 |
1089 | 1089 |
1090 void CodeGenerator::AssemblePrologue() { | 1090 void CodeGenerator::AssemblePrologue() { |
1091 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1091 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1092 int stack_slots = frame()->GetSpillSlotCount(); | 1092 int stack_slots = frame()->GetSpillSlotCount(); |
1093 if (descriptor->kind() == CallDescriptor::kCallAddress) { | 1093 if (descriptor->kind() == CallDescriptor::kCallAddress) { |
1094 __ SetStackPointer(csp); | 1094 __ SetStackPointer(csp); |
1095 __ Push(lr, fp); | 1095 __ Push(lr, fp); |
1096 __ Mov(fp, csp); | 1096 __ Mov(fp, csp); |
1097 // TODO(dcarney): correct callee saved registers. | 1097 |
1098 __ PushCalleeSavedRegisters(); | 1098 // Save FP registers. |
1099 frame()->SetRegisterSaveAreaSize(20 * kPointerSize); | 1099 CPURegList saves_fp = CPURegList(CPURegister::kFPRegister, kDRegSizeInBits, |
1100 descriptor->CalleeSavedFPRegisters()); | |
1101 DCHECK(saves_fp.list() == CPURegList::GetCalleeSavedFP().list()); | |
1102 int saved_count = saves_fp.Count(); | |
1103 __ PushCPURegList(saves_fp); | |
1104 // Save registers. | |
1105 CPURegList saves = CPURegList(CPURegister::kRegister, kXRegSizeInBits, | |
1106 descriptor->CalleeSavedRegisters()); | |
1107 // TODO(palfia): TF save list is not in sync with | |
1108 // CPURegList::GetCalleeSaved(): x30 is missing. | |
jbramley
2015/06/29 13:53:09
x30 (lr) is caller-saved in the procedure-call sta
akos.palfi.imgtec
2015/06/30 12:31:49
Acknowledged.
| |
1109 // DCHECK(saves.list() == CPURegList::GetCalleeSaved().list()); | |
1110 saved_count += saves.Count(); | |
1111 __ PushCPURegList(saves); | |
1112 | |
1113 frame()->SetRegisterSaveAreaSize(saved_count * kPointerSize); | |
1100 } else if (descriptor->IsJSFunctionCall()) { | 1114 } else if (descriptor->IsJSFunctionCall()) { |
1101 CompilationInfo* info = this->info(); | 1115 CompilationInfo* info = this->info(); |
1102 __ SetStackPointer(jssp); | 1116 __ SetStackPointer(jssp); |
1103 __ Prologue(info->IsCodePreAgingActive()); | 1117 __ Prologue(info->IsCodePreAgingActive()); |
1104 frame()->SetRegisterSaveAreaSize( | 1118 frame()->SetRegisterSaveAreaSize( |
1105 StandardFrameConstants::kFixedFrameSizeFromFp); | 1119 StandardFrameConstants::kFixedFrameSizeFromFp); |
1106 } else if (needs_frame_) { | 1120 } else if (needs_frame_) { |
1107 __ SetStackPointer(jssp); | 1121 __ SetStackPointer(jssp); |
1108 __ StubPrologue(); | 1122 __ StubPrologue(); |
1109 frame()->SetRegisterSaveAreaSize( | 1123 frame()->SetRegisterSaveAreaSize( |
(...skipping 28 matching lines...) Expand all Loading... | |
1138 | 1152 |
1139 void CodeGenerator::AssembleReturn() { | 1153 void CodeGenerator::AssembleReturn() { |
1140 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1154 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1141 int stack_slots = frame()->GetSpillSlotCount(); | 1155 int stack_slots = frame()->GetSpillSlotCount(); |
1142 if (descriptor->kind() == CallDescriptor::kCallAddress) { | 1156 if (descriptor->kind() == CallDescriptor::kCallAddress) { |
1143 if (frame()->GetRegisterSaveAreaSize() > 0) { | 1157 if (frame()->GetRegisterSaveAreaSize() > 0) { |
1144 // Remove this frame's spill slots first. | 1158 // Remove this frame's spill slots first. |
1145 if (stack_slots > 0) { | 1159 if (stack_slots > 0) { |
1146 __ Add(csp, csp, AlignedStackSlots(stack_slots) * kPointerSize); | 1160 __ Add(csp, csp, AlignedStackSlots(stack_slots) * kPointerSize); |
1147 } | 1161 } |
1162 | |
1148 // Restore registers. | 1163 // Restore registers. |
1149 // TODO(dcarney): correct callee saved registers. | 1164 CPURegList saves = CPURegList(CPURegister::kRegister, kXRegSizeInBits, |
1150 __ PopCalleeSavedRegisters(); | 1165 descriptor->CalleeSavedRegisters()); |
1166 __ PopCPURegList(saves); | |
1167 | |
1168 CPURegList saves_fp = | |
1169 CPURegList(CPURegister::kFPRegister, kDRegSizeInBits, | |
1170 descriptor->CalleeSavedFPRegisters()); | |
1171 __ PopCPURegList(saves_fp); | |
1151 } | 1172 } |
1173 | |
1152 __ Mov(csp, fp); | 1174 __ Mov(csp, fp); |
1153 __ Pop(fp, lr); | 1175 __ Pop(fp, lr); |
1154 __ Ret(); | 1176 __ Ret(); |
1155 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { | 1177 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { |
1156 // Canonicalize JSFunction return sites for now. | 1178 // Canonicalize JSFunction return sites for now. |
1157 if (return_label_.is_bound()) { | 1179 if (return_label_.is_bound()) { |
1158 __ B(&return_label_); | 1180 __ B(&return_label_); |
1159 } else { | 1181 } else { |
1160 __ Bind(&return_label_); | 1182 __ Bind(&return_label_); |
1161 __ Mov(jssp, fp); | 1183 __ Mov(jssp, fp); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1352 } | 1374 } |
1353 } | 1375 } |
1354 } | 1376 } |
1355 } | 1377 } |
1356 | 1378 |
1357 #undef __ | 1379 #undef __ |
1358 | 1380 |
1359 } // namespace compiler | 1381 } // namespace compiler |
1360 } // namespace internal | 1382 } // namespace internal |
1361 } // namespace v8 | 1383 } // namespace v8 |
OLD | NEW |