Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1698 __ ldr(result, | 1698 __ ldr(result, |
| 1699 MemOperand(result, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 1699 MemOperand(result, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 1700 __ SmiUntag(result); | 1700 __ SmiUntag(result); |
| 1701 | 1701 |
| 1702 // Argument length is in result register. | 1702 // Argument length is in result register. |
| 1703 __ bind(&done); | 1703 __ bind(&done); |
| 1704 } | 1704 } |
| 1705 | 1705 |
| 1706 | 1706 |
| 1707 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { | 1707 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { |
| 1708 Abort("DoApplyArguments unimplemented."); | 1708 Register receiver = ToRegister(instr->receiver()); |
| 1709 Register function = ToRegister(instr->function()); | |
| 1710 Register scratch = scratch0(); | |
| 1711 | |
| 1712 ASSERT(receiver.is(r0)); | |
| 1713 ASSERT(function.is(r1)); | |
| 1714 ASSERT(ToRegister(instr->result()).is(r0)); | |
| 1715 | |
| 1716 // If the receiver is null or undefined, we have to pass the | |
| 1717 // global object as a receiver. | |
| 1718 Label global_receiver, receiver_ok; | |
| 1719 __ LoadRoot(scratch, Heap::kNullValueRootIndex); | |
| 1720 __ cmp(receiver, scratch); | |
| 1721 __ b(eq, &global_receiver); | |
| 1722 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | |
| 1723 __ cmp(receiver, scratch); | |
| 1724 __ b(ne, &receiver_ok); | |
| 1725 __ bind(&global_receiver); | |
| 1726 __ ldr(receiver, GlobalObjectOperand()); | |
| 1727 __ bind(&receiver_ok); | |
| 1728 | |
| 1729 Register length = ToRegister(instr->length()); | |
| 1730 Register elements = ToRegister(instr->elements()); | |
| 1731 | |
| 1732 Label invoke; | |
| 1733 | |
| 1734 // Copy the arguments to this function possibly from the | |
| 1735 // adaptor frame below it. | |
| 1736 const uint32_t kArgumentsLimit = 1 * KB; | |
| 1737 __ cmp(length, Operand(kArgumentsLimit)); | |
| 1738 DeoptimizeIf(hi, instr->environment()); | |
| 1739 | |
| 1740 __ push(receiver); | |
| 1741 __ mov(receiver, length); | |
|
Søren Thygesen Gjesse
2011/01/11 12:01:28
Please add a comment why we are adding 4 here, and
Karl Klose
2011/01/11 13:04:33
Done.
| |
| 1742 __ add(elements, elements, Operand(4)); | |
| 1743 | |
| 1744 // Loop through the arguments pushing them onto the execution | |
| 1745 // stack. | |
| 1746 Label loop; | |
|
Søren Thygesen Gjesse
2011/01/11 12:01:28
I don't know if it will make a difference, but we
Karl Klose
2011/01/11 13:04:33
I do not see large numbers of arguments, so I did
| |
| 1747 // length is a small non-negative integer, due to the test above. | |
| 1748 __ tst(length, Operand(length)); | |
| 1749 __ b(eq, &invoke); | |
| 1750 __ bind(&loop); | |
| 1751 __ ldr(scratch, MemOperand(elements, length, LSL, 2)); | |
| 1752 __ push(scratch); | |
| 1753 __ sub(length, length, Operand(1), SetCC); | |
| 1754 __ b(ne, &loop); | |
| 1755 | |
| 1756 // Invoke the function. | |
| 1757 __ bind(&invoke); | |
| 1758 v8::internal::ParameterCount actual(receiver); | |
|
Søren Thygesen Gjesse
2011/01/11 12:01:28
Maybe comment here that receiver stores the origin
Karl Klose
2011/01/11 13:04:33
Done.
| |
| 1759 | |
| 1760 SafepointGenerator safepoint_generator(this, | |
| 1761 instr->pointer_map(), | |
| 1762 Safepoint::kNoDeoptimizationIndex); | |
| 1763 __ InvokeFunction(function, actual, CALL_FUNCTION, &safepoint_generator); | |
| 1709 } | 1764 } |
| 1710 | 1765 |
| 1711 | 1766 |
| 1712 void LCodeGen::DoPushArgument(LPushArgument* instr) { | 1767 void LCodeGen::DoPushArgument(LPushArgument* instr) { |
| 1713 LOperand* argument = instr->input(); | 1768 LOperand* argument = instr->input(); |
| 1714 if (argument->IsDoubleRegister() || argument->IsDoubleStackSlot()) { | 1769 if (argument->IsDoubleRegister() || argument->IsDoubleStackSlot()) { |
| 1715 Abort("DoPushArgument not implemented for double type."); | 1770 Abort("DoPushArgument not implemented for double type."); |
| 1716 } else { | 1771 } else { |
| 1717 Register argument_reg = EmitLoadRegister(argument, ip); | 1772 Register argument_reg = EmitLoadRegister(argument, ip); |
| 1718 __ push(argument_reg); | 1773 __ push(argument_reg); |
| (...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2597 | 2652 |
| 2598 | 2653 |
| 2599 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 2654 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
| 2600 Abort("DoOsrEntry unimplemented."); | 2655 Abort("DoOsrEntry unimplemented."); |
| 2601 } | 2656 } |
| 2602 | 2657 |
| 2603 | 2658 |
| 2604 #undef __ | 2659 #undef __ |
| 2605 | 2660 |
| 2606 } } // namespace v8::internal | 2661 } } // namespace v8::internal |
| OLD | NEW |