Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(826)

Side by Side Diff: src/ppc/macro-assembler-ppc.cc

Issue 1767173002: PPC: [crankshaft] Support ES6 tail call elimination. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ppc/macro-assembler-ppc.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <assert.h> // For assert 5 #include <assert.h> // For assert
6 #include <limits.h> // For LONG_MIN, LONG_MAX. 6 #include <limits.h> // For LONG_MIN, LONG_MAX.
7 7
8 #if V8_TARGET_ARCH_PPC 8 #if V8_TARGET_ARCH_PPC
9 9
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 1086
1087 void MacroAssembler::MovFromFloatResult(const DoubleRegister dst) { 1087 void MacroAssembler::MovFromFloatResult(const DoubleRegister dst) {
1088 Move(dst, d1); 1088 Move(dst, d1);
1089 } 1089 }
1090 1090
1091 1091
1092 void MacroAssembler::MovFromFloatParameter(const DoubleRegister dst) { 1092 void MacroAssembler::MovFromFloatParameter(const DoubleRegister dst) {
1093 Move(dst, d1); 1093 Move(dst, d1);
1094 } 1094 }
1095 1095
1096 void MacroAssembler::PrepareForTailCall(const ParameterCount& callee_args_count,
1097 Register caller_args_count_reg,
1098 Register scratch0, Register scratch1) {
1099 #if DEBUG
1100 if (callee_args_count.is_reg()) {
1101 DCHECK(!AreAliased(callee_args_count.reg(), caller_args_count_reg, scratch0,
1102 scratch1));
1103 } else {
1104 DCHECK(!AreAliased(caller_args_count_reg, scratch0, scratch1));
1105 }
1106 #endif
1107
1108 // Calculate the end of destination area where we will put the arguments
1109 // after we drop current frame. We add kPointerSize to count the receiver
1110 // argument which is not included into formal parameters count.
1111 Register dst_reg = scratch0;
1112 ShiftLeftImm(dst_reg, caller_args_count_reg, Operand(kPointerSizeLog2));
1113 add(dst_reg, fp, dst_reg);
1114 addi(dst_reg, dst_reg,
1115 Operand(StandardFrameConstants::kCallerSPOffset + kPointerSize));
1116
1117 Register src_reg = caller_args_count_reg;
1118 // Calculate the end of source area. +kPointerSize is for the receiver.
1119 if (callee_args_count.is_reg()) {
1120 ShiftLeftImm(src_reg, callee_args_count.reg(), Operand(kPointerSizeLog2));
1121 add(src_reg, sp, src_reg);
1122 addi(src_reg, src_reg, Operand(kPointerSize));
1123 } else {
1124 Add(src_reg, sp, (callee_args_count.immediate() + 1) * kPointerSize, r0);
1125 }
1126
1127 if (FLAG_debug_code) {
1128 cmpl(src_reg, dst_reg);
1129 Check(lt, kStackAccessBelowStackPointer);
1130 }
1131
1132 // Restore caller's frame pointer and return address now as they will be
1133 // overwritten by the copying loop.
1134 RestoreFrameStateForTailCall();
1135
1136 // Now copy callee arguments to the caller frame going backwards to avoid
1137 // callee arguments corruption (source and destination areas could overlap).
1138
1139 // Both src_reg and dst_reg are pointing to the word after the one to copy,
1140 // so they must be pre-decremented in the loop.
1141 Register tmp_reg = scratch1;
1142 Label loop;
1143 if (callee_args_count.is_reg()) {
1144 addi(tmp_reg, callee_args_count.reg(), Operand(1)); // +1 for receiver
1145 } else {
1146 mov(tmp_reg, Operand(callee_args_count.immediate() + 1));
1147 }
1148 mtctr(tmp_reg);
1149 bind(&loop);
1150 LoadPU(tmp_reg, MemOperand(src_reg, -kPointerSize));
1151 StorePU(tmp_reg, MemOperand(dst_reg, -kPointerSize));
1152 bdnz(&loop);
1153
1154 // Leave current frame.
1155 mr(sp, dst_reg);
1156 }
1096 1157
1097 void MacroAssembler::InvokePrologue(const ParameterCount& expected, 1158 void MacroAssembler::InvokePrologue(const ParameterCount& expected,
1098 const ParameterCount& actual, Label* done, 1159 const ParameterCount& actual, Label* done,
1099 bool* definitely_mismatches, 1160 bool* definitely_mismatches,
1100 InvokeFlag flag, 1161 InvokeFlag flag,
1101 const CallWrapper& call_wrapper) { 1162 const CallWrapper& call_wrapper) {
1102 bool definitely_matches = false; 1163 bool definitely_matches = false;
1103 *definitely_mismatches = false; 1164 *definitely_mismatches = false;
1104 Label regular_invoke; 1165 Label regular_invoke;
1105 1166
(...skipping 3294 matching lines...) Expand 10 before | Expand all | Expand 10 after
4400 } 4461 }
4401 if (mag.shift > 0) srawi(result, result, mag.shift); 4462 if (mag.shift > 0) srawi(result, result, mag.shift);
4402 ExtractBit(r0, dividend, 31); 4463 ExtractBit(r0, dividend, 31);
4403 add(result, result, r0); 4464 add(result, result, r0);
4404 } 4465 }
4405 4466
4406 } // namespace internal 4467 } // namespace internal
4407 } // namespace v8 4468 } // namespace v8
4408 4469
4409 #endif // V8_TARGET_ARCH_PPC 4470 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ppc/macro-assembler-ppc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698