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

Side by Side Diff: src/arm/builtins-arm.cc

Issue 157543002: A64: Synchronize with r18581. (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/api.cc ('k') | src/arm/code-stubs-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 16 matching lines...) Expand all
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #if V8_TARGET_ARCH_ARM 30 #if V8_TARGET_ARCH_ARM
31 31
32 #include "codegen.h" 32 #include "codegen.h"
33 #include "debug.h" 33 #include "debug.h"
34 #include "deoptimizer.h" 34 #include "deoptimizer.h"
35 #include "full-codegen.h" 35 #include "full-codegen.h"
36 #include "runtime.h" 36 #include "runtime.h"
37 #include "stub-cache.h"
37 38
38 namespace v8 { 39 namespace v8 {
39 namespace internal { 40 namespace internal {
40 41
41 42
42 #define __ ACCESS_MASM(masm) 43 #define __ ACCESS_MASM(masm)
43 44
44 45
45 void Builtins::Generate_Adaptor(MacroAssembler* masm, 46 void Builtins::Generate_Adaptor(MacroAssembler* masm,
46 CFunctionId id, 47 CFunctionId id,
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 __ SmiUntag(r0); 1082 __ SmiUntag(r0);
1082 1083
1083 // Exit the internal frame. 1084 // Exit the internal frame.
1084 } 1085 }
1085 1086
1086 // Restore the function to r1, and the flag to r4. 1087 // Restore the function to r1, and the flag to r4.
1087 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); 1088 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2));
1088 __ mov(r4, Operand::Zero()); 1089 __ mov(r4, Operand::Zero());
1089 __ jmp(&patch_receiver); 1090 __ jmp(&patch_receiver);
1090 1091
1091 // Use the global receiver object from the called function as the
1092 // receiver.
1093 __ bind(&use_global_receiver); 1092 __ bind(&use_global_receiver);
1094 const int kGlobalIndex = 1093 __ ldr(r2, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX));
1095 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; 1094 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset));
1096 __ ldr(r2, FieldMemOperand(cp, kGlobalIndex));
1097 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kNativeContextOffset));
1098 __ ldr(r2, FieldMemOperand(r2, kGlobalIndex));
1099 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset));
1100 1095
1101 __ bind(&patch_receiver); 1096 __ bind(&patch_receiver);
1102 __ add(r3, sp, Operand(r0, LSL, kPointerSizeLog2)); 1097 __ add(r3, sp, Operand(r0, LSL, kPointerSizeLog2));
1103 __ str(r2, MemOperand(r3, -kPointerSize)); 1098 __ str(r2, MemOperand(r3, -kPointerSize));
1104 1099
1105 __ jmp(&shift_arguments); 1100 __ jmp(&shift_arguments);
1106 } 1101 }
1107 1102
1108 // 3b. Check for function proxy. 1103 // 3b. Check for function proxy.
1109 __ bind(&slow); 1104 __ bind(&slow);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 // 5b. Get the code to call from the function and check that the number of 1171 // 5b. Get the code to call from the function and check that the number of
1177 // expected arguments matches what we're providing. If so, jump 1172 // expected arguments matches what we're providing. If so, jump
1178 // (tail-call) to the code in register edx without checking arguments. 1173 // (tail-call) to the code in register edx without checking arguments.
1179 // r0: actual number of arguments 1174 // r0: actual number of arguments
1180 // r1: function 1175 // r1: function
1181 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 1176 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
1182 __ ldr(r2, 1177 __ ldr(r2,
1183 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); 1178 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset));
1184 __ SmiUntag(r2); 1179 __ SmiUntag(r2);
1185 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); 1180 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
1186 __ SetCallKind(r5, CALL_AS_METHOD); 1181 __ SetCallKind(r5, CALL_AS_FUNCTION);
1187 __ cmp(r2, r0); // Check formal and actual parameter counts. 1182 __ cmp(r2, r0); // Check formal and actual parameter counts.
1188 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1183 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1189 RelocInfo::CODE_TARGET, 1184 RelocInfo::CODE_TARGET,
1190 ne); 1185 ne);
1191 1186
1192 ParameterCount expected(0); 1187 ParameterCount expected(0);
1193 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION, 1188 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION,
1194 NullCallWrapper(), CALL_AS_METHOD); 1189 NullCallWrapper(), CALL_AS_FUNCTION);
1195 } 1190 }
1196 1191
1197 1192
1198 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { 1193 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
1199 const int kIndexOffset = 1194 const int kIndexOffset =
1200 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); 1195 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize);
1201 const int kLimitOffset = 1196 const int kLimitOffset =
1202 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); 1197 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize);
1203 const int kArgsOffset = 2 * kPointerSize; 1198 const int kArgsOffset = 2 * kPointerSize;
1204 const int kRecvOffset = 3 * kPointerSize; 1199 const int kRecvOffset = 3 * kPointerSize;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 __ CompareObjectType(r0, r1, r1, FIRST_SPEC_OBJECT_TYPE); 1273 __ CompareObjectType(r0, r1, r1, FIRST_SPEC_OBJECT_TYPE);
1279 __ b(ge, &push_receiver); 1274 __ b(ge, &push_receiver);
1280 1275
1281 // Convert the receiver to a regular object. 1276 // Convert the receiver to a regular object.
1282 // r0: receiver 1277 // r0: receiver
1283 __ bind(&call_to_object); 1278 __ bind(&call_to_object);
1284 __ push(r0); 1279 __ push(r0);
1285 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 1280 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
1286 __ b(&push_receiver); 1281 __ b(&push_receiver);
1287 1282
1288 // Use the current global receiver object as the receiver.
1289 __ bind(&use_global_receiver); 1283 __ bind(&use_global_receiver);
1290 const int kGlobalOffset = 1284 __ ldr(r0, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX));
1291 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize;
1292 __ ldr(r0, FieldMemOperand(cp, kGlobalOffset));
1293 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kNativeContextOffset));
1294 __ ldr(r0, FieldMemOperand(r0, kGlobalOffset));
1295 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); 1285 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset));
1296 1286
1297 // Push the receiver. 1287 // Push the receiver.
1298 // r0: receiver 1288 // r0: receiver
1299 __ bind(&push_receiver); 1289 __ bind(&push_receiver);
1300 __ push(r0); 1290 __ push(r0);
1301 1291
1302 // Copy all arguments from the array to the stack. 1292 // Copy all arguments from the array to the stack.
1303 Label entry, loop; 1293 Label entry, loop;
1304 __ ldr(r0, MemOperand(fp, kIndexOffset)); 1294 __ ldr(r0, MemOperand(fp, kIndexOffset));
(...skipping 15 matching lines...) Expand all
1320 __ add(r0, r0, Operand(1 << kSmiTagSize)); 1310 __ add(r0, r0, Operand(1 << kSmiTagSize));
1321 __ str(r0, MemOperand(fp, kIndexOffset)); 1311 __ str(r0, MemOperand(fp, kIndexOffset));
1322 1312
1323 // Test if the copy loop has finished copying all the elements from the 1313 // Test if the copy loop has finished copying all the elements from the
1324 // arguments object. 1314 // arguments object.
1325 __ bind(&entry); 1315 __ bind(&entry);
1326 __ ldr(r1, MemOperand(fp, kLimitOffset)); 1316 __ ldr(r1, MemOperand(fp, kLimitOffset));
1327 __ cmp(r0, r1); 1317 __ cmp(r0, r1);
1328 __ b(ne, &loop); 1318 __ b(ne, &loop);
1329 1319
1330 // Invoke the function. 1320 // Call the function.
1331 Label call_proxy; 1321 Label call_proxy;
1332 ParameterCount actual(r0); 1322 ParameterCount actual(r0);
1333 __ SmiUntag(r0); 1323 __ SmiUntag(r0);
1334 __ ldr(r1, MemOperand(fp, kFunctionOffset)); 1324 __ ldr(r1, MemOperand(fp, kFunctionOffset));
1335 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); 1325 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE);
1336 __ b(ne, &call_proxy); 1326 __ b(ne, &call_proxy);
1337 __ InvokeFunction(r1, actual, CALL_FUNCTION, 1327 __ InvokeFunction(r1, actual, CALL_FUNCTION,
1338 NullCallWrapper(), CALL_AS_METHOD); 1328 NullCallWrapper(), CALL_AS_FUNCTION);
1339 1329
1340 frame_scope.GenerateLeaveFrame(); 1330 frame_scope.GenerateLeaveFrame();
1341 __ add(sp, sp, Operand(3 * kPointerSize)); 1331 __ add(sp, sp, Operand(3 * kPointerSize));
1342 __ Jump(lr); 1332 __ Jump(lr);
1343 1333
1344 // Invoke the function proxy. 1334 // Call the function proxy.
1345 __ bind(&call_proxy); 1335 __ bind(&call_proxy);
1346 __ push(r1); // add function proxy as last argument 1336 __ push(r1); // add function proxy as last argument
1347 __ add(r0, r0, Operand(1)); 1337 __ add(r0, r0, Operand(1));
1348 __ mov(r2, Operand::Zero()); 1338 __ mov(r2, Operand::Zero());
1349 __ SetCallKind(r5, CALL_AS_METHOD); 1339 __ SetCallKind(r5, CALL_AS_FUNCTION);
1350 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); 1340 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY);
1351 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1341 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1352 RelocInfo::CODE_TARGET); 1342 RelocInfo::CODE_TARGET);
1353 1343
1354 // Tear down the internal frame and remove function, receiver and args. 1344 // Tear down the internal frame and remove function, receiver and args.
1355 } 1345 }
1356 __ add(sp, sp, Operand(3 * kPointerSize)); 1346 __ add(sp, sp, Operand(3 * kPointerSize));
1357 __ Jump(lr); 1347 __ Jump(lr);
1358 } 1348 }
1359 1349
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 __ bind(&dont_adapt_arguments); 1482 __ bind(&dont_adapt_arguments);
1493 __ Jump(r3); 1483 __ Jump(r3);
1494 } 1484 }
1495 1485
1496 1486
1497 #undef __ 1487 #undef __
1498 1488
1499 } } // namespace v8::internal 1489 } } // namespace v8::internal
1500 1490
1501 #endif // V8_TARGET_ARCH_ARM 1491 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698