@@ -1353,59 +1353,15 @@ void Builtins::Generate_OsrAfterStackCheck(MacroAssembler* masm) {
13531353}
13541354
13551355
1356- void Builtins::Generate_FunctionCall (MacroAssembler* masm) {
1357- Register argc = x0;
1358- Register function = x1;
1359- Register scratch1 = x10;
1360- Register scratch2 = x11;
1361-
1362- ASM_LOCATION (" Builtins::Generate_FunctionCall" );
1363- // 1. Make sure we have at least one argument.
1364- {
1365- Label done;
1366- __ Cbnz (argc, &done);
1367- __ LoadRoot (scratch1, Heap::kUndefinedValueRootIndex );
1368- __ Push (scratch1);
1369- __ Mov (argc, 1 );
1370- __ Bind (&done);
1371- }
1372-
1373- // 2. Get the callable to call (passed as receiver) from the stack.
1374- __ Peek (function, Operand (argc, LSL , kXRegSizeLog2 ));
1375-
1376- // 3. Shift arguments and return address one slot down on the stack
1377- // (overwriting the original receiver). Adjust argument count to make
1378- // the original first argument the new receiver.
1379- {
1380- Label loop;
1381- // Calculate the copy start address (destination). Copy end address is jssp.
1382- __ Add (scratch2, jssp, Operand (argc, LSL , kPointerSizeLog2 ));
1383- __ Sub (scratch1, scratch2, kPointerSize );
1384-
1385- __ Bind (&loop);
1386- __ Ldr (x12, MemOperand (scratch1, -kPointerSize , PostIndex));
1387- __ Str (x12, MemOperand (scratch2, -kPointerSize , PostIndex));
1388- __ Cmp (scratch1, jssp);
1389- __ B (ge, &loop);
1390- // Adjust the actual number of arguments and remove the top element
1391- // (which is a copy of the last argument).
1392- __ Sub (argc, argc, 1 );
1393- __ Drop (1 );
1394- }
1395-
1396- // 4. Call the callable.
1397- __ Jump (masm->isolate ()->builtins ()->Call (), RelocInfo::CODE_TARGET );
1398- }
1399-
1400-
1401- void Builtins::Generate_FunctionApply (MacroAssembler* masm) {
1356+ // static
1357+ void Builtins::Generate_FunctionPrototypeApply (MacroAssembler* masm) {
14021358 // ----------- S t a t e -------------
14031359 // -- r0 : argc
14041360 // -- sp[0] : argArray
14051361 // -- sp[8] : thisArg
14061362 // -- sp[16] : receiver
14071363 // -----------------------------------
1408- ASM_LOCATION (" Builtins::Generate_FunctionApply " );
1364+ ASM_LOCATION (" Builtins::Generate_FunctionPrototypeApply " );
14091365
14101366 // 1. Load receiver into x1, argArray into x0 (if present), remove all
14111367 // arguments from the stack (including the receiver), and push thisArg (if
@@ -1467,6 +1423,53 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
14671423}
14681424
14691425
1426+ // static
1427+ void Builtins::Generate_FunctionPrototypeCall (MacroAssembler* masm) {
1428+ Register argc = x0;
1429+ Register function = x1;
1430+ Register scratch1 = x10;
1431+ Register scratch2 = x11;
1432+
1433+ ASM_LOCATION (" Builtins::Generate_FunctionPrototypeCall" );
1434+
1435+ // 1. Make sure we have at least one argument.
1436+ {
1437+ Label done;
1438+ __ Cbnz (argc, &done);
1439+ __ LoadRoot (scratch1, Heap::kUndefinedValueRootIndex );
1440+ __ Push (scratch1);
1441+ __ Mov (argc, 1 );
1442+ __ Bind (&done);
1443+ }
1444+
1445+ // 2. Get the callable to call (passed as receiver) from the stack.
1446+ __ Peek (function, Operand (argc, LSL , kXRegSizeLog2 ));
1447+
1448+ // 3. Shift arguments and return address one slot down on the stack
1449+ // (overwriting the original receiver). Adjust argument count to make
1450+ // the original first argument the new receiver.
1451+ {
1452+ Label loop;
1453+ // Calculate the copy start address (destination). Copy end address is jssp.
1454+ __ Add (scratch2, jssp, Operand (argc, LSL , kPointerSizeLog2 ));
1455+ __ Sub (scratch1, scratch2, kPointerSize );
1456+
1457+ __ Bind (&loop);
1458+ __ Ldr (x12, MemOperand (scratch1, -kPointerSize , PostIndex));
1459+ __ Str (x12, MemOperand (scratch2, -kPointerSize , PostIndex));
1460+ __ Cmp (scratch1, jssp);
1461+ __ B (ge, &loop);
1462+ // Adjust the actual number of arguments and remove the top element
1463+ // (which is a copy of the last argument).
1464+ __ Sub (argc, argc, 1 );
1465+ __ Drop (1 );
1466+ }
1467+
1468+ // 4. Call the callable.
1469+ __ Jump (masm->isolate ()->builtins ()->Call (), RelocInfo::CODE_TARGET );
1470+ }
1471+
1472+
14701473void Builtins::Generate_ReflectApply (MacroAssembler* masm) {
14711474 // ----------- S t a t e -------------
14721475 // -- x0 : argc
0 commit comments