| 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 8001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8012 Register right_arg = rax; | 8012 Register right_arg = rax; |
| 8013 if (!(left.is(left_arg) && right.is(right_arg))) { | 8013 if (!(left.is(left_arg) && right.is(right_arg))) { |
| 8014 if (left.is(right_arg) && right.is(left_arg)) { | 8014 if (left.is(right_arg) && right.is(left_arg)) { |
| 8015 if (IsOperationCommutative()) { | 8015 if (IsOperationCommutative()) { |
| 8016 SetArgsReversed(); | 8016 SetArgsReversed(); |
| 8017 } else { | 8017 } else { |
| 8018 __ xchg(left, right); | 8018 __ xchg(left, right); |
| 8019 } | 8019 } |
| 8020 } else if (left.is(left_arg)) { | 8020 } else if (left.is(left_arg)) { |
| 8021 __ movq(right_arg, right); | 8021 __ movq(right_arg, right); |
| 8022 } else if (right.is(right_arg)) { |
| 8023 __ movq(left_arg, left); |
| 8022 } else if (left.is(right_arg)) { | 8024 } else if (left.is(right_arg)) { |
| 8023 if (IsOperationCommutative()) { | 8025 if (IsOperationCommutative()) { |
| 8024 __ movq(left_arg, right); | 8026 __ movq(left_arg, right); |
| 8025 SetArgsReversed(); | 8027 SetArgsReversed(); |
| 8026 } else { | 8028 } else { |
| 8027 // Order of moves important to avoid destroying left argument. | 8029 // Order of moves important to avoid destroying left argument. |
| 8028 __ movq(left_arg, left); | 8030 __ movq(left_arg, left); |
| 8029 __ movq(right_arg, right); | 8031 __ movq(right_arg, right); |
| 8030 } | 8032 } |
| 8031 } else if (right.is(left_arg)) { | 8033 } else if (right.is(left_arg)) { |
| 8032 if (IsOperationCommutative()) { | 8034 if (IsOperationCommutative()) { |
| 8033 __ movq(right_arg, left); | 8035 __ movq(right_arg, left); |
| 8034 SetArgsReversed(); | 8036 SetArgsReversed(); |
| 8035 } else { | 8037 } else { |
| 8036 // Order of moves important to avoid destroying right argument. | 8038 // Order of moves important to avoid destroying right argument. |
| 8037 __ movq(right_arg, right); | 8039 __ movq(right_arg, right); |
| 8038 __ movq(left_arg, left); | 8040 __ movq(left_arg, left); |
| 8039 } | 8041 } |
| 8040 } else if (right.is(right_arg)) { | |
| 8041 __ movq(left_arg, left); | |
| 8042 } else { | 8042 } else { |
| 8043 // Order of moves is not important. | 8043 // Order of moves is not important. |
| 8044 __ movq(left_arg, left); | 8044 __ movq(left_arg, left); |
| 8045 __ movq(right_arg, right); | 8045 __ movq(right_arg, right); |
| 8046 } | 8046 } |
| 8047 } | 8047 } |
| 8048 | 8048 |
| 8049 // Update flags to indicate that arguments are in registers. | 8049 // Update flags to indicate that arguments are in registers. |
| 8050 SetArgsInRegisters(); | 8050 SetArgsInRegisters(); |
| 8051 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1); | 8051 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 8067 } else { | 8067 } else { |
| 8068 // The calling convention with registers is left in rdx and right in rax. | 8068 // The calling convention with registers is left in rdx and right in rax. |
| 8069 Register left_arg = rdx; | 8069 Register left_arg = rdx; |
| 8070 Register right_arg = rax; | 8070 Register right_arg = rax; |
| 8071 if (left.is(left_arg)) { | 8071 if (left.is(left_arg)) { |
| 8072 __ Move(right_arg, right); | 8072 __ Move(right_arg, right); |
| 8073 } else if (left.is(right_arg) && IsOperationCommutative()) { | 8073 } else if (left.is(right_arg) && IsOperationCommutative()) { |
| 8074 __ Move(left_arg, right); | 8074 __ Move(left_arg, right); |
| 8075 SetArgsReversed(); | 8075 SetArgsReversed(); |
| 8076 } else { | 8076 } else { |
| 8077 // For non-commutative operations, left and right_arg might be |
| 8078 // the same register. Therefore, the order of the moves is |
| 8079 // important here in order to not overwrite left before moving |
| 8080 // it to left_arg. |
| 8077 __ movq(left_arg, left); | 8081 __ movq(left_arg, left); |
| 8078 __ Move(right_arg, right); | 8082 __ Move(right_arg, right); |
| 8079 } | 8083 } |
| 8080 | 8084 |
| 8081 // Update flags to indicate that arguments are in registers. | 8085 // Update flags to indicate that arguments are in registers. |
| 8082 SetArgsInRegisters(); | 8086 SetArgsInRegisters(); |
| 8083 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1); | 8087 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1); |
| 8084 } | 8088 } |
| 8085 | 8089 |
| 8086 // Call the stub. | 8090 // Call the stub. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 8099 } else { | 8103 } else { |
| 8100 // The calling convention with registers is left in rdx and right in rax. | 8104 // The calling convention with registers is left in rdx and right in rax. |
| 8101 Register left_arg = rdx; | 8105 Register left_arg = rdx; |
| 8102 Register right_arg = rax; | 8106 Register right_arg = rax; |
| 8103 if (right.is(right_arg)) { | 8107 if (right.is(right_arg)) { |
| 8104 __ Move(left_arg, left); | 8108 __ Move(left_arg, left); |
| 8105 } else if (right.is(left_arg) && IsOperationCommutative()) { | 8109 } else if (right.is(left_arg) && IsOperationCommutative()) { |
| 8106 __ Move(right_arg, left); | 8110 __ Move(right_arg, left); |
| 8107 SetArgsReversed(); | 8111 SetArgsReversed(); |
| 8108 } else { | 8112 } else { |
| 8113 // For non-commutative operations, right and left_arg might be |
| 8114 // the same register. Therefore, the order of the moves is |
| 8115 // important here in order to not overwrite right before moving |
| 8116 // it to right_arg. |
| 8117 __ movq(right_arg, right); |
| 8109 __ Move(left_arg, left); | 8118 __ Move(left_arg, left); |
| 8110 __ movq(right_arg, right); | |
| 8111 } | 8119 } |
| 8112 // Update flags to indicate that arguments are in registers. | 8120 // Update flags to indicate that arguments are in registers. |
| 8113 SetArgsInRegisters(); | 8121 SetArgsInRegisters(); |
| 8114 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1); | 8122 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1); |
| 8115 } | 8123 } |
| 8116 | 8124 |
| 8117 // Call the stub. | 8125 // Call the stub. |
| 8118 __ CallStub(this); | 8126 __ CallStub(this); |
| 8119 } | 8127 } |
| 8120 | 8128 |
| (...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9198 // Call the function from C++. | 9206 // Call the function from C++. |
| 9199 return FUNCTION_CAST<ModuloFunction>(buffer); | 9207 return FUNCTION_CAST<ModuloFunction>(buffer); |
| 9200 } | 9208 } |
| 9201 | 9209 |
| 9202 #endif | 9210 #endif |
| 9203 | 9211 |
| 9204 | 9212 |
| 9205 #undef __ | 9213 #undef __ |
| 9206 | 9214 |
| 9207 } } // namespace v8::internal | 9215 } } // namespace v8::internal |
| OLD | NEW |