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

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

Issue 1540953004: [runtime] Rewrite Function.prototype.toString in C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typos. Created 4 years, 12 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 // a0: actual number of arguments
1390 {
1391 Label done;
1392 __ Branch(&done, ne, a0, Operand(zero_reg));
1393 __ PushRoot(Heap::kUndefinedValueRootIndex);
1394 __ Addu(a0, a0, Operand(1));
1395 __ bind(&done);
1396 }
1397
1398 // 2. Get the function to call (passed as receiver) from the stack.
1399 // a0: actual number of arguments
1400 __ sll(at, a0, kPointerSizeLog2);
1401 __ addu(at, sp, at);
1402 __ lw(a1, MemOperand(at));
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 // a0: actual number of arguments
1408 // a1: function
1409 {
1410 Label loop;
1411 // Calculate the copy start address (destination). Copy end address is sp.
1412 __ sll(at, a0, kPointerSizeLog2);
1413 __ addu(a2, sp, at);
1414
1415 __ bind(&loop);
1416 __ lw(at, MemOperand(a2, -kPointerSize));
1417 __ sw(at, MemOperand(a2));
1418 __ Subu(a2, a2, Operand(kPointerSize));
1419 __ Branch(&loop, ne, a2, Operand(sp));
1420 // Adjust the actual number of arguments and remove the top element
1421 // (which is a copy of the last argument).
1422 __ Subu(a0, a0, Operand(1));
1423 __ Pop();
1424 }
1425
1426 // 4. Call the callable.
1427 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
1428 }
1429
1430
1431 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
1432 // ----------- S t a t e ------------- 1388 // ----------- S t a t e -------------
1433 // -- a0 : argc 1389 // -- a0 : argc
1434 // -- sp[0] : argArray 1390 // -- sp[0] : argArray
1435 // -- sp[4] : thisArg 1391 // -- sp[4] : thisArg
1436 // -- sp[8] : receiver 1392 // -- sp[8] : receiver
1437 // ----------------------------------- 1393 // -----------------------------------
1438 1394
1439 // 1. Load receiver into a1, argArray into a0 (if present), remove all 1395 // 1. Load receiver into a1, argArray into a0 (if present), remove all
1440 // arguments from the stack (including the receiver), and push thisArg (if 1396 // arguments from the stack (including the receiver), and push thisArg (if
1441 // present) instead. 1397 // present) instead.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 1449
1494 // 4c. The receiver is not callable, throw an appropriate TypeError. 1450 // 4c. The receiver is not callable, throw an appropriate TypeError.
1495 __ bind(&receiver_not_callable); 1451 __ bind(&receiver_not_callable);
1496 { 1452 {
1497 __ sw(a1, MemOperand(sp)); 1453 __ sw(a1, MemOperand(sp));
1498 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1); 1454 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1);
1499 } 1455 }
1500 } 1456 }
1501 1457
1502 1458
1459 // static
1460 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) {
1461 // 1. Make sure we have at least one argument.
1462 // a0: actual number of arguments
1463 {
1464 Label done;
1465 __ Branch(&done, ne, a0, Operand(zero_reg));
1466 __ PushRoot(Heap::kUndefinedValueRootIndex);
1467 __ Addu(a0, a0, Operand(1));
1468 __ bind(&done);
1469 }
1470
1471 // 2. Get the function to call (passed as receiver) from the stack.
1472 // a0: actual number of arguments
1473 __ sll(at, a0, kPointerSizeLog2);
1474 __ addu(at, sp, at);
1475 __ lw(a1, MemOperand(at));
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 // a0: actual number of arguments
1481 // a1: function
1482 {
1483 Label loop;
1484 // Calculate the copy start address (destination). Copy end address is sp.
1485 __ sll(at, a0, kPointerSizeLog2);
1486 __ addu(a2, sp, at);
1487
1488 __ bind(&loop);
1489 __ lw(at, MemOperand(a2, -kPointerSize));
1490 __ sw(at, MemOperand(a2));
1491 __ Subu(a2, a2, Operand(kPointerSize));
1492 __ Branch(&loop, ne, a2, Operand(sp));
1493 // Adjust the actual number of arguments and remove the top element
1494 // (which is a copy of the last argument).
1495 __ Subu(a0, a0, Operand(1));
1496 __ Pop();
1497 }
1498
1499 // 4. Call the callable.
1500 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
1501 }
1502
1503
1503 void Builtins::Generate_ReflectApply(MacroAssembler* masm) { 1504 void Builtins::Generate_ReflectApply(MacroAssembler* masm) {
1504 // ----------- S t a t e ------------- 1505 // ----------- S t a t e -------------
1505 // -- a0 : argc 1506 // -- a0 : argc
1506 // -- sp[0] : argumentsList 1507 // -- sp[0] : argumentsList
1507 // -- sp[4] : thisArgument 1508 // -- sp[4] : thisArgument
1508 // -- sp[8] : target 1509 // -- sp[8] : target
1509 // -- sp[12] : receiver 1510 // -- sp[12] : receiver
1510 // ----------------------------------- 1511 // -----------------------------------
1511 1512
1512 // 1. Load target into a1 (if present), argumentsList into a0 (if present), 1513 // 1. Load target into a1 (if present), argumentsList into a0 (if present),
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
2218 } 2219 }
2219 } 2220 }
2220 2221
2221 2222
2222 #undef __ 2223 #undef __
2223 2224
2224 } // namespace internal 2225 } // namespace internal
2225 } // namespace v8 2226 } // namespace v8
2226 2227
2227 #endif // V8_TARGET_ARCH_MIPS 2228 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« src/debug/mirrors.js ('K') | « src/js/v8natives.js ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698