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

Unified Diff: src/objects-inl.h

Issue 12390057: Added back some utf8 optimizations (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments, rebased Created 7 years, 9 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
« src/api.cc ('K') | « src/objects.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index e09fabd7f7d6f56024dafd6a09dcc37de7a0d077..2139ae95c29a617d4bfc6e41afcd6f3207421021 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -2648,6 +2648,32 @@ void String::Visit(
}
+// TODO(dcarney): Remove this class after conversion to VisitFlat.
+class ConsStringCaptureOp {
+ public:
+ inline ConsStringCaptureOp() : cons_string_(NULL) {}
+ inline String* Operate(String* string, unsigned*, int32_t*, unsigned*) {
+ cons_string_ = ConsString::cast(string);
+ return NULL;
+ }
+ ConsString* cons_string_;
+};
+
+
+template<class Visitor>
+ConsString* String::VisitFlat(Visitor* visitor,
+ String* string,
+ int offset,
+ int length,
+ int32_t type) {
+ ASSERT(length >= 0 && length == string->length());
+ ASSERT(offset >= 0 && offset <= length);
+ ConsStringCaptureOp op;
+ Visit(string, offset, *visitor, op, type, static_cast<unsigned>(length));
+ return op.cons_string_;
+}
+
+
uint16_t SeqOneByteString::SeqOneByteStringGet(int index) {
ASSERT(index >= 0 && index < length());
return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
« src/api.cc ('K') | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698