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

Side by Side Diff: Source/wtf/text/ASCIIFastPath.h

Issue 397733004: Allow assertions to be enabled in Blink Release builds. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years, 5 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
« no previous file with comments | « Source/wtf/dtoa/cached-powers.cc ('k') | Source/wtf/text/StringImpl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 3 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 for (;i < length && !isAlignedTo<memoryAccessMask>(&source[i]); ++i) { 112 for (;i < length && !isAlignedTo<memoryAccessMask>(&source[i]); ++i) {
113 ASSERT(!(source[i] & 0xff00)); 113 ASSERT(!(source[i] & 0xff00));
114 destination[i] = static_cast<LChar>(source[i]); 114 destination[i] = static_cast<LChar>(source[i]);
115 } 115 }
116 116
117 const uintptr_t sourceLoadSize = 32; // Process 32 bytes (16 UChars) each it eration 117 const uintptr_t sourceLoadSize = 32; // Process 32 bytes (16 UChars) each it eration
118 const size_t ucharsPerLoop = sourceLoadSize / sizeof(UChar); 118 const size_t ucharsPerLoop = sourceLoadSize / sizeof(UChar);
119 if (length > ucharsPerLoop) { 119 if (length > ucharsPerLoop) {
120 const size_t endLength = length - ucharsPerLoop + 1; 120 const size_t endLength = length - ucharsPerLoop + 1;
121 for (; i < endLength; i += ucharsPerLoop) { 121 for (; i < endLength; i += ucharsPerLoop) {
122 #ifndef NDEBUG 122 #if ENABLE(ASSERT)
123 for (unsigned checkIndex = 0; checkIndex < ucharsPerLoop; ++checkInd ex) 123 for (unsigned checkIndex = 0; checkIndex < ucharsPerLoop; ++checkInd ex)
124 ASSERT(!(source[i+checkIndex] & 0xff00)); 124 ASSERT(!(source[i+checkIndex] & 0xff00));
125 #endif 125 #endif
126 __m128i first8UChars = _mm_load_si128(reinterpret_cast<const __m128i *>(&source[i])); 126 __m128i first8UChars = _mm_load_si128(reinterpret_cast<const __m128i *>(&source[i]));
127 __m128i second8UChars = _mm_load_si128(reinterpret_cast<const __m128 i*>(&source[i+8])); 127 __m128i second8UChars = _mm_load_si128(reinterpret_cast<const __m128 i*>(&source[i+8]));
128 __m128i packedChars = _mm_packus_epi16(first8UChars, second8UChars); 128 __m128i packedChars = _mm_packus_epi16(first8UChars, second8UChars);
129 _mm_storeu_si128(reinterpret_cast<__m128i*>(&destination[i]), packed Chars); 129 _mm_storeu_si128(reinterpret_cast<__m128i*>(&destination[i]), packed Chars);
130 } 130 }
131 } 131 }
132 132
(...skipping 29 matching lines...) Expand all
162 for (size_t i = 0; i < length; ++i) { 162 for (size_t i = 0; i < length; ++i) {
163 ASSERT(!(source[i] & 0xff00)); 163 ASSERT(!(source[i] & 0xff00));
164 destination[i] = static_cast<LChar>(source[i]); 164 destination[i] = static_cast<LChar>(source[i]);
165 } 165 }
166 #endif 166 #endif
167 } 167 }
168 168
169 } // namespace WTF 169 } // namespace WTF
170 170
171 #endif // ASCIIFastPath_h 171 #endif // ASCIIFastPath_h
OLDNEW
« no previous file with comments | « Source/wtf/dtoa/cached-powers.cc ('k') | Source/wtf/text/StringImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698