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

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

Issue 598059: Fix problem with GenericBinaryOperationStub::GenerateCall for a Smi... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 10 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/ia32/codegen-ia32.cc ('k') | no next file » | 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 8033 matching lines...) Expand 10 before | Expand all | Expand 10 after
8044 Register right_arg = rax; 8044 Register right_arg = rax;
8045 if (!(left.is(left_arg) && right.is(right_arg))) { 8045 if (!(left.is(left_arg) && right.is(right_arg))) {
8046 if (left.is(right_arg) && right.is(left_arg)) { 8046 if (left.is(right_arg) && right.is(left_arg)) {
8047 if (IsOperationCommutative()) { 8047 if (IsOperationCommutative()) {
8048 SetArgsReversed(); 8048 SetArgsReversed();
8049 } else { 8049 } else {
8050 __ xchg(left, right); 8050 __ xchg(left, right);
8051 } 8051 }
8052 } else if (left.is(left_arg)) { 8052 } else if (left.is(left_arg)) {
8053 __ movq(right_arg, right); 8053 __ movq(right_arg, right);
8054 } else if (right.is(right_arg)) {
8055 __ movq(left_arg, left);
8054 } else if (left.is(right_arg)) { 8056 } else if (left.is(right_arg)) {
8055 if (IsOperationCommutative()) { 8057 if (IsOperationCommutative()) {
8056 __ movq(left_arg, right); 8058 __ movq(left_arg, right);
8057 SetArgsReversed(); 8059 SetArgsReversed();
8058 } else { 8060 } else {
8059 // Order of moves important to avoid destroying left argument. 8061 // Order of moves important to avoid destroying left argument.
8060 __ movq(left_arg, left); 8062 __ movq(left_arg, left);
8061 __ movq(right_arg, right); 8063 __ movq(right_arg, right);
8062 } 8064 }
8063 } else if (right.is(left_arg)) { 8065 } else if (right.is(left_arg)) {
8064 if (IsOperationCommutative()) { 8066 if (IsOperationCommutative()) {
8065 __ movq(right_arg, left); 8067 __ movq(right_arg, left);
8066 SetArgsReversed(); 8068 SetArgsReversed();
8067 } else { 8069 } else {
8068 // Order of moves important to avoid destroying right argument. 8070 // Order of moves important to avoid destroying right argument.
8069 __ movq(right_arg, right); 8071 __ movq(right_arg, right);
8070 __ movq(left_arg, left); 8072 __ movq(left_arg, left);
8071 } 8073 }
8072 } else if (right.is(right_arg)) {
8073 __ movq(left_arg, left);
8074 } else { 8074 } else {
8075 // Order of moves is not important. 8075 // Order of moves is not important.
8076 __ movq(left_arg, left); 8076 __ movq(left_arg, left);
8077 __ movq(right_arg, right); 8077 __ movq(right_arg, right);
8078 } 8078 }
8079 } 8079 }
8080 8080
8081 // Update flags to indicate that arguments are in registers. 8081 // Update flags to indicate that arguments are in registers.
8082 SetArgsInRegisters(); 8082 SetArgsInRegisters();
8083 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1); 8083 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1);
(...skipping 15 matching lines...) Expand all
8099 } else { 8099 } else {
8100 // The calling convention with registers is left in rdx and right in rax. 8100 // The calling convention with registers is left in rdx and right in rax.
8101 Register left_arg = rdx; 8101 Register left_arg = rdx;
8102 Register right_arg = rax; 8102 Register right_arg = rax;
8103 if (left.is(left_arg)) { 8103 if (left.is(left_arg)) {
8104 __ Move(right_arg, right); 8104 __ Move(right_arg, right);
8105 } else if (left.is(right_arg) && IsOperationCommutative()) { 8105 } else if (left.is(right_arg) && IsOperationCommutative()) {
8106 __ Move(left_arg, right); 8106 __ Move(left_arg, right);
8107 SetArgsReversed(); 8107 SetArgsReversed();
8108 } else { 8108 } else {
8109 // For non-commutative operations, left and right_arg might be
8110 // the same register. Therefore, the order of the moves is
8111 // important here in order to not overwrite left before moving
8112 // it to left_arg.
8109 __ movq(left_arg, left); 8113 __ movq(left_arg, left);
8110 __ Move(right_arg, right); 8114 __ Move(right_arg, right);
8111 } 8115 }
8112 8116
8113 // Update flags to indicate that arguments are in registers. 8117 // Update flags to indicate that arguments are in registers.
8114 SetArgsInRegisters(); 8118 SetArgsInRegisters();
8115 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1); 8119 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1);
8116 } 8120 }
8117 8121
8118 // Call the stub. 8122 // Call the stub.
(...skipping 12 matching lines...) Expand all
8131 } else { 8135 } else {
8132 // The calling convention with registers is left in rdx and right in rax. 8136 // The calling convention with registers is left in rdx and right in rax.
8133 Register left_arg = rdx; 8137 Register left_arg = rdx;
8134 Register right_arg = rax; 8138 Register right_arg = rax;
8135 if (right.is(right_arg)) { 8139 if (right.is(right_arg)) {
8136 __ Move(left_arg, left); 8140 __ Move(left_arg, left);
8137 } else if (right.is(left_arg) && IsOperationCommutative()) { 8141 } else if (right.is(left_arg) && IsOperationCommutative()) {
8138 __ Move(right_arg, left); 8142 __ Move(right_arg, left);
8139 SetArgsReversed(); 8143 SetArgsReversed();
8140 } else { 8144 } else {
8145 // For non-commutative operations, right and left_arg might be
8146 // the same register. Therefore, the order of the moves is
8147 // important here in order to not overwrite right before moving
8148 // it to right_arg.
8149 __ movq(right_arg, right);
8141 __ Move(left_arg, left); 8150 __ Move(left_arg, left);
8142 __ movq(right_arg, right);
8143 } 8151 }
8144 // Update flags to indicate that arguments are in registers. 8152 // Update flags to indicate that arguments are in registers.
8145 SetArgsInRegisters(); 8153 SetArgsInRegisters();
8146 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1); 8154 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1);
8147 } 8155 }
8148 8156
8149 // Call the stub. 8157 // Call the stub.
8150 __ CallStub(this); 8158 __ CallStub(this);
8151 } 8159 }
8152 8160
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
9230 // Call the function from C++. 9238 // Call the function from C++.
9231 return FUNCTION_CAST<ModuloFunction>(buffer); 9239 return FUNCTION_CAST<ModuloFunction>(buffer);
9232 } 9240 }
9233 9241
9234 #endif 9242 #endif
9235 9243
9236 9244
9237 #undef __ 9245 #undef __
9238 9246
9239 } } // namespace v8::internal 9247 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698