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

Unified Diff: src/objects.h

Issue 569783003: Revert "Remove V8_HOST_CAN_READ_UNALIGNED and its uses." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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
« no previous file with comments | « src/deoptimizer.h ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 8203b36a97f1dee7ef9c14a2cf413ae2c370c7e4..32dd94f39b64457b6cbe853647222c22d49ba8e5 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -9172,33 +9172,22 @@ class String: public Name {
static inline int NonAsciiStart(const char* chars, int length) {
const char* start = chars;
const char* limit = chars + length;
-
- if (length >= kIntptrSize) {
- // Check unaligned bytes.
- while (!IsAligned(reinterpret_cast<intptr_t>(chars), sizeof(uintptr_t))) {
- if (static_cast<uint8_t>(*chars) > unibrow::Utf8::kMaxOneByteChar) {
- return static_cast<int>(chars - start);
- }
- ++chars;
- }
- // Check aligned words.
- DCHECK(unibrow::Utf8::kMaxOneByteChar == 0x7F);
- const uintptr_t non_one_byte_mask = kUintptrAllBitsSet / 0xFF * 0x80;
- while (chars + sizeof(uintptr_t) <= limit) {
- if (*reinterpret_cast<const uintptr_t*>(chars) & non_one_byte_mask) {
- return static_cast<int>(chars - start);
- }
- chars += sizeof(uintptr_t);
+#ifdef V8_HOST_CAN_READ_UNALIGNED
+ DCHECK(unibrow::Utf8::kMaxOneByteChar == 0x7F);
+ const uintptr_t non_one_byte_mask = kUintptrAllBitsSet / 0xFF * 0x80;
+ while (chars + sizeof(uintptr_t) <= limit) {
+ if (*reinterpret_cast<const uintptr_t*>(chars) & non_one_byte_mask) {
+ return static_cast<int>(chars - start);
}
+ chars += sizeof(uintptr_t);
}
- // Check remaining unaligned bytes.
+#endif
while (chars < limit) {
if (static_cast<uint8_t>(*chars) > unibrow::Utf8::kMaxOneByteChar) {
return static_cast<int>(chars - start);
}
++chars;
}
-
return static_cast<int>(chars - start);
}
« no previous file with comments | « src/deoptimizer.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698