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

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

Issue 5161002: Change the order of evaluation of sub-expressions for keyed call... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 1 month 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/x64/codegen-x64.cc ('k') | test/mjsunit/regress/regress-931.js » ('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 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 EmitCallIC(ic, mode); 1732 EmitCallIC(ic, mode);
1733 // Restore context register. 1733 // Restore context register.
1734 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 1734 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
1735 context()->Plug(rax); 1735 context()->Plug(rax);
1736 } 1736 }
1737 1737
1738 1738
1739 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, 1739 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr,
1740 Expression* key, 1740 Expression* key,
1741 RelocInfo::Mode mode) { 1741 RelocInfo::Mode mode) {
1742 // Code common for calls using the IC. 1742 // Load the key.
1743 VisitForAccumulatorValue(key);
1744
1745 // Swap the name of the function and the receiver on the stack to follow
1746 // the calling convention for call ICs.
1747 __ pop(rcx);
1748 __ push(rax);
1749 __ push(rcx);
1750
1751 // Load the arguments.
1743 ZoneList<Expression*>* args = expr->arguments(); 1752 ZoneList<Expression*>* args = expr->arguments();
1744 int arg_count = args->length(); 1753 int arg_count = args->length();
1745 { PreserveStatementPositionScope scope(masm()->positions_recorder()); 1754 { PreserveStatementPositionScope scope(masm()->positions_recorder());
1746 for (int i = 0; i < arg_count; i++) { 1755 for (int i = 0; i < arg_count; i++) {
1747 VisitForStackValue(args->at(i)); 1756 VisitForStackValue(args->at(i));
1748 } 1757 }
1749 VisitForAccumulatorValue(key);
1750 __ movq(rcx, rax);
1751 } 1758 }
1752 // Record source position for debugger. 1759 // Record source position for debugger.
1753 SetSourcePosition(expr->position(), FORCED_POSITION); 1760 SetSourcePosition(expr->position(), FORCED_POSITION);
1754 // Call the IC initialization code. 1761 // Call the IC initialization code.
1755 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; 1762 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
1756 Handle<Code> ic = StubCache::ComputeKeyedCallInitialize(arg_count, in_loop); 1763 Handle<Code> ic = StubCache::ComputeKeyedCallInitialize(arg_count, in_loop);
1764 __ movq(rcx, Operand(rsp, (arg_count + 1) * kPointerSize)); // Key.
1757 EmitCallIC(ic, mode); 1765 EmitCallIC(ic, mode);
1758 // Restore context register. 1766 // Restore context register.
1759 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 1767 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
1760 context()->Plug(rax); 1768 context()->DropAndPlug(1, rax); // Drop the key still on the stack.
1761 } 1769 }
1762 1770
1763 1771
1764 void FullCodeGenerator::EmitCallWithStub(Call* expr) { 1772 void FullCodeGenerator::EmitCallWithStub(Call* expr) {
1765 // Code common for calls using the call stub. 1773 // Code common for calls using the call stub.
1766 ZoneList<Expression*>* args = expr->arguments(); 1774 ZoneList<Expression*>* args = expr->arguments();
1767 int arg_count = args->length(); 1775 int arg_count = args->length();
1768 { PreserveStatementPositionScope scope(masm()->positions_recorder()); 1776 { PreserveStatementPositionScope scope(masm()->positions_recorder());
1769 for (int i = 0; i < arg_count; i++) { 1777 for (int i = 0; i < arg_count; i++) {
1770 VisitForStackValue(args->at(i)); 1778 VisitForStackValue(args->at(i));
(...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after
3452 __ ret(0); 3460 __ ret(0);
3453 } 3461 }
3454 3462
3455 3463
3456 #undef __ 3464 #undef __
3457 3465
3458 3466
3459 } } // namespace v8::internal 3467 } } // namespace v8::internal
3460 3468
3461 #endif // V8_TARGET_ARCH_X64 3469 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/codegen-x64.cc ('k') | test/mjsunit/regress/regress-931.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698