OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2184 left_side = Result(left_reg); | 2184 left_side = Result(left_reg); |
2185 right_side = Result(right_val); | 2185 right_side = Result(right_val); |
2186 Result temp2 = allocator_->Allocate(); | 2186 Result temp2 = allocator_->Allocate(); |
2187 ASSERT(temp2.is_valid()); | 2187 ASSERT(temp2.is_valid()); |
2188 // Test string equality and comparison. | 2188 // Test string equality and comparison. |
2189 if (cc == equal) { | 2189 if (cc == equal) { |
2190 Label comparison_done; | 2190 Label comparison_done; |
2191 __ cmp(FieldOperand(left_side.reg(), String::kLengthOffset), | 2191 __ cmp(FieldOperand(left_side.reg(), String::kLengthOffset), |
2192 Immediate(1)); | 2192 Immediate(1)); |
2193 __ j(not_equal, &comparison_done); | 2193 __ j(not_equal, &comparison_done); |
| 2194 uint8_t char_value = |
| 2195 static_cast<uint8_t>(String::cast(*right_side.handle())->Get(0)); |
2194 __ cmpb(FieldOperand(left_side.reg(), SeqAsciiString::kHeaderSize), | 2196 __ cmpb(FieldOperand(left_side.reg(), SeqAsciiString::kHeaderSize), |
2195 String::cast(*right_side.handle())->Get(0)); | 2197 char_value); |
2196 __ bind(&comparison_done); | 2198 __ bind(&comparison_done); |
2197 } else { | 2199 } else { |
2198 __ mov(temp2.reg(), | 2200 __ mov(temp2.reg(), |
2199 FieldOperand(left_side.reg(), String::kLengthOffset)); | 2201 FieldOperand(left_side.reg(), String::kLengthOffset)); |
2200 __ sub(Operand(temp2.reg()), Immediate(1)); | 2202 __ sub(Operand(temp2.reg()), Immediate(1)); |
2201 Label comparison; | 2203 Label comparison; |
2202 // If the length is 0 then our subtraction gave -1 which compares less | 2204 // If the length is 0 then our subtraction gave -1 which compares less |
2203 // than any character. | 2205 // than any character. |
2204 __ j(negative, &comparison); | 2206 __ j(negative, &comparison); |
2205 // Otherwise load the first character. | 2207 // Otherwise load the first character. |
(...skipping 7559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9765 | 9767 |
9766 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 9768 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
9767 // tagged as a small integer. | 9769 // tagged as a small integer. |
9768 __ bind(&runtime); | 9770 __ bind(&runtime); |
9769 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); | 9771 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); |
9770 } | 9772 } |
9771 | 9773 |
9772 #undef __ | 9774 #undef __ |
9773 | 9775 |
9774 } } // namespace v8::internal | 9776 } } // namespace v8::internal |
OLD | NEW |