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

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

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

Powered by Google App Engine
This is Rietveld 408576698