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

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

Issue 1544833002: PPC: [runtime] Rewrite Function.prototype.toString in C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_PPC 5 #if V8_TARGET_ARCH_PPC
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 } 1377 }
1378 __ Jump(masm->isolate()->builtins()->OnStackReplacement(), 1378 __ Jump(masm->isolate()->builtins()->OnStackReplacement(),
1379 RelocInfo::CODE_TARGET); 1379 RelocInfo::CODE_TARGET);
1380 1380
1381 __ bind(&ok); 1381 __ bind(&ok);
1382 __ Ret(); 1382 __ Ret();
1383 } 1383 }
1384 1384
1385 1385
1386 // static 1386 // static
1387 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { 1387 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) {
1388 // 1. Make sure we have at least one argument.
1389 // r3: actual number of arguments
1390 {
1391 Label done;
1392 __ cmpi(r3, Operand::Zero());
1393 __ bne(&done);
1394 __ PushRoot(Heap::kUndefinedValueRootIndex);
1395 __ addi(r3, r3, Operand(1));
1396 __ bind(&done);
1397 }
1398
1399 // 2. Get the callable to call (passed as receiver) from the stack.
1400 // r3: actual number of arguments
1401 __ ShiftLeftImm(r5, r3, Operand(kPointerSizeLog2));
1402 __ LoadPX(r4, MemOperand(sp, r5));
1403
1404 // 3. Shift arguments and return address one slot down on the stack
1405 // (overwriting the original receiver). Adjust argument count to make
1406 // the original first argument the new receiver.
1407 // r3: actual number of arguments
1408 // r4: callable
1409 {
1410 Label loop;
1411 // Calculate the copy start address (destination). Copy end address is sp.
1412 __ add(r5, sp, r5);
1413
1414
1415 __ mtctr(r3);
1416 __ bind(&loop);
1417 __ LoadP(ip, MemOperand(r5, -kPointerSize));
1418 __ StoreP(ip, MemOperand(r5));
1419 __ subi(r5, r5, Operand(kPointerSize));
1420 __ bdnz(&loop);
1421 // Adjust the actual number of arguments and remove the top element
1422 // (which is a copy of the last argument).
1423 __ subi(r3, r3, Operand(1));
1424 __ pop();
1425 }
1426
1427 // 4. Call the callable.
1428 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
1429 }
1430
1431
1432 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
1433 // ----------- S t a t e ------------- 1388 // ----------- S t a t e -------------
1434 // -- r3 : argc 1389 // -- r3 : argc
1435 // -- sp[0] : argArray 1390 // -- sp[0] : argArray
1436 // -- sp[4] : thisArg 1391 // -- sp[4] : thisArg
1437 // -- sp[8] : receiver 1392 // -- sp[8] : receiver
1438 // ----------------------------------- 1393 // -----------------------------------
1439 1394
1440 // 1. Load receiver into r4, argArray into r3 (if present), remove all 1395 // 1. Load receiver into r4, argArray into r3 (if present), remove all
1441 // arguments from the stack (including the receiver), and push thisArg (if 1396 // arguments from the stack (including the receiver), and push thisArg (if
1442 // present) instead. 1397 // present) instead.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 1449
1495 // 4c. The receiver is not callable, throw an appropriate TypeError. 1450 // 4c. The receiver is not callable, throw an appropriate TypeError.
1496 __ bind(&receiver_not_callable); 1451 __ bind(&receiver_not_callable);
1497 { 1452 {
1498 __ StoreP(r4, MemOperand(sp, 0)); 1453 __ StoreP(r4, MemOperand(sp, 0));
1499 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1); 1454 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1);
1500 } 1455 }
1501 } 1456 }
1502 1457
1503 1458
1459 // static
1460 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) {
1461 // 1. Make sure we have at least one argument.
1462 // r3: actual number of arguments
1463 {
1464 Label done;
1465 __ cmpi(r3, Operand::Zero());
1466 __ bne(&done);
1467 __ PushRoot(Heap::kUndefinedValueRootIndex);
1468 __ addi(r3, r3, Operand(1));
1469 __ bind(&done);
1470 }
1471
1472 // 2. Get the callable to call (passed as receiver) from the stack.
1473 // r3: actual number of arguments
1474 __ ShiftLeftImm(r5, r3, Operand(kPointerSizeLog2));
1475 __ LoadPX(r4, MemOperand(sp, r5));
1476
1477 // 3. Shift arguments and return address one slot down on the stack
1478 // (overwriting the original receiver). Adjust argument count to make
1479 // the original first argument the new receiver.
1480 // r3: actual number of arguments
1481 // r4: callable
1482 {
1483 Label loop;
1484 // Calculate the copy start address (destination). Copy end address is sp.
1485 __ add(r5, sp, r5);
1486
1487
1488 __ mtctr(r3);
1489 __ bind(&loop);
1490 __ LoadP(ip, MemOperand(r5, -kPointerSize));
1491 __ StoreP(ip, MemOperand(r5));
1492 __ subi(r5, r5, Operand(kPointerSize));
1493 __ bdnz(&loop);
1494 // Adjust the actual number of arguments and remove the top element
1495 // (which is a copy of the last argument).
1496 __ subi(r3, r3, Operand(1));
1497 __ pop();
1498 }
1499
1500 // 4. Call the callable.
1501 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
1502 }
1503
1504
1504 void Builtins::Generate_ReflectApply(MacroAssembler* masm) { 1505 void Builtins::Generate_ReflectApply(MacroAssembler* masm) {
1505 // ----------- S t a t e ------------- 1506 // ----------- S t a t e -------------
1506 // -- r3 : argc 1507 // -- r3 : argc
1507 // -- sp[0] : argumentsList 1508 // -- sp[0] : argumentsList
1508 // -- sp[4] : thisArgument 1509 // -- sp[4] : thisArgument
1509 // -- sp[8] : target 1510 // -- sp[8] : target
1510 // -- sp[12] : receiver 1511 // -- sp[12] : receiver
1511 // ----------------------------------- 1512 // -----------------------------------
1512 1513
1513 // 1. Load target into r4 (if present), argumentsList into r3 (if present), 1514 // 1. Load target into r4 (if present), argumentsList into r3 (if present),
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
2222 __ bkpt(0); 2223 __ bkpt(0);
2223 } 2224 }
2224 } 2225 }
2225 2226
2226 2227
2227 #undef __ 2228 #undef __
2228 } // namespace internal 2229 } // namespace internal
2229 } // namespace v8 2230 } // namespace v8
2230 2231
2231 #endif // V8_TARGET_ARCH_PPC 2232 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698