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

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 6164003: Implement DoApplyArguments. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/benchmarks
Patch Set: Adress comments. Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 __ ldr(result, 1711 __ ldr(result,
1712 MemOperand(result, ArgumentsAdaptorFrameConstants::kLengthOffset)); 1712 MemOperand(result, ArgumentsAdaptorFrameConstants::kLengthOffset));
1713 __ SmiUntag(result); 1713 __ SmiUntag(result);
1714 1714
1715 // Argument length is in result register. 1715 // Argument length is in result register.
1716 __ bind(&done); 1716 __ bind(&done);
1717 } 1717 }
1718 1718
1719 1719
1720 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { 1720 void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
1721 Abort("DoApplyArguments unimplemented."); 1721 Register receiver = ToRegister(instr->receiver());
1722 Register function = ToRegister(instr->function());
1723 Register scratch = scratch0();
1724
1725 ASSERT(receiver.is(r0));
1726 ASSERT(function.is(r1));
1727 ASSERT(ToRegister(instr->result()).is(r0));
1728
1729 // If the receiver is null or undefined, we have to pass the
1730 // global object as a receiver.
1731 Label global_receiver, receiver_ok;
1732 __ LoadRoot(scratch, Heap::kNullValueRootIndex);
1733 __ cmp(receiver, scratch);
1734 __ b(eq, &global_receiver);
1735 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
1736 __ cmp(receiver, scratch);
1737 __ b(ne, &receiver_ok);
1738 __ bind(&global_receiver);
1739 __ ldr(receiver, GlobalObjectOperand());
1740 __ bind(&receiver_ok);
1741
1742 Register length = ToRegister(instr->length());
1743 Register elements = ToRegister(instr->elements());
1744
1745 Label invoke;
1746
1747 // Copy the arguments to this function possibly from the
1748 // adaptor frame below it.
1749 const uint32_t kArgumentsLimit = 1 * KB;
1750 __ cmp(length, Operand(kArgumentsLimit));
1751 DeoptimizeIf(hi, instr->environment());
1752
1753 // Push the receiver and use the register to keep the original
1754 // number of arguments.
1755 __ push(receiver);
1756 __ mov(receiver, length);
1757 // The arguments are at a one pointer size offset from elements.
1758 __ add(elements, elements, Operand(1 * kPointerSize));
1759
1760 // Loop through the arguments pushing them onto the execution
1761 // stack.
1762 Label loop;
1763 // length is a small non-negative integer, due to the test above.
1764 __ tst(length, Operand(length));
1765 __ b(eq, &invoke);
1766 __ bind(&loop);
1767 __ ldr(scratch, MemOperand(elements, length, LSL, 2));
1768 __ push(scratch);
1769 __ sub(length, length, Operand(1), SetCC);
1770 __ b(ne, &loop);
1771
1772 __ bind(&invoke);
1773 // Invoke the function. The number of arguments is stored in receiver
1774 // which is r0, as expected by InvokeFunction.
1775 v8::internal::ParameterCount actual(receiver);
1776 SafepointGenerator safepoint_generator(this,
1777 instr->pointer_map(),
1778 Safepoint::kNoDeoptimizationIndex);
1779 __ InvokeFunction(function, actual, CALL_FUNCTION, &safepoint_generator);
1722 } 1780 }
1723 1781
1724 1782
1725 void LCodeGen::DoPushArgument(LPushArgument* instr) { 1783 void LCodeGen::DoPushArgument(LPushArgument* instr) {
1726 LOperand* argument = instr->input(); 1784 LOperand* argument = instr->input();
1727 if (argument->IsDoubleRegister() || argument->IsDoubleStackSlot()) { 1785 if (argument->IsDoubleRegister() || argument->IsDoubleStackSlot()) {
1728 Abort("DoPushArgument not implemented for double type."); 1786 Abort("DoPushArgument not implemented for double type.");
1729 } else { 1787 } else {
1730 Register argument_reg = EmitLoadRegister(argument, ip); 1788 Register argument_reg = EmitLoadRegister(argument, ip);
1731 __ push(argument_reg); 1789 __ push(argument_reg);
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
2648 2706
2649 2707
2650 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { 2708 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
2651 Abort("DoOsrEntry unimplemented."); 2709 Abort("DoOsrEntry unimplemented.");
2652 } 2710 }
2653 2711
2654 2712
2655 #undef __ 2713 #undef __
2656 2714
2657 } } // namespace v8::internal 2715 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698