Author: [email protected]
Date: Tue Mar 24 03:16:30 2009
New Revision: 1589

Modified:
    branches/bleeding_edge/src/mark-compact.cc
    branches/bleeding_edge/src/objects-inl.h
    branches/bleeding_edge/src/objects.cc
    branches/bleeding_edge/src/regexp-macro-assembler-ia32.cc

Log:
Test a few assertions that should hold.


Modified: branches/bleeding_edge/src/mark-compact.cc
==============================================================================
--- branches/bleeding_edge/src/mark-compact.cc  (original)
+++ branches/bleeding_edge/src/mark-compact.cc  Tue Mar 24 03:16:30 2009
@@ -228,13 +228,13 @@
        static_cast<StringRepresentationTag>(type &  
kStringRepresentationMask);
    if (rep != kConsStringTag) return object;

-  Object* second = reinterpret_cast<ConsString*>(object)->second();
+  Object* second =  
reinterpret_cast<ConsString*>(object)->unchecked_second();
    if (reinterpret_cast<String*>(second) != Heap::empty_string()) return  
object;

    // Since we don't have the object's start, it is impossible to update the
    // remembered set.  Therefore, we only replace the string with its left
    // substring when the remembered set does not change.
-  Object* first = reinterpret_cast<ConsString*>(object)->first();
+  Object* first = reinterpret_cast<ConsString*>(object)->unchecked_first();
    if (!Heap::InNewSpace(object) && Heap::InNewSpace(first)) return object;

    *p = first;

Modified: branches/bleeding_edge/src/objects-inl.h
==============================================================================
--- branches/bleeding_edge/src/objects-inl.h    (original)
+++ branches/bleeding_edge/src/objects-inl.h    Tue Mar 24 03:16:30 2009
@@ -1578,6 +1578,11 @@


  String* ConsString::first() {
+  ASSERT(String::cast(READ_FIELD(this, kSecondOffset))->length() != 0 ||
+      StringShape(
+          String::cast(
+              READ_FIELD(this, kFirstOffset))).IsAsciiRepresentation()
+          == StringShape(this).IsAsciiRepresentation());
    return String::cast(READ_FIELD(this, kFirstOffset));
  }

@@ -1610,6 +1615,10 @@


  String* SlicedString::buffer() {
+  ASSERT(
+      StringShape(
+          String::cast(READ_FIELD(this,  
kBufferOffset))).IsAsciiRepresentation()
+      == StringShape(this).IsAsciiRepresentation());
    return String::cast(READ_FIELD(this, kBufferOffset));
  }


Modified: branches/bleeding_edge/src/objects.cc
==============================================================================
--- branches/bleeding_edge/src/objects.cc       (original)
+++ branches/bleeding_edge/src/objects.cc       Tue Mar 24 03:16:30 2009
@@ -618,6 +618,8 @@
        if (StringShape(String::cast(ok)).IsCons()) {
          ss->set_buffer(ConsString::cast(ok)->first());
        }
+      ASSERT(StringShape(this).IsAsciiRepresentation() ==
+          StringShape(ss->buffer()).IsAsciiRepresentation());
        return this;
      }
      case kConsStringTag: {

Modified: branches/bleeding_edge/src/regexp-macro-assembler-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/regexp-macro-assembler-ia32.cc   (original)
+++ branches/bleeding_edge/src/regexp-macro-assembler-ia32.cc   Tue Mar 24  
03:16:30 2009
@@ -972,6 +972,8 @@
    int start_offset = previous_index;
    int end_offset = subject_ptr->length();

+  bool is_ascii = StringShape(*subject).IsAsciiRepresentation();
+
    if (StringShape(subject_ptr).IsCons()) {
      subject_ptr = ConsString::cast(subject_ptr)->first();
    } else if (StringShape(subject_ptr).IsSliced()) {
@@ -980,9 +982,10 @@
      end_offset += slice->start();
      subject_ptr = slice->buffer();
    }
-
+  // Ensure that an underlying string has the same ascii-ness.
+  ASSERT(StringShape(subject_ptr).IsAsciiRepresentation() == is_ascii);
+  ASSERT(subject_ptr->IsExternalString() || subject_ptr->IsSeqString());
    // String is now either Sequential or External
-  bool is_ascii = StringShape(*subject).IsAsciiRepresentation();
    int char_size_shift = is_ascii ? 0 : 1;
    int char_length = end_offset - start_offset;


--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to