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

Unified Diff: src/objects.cc

Issue 7866: Misc (Closed)
Patch Set: Created 12 years, 2 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 side-by-side diff with in-line comments
Download patch
« src/log.cc ('K') | « src/log.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« src/log.cc ('K') | « src/log.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698