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

Side by Side Diff: src/a64/builtins-a64.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 | « samples/shell.cc ('k') | src/a64/code-stubs-a64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_A64 30 #if V8_TARGET_ARCH_A64
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 // Load the built-in Array function from the current context. 46 // Load the built-in Array function from the current context.
46 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) { 47 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) {
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 __ SmiUntag(x0); 1077 __ SmiUntag(x0);
1077 1078
1078 // Exit the internal frame. 1079 // Exit the internal frame.
1079 } 1080 }
1080 1081
1081 // Restore the function to x1, and the flag to x4. 1082 // Restore the function to x1, and the flag to x4.
1082 __ Peek(x1, Operand(x0, LSL, kXRegSizeInBytesLog2)); 1083 __ Peek(x1, Operand(x0, LSL, kXRegSizeInBytesLog2));
1083 __ Mov(x4, 0); 1084 __ Mov(x4, 0);
1084 __ B(&patch_receiver); 1085 __ B(&patch_receiver);
1085 1086
1086 // Use the global receiver object from the called function as the
1087 // receiver.
1088 __ Bind(&use_global_receiver); 1087 __ Bind(&use_global_receiver);
1089 const int kGlobalIndex = 1088 __ Ldr(x2, GlobalObjectMemOperand());
1090 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize;
1091 __ Ldr(x10, FieldMemOperand(cp, kGlobalIndex));
1092 __ Ldr(x2, FieldMemOperand(x10, GlobalObject::kNativeContextOffset));
1093 __ Ldr(x10, FieldMemOperand(x2, kGlobalIndex));
1094 __ Ldr(x2, FieldMemOperand(x10, GlobalObject::kGlobalReceiverOffset));
1095 1089
1096 __ Bind(&patch_receiver); 1090 __ Bind(&patch_receiver);
1097 __ Sub(x10, x0, 1); 1091 __ Sub(x10, x0, 1);
1098 __ Poke(x2, Operand(x10, LSL, kXRegSizeInBytesLog2)); 1092 __ Poke(x2, Operand(x10, LSL, kXRegSizeInBytesLog2));
1099 1093
1100 __ B(&shift_arguments); 1094 __ B(&shift_arguments);
1101 } 1095 }
1102 1096
1103 // 3b. Check for function proxy. 1097 // 3b. Check for function proxy.
1104 __ Bind(&slow); 1098 __ Bind(&slow);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 // 5b. Get the code to call from the function and check that the number of 1165 // 5b. Get the code to call from the function and check that the number of
1172 // expected arguments matches what we're providing. If so, jump 1166 // expected arguments matches what we're providing. If so, jump
1173 // (tail-call) to the code in register edx without checking arguments. 1167 // (tail-call) to the code in register edx without checking arguments.
1174 // x0: actual number of arguments 1168 // x0: actual number of arguments
1175 // x1: function 1169 // x1: function
1176 __ Ldr(x3, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); 1170 __ Ldr(x3, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset));
1177 __ Ldrsw(x2, 1171 __ Ldrsw(x2,
1178 FieldMemOperand(x3, 1172 FieldMemOperand(x3,
1179 SharedFunctionInfo::kFormalParameterCountOffset)); 1173 SharedFunctionInfo::kFormalParameterCountOffset));
1180 __ Ldr(x3, FieldMemOperand(x1, JSFunction::kCodeEntryOffset)); 1174 __ Ldr(x3, FieldMemOperand(x1, JSFunction::kCodeEntryOffset));
1181 __ SetCallKind(x5, CALL_AS_METHOD); 1175 __ SetCallKind(x5, CALL_AS_FUNCTION);
1182 Label dont_adapt_args; 1176 Label dont_adapt_args;
1183 __ Cmp(x2, x0); // Check formal and actual parameter counts. 1177 __ Cmp(x2, x0); // Check formal and actual parameter counts.
1184 __ B(eq, &dont_adapt_args); 1178 __ B(eq, &dont_adapt_args);
1185 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1179 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1186 RelocInfo::CODE_TARGET); 1180 RelocInfo::CODE_TARGET);
1187 1181
1188 __ Bind(&dont_adapt_args); 1182 __ Bind(&dont_adapt_args);
1189 ParameterCount expected(0); 1183 ParameterCount expected(0);
1190 __ InvokeCode(x3, expected, expected, JUMP_FUNCTION, 1184 __ InvokeCode(x3, expected, expected, JUMP_FUNCTION,
1191 NullCallWrapper(), CALL_AS_METHOD); 1185 NullCallWrapper(), CALL_AS_FUNCTION);
1192 } 1186 }
1193 1187
1194 1188
1195 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { 1189 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
1196 ASM_LOCATION("Builtins::Generate_FunctionApply"); 1190 ASM_LOCATION("Builtins::Generate_FunctionApply");
1197 const int kIndexOffset = 1191 const int kIndexOffset =
1198 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); 1192 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize);
1199 const int kLimitOffset = 1193 const int kLimitOffset =
1200 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); 1194 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize);
1201 const int kArgsOffset = 2 * kPointerSize; 1195 const int kArgsOffset = 2 * kPointerSize;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 __ JumpIfObjectType(receiver, x10, x11, FIRST_SPEC_OBJECT_TYPE, 1270 __ JumpIfObjectType(receiver, x10, x11, FIRST_SPEC_OBJECT_TYPE,
1277 &push_receiver, ge); 1271 &push_receiver, ge);
1278 1272
1279 // Call a builtin to convert the receiver to a regular object. 1273 // Call a builtin to convert the receiver to a regular object.
1280 __ Bind(&convert_receiver_to_object); 1274 __ Bind(&convert_receiver_to_object);
1281 __ Push(receiver); 1275 __ Push(receiver);
1282 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 1276 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
1283 __ Mov(receiver, x0); 1277 __ Mov(receiver, x0);
1284 __ B(&push_receiver); 1278 __ B(&push_receiver);
1285 1279
1286 // Use the current global receiver object as the receiver.
1287 __ Bind(&use_global_receiver); 1280 __ Bind(&use_global_receiver);
1288 const int kGlobalOffset = 1281 __ Ldr(x10, GlobalObjectMemOperand());
1289 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize;
1290 __ Ldr(x10, FieldMemOperand(cp, kGlobalOffset));
1291 __ Ldr(x11, FieldMemOperand(x10, GlobalObject::kNativeContextOffset));
1292 __ Ldr(x10, FieldMemOperand(x11, kGlobalOffset));
1293 __ Ldr(receiver, FieldMemOperand(x10, GlobalObject::kGlobalReceiverOffset)); 1282 __ Ldr(receiver, FieldMemOperand(x10, GlobalObject::kGlobalReceiverOffset));
1294 1283
1295 // Push the receiver 1284 // Push the receiver
1296 __ Bind(&push_receiver); 1285 __ Bind(&push_receiver);
1297 __ Push(receiver); 1286 __ Push(receiver);
1298 1287
1299 // Copy all arguments from the array to the stack. 1288 // Copy all arguments from the array to the stack.
1300 Label entry, loop; 1289 Label entry, loop;
1301 Register current = x0; 1290 Register current = x0;
1302 __ Ldr(current, MemOperand(fp, kIndexOffset)); 1291 __ Ldr(current, MemOperand(fp, kIndexOffset));
(...skipping 21 matching lines...) Expand all
1324 __ Ldr(x1, MemOperand(fp, kLimitOffset)); 1313 __ Ldr(x1, MemOperand(fp, kLimitOffset));
1325 __ Cmp(current, x1); 1314 __ Cmp(current, x1);
1326 __ B(ne, &loop); 1315 __ B(ne, &loop);
1327 1316
1328 // At the end of the loop, the number of arguments is stored in 'current', 1317 // At the end of the loop, the number of arguments is stored in 'current',
1329 // represented as a smi. 1318 // represented as a smi.
1330 1319
1331 function = x1; // From now on we want the function to be kept in x1; 1320 function = x1; // From now on we want the function to be kept in x1;
1332 __ Ldr(function, MemOperand(fp, kFunctionOffset)); 1321 __ Ldr(function, MemOperand(fp, kFunctionOffset));
1333 1322
1334 // Invoke the function. 1323 // Call the function.
1335 Label call_proxy; 1324 Label call_proxy;
1336 ParameterCount actual(current); 1325 ParameterCount actual(current);
1337 __ SmiUntag(current); 1326 __ SmiUntag(current);
1338 __ JumpIfNotObjectType(function, x10, x11, JS_FUNCTION_TYPE, &call_proxy); 1327 __ JumpIfNotObjectType(function, x10, x11, JS_FUNCTION_TYPE, &call_proxy);
1339 __ InvokeFunction(function, actual, CALL_FUNCTION, 1328 __ InvokeFunction(function, actual, CALL_FUNCTION,
1340 NullCallWrapper(), CALL_AS_METHOD); 1329 NullCallWrapper(), CALL_AS_FUNCTION);
1341 frame_scope.GenerateLeaveFrame(); 1330 frame_scope.GenerateLeaveFrame();
1342 __ Drop(3); 1331 __ Drop(3);
1343 __ Ret(); 1332 __ Ret();
1344 1333
1345 // Invoke the function proxy. 1334 // Call the function proxy.
1346 __ Bind(&call_proxy); 1335 __ Bind(&call_proxy);
1347 // x0 : argc 1336 // x0 : argc
1348 // x1 : function 1337 // x1 : function
1349 __ Push(function); // Add function proxy as last argument. 1338 __ Push(function); // Add function proxy as last argument.
1350 __ Add(x0, x0, 1); 1339 __ Add(x0, x0, 1);
1351 __ Mov(x2, 0); 1340 __ Mov(x2, 0);
1352 __ SetCallKind(x5, CALL_AS_METHOD); 1341 __ SetCallKind(x5, CALL_AS_FUNCTION);
1353 __ GetBuiltinEntry(x3, Builtins::CALL_FUNCTION_PROXY); 1342 __ GetBuiltinEntry(x3, Builtins::CALL_FUNCTION_PROXY);
1354 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1343 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1355 RelocInfo::CODE_TARGET); 1344 RelocInfo::CODE_TARGET);
1356 } 1345 }
1357 __ Drop(3); 1346 __ Drop(3);
1358 __ Ret(); 1347 __ Ret();
1359 } 1348 }
1360 1349
1361 1350
1362 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { 1351 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 __ Bind(&dont_adapt_arguments); 1485 __ Bind(&dont_adapt_arguments);
1497 __ Jump(x3); 1486 __ Jump(x3);
1498 } 1487 }
1499 1488
1500 1489
1501 #undef __ 1490 #undef __
1502 1491
1503 } } // namespace v8::internal 1492 } } // namespace v8::internal
1504 1493
1505 #endif // V8_TARGET_ARCH_ARM 1494 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « samples/shell.cc ('k') | src/a64/code-stubs-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698