| 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 7027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7038 Register right_arg = eax; | 7038 Register right_arg = eax; |
| 7039 if (!(left.is(left_arg) && right.is(right_arg))) { | 7039 if (!(left.is(left_arg) && right.is(right_arg))) { |
| 7040 if (left.is(right_arg) && right.is(left_arg)) { | 7040 if (left.is(right_arg) && right.is(left_arg)) { |
| 7041 if (IsOperationCommutative()) { | 7041 if (IsOperationCommutative()) { |
| 7042 SetArgsReversed(); | 7042 SetArgsReversed(); |
| 7043 } else { | 7043 } else { |
| 7044 __ xchg(left, right); | 7044 __ xchg(left, right); |
| 7045 } | 7045 } |
| 7046 } else if (left.is(left_arg)) { | 7046 } else if (left.is(left_arg)) { |
| 7047 __ mov(right_arg, right); | 7047 __ mov(right_arg, right); |
| 7048 } else if (right.is(right_arg)) { |
| 7049 __ mov(left_arg, left); |
| 7048 } else if (left.is(right_arg)) { | 7050 } else if (left.is(right_arg)) { |
| 7049 if (IsOperationCommutative()) { | 7051 if (IsOperationCommutative()) { |
| 7050 __ mov(left_arg, right); | 7052 __ mov(left_arg, right); |
| 7051 SetArgsReversed(); | 7053 SetArgsReversed(); |
| 7052 } else { | 7054 } else { |
| 7053 // Order of moves important to avoid destroying left argument. | 7055 // Order of moves important to avoid destroying left argument. |
| 7054 __ mov(left_arg, left); | 7056 __ mov(left_arg, left); |
| 7055 __ mov(right_arg, right); | 7057 __ mov(right_arg, right); |
| 7056 } | 7058 } |
| 7057 } else if (right.is(left_arg)) { | 7059 } else if (right.is(left_arg)) { |
| 7058 if (IsOperationCommutative()) { | 7060 if (IsOperationCommutative()) { |
| 7059 __ mov(right_arg, left); | 7061 __ mov(right_arg, left); |
| 7060 SetArgsReversed(); | 7062 SetArgsReversed(); |
| 7061 } else { | 7063 } else { |
| 7062 // Order of moves important to avoid destroying right argument. | 7064 // Order of moves important to avoid destroying right argument. |
| 7063 __ mov(right_arg, right); | 7065 __ mov(right_arg, right); |
| 7064 __ mov(left_arg, left); | 7066 __ mov(left_arg, left); |
| 7065 } | 7067 } |
| 7066 } else if (right.is(right_arg)) { | |
| 7067 __ mov(left_arg, left); | |
| 7068 } else { | 7068 } else { |
| 7069 // Order of moves is not important. | 7069 // Order of moves is not important. |
| 7070 __ mov(left_arg, left); | 7070 __ mov(left_arg, left); |
| 7071 __ mov(right_arg, right); | 7071 __ mov(right_arg, right); |
| 7072 } | 7072 } |
| 7073 } | 7073 } |
| 7074 | 7074 |
| 7075 // Update flags to indicate that arguments are in registers. | 7075 // Update flags to indicate that arguments are in registers. |
| 7076 SetArgsInRegisters(); | 7076 SetArgsInRegisters(); |
| 7077 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1); | 7077 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 7093 } else { | 7093 } else { |
| 7094 // The calling convention with registers is left in edx and right in eax. | 7094 // The calling convention with registers is left in edx and right in eax. |
| 7095 Register left_arg = edx; | 7095 Register left_arg = edx; |
| 7096 Register right_arg = eax; | 7096 Register right_arg = eax; |
| 7097 if (left.is(left_arg)) { | 7097 if (left.is(left_arg)) { |
| 7098 __ mov(right_arg, Immediate(right)); | 7098 __ mov(right_arg, Immediate(right)); |
| 7099 } else if (left.is(right_arg) && IsOperationCommutative()) { | 7099 } else if (left.is(right_arg) && IsOperationCommutative()) { |
| 7100 __ mov(left_arg, Immediate(right)); | 7100 __ mov(left_arg, Immediate(right)); |
| 7101 SetArgsReversed(); | 7101 SetArgsReversed(); |
| 7102 } else { | 7102 } else { |
| 7103 // For non-commutative operations, left and right_arg might be |
| 7104 // the same register. Therefore, the order of the moves is |
| 7105 // important here in order to not overwrite left before moving |
| 7106 // it to left_arg. |
| 7103 __ mov(left_arg, left); | 7107 __ mov(left_arg, left); |
| 7104 __ mov(right_arg, Immediate(right)); | 7108 __ mov(right_arg, Immediate(right)); |
| 7105 } | 7109 } |
| 7106 | 7110 |
| 7107 // Update flags to indicate that arguments are in registers. | 7111 // Update flags to indicate that arguments are in registers. |
| 7108 SetArgsInRegisters(); | 7112 SetArgsInRegisters(); |
| 7109 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1); | 7113 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1); |
| 7110 } | 7114 } |
| 7111 | 7115 |
| 7112 // Call the stub. | 7116 // Call the stub. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 7125 } else { | 7129 } else { |
| 7126 // The calling convention with registers is left in edx and right in eax. | 7130 // The calling convention with registers is left in edx and right in eax. |
| 7127 Register left_arg = edx; | 7131 Register left_arg = edx; |
| 7128 Register right_arg = eax; | 7132 Register right_arg = eax; |
| 7129 if (right.is(right_arg)) { | 7133 if (right.is(right_arg)) { |
| 7130 __ mov(left_arg, Immediate(left)); | 7134 __ mov(left_arg, Immediate(left)); |
| 7131 } else if (right.is(left_arg) && IsOperationCommutative()) { | 7135 } else if (right.is(left_arg) && IsOperationCommutative()) { |
| 7132 __ mov(right_arg, Immediate(left)); | 7136 __ mov(right_arg, Immediate(left)); |
| 7133 SetArgsReversed(); | 7137 SetArgsReversed(); |
| 7134 } else { | 7138 } else { |
| 7139 // For non-commutative operations, right and left_arg might be |
| 7140 // the same register. Therefore, the order of the moves is |
| 7141 // important here in order to not overwrite right before moving |
| 7142 // it to right_arg. |
| 7143 __ mov(right_arg, right); |
| 7135 __ mov(left_arg, Immediate(left)); | 7144 __ mov(left_arg, Immediate(left)); |
| 7136 __ mov(right_arg, right); | |
| 7137 } | 7145 } |
| 7138 // Update flags to indicate that arguments are in registers. | 7146 // Update flags to indicate that arguments are in registers. |
| 7139 SetArgsInRegisters(); | 7147 SetArgsInRegisters(); |
| 7140 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1); | 7148 __ IncrementCounter(&Counters::generic_binary_stub_calls_regs, 1); |
| 7141 } | 7149 } |
| 7142 | 7150 |
| 7143 // Call the stub. | 7151 // Call the stub. |
| 7144 __ CallStub(this); | 7152 __ CallStub(this); |
| 7145 } | 7153 } |
| 7146 | 7154 |
| (...skipping 2955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10102 | 10110 |
| 10103 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 10111 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
| 10104 // tagged as a small integer. | 10112 // tagged as a small integer. |
| 10105 __ bind(&runtime); | 10113 __ bind(&runtime); |
| 10106 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); | 10114 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); |
| 10107 } | 10115 } |
| 10108 | 10116 |
| 10109 #undef __ | 10117 #undef __ |
| 10110 | 10118 |
| 10111 } } // namespace v8::internal | 10119 } } // namespace v8::internal |
| OLD | NEW |