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 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/regexp/regexp-macro-assembler-irregexp.h" | 5 #include "src/regexp/regexp-macro-assembler-irregexp.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/regexp/bytecodes-irregexp.h" | 8 #include "src/regexp/bytecodes-irregexp.h" |
9 #include "src/regexp/regexp-macro-assembler.h" | 9 #include "src/regexp/regexp-macro-assembler.h" |
10 #include "src/regexp/regexp-macro-assembler-irregexp-inl.h" | 10 #include "src/regexp/regexp-macro-assembler-irregexp-inl.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 EmitOrLink(on_equal); | 266 EmitOrLink(on_equal); |
267 } | 267 } |
268 | 268 |
269 | 269 |
270 void RegExpMacroAssemblerIrregexp::CheckAtStart(Label* on_at_start) { | 270 void RegExpMacroAssemblerIrregexp::CheckAtStart(Label* on_at_start) { |
271 Emit(BC_CHECK_AT_START, 0); | 271 Emit(BC_CHECK_AT_START, 0); |
272 EmitOrLink(on_at_start); | 272 EmitOrLink(on_at_start); |
273 } | 273 } |
274 | 274 |
275 | 275 |
276 void RegExpMacroAssemblerIrregexp::CheckNotAtStart(Label* on_not_at_start) { | 276 void RegExpMacroAssemblerIrregexp::CheckNotAtStart(int cp_offset, |
277 Emit(BC_CHECK_NOT_AT_START, 0); | 277 Label* on_not_at_start) { |
| 278 Emit(BC_CHECK_NOT_AT_START, cp_offset); |
278 EmitOrLink(on_not_at_start); | 279 EmitOrLink(on_not_at_start); |
279 } | 280 } |
280 | 281 |
281 | 282 |
282 void RegExpMacroAssemblerIrregexp::CheckNotCharacter(uint32_t c, | 283 void RegExpMacroAssemblerIrregexp::CheckNotCharacter(uint32_t c, |
283 Label* on_not_equal) { | 284 Label* on_not_equal) { |
284 if (c > MAX_FIRST_ARG) { | 285 if (c > MAX_FIRST_ARG) { |
285 Emit(BC_CHECK_NOT_4_CHARS, 0); | 286 Emit(BC_CHECK_NOT_4_CHARS, 0); |
286 Emit32(c); | 287 Emit32(c); |
287 } else { | 288 } else { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 int byte = 0; | 364 int byte = 0; |
364 for (int j = 0; j < kBitsPerByte; j++) { | 365 for (int j = 0; j < kBitsPerByte; j++) { |
365 if (table->get(i + j) != 0) byte |= 1 << j; | 366 if (table->get(i + j) != 0) byte |= 1 << j; |
366 } | 367 } |
367 Emit8(byte); | 368 Emit8(byte); |
368 } | 369 } |
369 } | 370 } |
370 | 371 |
371 | 372 |
372 void RegExpMacroAssemblerIrregexp::CheckNotBackReference(int start_reg, | 373 void RegExpMacroAssemblerIrregexp::CheckNotBackReference(int start_reg, |
| 374 bool read_backward, |
373 Label* on_not_equal) { | 375 Label* on_not_equal) { |
374 DCHECK(start_reg >= 0); | 376 DCHECK(start_reg >= 0); |
375 DCHECK(start_reg <= kMaxRegister); | 377 DCHECK(start_reg <= kMaxRegister); |
376 Emit(BC_CHECK_NOT_BACK_REF, start_reg); | 378 Emit(read_backward ? BC_CHECK_NOT_BACK_REF_BACKWARD : BC_CHECK_NOT_BACK_REF, |
| 379 start_reg); |
377 EmitOrLink(on_not_equal); | 380 EmitOrLink(on_not_equal); |
378 } | 381 } |
379 | 382 |
380 | 383 |
381 void RegExpMacroAssemblerIrregexp::CheckNotBackReferenceIgnoreCase( | 384 void RegExpMacroAssemblerIrregexp::CheckNotBackReferenceIgnoreCase( |
382 int start_reg, | 385 int start_reg, bool read_backward, Label* on_not_equal) { |
383 Label* on_not_equal) { | |
384 DCHECK(start_reg >= 0); | 386 DCHECK(start_reg >= 0); |
385 DCHECK(start_reg <= kMaxRegister); | 387 DCHECK(start_reg <= kMaxRegister); |
386 Emit(BC_CHECK_NOT_BACK_REF_NO_CASE, start_reg); | 388 Emit(read_backward ? BC_CHECK_NOT_BACK_REF_NO_CASE_BACKWARD |
| 389 : BC_CHECK_NOT_BACK_REF_NO_CASE, |
| 390 start_reg); |
387 EmitOrLink(on_not_equal); | 391 EmitOrLink(on_not_equal); |
388 } | 392 } |
389 | 393 |
390 | 394 |
391 void RegExpMacroAssemblerIrregexp::IfRegisterLT(int register_index, | 395 void RegExpMacroAssemblerIrregexp::IfRegisterLT(int register_index, |
392 int comparand, | 396 int comparand, |
393 Label* on_less_than) { | 397 Label* on_less_than) { |
394 DCHECK(register_index >= 0); | 398 DCHECK(register_index >= 0); |
395 DCHECK(register_index <= kMaxRegister); | 399 DCHECK(register_index <= kMaxRegister); |
396 Emit(BC_CHECK_REGISTER_LT, register_index); | 400 Emit(BC_CHECK_REGISTER_LT, register_index); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 MemCopy(buffer_.start(), old_buffer.start(), old_buffer.length()); | 451 MemCopy(buffer_.start(), old_buffer.start(), old_buffer.length()); |
448 if (old_buffer_was_our_own) { | 452 if (old_buffer_was_our_own) { |
449 old_buffer.Dispose(); | 453 old_buffer.Dispose(); |
450 } | 454 } |
451 } | 455 } |
452 | 456 |
453 #endif // V8_INTERPRETED_REGEXP | 457 #endif // V8_INTERPRETED_REGEXP |
454 | 458 |
455 } // namespace internal | 459 } // namespace internal |
456 } // namespace v8 | 460 } // namespace v8 |
OLD | NEW |