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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 ASSERT(register_index >= 0); | 431 ASSERT(register_index >= 0); |
432 ASSERT(register_index <= kMaxRegister); | 432 ASSERT(register_index <= kMaxRegister); |
433 Emit(BC_CHECK_REGISTER_EQ_POS, register_index); | 433 Emit(BC_CHECK_REGISTER_EQ_POS, register_index); |
434 EmitOrLink(on_eq); | 434 EmitOrLink(on_eq); |
435 } | 435 } |
436 | 436 |
437 | 437 |
438 Handle<Object> RegExpMacroAssemblerIrregexp::GetCode(Handle<String> source) { | 438 Handle<Object> RegExpMacroAssemblerIrregexp::GetCode(Handle<String> source) { |
439 Bind(&backtrack_); | 439 Bind(&backtrack_); |
440 Emit(BC_POP_BT, 0); | 440 Emit(BC_POP_BT, 0); |
441 Handle<ByteArray> array = Factory::NewByteArray(length()); | 441 Handle<ByteArray> array = FACTORY->NewByteArray(length()); |
442 Copy(array->GetDataStartAddress()); | 442 Copy(array->GetDataStartAddress()); |
443 return array; | 443 return array; |
444 } | 444 } |
445 | 445 |
446 | 446 |
447 int RegExpMacroAssemblerIrregexp::length() { | 447 int RegExpMacroAssemblerIrregexp::length() { |
448 return pc_; | 448 return pc_; |
449 } | 449 } |
450 | 450 |
451 | 451 |
452 void RegExpMacroAssemblerIrregexp::Copy(Address a) { | 452 void RegExpMacroAssemblerIrregexp::Copy(Address a) { |
453 memcpy(a, buffer_.start(), length()); | 453 memcpy(a, buffer_.start(), length()); |
454 } | 454 } |
455 | 455 |
456 | 456 |
457 void RegExpMacroAssemblerIrregexp::Expand() { | 457 void RegExpMacroAssemblerIrregexp::Expand() { |
458 bool old_buffer_was_our_own = own_buffer_; | 458 bool old_buffer_was_our_own = own_buffer_; |
459 Vector<byte> old_buffer = buffer_; | 459 Vector<byte> old_buffer = buffer_; |
460 buffer_ = Vector<byte>::New(old_buffer.length() * 2); | 460 buffer_ = Vector<byte>::New(old_buffer.length() * 2); |
461 own_buffer_ = true; | 461 own_buffer_ = true; |
462 memcpy(buffer_.start(), old_buffer.start(), old_buffer.length()); | 462 memcpy(buffer_.start(), old_buffer.start(), old_buffer.length()); |
463 if (old_buffer_was_our_own) { | 463 if (old_buffer_was_our_own) { |
464 old_buffer.Dispose(); | 464 old_buffer.Dispose(); |
465 } | 465 } |
466 } | 466 } |
467 | 467 |
468 #endif // V8_INTERPRETED_REGEXP | 468 #endif // V8_INTERPRETED_REGEXP |
469 | 469 |
470 } } // namespace v8::internal | 470 } } // namespace v8::internal |
OLD | NEW |