OLD | NEW |
1 // Copyright 2008-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2008-2009 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 uc16 minus, | 345 uc16 minus, |
346 uc16 mask, | 346 uc16 mask, |
347 Label* on_not_equal) { | 347 Label* on_not_equal) { |
348 Emit(BC_MINUS_AND_CHECK_NOT_CHAR, c); | 348 Emit(BC_MINUS_AND_CHECK_NOT_CHAR, c); |
349 Emit16(minus); | 349 Emit16(minus); |
350 Emit16(mask); | 350 Emit16(mask); |
351 EmitOrLink(on_not_equal); | 351 EmitOrLink(on_not_equal); |
352 } | 352 } |
353 | 353 |
354 | 354 |
| 355 void RegExpMacroAssemblerIrregexp::CheckCharacterInRange( |
| 356 uc16 from, |
| 357 uc16 to, |
| 358 Label* on_in_range) { |
| 359 Emit(BC_CHECK_CHAR_IN_RANGE, 0); |
| 360 Emit16(from); |
| 361 Emit16(to); |
| 362 EmitOrLink(on_in_range); |
| 363 } |
| 364 |
| 365 |
| 366 void RegExpMacroAssemblerIrregexp::CheckCharacterNotInRange( |
| 367 uc16 from, |
| 368 uc16 to, |
| 369 Label* on_not_in_range) { |
| 370 Emit(BC_CHECK_CHAR_NOT_IN_RANGE, 0); |
| 371 Emit16(from); |
| 372 Emit16(to); |
| 373 EmitOrLink(on_not_in_range); |
| 374 } |
| 375 |
| 376 |
| 377 void RegExpMacroAssemblerIrregexp::CheckBitInTable( |
| 378 Handle<ByteArray> table, Label* on_bit_set) { |
| 379 Emit(BC_CHECK_BIT_IN_TABLE, 0); |
| 380 EmitOrLink(on_bit_set); |
| 381 for (int i = 0; i < kTableSize; i += kBitsPerByte) { |
| 382 int byte = 0; |
| 383 for (int j = 0; j < kBitsPerByte; j++) { |
| 384 if (table->get(i + j) != 0) byte |= 1 << j; |
| 385 } |
| 386 Emit8(byte); |
| 387 } |
| 388 } |
| 389 |
| 390 |
355 void RegExpMacroAssemblerIrregexp::CheckNotBackReference(int start_reg, | 391 void RegExpMacroAssemblerIrregexp::CheckNotBackReference(int start_reg, |
356 Label* on_not_equal) { | 392 Label* on_not_equal) { |
357 ASSERT(start_reg >= 0); | 393 ASSERT(start_reg >= 0); |
358 ASSERT(start_reg <= kMaxRegister); | 394 ASSERT(start_reg <= kMaxRegister); |
359 Emit(BC_CHECK_NOT_BACK_REF, start_reg); | 395 Emit(BC_CHECK_NOT_BACK_REF, start_reg); |
360 EmitOrLink(on_not_equal); | 396 EmitOrLink(on_not_equal); |
361 } | 397 } |
362 | 398 |
363 | 399 |
364 void RegExpMacroAssemblerIrregexp::CheckNotBackReferenceIgnoreCase( | 400 void RegExpMacroAssemblerIrregexp::CheckNotBackReferenceIgnoreCase( |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 own_buffer_ = true; | 498 own_buffer_ = true; |
463 memcpy(buffer_.start(), old_buffer.start(), old_buffer.length()); | 499 memcpy(buffer_.start(), old_buffer.start(), old_buffer.length()); |
464 if (old_buffer_was_our_own) { | 500 if (old_buffer_was_our_own) { |
465 old_buffer.Dispose(); | 501 old_buffer.Dispose(); |
466 } | 502 } |
467 } | 503 } |
468 | 504 |
469 #endif // V8_INTERPRETED_REGEXP | 505 #endif // V8_INTERPRETED_REGEXP |
470 | 506 |
471 } } // namespace v8::internal | 507 } } // namespace v8::internal |
OLD | NEW |