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

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

Issue 132623005: A64: Synchronize with r18642. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm/stub-cache-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 } 1089 }
1090 } 1090 }
1091 1091
1092 1092
1093 // On ARM this is just a synonym to make the purpose clear. 1093 // On ARM this is just a synonym to make the purpose clear.
1094 void MacroAssembler::MovFromFloatParameter(DwVfpRegister dst) { 1094 void MacroAssembler::MovFromFloatParameter(DwVfpRegister dst) {
1095 MovFromFloatResult(dst); 1095 MovFromFloatResult(dst);
1096 } 1096 }
1097 1097
1098 1098
1099 void MacroAssembler::SetCallKind(Register dst, CallKind call_kind) {
1100 // This macro takes the dst register to make the code more readable
1101 // at the call sites. However, the dst register has to be r5 to
1102 // follow the calling convention which requires the call type to be
1103 // in r5.
1104 ASSERT(dst.is(r5));
1105 if (call_kind == CALL_AS_FUNCTION) {
1106 mov(dst, Operand(Smi::FromInt(1)));
1107 } else {
1108 mov(dst, Operand(Smi::FromInt(0)));
1109 }
1110 }
1111
1112
1113 void MacroAssembler::InvokePrologue(const ParameterCount& expected, 1099 void MacroAssembler::InvokePrologue(const ParameterCount& expected,
1114 const ParameterCount& actual, 1100 const ParameterCount& actual,
1115 Handle<Code> code_constant, 1101 Handle<Code> code_constant,
1116 Register code_reg, 1102 Register code_reg,
1117 Label* done, 1103 Label* done,
1118 bool* definitely_mismatches, 1104 bool* definitely_mismatches,
1119 InvokeFlag flag, 1105 InvokeFlag flag,
1120 const CallWrapper& call_wrapper, 1106 const CallWrapper& call_wrapper) {
1121 CallKind call_kind) {
1122 bool definitely_matches = false; 1107 bool definitely_matches = false;
1123 *definitely_mismatches = false; 1108 *definitely_mismatches = false;
1124 Label regular_invoke; 1109 Label regular_invoke;
1125 1110
1126 // Check whether the expected and actual arguments count match. If not, 1111 // Check whether the expected and actual arguments count match. If not,
1127 // setup registers according to contract with ArgumentsAdaptorTrampoline: 1112 // setup registers according to contract with ArgumentsAdaptorTrampoline:
1128 // r0: actual arguments count 1113 // r0: actual arguments count
1129 // r1: function (passed through to callee) 1114 // r1: function (passed through to callee)
1130 // r2: expected arguments count 1115 // r2: expected arguments count
1131 // r3: callee code entry
1132 1116
1133 // The code below is made a lot easier because the calling code already sets 1117 // The code below is made a lot easier because the calling code already sets
1134 // up actual and expected registers according to the contract if values are 1118 // up actual and expected registers according to the contract if values are
1135 // passed in registers. 1119 // passed in registers.
1136 ASSERT(actual.is_immediate() || actual.reg().is(r0)); 1120 ASSERT(actual.is_immediate() || actual.reg().is(r0));
1137 ASSERT(expected.is_immediate() || expected.reg().is(r2)); 1121 ASSERT(expected.is_immediate() || expected.reg().is(r2));
1138 ASSERT((!code_constant.is_null() && code_reg.is(no_reg)) || code_reg.is(r3)); 1122 ASSERT((!code_constant.is_null() && code_reg.is(no_reg)) || code_reg.is(r3));
1139 1123
1140 if (expected.is_immediate()) { 1124 if (expected.is_immediate()) {
1141 ASSERT(actual.is_immediate()); 1125 ASSERT(actual.is_immediate());
(...skipping 27 matching lines...) Expand all
1169 if (!definitely_matches) { 1153 if (!definitely_matches) {
1170 if (!code_constant.is_null()) { 1154 if (!code_constant.is_null()) {
1171 mov(r3, Operand(code_constant)); 1155 mov(r3, Operand(code_constant));
1172 add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); 1156 add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag));
1173 } 1157 }
1174 1158
1175 Handle<Code> adaptor = 1159 Handle<Code> adaptor =
1176 isolate()->builtins()->ArgumentsAdaptorTrampoline(); 1160 isolate()->builtins()->ArgumentsAdaptorTrampoline();
1177 if (flag == CALL_FUNCTION) { 1161 if (flag == CALL_FUNCTION) {
1178 call_wrapper.BeforeCall(CallSize(adaptor)); 1162 call_wrapper.BeforeCall(CallSize(adaptor));
1179 SetCallKind(r5, call_kind);
1180 Call(adaptor); 1163 Call(adaptor);
1181 call_wrapper.AfterCall(); 1164 call_wrapper.AfterCall();
1182 if (!*definitely_mismatches) { 1165 if (!*definitely_mismatches) {
1183 b(done); 1166 b(done);
1184 } 1167 }
1185 } else { 1168 } else {
1186 SetCallKind(r5, call_kind);
1187 Jump(adaptor, RelocInfo::CODE_TARGET); 1169 Jump(adaptor, RelocInfo::CODE_TARGET);
1188 } 1170 }
1189 bind(&regular_invoke); 1171 bind(&regular_invoke);
1190 } 1172 }
1191 } 1173 }
1192 1174
1193 1175
1194 void MacroAssembler::InvokeCode(Register code, 1176 void MacroAssembler::InvokeCode(Register code,
1195 const ParameterCount& expected, 1177 const ParameterCount& expected,
1196 const ParameterCount& actual, 1178 const ParameterCount& actual,
1197 InvokeFlag flag, 1179 InvokeFlag flag,
1198 const CallWrapper& call_wrapper, 1180 const CallWrapper& call_wrapper) {
1199 CallKind call_kind) {
1200 // You can't call a function without a valid frame. 1181 // You can't call a function without a valid frame.
1201 ASSERT(flag == JUMP_FUNCTION || has_frame()); 1182 ASSERT(flag == JUMP_FUNCTION || has_frame());
1202 1183
1203 Label done; 1184 Label done;
1204 bool definitely_mismatches = false; 1185 bool definitely_mismatches = false;
1205 InvokePrologue(expected, actual, Handle<Code>::null(), code, 1186 InvokePrologue(expected, actual, Handle<Code>::null(), code,
1206 &done, &definitely_mismatches, flag, 1187 &done, &definitely_mismatches, flag,
1207 call_wrapper, call_kind); 1188 call_wrapper);
1208 if (!definitely_mismatches) { 1189 if (!definitely_mismatches) {
1209 if (flag == CALL_FUNCTION) { 1190 if (flag == CALL_FUNCTION) {
1210 call_wrapper.BeforeCall(CallSize(code)); 1191 call_wrapper.BeforeCall(CallSize(code));
1211 SetCallKind(r5, call_kind);
1212 Call(code); 1192 Call(code);
1213 call_wrapper.AfterCall(); 1193 call_wrapper.AfterCall();
1214 } else { 1194 } else {
1215 ASSERT(flag == JUMP_FUNCTION); 1195 ASSERT(flag == JUMP_FUNCTION);
1216 SetCallKind(r5, call_kind);
1217 Jump(code); 1196 Jump(code);
1218 } 1197 }
1219 1198
1220 // Continue here if InvokePrologue does handle the invocation due to 1199 // Continue here if InvokePrologue does handle the invocation due to
1221 // mismatched parameter counts. 1200 // mismatched parameter counts.
1222 bind(&done); 1201 bind(&done);
1223 } 1202 }
1224 } 1203 }
1225 1204
1226 1205
1227 void MacroAssembler::InvokeCode(Handle<Code> code,
1228 const ParameterCount& expected,
1229 const ParameterCount& actual,
1230 RelocInfo::Mode rmode,
1231 InvokeFlag flag,
1232 CallKind call_kind) {
1233 // You can't call a function without a valid frame.
1234 ASSERT(flag == JUMP_FUNCTION || has_frame());
1235
1236 Label done;
1237 bool definitely_mismatches = false;
1238 InvokePrologue(expected, actual, code, no_reg,
1239 &done, &definitely_mismatches, flag,
1240 NullCallWrapper(), call_kind);
1241 if (!definitely_mismatches) {
1242 if (flag == CALL_FUNCTION) {
1243 SetCallKind(r5, call_kind);
1244 Call(code, rmode);
1245 } else {
1246 SetCallKind(r5, call_kind);
1247 Jump(code, rmode);
1248 }
1249
1250 // Continue here if InvokePrologue does handle the invocation due to
1251 // mismatched parameter counts.
1252 bind(&done);
1253 }
1254 }
1255
1256
1257 void MacroAssembler::InvokeFunction(Register fun, 1206 void MacroAssembler::InvokeFunction(Register fun,
1258 const ParameterCount& actual, 1207 const ParameterCount& actual,
1259 InvokeFlag flag, 1208 InvokeFlag flag,
1260 const CallWrapper& call_wrapper, 1209 const CallWrapper& call_wrapper) {
1261 CallKind call_kind) {
1262 // You can't call a function without a valid frame. 1210 // You can't call a function without a valid frame.
1263 ASSERT(flag == JUMP_FUNCTION || has_frame()); 1211 ASSERT(flag == JUMP_FUNCTION || has_frame());
1264 1212
1265 // Contract with called JS functions requires that function is passed in r1. 1213 // Contract with called JS functions requires that function is passed in r1.
1266 ASSERT(fun.is(r1)); 1214 ASSERT(fun.is(r1));
1267 1215
1268 Register expected_reg = r2; 1216 Register expected_reg = r2;
1269 Register code_reg = r3; 1217 Register code_reg = r3;
1270 1218
1271 ldr(code_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 1219 ldr(code_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
1272 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 1220 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
1273 ldr(expected_reg, 1221 ldr(expected_reg,
1274 FieldMemOperand(code_reg, 1222 FieldMemOperand(code_reg,
1275 SharedFunctionInfo::kFormalParameterCountOffset)); 1223 SharedFunctionInfo::kFormalParameterCountOffset));
1276 SmiUntag(expected_reg); 1224 SmiUntag(expected_reg);
1277 ldr(code_reg, 1225 ldr(code_reg,
1278 FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); 1226 FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
1279 1227
1280 ParameterCount expected(expected_reg); 1228 ParameterCount expected(expected_reg);
1281 InvokeCode(code_reg, expected, actual, flag, call_wrapper, call_kind); 1229 InvokeCode(code_reg, expected, actual, flag, call_wrapper);
1282 } 1230 }
1283 1231
1284 1232
1285 void MacroAssembler::InvokeFunction(Register function, 1233 void MacroAssembler::InvokeFunction(Register function,
1286 const ParameterCount& expected, 1234 const ParameterCount& expected,
1287 const ParameterCount& actual, 1235 const ParameterCount& actual,
1288 InvokeFlag flag, 1236 InvokeFlag flag,
1289 const CallWrapper& call_wrapper, 1237 const CallWrapper& call_wrapper) {
1290 CallKind call_kind) {
1291 // You can't call a function without a valid frame. 1238 // You can't call a function without a valid frame.
1292 ASSERT(flag == JUMP_FUNCTION || has_frame()); 1239 ASSERT(flag == JUMP_FUNCTION || has_frame());
1293 1240
1294 // Contract with called JS functions requires that function is passed in r1. 1241 // Contract with called JS functions requires that function is passed in r1.
1295 ASSERT(function.is(r1)); 1242 ASSERT(function.is(r1));
1296 1243
1297 // Get the function and setup the context. 1244 // Get the function and setup the context.
1298 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 1245 ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
1299 1246
1300 // We call indirectly through the code field in the function to 1247 // We call indirectly through the code field in the function to
1301 // allow recompilation to take effect without changing any of the 1248 // allow recompilation to take effect without changing any of the
1302 // call sites. 1249 // call sites.
1303 ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); 1250 ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
1304 InvokeCode(r3, expected, actual, flag, call_wrapper, call_kind); 1251 InvokeCode(r3, expected, actual, flag, call_wrapper);
1305 } 1252 }
1306 1253
1307 1254
1308 void MacroAssembler::InvokeFunction(Handle<JSFunction> function, 1255 void MacroAssembler::InvokeFunction(Handle<JSFunction> function,
1309 const ParameterCount& expected, 1256 const ParameterCount& expected,
1310 const ParameterCount& actual, 1257 const ParameterCount& actual,
1311 InvokeFlag flag, 1258 InvokeFlag flag,
1312 const CallWrapper& call_wrapper, 1259 const CallWrapper& call_wrapper) {
1313 CallKind call_kind) {
1314 Move(r1, function); 1260 Move(r1, function);
1315 InvokeFunction(r1, expected, actual, flag, call_wrapper, call_kind); 1261 InvokeFunction(r1, expected, actual, flag, call_wrapper);
1316 } 1262 }
1317 1263
1318 1264
1319 void MacroAssembler::IsObjectJSObjectType(Register heap_object, 1265 void MacroAssembler::IsObjectJSObjectType(Register heap_object,
1320 Register map, 1266 Register map,
1321 Register scratch, 1267 Register scratch,
1322 Label* fail) { 1268 Label* fail) {
1323 ldr(map, FieldMemOperand(heap_object, HeapObject::kMapOffset)); 1269 ldr(map, FieldMemOperand(heap_object, HeapObject::kMapOffset));
1324 IsInstanceJSObjectType(map, scratch, fail); 1270 IsInstanceJSObjectType(map, scratch, fail);
1325 } 1271 }
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
2752 2698
2753 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, 2699 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id,
2754 InvokeFlag flag, 2700 InvokeFlag flag,
2755 const CallWrapper& call_wrapper) { 2701 const CallWrapper& call_wrapper) {
2756 // You can't call a builtin without a valid frame. 2702 // You can't call a builtin without a valid frame.
2757 ASSERT(flag == JUMP_FUNCTION || has_frame()); 2703 ASSERT(flag == JUMP_FUNCTION || has_frame());
2758 2704
2759 GetBuiltinEntry(r2, id); 2705 GetBuiltinEntry(r2, id);
2760 if (flag == CALL_FUNCTION) { 2706 if (flag == CALL_FUNCTION) {
2761 call_wrapper.BeforeCall(CallSize(r2)); 2707 call_wrapper.BeforeCall(CallSize(r2));
2762 SetCallKind(r5, CALL_AS_METHOD);
2763 Call(r2); 2708 Call(r2);
2764 call_wrapper.AfterCall(); 2709 call_wrapper.AfterCall();
2765 } else { 2710 } else {
2766 ASSERT(flag == JUMP_FUNCTION); 2711 ASSERT(flag == JUMP_FUNCTION);
2767 SetCallKind(r5, CALL_AS_METHOD);
2768 Jump(r2); 2712 Jump(r2);
2769 } 2713 }
2770 } 2714 }
2771 2715
2772 2716
2773 void MacroAssembler::GetBuiltinFunction(Register target, 2717 void MacroAssembler::GetBuiltinFunction(Register target,
2774 Builtins::JavaScript id) { 2718 Builtins::JavaScript id) {
2775 // Load the builtins object into target register. 2719 // Load the builtins object into target register.
2776 ldr(target, 2720 ldr(target,
2777 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 2721 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
4127 void CodePatcher::EmitCondition(Condition cond) { 4071 void CodePatcher::EmitCondition(Condition cond) {
4128 Instr instr = Assembler::instr_at(masm_.pc_); 4072 Instr instr = Assembler::instr_at(masm_.pc_);
4129 instr = (instr & ~kCondMask) | cond; 4073 instr = (instr & ~kCondMask) | cond;
4130 masm_.emit(instr); 4074 masm_.emit(instr);
4131 } 4075 }
4132 4076
4133 4077
4134 } } // namespace v8::internal 4078 } } // namespace v8::internal
4135 4079
4136 #endif // V8_TARGET_ARCH_ARM 4080 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm/stub-cache-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698