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

Side by Side Diff: src/arm/builtins-arm.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 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 | src/arm64/builtins-arm64.cc » ('j') | src/debug/mirrors.js » ('J')
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 // 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_ARM 5 #if V8_TARGET_ARCH_ARM
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 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 } 1375 }
1376 __ Jump(masm->isolate()->builtins()->OnStackReplacement(), 1376 __ Jump(masm->isolate()->builtins()->OnStackReplacement(),
1377 RelocInfo::CODE_TARGET); 1377 RelocInfo::CODE_TARGET);
1378 1378
1379 __ bind(&ok); 1379 __ bind(&ok);
1380 __ Ret(); 1380 __ Ret();
1381 } 1381 }
1382 1382
1383 1383
1384 // static 1384 // static
1385 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { 1385 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) {
1386 // 1. Make sure we have at least one argument.
1387 // r0: actual number of arguments
1388 {
1389 Label done;
1390 __ cmp(r0, Operand::Zero());
1391 __ b(ne, &done);
1392 __ PushRoot(Heap::kUndefinedValueRootIndex);
1393 __ add(r0, r0, Operand(1));
1394 __ bind(&done);
1395 }
1396
1397 // 2. Get the callable to call (passed as receiver) from the stack.
1398 // r0: actual number of arguments
1399 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2));
1400
1401 // 3. Shift arguments and return address one slot down on the stack
1402 // (overwriting the original receiver). Adjust argument count to make
1403 // the original first argument the new receiver.
1404 // r0: actual number of arguments
1405 // r1: callable
1406 {
1407 Label loop;
1408 // Calculate the copy start address (destination). Copy end address is sp.
1409 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2));
1410
1411 __ bind(&loop);
1412 __ ldr(ip, MemOperand(r2, -kPointerSize));
1413 __ str(ip, MemOperand(r2));
1414 __ sub(r2, r2, Operand(kPointerSize));
1415 __ cmp(r2, sp);
1416 __ b(ne, &loop);
1417 // Adjust the actual number of arguments and remove the top element
1418 // (which is a copy of the last argument).
1419 __ sub(r0, r0, Operand(1));
1420 __ pop();
1421 }
1422
1423 // 4. Call the callable.
1424 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
1425 }
1426
1427
1428 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
1429 // ----------- S t a t e ------------- 1386 // ----------- S t a t e -------------
1430 // -- r0 : argc 1387 // -- r0 : argc
1431 // -- sp[0] : argArray 1388 // -- sp[0] : argArray
1432 // -- sp[4] : thisArg 1389 // -- sp[4] : thisArg
1433 // -- sp[8] : receiver 1390 // -- sp[8] : receiver
1434 // ----------------------------------- 1391 // -----------------------------------
1435 1392
1436 // 1. Load receiver into r1, argArray into r0 (if present), remove all 1393 // 1. Load receiver into r1, argArray into r0 (if present), remove all
1437 // arguments from the stack (including the receiver), and push thisArg (if 1394 // arguments from the stack (including the receiver), and push thisArg (if
1438 // present) instead. 1395 // present) instead.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 1440
1484 // 4c. The receiver is not callable, throw an appropriate TypeError. 1441 // 4c. The receiver is not callable, throw an appropriate TypeError.
1485 __ bind(&receiver_not_callable); 1442 __ bind(&receiver_not_callable);
1486 { 1443 {
1487 __ str(r1, MemOperand(sp, 0)); 1444 __ str(r1, MemOperand(sp, 0));
1488 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1); 1445 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1);
1489 } 1446 }
1490 } 1447 }
1491 1448
1492 1449
1450 // static
1451 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) {
1452 // 1. Make sure we have at least one argument.
1453 // r0: actual number of arguments
1454 {
1455 Label done;
1456 __ cmp(r0, Operand::Zero());
1457 __ b(ne, &done);
1458 __ PushRoot(Heap::kUndefinedValueRootIndex);
1459 __ add(r0, r0, Operand(1));
1460 __ bind(&done);
1461 }
1462
1463 // 2. Get the callable to call (passed as receiver) from the stack.
1464 // r0: actual number of arguments
1465 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2));
1466
1467 // 3. Shift arguments and return address one slot down on the stack
1468 // (overwriting the original receiver). Adjust argument count to make
1469 // the original first argument the new receiver.
1470 // r0: actual number of arguments
1471 // r1: callable
1472 {
1473 Label loop;
1474 // Calculate the copy start address (destination). Copy end address is sp.
1475 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2));
1476
1477 __ bind(&loop);
1478 __ ldr(ip, MemOperand(r2, -kPointerSize));
1479 __ str(ip, MemOperand(r2));
1480 __ sub(r2, r2, Operand(kPointerSize));
1481 __ cmp(r2, sp);
1482 __ b(ne, &loop);
1483 // Adjust the actual number of arguments and remove the top element
1484 // (which is a copy of the last argument).
1485 __ sub(r0, r0, Operand(1));
1486 __ pop();
1487 }
1488
1489 // 4. Call the callable.
1490 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
1491 }
1492
1493
1493 void Builtins::Generate_ReflectApply(MacroAssembler* masm) { 1494 void Builtins::Generate_ReflectApply(MacroAssembler* masm) {
1494 // ----------- S t a t e ------------- 1495 // ----------- S t a t e -------------
1495 // -- r0 : argc 1496 // -- r0 : argc
1496 // -- sp[0] : argumentsList 1497 // -- sp[0] : argumentsList
1497 // -- sp[4] : thisArgument 1498 // -- sp[4] : thisArgument
1498 // -- sp[8] : target 1499 // -- sp[8] : target
1499 // -- sp[12] : receiver 1500 // -- sp[12] : receiver
1500 // ----------------------------------- 1501 // -----------------------------------
1501 1502
1502 // 1. Load target into r1 (if present), argumentsList into r0 (if present), 1503 // 1. Load target into r1 (if present), argumentsList into r0 (if present),
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 } 2175 }
2175 } 2176 }
2176 2177
2177 2178
2178 #undef __ 2179 #undef __
2179 2180
2180 } // namespace internal 2181 } // namespace internal
2181 } // namespace v8 2182 } // namespace v8
2182 2183
2183 #endif // V8_TARGET_ARCH_ARM 2184 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/builtins-arm64.cc » ('j') | src/debug/mirrors.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698