Changeset 197534 in webkit for trunk/Source/JavaScriptCore/yarr/YarrInterpreter.cpp
- Timestamp:
- Mar 3, 2016, 5:24:28 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/yarr/YarrInterpreter.cpp
r197426 r197534 209 209 ASSERT(p < length); 210 210 int result = input[p]; 211 if (U16_IS_LEAD(result) && decodeSurrogatePairs && p + 1 < length 212 && U16_IS_TRAIL(input[p + 1])) { 211 if (U16_IS_LEAD(result) && decodeSurrogatePairs && p + 1 < length && U16_IS_TRAIL(input[p + 1])) { 213 212 if (atEnd()) 214 213 return -1; … … 220 219 } 221 220 222 int readSurrogatePairChecked(unsigned negativePositionOff est)223 { 224 RELEASE_ASSERT(pos >= negativePositionOff est);225 unsigned p = pos - negativePositionOff est;221 int readSurrogatePairChecked(unsigned negativePositionOffset) 222 { 223 RELEASE_ASSERT(pos >= negativePositionOffset); 224 unsigned p = pos - negativePositionOffset; 226 225 ASSERT(p < length); 227 226 if (p + 1 >= length) … … 229 228 230 229 int first = input[p]; 231 if (U16_IS_LEAD(first) && U16_IS_TRAIL(input[p + 1])) 232 return U16_GET_SUPPLEMENTARY(first, input[p + 1]); 230 int second = input[p + 1]; 231 if (U16_IS_LEAD(first) && U16_IS_TRAIL(second)) 232 return U16_GET_SUPPLEMENTARY(first, second); 233 233 234 234 return -1; … … 239 239 ASSERT(from < length); 240 240 int result = input[from]; 241 if (U16_IS_LEAD(result) && decodeSurrogatePairs && from + 1 < length 242 && U16_IS_TRAIL(input[from + 1])) { 243 241 if (U16_IS_LEAD(result) && decodeSurrogatePairs && from + 1 < length && U16_IS_TRAIL(input[from + 1])) 244 242 result = U16_GET_SUPPLEMENTARY(result, input[from + 1]); 245 }246 243 return result; 247 244 } … … 295 292 } 296 293 297 bool atStart(unsigned negativePositionOff est)298 { 299 return pos == negativePositionOff est;294 bool atStart(unsigned negativePositionOffset) 295 { 296 return pos == negativePositionOffset; 300 297 } 301 298 … … 320 317 bool testCharacterClass(CharacterClass* characterClass, int ch) 321 318 { 322 if ( ch & 0x1FFF80) {319 if (!isASCII(ch)) { 323 320 for (unsigned i = 0; i < characterClass->m_matchesUnicode.size(); ++i) 324 321 if (ch == characterClass->m_matchesUnicode[i]) … … 434 431 if (backTrack->matchAmount) { 435 432 --backTrack->matchAmount; 436 if (unicode && !U_IS_BMP(term.atom.patternCharacter)) 437 input.uncheckInput(2); 438 else 439 input.uncheckInput(1); 433 input.uncheckInput(U16_LENGTH(term.atom.patternCharacter)); 440 434 return true; 441 435 } … … 1268 1262 case ByteTerm::TypePatternCasedCharacterFixed: { 1269 1263 if (unicode) { 1270 // Case insensitive matching of unicode chara ters are handled as TypeCharacterClass1264 // Case insensitive matching of unicode characters is handled as TypeCharacterClass. 1271 1265 ASSERT(U_IS_BMP(currentTerm().atom.patternCharacter)); 1272 1266 … … 1291 1285 BackTrackInfoPatternCharacter* backTrack = reinterpret_cast<BackTrackInfoPatternCharacter*>(context->frame + currentTerm().frameLocation); 1292 1286 1293 // Case insensitive matching of unicode chara ters are handled as TypeCharacterClass1287 // Case insensitive matching of unicode characters is handled as TypeCharacterClass. 1294 1288 ASSERT(!unicode || U_IS_BMP(currentTerm().atom.patternCharacter)); 1295 1289 … … 1309 1303 BackTrackInfoPatternCharacter* backTrack = reinterpret_cast<BackTrackInfoPatternCharacter*>(context->frame + currentTerm().frameLocation); 1310 1304 1311 // Case insensitive matching of unicode chara ters are handled as TypeCharacterClass1305 // Case insensitive matching of unicode characters is handled as TypeCharacterClass. 1312 1306 ASSERT(!unicode || U_IS_BMP(currentTerm().atom.patternCharacter)); 1313 1307 … … 1619 1613 { 1620 1614 if (m_pattern.m_ignoreCase) { 1621 ASSERT(u_tolower(ch) <= UCHAR_MAX_VALUE);1622 ASSERT(u_toupper(ch) <= UCHAR_MAX_VALUE);1623 1624 1615 UChar32 lo = u_tolower(ch); 1625 1616 UChar32 hi = u_toupper(ch);
Note:
See TracChangeset
for help on using the changeset viewer.