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 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1055 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 1055 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
1056 } | 1056 } |
1057 | 1057 |
1058 | 1058 |
1059 void CodeGenerator::AssemblePrologue() { | 1059 void CodeGenerator::AssemblePrologue() { |
1060 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1060 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1061 int stack_slots = frame()->GetSpillSlotCount(); | 1061 int stack_slots = frame()->GetSpillSlotCount(); |
1062 if (descriptor->kind() == CallDescriptor::kCallAddress) { | 1062 if (descriptor->kind() == CallDescriptor::kCallAddress) { |
1063 __ Push(ra, fp); | 1063 __ Push(ra, fp); |
1064 __ mov(fp, sp); | 1064 __ mov(fp, sp); |
1065 int register_save_area_size = 0; | |
1065 const RegList saves = descriptor->CalleeSavedRegisters(); | 1066 const RegList saves = descriptor->CalleeSavedRegisters(); |
1066 if (saves != 0) { // Save callee-saved registers. | 1067 if (saves != 0) { // Save callee-saved registers. |
1067 // TODO(plind): make callee save size const, possibly DCHECK it. | 1068 // TODO(plind): make callee save size const, possibly DCHECK it. |
1068 int register_save_area_size = 0; | |
1069 for (int i = Register::kNumRegisters - 1; i >= 0; i--) { | 1069 for (int i = Register::kNumRegisters - 1; i >= 0; i--) { |
1070 if (!((1 << i) & saves)) continue; | 1070 if (!((1 << i) & saves)) continue; |
1071 register_save_area_size += kPointerSize; | 1071 register_save_area_size += kPointerSize; |
paul.l...
2015/06/15 23:05:17
Rather than computing this, use kNumCalleeSaved +
akos.palfi.imgtec
2015/06/22 17:33:20
Done.
| |
1072 } | 1072 } |
1073 frame()->SetRegisterSaveAreaSize(register_save_area_size); | |
1074 __ MultiPush(saves); | 1073 __ MultiPush(saves); |
1075 } | 1074 } |
1075 const RegList saves_fpu = descriptor->CalleeSavedFPURegisters(); | |
1076 if (saves_fpu != 0) { // Save callee-saved FPU registers. | |
1077 // TODO(plind): make callee save size const, possibly DCHECK it. | |
1078 for (int i = FPURegister::kMaxNumRegisters - 1; i >= 0; i--) { | |
1079 if (!((1 << i) & saves_fpu)) continue; | |
1080 register_save_area_size += kPointerSize; | |
1081 } | |
1082 __ MultiPushFPU(saves_fpu); | |
1083 } | |
1084 frame()->SetRegisterSaveAreaSize(register_save_area_size); | |
1076 } else if (descriptor->IsJSFunctionCall()) { | 1085 } else if (descriptor->IsJSFunctionCall()) { |
1077 CompilationInfo* info = this->info(); | 1086 CompilationInfo* info = this->info(); |
1078 __ Prologue(info->IsCodePreAgingActive()); | 1087 __ Prologue(info->IsCodePreAgingActive()); |
1079 frame()->SetRegisterSaveAreaSize( | 1088 frame()->SetRegisterSaveAreaSize( |
1080 StandardFrameConstants::kFixedFrameSizeFromFp); | 1089 StandardFrameConstants::kFixedFrameSizeFromFp); |
1081 } else if (needs_frame_) { | 1090 } else if (needs_frame_) { |
1082 __ StubPrologue(); | 1091 __ StubPrologue(); |
1083 frame()->SetRegisterSaveAreaSize( | 1092 frame()->SetRegisterSaveAreaSize( |
1084 StandardFrameConstants::kFixedFrameSizeFromFp); | 1093 StandardFrameConstants::kFixedFrameSizeFromFp); |
1085 } | 1094 } |
(...skipping 22 matching lines...) Expand all Loading... | |
1108 | 1117 |
1109 void CodeGenerator::AssembleReturn() { | 1118 void CodeGenerator::AssembleReturn() { |
1110 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1119 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1111 int stack_slots = frame()->GetSpillSlotCount(); | 1120 int stack_slots = frame()->GetSpillSlotCount(); |
1112 if (descriptor->kind() == CallDescriptor::kCallAddress) { | 1121 if (descriptor->kind() == CallDescriptor::kCallAddress) { |
1113 if (frame()->GetRegisterSaveAreaSize() > 0) { | 1122 if (frame()->GetRegisterSaveAreaSize() > 0) { |
1114 // Remove this frame's spill slots first. | 1123 // Remove this frame's spill slots first. |
1115 if (stack_slots > 0) { | 1124 if (stack_slots > 0) { |
1116 __ Addu(sp, sp, Operand(stack_slots * kPointerSize)); | 1125 __ Addu(sp, sp, Operand(stack_slots * kPointerSize)); |
1117 } | 1126 } |
1118 // Restore registers. | 1127 // Restore FPU registers. |
1128 const RegList saves_fpu = descriptor->CalleeSavedFPURegisters(); | |
1129 if (saves_fpu != 0) { | |
1130 __ MultiPopFPU(saves_fpu); | |
1131 } | |
1132 // Restore GP registers. | |
1119 const RegList saves = descriptor->CalleeSavedRegisters(); | 1133 const RegList saves = descriptor->CalleeSavedRegisters(); |
1120 if (saves != 0) { | 1134 if (saves != 0) { |
1121 __ MultiPop(saves); | 1135 __ MultiPop(saves); |
1122 } | 1136 } |
1123 } | 1137 } |
1124 __ mov(sp, fp); | 1138 __ mov(sp, fp); |
1125 __ Pop(ra, fp); | 1139 __ Pop(ra, fp); |
1126 __ Ret(); | 1140 __ Ret(); |
1127 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { | 1141 } else if (descriptor->IsJSFunctionCall() || needs_frame_) { |
1128 __ mov(sp, fp); | 1142 __ mov(sp, fp); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1342 } | 1356 } |
1343 } | 1357 } |
1344 MarkLazyDeoptSite(); | 1358 MarkLazyDeoptSite(); |
1345 } | 1359 } |
1346 | 1360 |
1347 #undef __ | 1361 #undef __ |
1348 | 1362 |
1349 } // namespace compiler | 1363 } // namespace compiler |
1350 } // namespace internal | 1364 } // namespace internal |
1351 } // namespace v8 | 1365 } // namespace v8 |
OLD | NEW |