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

Side by Side Diff: src/mips64/builtins-mips64.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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
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 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 } 1368 }
1369 __ Jump(masm->isolate()->builtins()->OnStackReplacement(), 1369 __ Jump(masm->isolate()->builtins()->OnStackReplacement(),
1370 RelocInfo::CODE_TARGET); 1370 RelocInfo::CODE_TARGET);
1371 1371
1372 __ bind(&ok); 1372 __ bind(&ok);
1373 __ Ret(); 1373 __ Ret();
1374 } 1374 }
1375 1375
1376 1376
1377 // static 1377 // static
1378 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { 1378 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) {
1379 // 1. Make sure we have at least one argument.
1380 // a0: actual number of arguments
1381 {
1382 Label done;
1383 __ Branch(&done, ne, a0, Operand(zero_reg));
1384 __ PushRoot(Heap::kUndefinedValueRootIndex);
1385 __ Daddu(a0, a0, Operand(1));
1386 __ bind(&done);
1387 }
1388
1389 // 2. Get the function to call (passed as receiver) from the stack.
1390 // a0: actual number of arguments
1391 __ dsll(at, a0, kPointerSizeLog2);
1392 __ daddu(at, sp, at);
1393 __ ld(a1, MemOperand(at));
1394
1395 // 3. Shift arguments and return address one slot down on the stack
1396 // (overwriting the original receiver). Adjust argument count to make
1397 // the original first argument the new receiver.
1398 // a0: actual number of arguments
1399 // a1: function
1400 {
1401 Label loop;
1402 // Calculate the copy start address (destination). Copy end address is sp.
1403 __ dsll(at, a0, kPointerSizeLog2);
1404 __ daddu(a2, sp, at);
1405
1406 __ bind(&loop);
1407 __ ld(at, MemOperand(a2, -kPointerSize));
1408 __ sd(at, MemOperand(a2));
1409 __ Dsubu(a2, a2, Operand(kPointerSize));
1410 __ Branch(&loop, ne, a2, Operand(sp));
1411 // Adjust the actual number of arguments and remove the top element
1412 // (which is a copy of the last argument).
1413 __ Dsubu(a0, a0, Operand(1));
1414 __ Pop();
1415 }
1416
1417 // 4. Call the callable.
1418 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
1419 }
1420
1421
1422 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
1423 // ----------- S t a t e ------------- 1379 // ----------- S t a t e -------------
1424 // -- a0 : argc 1380 // -- a0 : argc
1425 // -- sp[0] : argArray 1381 // -- sp[0] : argArray
1426 // -- sp[4] : thisArg 1382 // -- sp[4] : thisArg
1427 // -- sp[8] : receiver 1383 // -- sp[8] : receiver
1428 // ----------------------------------- 1384 // -----------------------------------
1429 1385
1430 // 1. Load receiver into a1, argArray into a0 (if present), remove all 1386 // 1. Load receiver into a1, argArray into a0 (if present), remove all
1431 // arguments from the stack (including the receiver), and push thisArg (if 1387 // arguments from the stack (including the receiver), and push thisArg (if
1432 // present) instead. 1388 // present) instead.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 1440
1485 // 4c. The receiver is not callable, throw an appropriate TypeError. 1441 // 4c. The receiver is not callable, throw an appropriate TypeError.
1486 __ bind(&receiver_not_callable); 1442 __ bind(&receiver_not_callable);
1487 { 1443 {
1488 __ sd(a1, MemOperand(sp)); 1444 __ sd(a1, MemOperand(sp));
1489 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1); 1445 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1);
1490 } 1446 }
1491 } 1447 }
1492 1448
1493 1449
1450 // static
1451 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) {
1452 // 1. Make sure we have at least one argument.
1453 // a0: actual number of arguments
1454 {
1455 Label done;
1456 __ Branch(&done, ne, a0, Operand(zero_reg));
1457 __ PushRoot(Heap::kUndefinedValueRootIndex);
1458 __ Daddu(a0, a0, Operand(1));
1459 __ bind(&done);
1460 }
1461
1462 // 2. Get the function to call (passed as receiver) from the stack.
1463 // a0: actual number of arguments
1464 __ dsll(at, a0, kPointerSizeLog2);
1465 __ daddu(at, sp, at);
1466 __ ld(a1, MemOperand(at));
1467
1468 // 3. Shift arguments and return address one slot down on the stack
1469 // (overwriting the original receiver). Adjust argument count to make
1470 // the original first argument the new receiver.
1471 // a0: actual number of arguments
1472 // a1: function
1473 {
1474 Label loop;
1475 // Calculate the copy start address (destination). Copy end address is sp.
1476 __ dsll(at, a0, kPointerSizeLog2);
1477 __ daddu(a2, sp, at);
1478
1479 __ bind(&loop);
1480 __ ld(at, MemOperand(a2, -kPointerSize));
1481 __ sd(at, MemOperand(a2));
1482 __ Dsubu(a2, a2, Operand(kPointerSize));
1483 __ Branch(&loop, ne, a2, Operand(sp));
1484 // Adjust the actual number of arguments and remove the top element
1485 // (which is a copy of the last argument).
1486 __ Dsubu(a0, a0, Operand(1));
1487 __ Pop();
1488 }
1489
1490 // 4. Call the callable.
1491 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
1492 }
1493
1494
1494 void Builtins::Generate_ReflectApply(MacroAssembler* masm) { 1495 void Builtins::Generate_ReflectApply(MacroAssembler* masm) {
1495 // ----------- S t a t e ------------- 1496 // ----------- S t a t e -------------
1496 // -- a0 : argc 1497 // -- a0 : argc
1497 // -- sp[0] : argumentsList 1498 // -- sp[0] : argumentsList
1498 // -- sp[4] : thisArgument 1499 // -- sp[4] : thisArgument
1499 // -- sp[8] : target 1500 // -- sp[8] : target
1500 // -- sp[12] : receiver 1501 // -- sp[12] : receiver
1501 // ----------------------------------- 1502 // -----------------------------------
1502 1503
1503 // 1. Load target into a1 (if present), argumentsList into a0 (if present), 1504 // 1. Load target into a1 (if present), argumentsList into a0 (if present),
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 } 2209 }
2209 } 2210 }
2210 2211
2211 2212
2212 #undef __ 2213 #undef __
2213 2214
2214 } // namespace internal 2215 } // namespace internal
2215 } // namespace v8 2216 } // namespace v8
2216 2217
2217 #endif // V8_TARGET_ARCH_MIPS64 2218 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« src/debug/mirrors.js ('K') | « src/mips/builtins-mips.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698