Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1053)

Unified Diff: src/scanner-character-streams.cc

Issue 1102523003: Implement a 'trial parse' step, that will abort pre-parsing excessively (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use a seperate 'hint' bit for "to be executed once" code aging. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/scanner-character-streams.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scanner-character-streams.cc
diff --git a/src/scanner-character-streams.cc b/src/scanner-character-streams.cc
index cc4a18b540f3555a2ea53ab9b9c66147f9979b99..a710330a2be65c288df06ad6f1ec4741e8f52ee9 100644
--- a/src/scanner-character-streams.cc
+++ b/src/scanner-character-streams.cc
@@ -130,7 +130,7 @@ size_t BufferedUtf16CharacterStream::SlowSeekForward(size_t delta) {
GenericStringUtf16CharacterStream::GenericStringUtf16CharacterStream(
Handle<String> data, size_t start_position, size_t end_position)
- : string_(data), length_(end_position) {
+ : string_(data), length_(end_position), bookmark_(kNoBookmark) {
DCHECK(end_position >= start_position);
pos_ = start_position;
}
@@ -139,6 +139,20 @@ GenericStringUtf16CharacterStream::GenericStringUtf16CharacterStream(
GenericStringUtf16CharacterStream::~GenericStringUtf16CharacterStream() { }
+bool GenericStringUtf16CharacterStream::SetBookmark() {
+ bookmark_ = pos_;
+ return true;
+}
+
+
+void GenericStringUtf16CharacterStream::ResetToBookmark() {
+ DCHECK(bookmark_ != kNoBookmark);
+ pos_ = bookmark_;
+ buffer_cursor_ = buffer_;
+ buffer_end_ = buffer_ + FillBuffer(pos_);
+}
+
+
size_t GenericStringUtf16CharacterStream::BufferSeekForward(size_t delta) {
size_t old_pos = pos_;
pos_ = Min(pos_ + delta, length_);
@@ -447,17 +461,29 @@ ExternalTwoByteStringUtf16CharacterStream::
~ExternalTwoByteStringUtf16CharacterStream() { }
-ExternalTwoByteStringUtf16CharacterStream
- ::ExternalTwoByteStringUtf16CharacterStream(
- Handle<ExternalTwoByteString> data,
- int start_position,
+ExternalTwoByteStringUtf16CharacterStream::
+ ExternalTwoByteStringUtf16CharacterStream(
+ Handle<ExternalTwoByteString> data, int start_position,
int end_position)
: Utf16CharacterStream(),
source_(data),
- raw_data_(data->GetTwoByteData(start_position)) {
+ raw_data_(data->GetTwoByteData(start_position)),
+ bookmark_(kNoBookmark) {
buffer_cursor_ = raw_data_,
buffer_end_ = raw_data_ + (end_position - start_position);
pos_ = start_position;
}
+
+bool ExternalTwoByteStringUtf16CharacterStream::SetBookmark() {
+ bookmark_ = pos_;
+ return true;
+}
+
+
+void ExternalTwoByteStringUtf16CharacterStream::ResetToBookmark() {
+ DCHECK(bookmark_ != kNoBookmark);
+ pos_ = bookmark_;
+ buffer_cursor_ = raw_data_ + bookmark_;
+}
} } // namespace v8::internal
« no previous file with comments | « src/scanner-character-streams.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698