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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« src/objects-inl.h ('K') | « src/runtime.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 436
437 private: 437 private:
438 Vector<char> buffer_; 438 Vector<char> buffer_;
439 int position_; 439 int position_;
440 440
441 bool is_finalized() const { return position_ < 0; } 441 bool is_finalized() const { return position_ < 0; }
442 442
443 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); 443 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder);
444 }; 444 };
445 445
446
447 // Widening copy from ASCII to 16 bit chars. This is templatized to allow
448 // it to be used inside if statements in templatized callers, but it is only
449 // usable for sinkchar == uc16.
450 template <typename sinkchar>
451 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.
452 ASSERT(sizeof(sinkchar) == 2);
Christian Plesner Hansen 2008/10/21 14:16:22 You can use STATIC_CHECK here to catch this at com
453 while (chars--) {
454 char c = *src++;
455 *dest++ = c;
456 }
457 }
458
446 } } // namespace v8::internal 459 } } // namespace v8::internal
447 460
448 #endif // V8_UTILS_H_ 461 #endif // V8_UTILS_H_
OLDNEW
« 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