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

Unified Diff: src/objects-debug.cc

Issue 7477045: Tentative implementation of string slices (hidden under the flag --string-slices). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Implemented some changes suggested by Anton. Created 9 years, 4 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/objects.h ('K') | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-debug.cc
diff --git a/src/objects-debug.cc b/src/objects-debug.cc
index 29632317a5e9309ee456c2e0ce9042b0b4c48cdf..62e38767608d03a48764484b05c8b36de0d49f41 100644
--- a/src/objects-debug.cc
+++ b/src/objects-debug.cc
@@ -349,6 +349,37 @@ void String::StringVerify() {
if (IsSymbol()) {
CHECK(!HEAP->InNewSpace(this));
}
+ if (IsConsString()) {
+ ConsString::cast(this)->ConsStringVerify();
+ } else if (IsSlicedString()) {
+ SlicedString::cast(this)->SlicedStringVerify();
+ }
+}
+
+
+void ConsString::ConsStringVerify() {
+ CHECK(this->first()->IsString());
+ CHECK(this->second() == GetHeap()->empty_string() ||
+ this->second()->IsString());
+ if (this->IsFlat()) {
+ // A flat cons can only have a sequential string as first part because only
+ // String::SlowTryFlatten can convert a cons into a flat cons.
+ CHECK(this->first()->IsSeqString());
+ }
+}
+
+
+void SlicedString::SlicedStringVerify() {
+ CHECK(!this->parent()->IsConsString());
+ CHECK(!this->parent()->IsSlicedString());
+ if (this->IsTruncated()) {
+ CHECK(this->offset() == 0);
+ // A truncated slice cannot have an external string as parent because only
+ // String::SlowTryTruncate can convert a slice into a truncated slice.
+ // There is no way to gain direct access to the truncated parent string,
+ // therefore the truncated parent cannot be morphed into an external string.
+ CHECK(this->parent()->IsSeqString());
+ }
}
« src/objects.h ('K') | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698