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

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

Issue 1469283004: PPC: [turbofan] Switch passing of new.target to register. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 b(done); 1078 b(done);
1079 } 1079 }
1080 } else { 1080 } else {
1081 Jump(adaptor, RelocInfo::CODE_TARGET); 1081 Jump(adaptor, RelocInfo::CODE_TARGET);
1082 } 1082 }
1083 bind(&regular_invoke); 1083 bind(&regular_invoke);
1084 } 1084 }
1085 } 1085 }
1086 1086
1087 1087
1088 void MacroAssembler::InvokeCode(Register code, const ParameterCount& expected, 1088 void MacroAssembler::InvokeCode(Register code, Register new_target,
1089 const ParameterCount& expected,
1089 const ParameterCount& actual, InvokeFlag flag, 1090 const ParameterCount& actual, InvokeFlag flag,
1090 const CallWrapper& call_wrapper) { 1091 const CallWrapper& call_wrapper) {
1091 // You can't call a function without a valid frame. 1092 // You can't call a function without a valid frame.
1092 DCHECK(flag == JUMP_FUNCTION || has_frame()); 1093 DCHECK(flag == JUMP_FUNCTION || has_frame());
1093 1094
1095 // Ensure new target is passed in the correct register. Otherwise clear the
1096 // appropriate register in case new target is not given.
1097 DCHECK_IMPLIES(new_target.is_valid(), new_target.is(r6));
1098 if (!new_target.is_valid()) {
1099 LoadRoot(r6, Heap::kUndefinedValueRootIndex);
1100 }
1101
1094 Label done; 1102 Label done;
1095 bool definitely_mismatches = false; 1103 bool definitely_mismatches = false;
1096 InvokePrologue(expected, actual, &done, &definitely_mismatches, flag, 1104 InvokePrologue(expected, actual, &done, &definitely_mismatches, flag,
1097 call_wrapper); 1105 call_wrapper);
1098 if (!definitely_mismatches) { 1106 if (!definitely_mismatches) {
1099 if (flag == CALL_FUNCTION) { 1107 if (flag == CALL_FUNCTION) {
1100 call_wrapper.BeforeCall(CallSize(code)); 1108 call_wrapper.BeforeCall(CallSize(code));
1101 CallJSEntry(code); 1109 CallJSEntry(code);
1102 call_wrapper.AfterCall(); 1110 call_wrapper.AfterCall();
1103 } else { 1111 } else {
1104 DCHECK(flag == JUMP_FUNCTION); 1112 DCHECK(flag == JUMP_FUNCTION);
1105 JumpToJSEntry(code); 1113 JumpToJSEntry(code);
1106 } 1114 }
1107 1115
1108 // Continue here if InvokePrologue does handle the invocation due to 1116 // Continue here if InvokePrologue does handle the invocation due to
1109 // mismatched parameter counts. 1117 // mismatched parameter counts.
1110 bind(&done); 1118 bind(&done);
1111 } 1119 }
1112 } 1120 }
1113 1121
1114 1122
1115 void MacroAssembler::InvokeFunction(Register fun, const ParameterCount& actual, 1123 void MacroAssembler::InvokeFunction(Register fun, Register new_target,
1124 const ParameterCount& actual,
1116 InvokeFlag flag, 1125 InvokeFlag flag,
1117 const CallWrapper& call_wrapper) { 1126 const CallWrapper& call_wrapper) {
1118 // You can't call a function without a valid frame. 1127 // You can't call a function without a valid frame.
1119 DCHECK(flag == JUMP_FUNCTION || has_frame()); 1128 DCHECK(flag == JUMP_FUNCTION || has_frame());
1120 1129
1121 // Contract with called JS functions requires that function is passed in r4. 1130 // Contract with called JS functions requires that function is passed in r4.
1122 DCHECK(fun.is(r4)); 1131 DCHECK(fun.is(r4));
1123 1132
1124 Register expected_reg = r5; 1133 Register expected_reg = r5;
1125 Register code_reg = ip; 1134 Register code_reg = ip;
1126 1135
1127 LoadP(code_reg, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); 1136 LoadP(code_reg, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
1128 LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); 1137 LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset));
1129 LoadWordArith(expected_reg, 1138 LoadWordArith(expected_reg,
1130 FieldMemOperand( 1139 FieldMemOperand(
1131 code_reg, SharedFunctionInfo::kFormalParameterCountOffset)); 1140 code_reg, SharedFunctionInfo::kFormalParameterCountOffset));
1132 #if !defined(V8_TARGET_ARCH_PPC64) 1141 #if !defined(V8_TARGET_ARCH_PPC64)
1133 SmiUntag(expected_reg); 1142 SmiUntag(expected_reg);
1134 #endif 1143 #endif
1135 LoadP(code_reg, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); 1144 LoadP(code_reg, FieldMemOperand(r4, JSFunction::kCodeEntryOffset));
1136 1145
1137 ParameterCount expected(expected_reg); 1146 ParameterCount expected(expected_reg);
1138 InvokeCode(code_reg, expected, actual, flag, call_wrapper); 1147 InvokeCode(code_reg, new_target, expected, actual, flag, call_wrapper);
1139 } 1148 }
1140 1149
1141 1150
1142 void MacroAssembler::InvokeFunction(Register function, 1151 void MacroAssembler::InvokeFunction(Register function,
1143 const ParameterCount& expected, 1152 const ParameterCount& expected,
1144 const ParameterCount& actual, 1153 const ParameterCount& actual,
1145 InvokeFlag flag, 1154 InvokeFlag flag,
1146 const CallWrapper& call_wrapper) { 1155 const CallWrapper& call_wrapper) {
1147 // You can't call a function without a valid frame. 1156 // You can't call a function without a valid frame.
1148 DCHECK(flag == JUMP_FUNCTION || has_frame()); 1157 DCHECK(flag == JUMP_FUNCTION || has_frame());
1149 1158
1150 // Contract with called JS functions requires that function is passed in r4. 1159 // Contract with called JS functions requires that function is passed in r4.
1151 DCHECK(function.is(r4)); 1160 DCHECK(function.is(r4));
1152 1161
1153 // Get the function and setup the context. 1162 // Get the function and setup the context.
1154 LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); 1163 LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset));
1155 1164
1156 // We call indirectly through the code field in the function to 1165 // We call indirectly through the code field in the function to
1157 // allow recompilation to take effect without changing any of the 1166 // allow recompilation to take effect without changing any of the
1158 // call sites. 1167 // call sites.
1159 LoadP(ip, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); 1168 LoadP(ip, FieldMemOperand(r4, JSFunction::kCodeEntryOffset));
1160 InvokeCode(ip, expected, actual, flag, call_wrapper); 1169 InvokeCode(ip, no_reg, expected, actual, flag, call_wrapper);
1161 } 1170 }
1162 1171
1163 1172
1164 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, 1173 void MacroAssembler::InvokeFunction(Handle<JSFunction> function,
1165 const ParameterCount& expected, 1174 const ParameterCount& expected,
1166 const ParameterCount& actual, 1175 const ParameterCount& actual,
1167 InvokeFlag flag, 1176 InvokeFlag flag,
1168 const CallWrapper& call_wrapper) { 1177 const CallWrapper& call_wrapper) {
1169 Move(r4, function); 1178 Move(r4, function);
1170 InvokeFunction(r4, expected, actual, flag, call_wrapper); 1179 InvokeFunction(r4, expected, actual, flag, call_wrapper);
(...skipping 3257 matching lines...) Expand 10 before | Expand all | Expand 10 after
4428 } 4437 }
4429 if (mag.shift > 0) srawi(result, result, mag.shift); 4438 if (mag.shift > 0) srawi(result, result, mag.shift);
4430 ExtractBit(r0, dividend, 31); 4439 ExtractBit(r0, dividend, 31);
4431 add(result, result, r0); 4440 add(result, result, r0);
4432 } 4441 }
4433 4442
4434 } // namespace internal 4443 } // namespace internal
4435 } // namespace v8 4444 } // namespace v8
4436 4445
4437 #endif // V8_TARGET_ARCH_PPC 4446 #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