Chromium Code Reviews| Index: src/objects.cc |
| diff --git a/src/objects.cc b/src/objects.cc |
| index 30b724aa0d4d962f0aadc008613e8c10648d8b41..682aa19fb2380b4ca061f59587130c5b910b3de9 100644 |
| --- a/src/objects.cc |
| +++ b/src/objects.cc |
| @@ -3727,6 +3727,19 @@ static inline bool CompareRawStringContents(Vector<Char> a, Vector<Char> b) { |
| int endpoint = length - kStepSize; |
| const Char* pa = a.start(); |
| const Char* pb = b.start(); |
| +#ifndef CAN_READ_UNALIGNED |
| + // If this architecture isn't comfortable reading unaligned ints |
| + // then we have to check that the strings are alingned and fall back |
| + // to the standard comparison if they are not. |
| + const int kAlignmentMask = sizeof(int) - 1; // NOLINT |
|
Erik Corry
2008/10/22 11:44:15
Since you are accessing by uint32_t then that is w
|
| + uint32_t pa_addr = reinterpret_cast<uint32_t>(pa); |
| + uint32_t pb_addr = reinterpret_cast<uint32_t>(pb); |
| + if ((pa_addr & kAlignmentMask) | (pb_addr & kAlignmentMask)) { |
|
Erik Corry
2008/10/22 11:44:15
!= 0
|
| + VectorIterator<Char> ia(a); |
| + VectorIterator<Char> ib(b); |
| + return CompareStringContents(&ia, &ib); |
| + } |
| +#endif |
| int i; |
| // Compare blocks until we reach near the end of the string. |
| for (i = 0; i <= endpoint; i += kStepSize) { |