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

Unified Diff: src/objects.cc

Issue 12427: Merge regexp2000 back into bleeding_edge (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 1 month 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
Index: src/objects.cc
===================================================================
--- src/objects.cc (revision 830)
+++ src/objects.cc (working copy)
@@ -3501,6 +3501,57 @@
}
+FlatStringReader* FlatStringReader::top_ = NULL;
+
+
+FlatStringReader::FlatStringReader(Handle<String> str)
+ : str_(str.location()),
Mads Ager (chromium) 2008/11/25 21:09:41 Four space indent. More occurrences below.
Christian Plesner Hansen 2008/11/26 06:49:56 Fixed.
+ length_(str->length()),
+ prev_(top_) {
+ top_ = this;
+ RefreshState();
+}
+
+
+FlatStringReader::FlatStringReader(Vector<const char> input)
+ : str_(NULL),
+ is_ascii_(true),
+ length_(input.length()),
+ start_(input.start()),
+ prev_(top_) {
+ top_ = this;
+}
+
+
+FlatStringReader::~FlatStringReader() {
+ ASSERT_EQ(top_, this);
+ top_ = prev_;
+}
+
+
+void FlatStringReader::RefreshState() {
+ if (str_ == NULL) return;
+ Handle<String> str(str_);
+ StringShape shape(*str);
+ ASSERT(str->IsFlat(shape));
+ is_ascii_ = shape.IsAsciiRepresentation();
+ if (is_ascii_) {
+ start_ = str->ToAsciiVector().start();
+ } else {
+ start_ = str->ToUC16Vector().start();
+ }
+}
+
+
+void FlatStringReader::PostGarbageCollectionProcessing() {
+ FlatStringReader* current = top_;
+ while (current != NULL) {
+ current->RefreshState();
+ current = current->prev_;
+ }
+}
+
+
void StringInputBuffer::Seek(unsigned pos) {
Reset(pos, input_);
}

Powered by Google App Engine
This is Rietveld 408576698