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 26 matching lines...) Expand all Loading... |
37 namespace internal { | 37 namespace internal { |
38 | 38 |
39 #ifdef V8_INTERPRETED_REGEXP | 39 #ifdef V8_INTERPRETED_REGEXP |
40 | 40 |
41 RegExpMacroAssemblerIrregexp::RegExpMacroAssemblerIrregexp(Vector<byte> buffer, | 41 RegExpMacroAssemblerIrregexp::RegExpMacroAssemblerIrregexp(Vector<byte> buffer, |
42 Zone* zone) | 42 Zone* zone) |
43 : RegExpMacroAssembler(zone), | 43 : RegExpMacroAssembler(zone), |
44 buffer_(buffer), | 44 buffer_(buffer), |
45 pc_(0), | 45 pc_(0), |
46 own_buffer_(false), | 46 own_buffer_(false), |
47 advance_current_end_(kInvalidPC) { | 47 advance_current_end_(kInvalidPC), |
48 } | 48 isolate_(zone->isolate()) { } |
49 | 49 |
50 | 50 |
51 RegExpMacroAssemblerIrregexp::~RegExpMacroAssemblerIrregexp() { | 51 RegExpMacroAssemblerIrregexp::~RegExpMacroAssemblerIrregexp() { |
52 if (backtrack_.is_linked()) backtrack_.Unuse(); | 52 if (backtrack_.is_linked()) backtrack_.Unuse(); |
53 if (own_buffer_) buffer_.Dispose(); | 53 if (own_buffer_) buffer_.Dispose(); |
54 } | 54 } |
55 | 55 |
56 | 56 |
57 RegExpMacroAssemblerIrregexp::IrregexpImplementation | 57 RegExpMacroAssemblerIrregexp::IrregexpImplementation |
58 RegExpMacroAssemblerIrregexp::Implementation() { | 58 RegExpMacroAssemblerIrregexp::Implementation() { |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 ASSERT(register_index <= kMaxRegister); | 438 ASSERT(register_index <= kMaxRegister); |
439 Emit(BC_CHECK_REGISTER_EQ_POS, register_index); | 439 Emit(BC_CHECK_REGISTER_EQ_POS, register_index); |
440 EmitOrLink(on_eq); | 440 EmitOrLink(on_eq); |
441 } | 441 } |
442 | 442 |
443 | 443 |
444 Handle<HeapObject> RegExpMacroAssemblerIrregexp::GetCode( | 444 Handle<HeapObject> RegExpMacroAssemblerIrregexp::GetCode( |
445 Handle<String> source) { | 445 Handle<String> source) { |
446 Bind(&backtrack_); | 446 Bind(&backtrack_); |
447 Emit(BC_POP_BT, 0); | 447 Emit(BC_POP_BT, 0); |
448 Handle<ByteArray> array = FACTORY->NewByteArray(length()); | 448 Handle<ByteArray> array = isolate_->factory()->NewByteArray(length()); |
449 Copy(array->GetDataStartAddress()); | 449 Copy(array->GetDataStartAddress()); |
450 return array; | 450 return array; |
451 } | 451 } |
452 | 452 |
453 | 453 |
454 int RegExpMacroAssemblerIrregexp::length() { | 454 int RegExpMacroAssemblerIrregexp::length() { |
455 return pc_; | 455 return pc_; |
456 } | 456 } |
457 | 457 |
458 | 458 |
459 void RegExpMacroAssemblerIrregexp::Copy(Address a) { | 459 void RegExpMacroAssemblerIrregexp::Copy(Address a) { |
460 OS::MemCopy(a, buffer_.start(), length()); | 460 OS::MemCopy(a, buffer_.start(), length()); |
461 } | 461 } |
462 | 462 |
463 | 463 |
464 void RegExpMacroAssemblerIrregexp::Expand() { | 464 void RegExpMacroAssemblerIrregexp::Expand() { |
465 bool old_buffer_was_our_own = own_buffer_; | 465 bool old_buffer_was_our_own = own_buffer_; |
466 Vector<byte> old_buffer = buffer_; | 466 Vector<byte> old_buffer = buffer_; |
467 buffer_ = Vector<byte>::New(old_buffer.length() * 2); | 467 buffer_ = Vector<byte>::New(old_buffer.length() * 2); |
468 own_buffer_ = true; | 468 own_buffer_ = true; |
469 OS::MemCopy(buffer_.start(), old_buffer.start(), old_buffer.length()); | 469 OS::MemCopy(buffer_.start(), old_buffer.start(), old_buffer.length()); |
470 if (old_buffer_was_our_own) { | 470 if (old_buffer_was_our_own) { |
471 old_buffer.Dispose(); | 471 old_buffer.Dispose(); |
472 } | 472 } |
473 } | 473 } |
474 | 474 |
475 #endif // V8_INTERPRETED_REGEXP | 475 #endif // V8_INTERPRETED_REGEXP |
476 | 476 |
477 } } // namespace v8::internal | 477 } } // namespace v8::internal |
OLD | NEW |