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

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

Issue 2853003: Port KeyedCallIC implementation to x64 and ARM.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 6 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 | « src/arm/codegen-arm.cc ('k') | src/arm/ic-arm.cc » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 // Call the IC initialization code. 1641 // Call the IC initialization code.
1642 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; 1642 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
1643 Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count, in_loop); 1643 Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count, in_loop);
1644 __ Call(ic, mode); 1644 __ Call(ic, mode);
1645 // Restore context register. 1645 // Restore context register.
1646 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 1646 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1647 Apply(context_, r0); 1647 Apply(context_, r0);
1648 } 1648 }
1649 1649
1650 1650
1651 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr,
1652 Expression* key,
1653 RelocInfo::Mode mode) {
1654 // Code common for calls using the IC.
1655 ZoneList<Expression*>* args = expr->arguments();
1656 int arg_count = args->length();
1657 for (int i = 0; i < arg_count; i++) {
1658 VisitForValue(args->at(i), kStack);
1659 }
1660 VisitForValue(key, kAccumulator);
1661 __ mov(r2, r0);
1662 // Record source position for debugger.
1663 SetSourcePosition(expr->position());
1664 // Call the IC initialization code.
1665 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
1666 Handle<Code> ic = CodeGenerator::ComputeKeyedCallInitialize(arg_count,
1667 in_loop);
1668 __ Call(ic, mode);
1669 // Restore context register.
1670 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1671 Apply(context_, r0);
1672 }
1673
1674
1651 void FullCodeGenerator::EmitCallWithStub(Call* expr) { 1675 void FullCodeGenerator::EmitCallWithStub(Call* expr) {
1652 // Code common for calls using the call stub. 1676 // Code common for calls using the call stub.
1653 ZoneList<Expression*>* args = expr->arguments(); 1677 ZoneList<Expression*>* args = expr->arguments();
1654 int arg_count = args->length(); 1678 int arg_count = args->length();
1655 for (int i = 0; i < arg_count; i++) { 1679 for (int i = 0; i < arg_count; i++) {
1656 VisitForValue(args->at(i), kStack); 1680 VisitForValue(args->at(i), kStack);
1657 } 1681 }
1658 // Record source position for debugger. 1682 // Record source position for debugger.
1659 SetSourcePosition(expr->position()); 1683 SetSourcePosition(expr->position());
1660 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; 1684 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 EmitCallWithStub(expr); 1760 EmitCallWithStub(expr);
1737 } else if (fun->AsProperty() != NULL) { 1761 } else if (fun->AsProperty() != NULL) {
1738 // Call to an object property. 1762 // Call to an object property.
1739 Property* prop = fun->AsProperty(); 1763 Property* prop = fun->AsProperty();
1740 Literal* key = prop->key()->AsLiteral(); 1764 Literal* key = prop->key()->AsLiteral();
1741 if (key != NULL && key->handle()->IsSymbol()) { 1765 if (key != NULL && key->handle()->IsSymbol()) {
1742 // Call to a named property, use call IC. 1766 // Call to a named property, use call IC.
1743 VisitForValue(prop->obj(), kStack); 1767 VisitForValue(prop->obj(), kStack);
1744 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET); 1768 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET);
1745 } else { 1769 } else {
1746 // Call to a keyed property, use keyed load IC followed by function 1770 // Call to a keyed property.
1747 // call. 1771 // For a synthetic property use keyed load IC followed by function call,
1772 // for a regular property use keyed CallIC.
1748 VisitForValue(prop->obj(), kStack); 1773 VisitForValue(prop->obj(), kStack);
1749 VisitForValue(prop->key(), kAccumulator);
1750 // Record source code position for IC call.
1751 SetSourcePosition(prop->position());
1752 if (prop->is_synthetic()) { 1774 if (prop->is_synthetic()) {
1775 VisitForValue(prop->key(), kAccumulator);
1776 // Record source code position for IC call.
1777 SetSourcePosition(prop->position());
1753 __ pop(r1); // We do not need to keep the receiver. 1778 __ pop(r1); // We do not need to keep the receiver.
1754 } else {
1755 __ ldr(r1, MemOperand(sp, 0)); // Keep receiver, to call function on.
1756 }
1757 1779
1758 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); 1780 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
1759 __ Call(ic, RelocInfo::CODE_TARGET); 1781 __ Call(ic, RelocInfo::CODE_TARGET);
1760 if (prop->is_synthetic()) {
1761 // Push result (function). 1782 // Push result (function).
1762 __ push(r0); 1783 __ push(r0);
1763 // Push Global receiver. 1784 // Push Global receiver.
1764 __ ldr(r1, CodeGenerator::GlobalObject()); 1785 __ ldr(r1, CodeGenerator::GlobalObject());
1765 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); 1786 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset));
1766 __ push(r1); 1787 __ push(r1);
1788 EmitCallWithStub(expr);
1767 } else { 1789 } else {
1768 // Pop receiver. 1790 EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET);
1769 __ pop(r1);
1770 // Push result (function).
1771 __ push(r0);
1772 __ push(r1);
1773 } 1791 }
1774 EmitCallWithStub(expr);
1775 } 1792 }
1776 } else { 1793 } else {
1777 // Call to some other expression. If the expression is an anonymous 1794 // Call to some other expression. If the expression is an anonymous
1778 // function literal not called in a loop, mark it as one that should 1795 // function literal not called in a loop, mark it as one that should
1779 // also use the fast code generator. 1796 // also use the fast code generator.
1780 FunctionLiteral* lit = fun->AsFunctionLiteral(); 1797 FunctionLiteral* lit = fun->AsFunctionLiteral();
1781 if (lit != NULL && 1798 if (lit != NULL &&
1782 lit->name()->Equals(Heap::empty_string()) && 1799 lit->name()->Equals(Heap::empty_string()) &&
1783 loop_depth() == 0) { 1800 loop_depth() == 0) {
1784 lit->set_try_full_codegen(true); 1801 lit->set_try_full_codegen(true);
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
3135 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 3152 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
3136 __ add(pc, r1, Operand(masm_->CodeObject())); 3153 __ add(pc, r1, Operand(masm_->CodeObject()));
3137 } 3154 }
3138 3155
3139 3156
3140 #undef __ 3157 #undef __
3141 3158
3142 } } // namespace v8::internal 3159 } } // namespace v8::internal
3143 3160
3144 #endif // V8_TARGET_ARCH_ARM 3161 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/arm/ic-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698