OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/scanner-character-streams.h" | 5 #include "src/scanner-character-streams.h" |
6 | 6 |
7 #include "include/v8.h" | 7 #include "include/v8.h" |
8 #include "src/globals.h" | 8 #include "src/globals.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 #include "src/list-inl.h" // TODO(mstarzinger): Temporary cycle breaker! | 10 #include "src/list-inl.h" // TODO(mstarzinger): Temporary cycle breaker! |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 | 451 |
452 | 452 |
453 void ExternalStreamingStream::ResetToBookmark() { | 453 void ExternalStreamingStream::ResetToBookmark() { |
454 source_stream_->ResetToBookmark(); | 454 source_stream_->ResetToBookmark(); |
455 FlushCurrent(); | 455 FlushCurrent(); |
456 | 456 |
457 pos_ = bookmark_; | 457 pos_ = bookmark_; |
458 | 458 |
459 // bookmark_data_* => current_data_* | 459 // bookmark_data_* => current_data_* |
460 // (current_data_ assumes ownership of its memory.) | 460 // (current_data_ assumes ownership of its memory.) |
461 uint8_t* data = new uint8_t[bookmark_data_.length() - bookmark_data_offset_]; | |
462 current_data_offset_ = 0; | 461 current_data_offset_ = 0; |
463 current_data_length_ = bookmark_data_.length() - bookmark_data_offset_; | 462 current_data_length_ = bookmark_data_.length() - bookmark_data_offset_; |
| 463 uint8_t* data = new uint8_t[current_data_length_]; |
464 CopyCharsUnsigned(data, bookmark_data_.begin() + bookmark_data_offset_, | 464 CopyCharsUnsigned(data, bookmark_data_.begin() + bookmark_data_offset_, |
465 bookmark_data_.length()); | 465 current_data_length_); |
466 delete[] current_data_; | 466 delete[] current_data_; |
467 current_data_ = data; | 467 current_data_ = data; |
468 bookmark_data_is_from_current_data_ = true; | 468 bookmark_data_is_from_current_data_ = true; |
469 | 469 |
470 // bookmark_buffer_ needs to be copied to buffer_. | 470 // bookmark_buffer_ needs to be copied to buffer_. |
471 CopyCharsUnsigned(buffer_, bookmark_buffer_.begin(), | 471 CopyCharsUnsigned(buffer_, bookmark_buffer_.begin(), |
472 bookmark_buffer_.length()); | 472 bookmark_buffer_.length()); |
473 buffer_cursor_ = buffer_; | 473 buffer_cursor_ = buffer_; |
474 buffer_end_ = buffer_ + bookmark_buffer_.length(); | 474 buffer_end_ = buffer_ + bookmark_buffer_.length(); |
475 | 475 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 } | 579 } |
580 | 580 |
581 | 581 |
582 void ExternalTwoByteStringUtf16CharacterStream::ResetToBookmark() { | 582 void ExternalTwoByteStringUtf16CharacterStream::ResetToBookmark() { |
583 DCHECK(bookmark_ != kNoBookmark); | 583 DCHECK(bookmark_ != kNoBookmark); |
584 pos_ = bookmark_; | 584 pos_ = bookmark_; |
585 buffer_cursor_ = raw_data_ + bookmark_; | 585 buffer_cursor_ = raw_data_ + bookmark_; |
586 } | 586 } |
587 } // namespace internal | 587 } // namespace internal |
588 } // namespace v8 | 588 } // namespace v8 |
OLD | NEW |