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

Unified Diff: src/utils.h

Issue 8011: Use direct copy and templates to speed up flattening of strings. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
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/objects-inl.h ('K') | « src/runtime.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils.h
===================================================================
--- src/utils.h (revision 535)
+++ src/utils.h (working copy)
@@ -443,6 +443,19 @@
DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder);
};
+
+// Widening copy from ASCII to 16 bit chars. This is templatized to allow
+// it to be used inside if statements in templatized callers, but it is only
+// usable for sinkchar == uc16.
+template <typename sinkchar>
+static inline void Cpy168(sinkchar* dest, const unsigned char* src, int chars) {
Christian Plesner Hansen 2008/10/21 14:16:22 You may consider copying the first parts of the st
Erik Corry 2008/10/22 11:59:48 Can't do this because of alignment issues.
+ ASSERT(sizeof(sinkchar) == 2);
Christian Plesner Hansen 2008/10/21 14:16:22 You can use STATIC_CHECK here to catch this at com
+ while (chars--) {
+ char c = *src++;
+ *dest++ = c;
+ }
+}
+
} } // namespace v8::internal
#endif // V8_UTILS_H_
« src/objects-inl.h ('K') | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698