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

Side by Side Diff: src/arm/builtins-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/apiutils.h ('k') | src/arm/code-stubs-arm.h » ('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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 288 }
289 __ Ret(); 289 __ Ret();
290 } 290 }
291 291
292 292
293 static void CallRuntimePassFunction( 293 static void CallRuntimePassFunction(
294 MacroAssembler* masm, Runtime::FunctionId function_id) { 294 MacroAssembler* masm, Runtime::FunctionId function_id) {
295 FrameScope scope(masm, StackFrame::INTERNAL); 295 FrameScope scope(masm, StackFrame::INTERNAL);
296 // Push a copy of the function onto the stack. 296 // Push a copy of the function onto the stack.
297 __ push(r1); 297 __ push(r1);
298 // Push call kind information and function as parameter to the runtime call. 298 // Push function as parameter to the runtime call.
299 __ Push(r5, r1); 299 __ Push(r1);
300 300
301 __ CallRuntime(function_id, 1); 301 __ CallRuntime(function_id, 1);
302 // Restore call kind information.
303 __ pop(r5);
304 // Restore receiver. 302 // Restore receiver.
305 __ pop(r1); 303 __ pop(r1);
306 } 304 }
307 305
308 306
309 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { 307 static void GenerateTailCallToSharedCode(MacroAssembler* masm) {
310 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 308 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
311 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kCodeOffset)); 309 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kCodeOffset));
312 __ add(r2, r2, Operand(Code::kHeaderSize - kHeapObjectTag)); 310 __ add(r2, r2, Operand(Code::kHeaderSize - kHeapObjectTag));
313 __ Jump(r2); 311 __ Jump(r2);
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 __ sub(r3, r3, Operand(2), SetCC); 598 __ sub(r3, r3, Operand(2), SetCC);
601 __ b(ge, &loop); 599 __ b(ge, &loop);
602 600
603 // Call the function. 601 // Call the function.
604 // r0: number of arguments 602 // r0: number of arguments
605 // r1: constructor function 603 // r1: constructor function
606 if (is_api_function) { 604 if (is_api_function) {
607 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 605 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
608 Handle<Code> code = 606 Handle<Code> code =
609 masm->isolate()->builtins()->HandleApiCallConstruct(); 607 masm->isolate()->builtins()->HandleApiCallConstruct();
610 ParameterCount expected(0); 608 __ Call(code, RelocInfo::CODE_TARGET);
611 __ InvokeCode(code, expected, expected,
612 RelocInfo::CODE_TARGET, CALL_FUNCTION, CALL_AS_METHOD);
613 } else { 609 } else {
614 ParameterCount actual(r0); 610 ParameterCount actual(r0);
615 __ InvokeFunction(r1, actual, CALL_FUNCTION, 611 __ InvokeFunction(r1, actual, CALL_FUNCTION, NullCallWrapper());
616 NullCallWrapper(), CALL_AS_METHOD);
617 } 612 }
618 613
619 // Store offset of return address for deoptimizer. 614 // Store offset of return address for deoptimizer.
620 if (!is_api_function && !count_constructions) { 615 if (!is_api_function && !count_constructions) {
621 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); 616 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset());
622 } 617 }
623 618
624 // Restore context from the frame. 619 // Restore context from the frame.
625 // r0: result 620 // r0: result
626 // sp[0]: receiver 621 // sp[0]: receiver
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 __ mov(r0, Operand(r3)); 738 __ mov(r0, Operand(r3));
744 if (is_construct) { 739 if (is_construct) {
745 // No type feedback cell is available 740 // No type feedback cell is available
746 Handle<Object> undefined_sentinel( 741 Handle<Object> undefined_sentinel(
747 masm->isolate()->heap()->undefined_value(), masm->isolate()); 742 masm->isolate()->heap()->undefined_value(), masm->isolate());
748 __ mov(r2, Operand(undefined_sentinel)); 743 __ mov(r2, Operand(undefined_sentinel));
749 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); 744 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS);
750 __ CallStub(&stub); 745 __ CallStub(&stub);
751 } else { 746 } else {
752 ParameterCount actual(r0); 747 ParameterCount actual(r0);
753 __ InvokeFunction(r1, actual, CALL_FUNCTION, 748 __ InvokeFunction(r1, actual, CALL_FUNCTION, NullCallWrapper());
754 NullCallWrapper(), CALL_AS_METHOD);
755 } 749 }
756 // Exit the JS frame and remove the parameters (except function), and 750 // Exit the JS frame and remove the parameters (except function), and
757 // return. 751 // return.
758 // Respect ABI stack constraint. 752 // Respect ABI stack constraint.
759 } 753 }
760 __ Jump(lr); 754 __ Jump(lr);
761 755
762 // r0: result 756 // r0: result
763 } 757 }
764 758
(...skipping 11 matching lines...) Expand all
776 void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) { 770 void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) {
777 CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized); 771 CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized);
778 GenerateTailCallToReturnedCode(masm); 772 GenerateTailCallToReturnedCode(masm);
779 } 773 }
780 774
781 775
782 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { 776 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) {
783 FrameScope scope(masm, StackFrame::INTERNAL); 777 FrameScope scope(masm, StackFrame::INTERNAL);
784 // Push a copy of the function onto the stack. 778 // Push a copy of the function onto the stack.
785 __ push(r1); 779 __ push(r1);
786 // Push call kind information and function as parameter to the runtime call. 780 // Push function as parameter to the runtime call.
787 __ Push(r5, r1); 781 __ Push(r1);
788 // Whether to compile in a background thread. 782 // Whether to compile in a background thread.
789 __ Push(masm->isolate()->factory()->ToBoolean(concurrent)); 783 __ Push(masm->isolate()->factory()->ToBoolean(concurrent));
790 784
791 __ CallRuntime(Runtime::kCompileOptimized, 2); 785 __ CallRuntime(Runtime::kCompileOptimized, 2);
792 // Restore call kind information.
793 __ pop(r5);
794 // Restore receiver. 786 // Restore receiver.
795 __ pop(r1); 787 __ pop(r1);
796 } 788 }
797 789
798 790
799 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { 791 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) {
800 CallCompileOptimized(masm, false); 792 CallCompileOptimized(masm, false);
801 GenerateTailCallToReturnedCode(masm); 793 GenerateTailCallToReturnedCode(masm);
802 } 794 }
803 795
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin, 1136 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin,
1145 // or a function proxy via CALL_FUNCTION_PROXY. 1137 // or a function proxy via CALL_FUNCTION_PROXY.
1146 // r0: actual number of arguments 1138 // r0: actual number of arguments
1147 // r1: function 1139 // r1: function
1148 // r4: call type (0: JS function, 1: function proxy, 2: non-function) 1140 // r4: call type (0: JS function, 1: function proxy, 2: non-function)
1149 { Label function, non_proxy; 1141 { Label function, non_proxy;
1150 __ tst(r4, r4); 1142 __ tst(r4, r4);
1151 __ b(eq, &function); 1143 __ b(eq, &function);
1152 // Expected number of arguments is 0 for CALL_NON_FUNCTION. 1144 // Expected number of arguments is 0 for CALL_NON_FUNCTION.
1153 __ mov(r2, Operand::Zero()); 1145 __ mov(r2, Operand::Zero());
1154 __ SetCallKind(r5, CALL_AS_METHOD);
1155 __ cmp(r4, Operand(1)); 1146 __ cmp(r4, Operand(1));
1156 __ b(ne, &non_proxy); 1147 __ b(ne, &non_proxy);
1157 1148
1158 __ push(r1); // re-add proxy object as additional argument 1149 __ push(r1); // re-add proxy object as additional argument
1159 __ add(r0, r0, Operand(1)); 1150 __ add(r0, r0, Operand(1));
1160 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); 1151 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY);
1161 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1152 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1162 RelocInfo::CODE_TARGET); 1153 RelocInfo::CODE_TARGET);
1163 1154
1164 __ bind(&non_proxy); 1155 __ bind(&non_proxy);
1165 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); 1156 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION);
1166 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1157 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1167 RelocInfo::CODE_TARGET); 1158 RelocInfo::CODE_TARGET);
1168 __ bind(&function); 1159 __ bind(&function);
1169 } 1160 }
1170 1161
1171 // 5b. Get the code to call from the function and check that the number of 1162 // 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 1163 // expected arguments matches what we're providing. If so, jump
1173 // (tail-call) to the code in register edx without checking arguments. 1164 // (tail-call) to the code in register edx without checking arguments.
1174 // r0: actual number of arguments 1165 // r0: actual number of arguments
1175 // r1: function 1166 // r1: function
1176 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 1167 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
1177 __ ldr(r2, 1168 __ ldr(r2,
1178 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); 1169 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset));
1179 __ SmiUntag(r2); 1170 __ SmiUntag(r2);
1180 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
1181 __ SetCallKind(r5, CALL_AS_FUNCTION);
1182 __ cmp(r2, r0); // Check formal and actual parameter counts. 1171 __ cmp(r2, r0); // Check formal and actual parameter counts.
1183 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1172 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1184 RelocInfo::CODE_TARGET, 1173 RelocInfo::CODE_TARGET,
1185 ne); 1174 ne);
1186 1175
1176 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
1187 ParameterCount expected(0); 1177 ParameterCount expected(0);
1188 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION, 1178 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION, NullCallWrapper());
1189 NullCallWrapper(), CALL_AS_FUNCTION);
1190 } 1179 }
1191 1180
1192 1181
1193 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { 1182 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
1194 const int kIndexOffset = 1183 const int kIndexOffset =
1195 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); 1184 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize);
1196 const int kLimitOffset = 1185 const int kLimitOffset =
1197 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); 1186 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize);
1198 const int kArgsOffset = 2 * kPointerSize; 1187 const int kArgsOffset = 2 * kPointerSize;
1199 const int kRecvOffset = 3 * kPointerSize; 1188 const int kRecvOffset = 3 * kPointerSize;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 __ cmp(r0, r1); 1306 __ cmp(r0, r1);
1318 __ b(ne, &loop); 1307 __ b(ne, &loop);
1319 1308
1320 // Call the function. 1309 // Call the function.
1321 Label call_proxy; 1310 Label call_proxy;
1322 ParameterCount actual(r0); 1311 ParameterCount actual(r0);
1323 __ SmiUntag(r0); 1312 __ SmiUntag(r0);
1324 __ ldr(r1, MemOperand(fp, kFunctionOffset)); 1313 __ ldr(r1, MemOperand(fp, kFunctionOffset));
1325 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); 1314 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE);
1326 __ b(ne, &call_proxy); 1315 __ b(ne, &call_proxy);
1327 __ InvokeFunction(r1, actual, CALL_FUNCTION, 1316 __ InvokeFunction(r1, actual, CALL_FUNCTION, NullCallWrapper());
1328 NullCallWrapper(), CALL_AS_FUNCTION);
1329 1317
1330 frame_scope.GenerateLeaveFrame(); 1318 frame_scope.GenerateLeaveFrame();
1331 __ add(sp, sp, Operand(3 * kPointerSize)); 1319 __ add(sp, sp, Operand(3 * kPointerSize));
1332 __ Jump(lr); 1320 __ Jump(lr);
1333 1321
1334 // Call the function proxy. 1322 // Call the function proxy.
1335 __ bind(&call_proxy); 1323 __ bind(&call_proxy);
1336 __ push(r1); // add function proxy as last argument 1324 __ push(r1); // add function proxy as last argument
1337 __ add(r0, r0, Operand(1)); 1325 __ add(r0, r0, Operand(1));
1338 __ mov(r2, Operand::Zero()); 1326 __ mov(r2, Operand::Zero());
1339 __ SetCallKind(r5, CALL_AS_FUNCTION); 1327 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY);
1340 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY);
1341 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1328 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1342 RelocInfo::CODE_TARGET); 1329 RelocInfo::CODE_TARGET);
1343 1330
1344 // Tear down the internal frame and remove function, receiver and args. 1331 // Tear down the internal frame and remove function, receiver and args.
1345 } 1332 }
1346 __ add(sp, sp, Operand(3 * kPointerSize)); 1333 __ add(sp, sp, Operand(3 * kPointerSize));
1347 __ Jump(lr); 1334 __ Jump(lr);
1348 } 1335 }
1349 1336
1350 1337
(...skipping 21 matching lines...) Expand all
1372 __ add(sp, sp, Operand::PointerOffsetFromSmiKey(r1)); 1359 __ add(sp, sp, Operand::PointerOffsetFromSmiKey(r1));
1373 __ add(sp, sp, Operand(kPointerSize)); // adjust for receiver 1360 __ add(sp, sp, Operand(kPointerSize)); // adjust for receiver
1374 } 1361 }
1375 1362
1376 1363
1377 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { 1364 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
1378 // ----------- S t a t e ------------- 1365 // ----------- S t a t e -------------
1379 // -- r0 : actual number of arguments 1366 // -- r0 : actual number of arguments
1380 // -- r1 : function (passed through to callee) 1367 // -- r1 : function (passed through to callee)
1381 // -- r2 : expected number of arguments 1368 // -- r2 : expected number of arguments
1382 // -- r3 : code entry to call
1383 // -- r5 : call kind information
1384 // ----------------------------------- 1369 // -----------------------------------
1385 1370
1386 Label invoke, dont_adapt_arguments; 1371 Label invoke, dont_adapt_arguments;
1387 1372
1388 Label enough, too_few; 1373 Label enough, too_few;
1374 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
1389 __ cmp(r0, r2); 1375 __ cmp(r0, r2);
1390 __ b(lt, &too_few); 1376 __ b(lt, &too_few);
1391 __ cmp(r2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); 1377 __ cmp(r2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel));
1392 __ b(eq, &dont_adapt_arguments); 1378 __ b(eq, &dont_adapt_arguments);
1393 1379
1394 { // Enough parameters: actual >= expected 1380 { // Enough parameters: actual >= expected
1395 __ bind(&enough); 1381 __ bind(&enough);
1396 EnterArgumentsAdaptorFrame(masm); 1382 EnterArgumentsAdaptorFrame(masm);
1397 1383
1398 // Calculate copy start address into r0 and copy end address into r2. 1384 // Calculate copy start address into r0 and copy end address into r2.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 __ bind(&dont_adapt_arguments); 1468 __ bind(&dont_adapt_arguments);
1483 __ Jump(r3); 1469 __ Jump(r3);
1484 } 1470 }
1485 1471
1486 1472
1487 #undef __ 1473 #undef __
1488 1474
1489 } } // namespace v8::internal 1475 } } // namespace v8::internal
1490 1476
1491 #endif // V8_TARGET_ARCH_ARM 1477 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/apiutils.h ('k') | src/arm/code-stubs-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698