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

Unified Diff: src/runtime/runtime-utils.h

Issue 2533033003: Fix the uppercasing of U+00E7(ç) and U+00F7(÷) (Closed)
Patch Set: a bit more tweaks + tests Created 4 years 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/runtime/runtime-strings.cc ('k') | src/runtime/runtime-utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-utils.h
diff --git a/src/runtime/runtime-utils.h b/src/runtime/runtime-utils.h
index 147efed092a742724f66013147e76ee4d1b66d0f..3452bfe073b2eaa296c71c95875ec5101e9464a4 100644
--- a/src/runtime/runtime-utils.h
+++ b/src/runtime/runtime-utils.h
@@ -6,6 +6,7 @@
#define V8_RUNTIME_RUNTIME_UTILS_H_
#include "src/base/logging.h"
+#include "src/globals.h"
#include "src/runtime/runtime.h"
namespace v8 {
@@ -167,6 +168,36 @@ static inline ObjectTriple MakeTriple(Object* x, Object* y, Object* z) {
return result;
}
+const uintptr_t kOneInEveryByte = kUintptrAllBitsSet / 0xFF;
+const uintptr_t kAsciiMask = kOneInEveryByte << 7;
+
+// Given a word and two range boundaries returns a word with high bit
+// set in every byte iff the corresponding input byte was strictly in
+// the range (m, n). All the other bits in the result are cleared.
+// This function is only useful when it can be inlined and the
+// boundaries are statically known.
+// Requires: all bytes in the input word and the boundaries must be
+// ASCII (less than 0x7F).
+static inline uintptr_t AsciiRangeMask(uintptr_t w, char m, char n) {
+ // Use strict inequalities since in edge cases the function could be
+ // further simplified.
+ DCHECK(0 < m && m < n);
+ // Has high bit set in every w byte less than n.
+ uintptr_t tmp1 = kOneInEveryByte * (0x7F + n) - w;
+ // Has high bit set in every w byte greater than m.
+ uintptr_t tmp2 = w + kOneInEveryByte * (0x7F - m);
+ return (tmp1 & tmp2 & (kOneInEveryByte * 0x80));
+}
+
+#ifdef DEBUG
+bool CheckFastAsciiConvert(char* dst, const char* src, int length, bool changed,
+ bool is_to_lower);
+#endif
+
+template <bool is_lower>
+bool FastAsciiConvert(char* dst, const char* src, int length,
+ bool* changed_out);
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/runtime/runtime-strings.cc ('k') | src/runtime/runtime-utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698