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

Side by Side Diff: src/objects.cc

Issue 100249: When strings can change from an ASCII representation to a... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 String* buf = ss->buffer(); 595 String* buf = ss->buffer();
596 ASSERT(!buf->IsSlicedString()); 596 ASSERT(!buf->IsSlicedString());
597 Object* ok = buf->TryFlatten(); 597 Object* ok = buf->TryFlatten();
598 if (ok->IsFailure()) return ok; 598 if (ok->IsFailure()) return ok;
599 // Under certain circumstances (TryFlattenIfNotFlat fails in 599 // Under certain circumstances (TryFlattenIfNotFlat fails in
600 // String::Slice) we can have a cons string under a slice. 600 // String::Slice) we can have a cons string under a slice.
601 // In this case we need to get the flat string out of the cons! 601 // In this case we need to get the flat string out of the cons!
602 if (StringShape(String::cast(ok)).IsCons()) { 602 if (StringShape(String::cast(ok)).IsCons()) {
603 ss->set_buffer(ConsString::cast(ok)->first()); 603 ss->set_buffer(ConsString::cast(ok)->first());
604 } 604 }
605 ASSERT(StringShape(this).IsAsciiRepresentation() ==
606 StringShape(ss->buffer()).IsAsciiRepresentation());
607 return this; 605 return this;
608 } 606 }
609 case kConsStringTag: { 607 case kConsStringTag: {
610 ConsString* cs = ConsString::cast(this); 608 ConsString* cs = ConsString::cast(this);
611 if (cs->second()->length() == 0) { 609 if (cs->second()->length() == 0) {
612 return this; 610 return this;
613 } 611 }
614 // There's little point in putting the flat string in new space if the 612 // There's little point in putting the flat string in new space if the
615 // cons string is in old space. It can never get GCed until there is 613 // cons string is in old space. It can never get GCed until there is
616 // an old space GC. 614 // an old space GC.
617 PretenureFlag tenure = Heap::InNewSpace(this) ? NOT_TENURED : TENURED; 615 PretenureFlag tenure = Heap::InNewSpace(this) ? NOT_TENURED : TENURED;
618 int len = length(); 616 int len = length();
619 Object* object; 617 Object* object;
620 String* result; 618 String* result;
621 if (StringShape(this).IsAsciiRepresentation()) { 619 if (IsAsciiRepresentation()) {
622 object = Heap::AllocateRawAsciiString(len, tenure); 620 object = Heap::AllocateRawAsciiString(len, tenure);
623 if (object->IsFailure()) return object; 621 if (object->IsFailure()) return object;
624 result = String::cast(object); 622 result = String::cast(object);
625 String* first = cs->first(); 623 String* first = cs->first();
626 int first_length = first->length(); 624 int first_length = first->length();
627 char* dest = SeqAsciiString::cast(result)->GetChars(); 625 char* dest = SeqAsciiString::cast(result)->GetChars();
628 WriteToFlat(first, dest, 0, first_length); 626 WriteToFlat(first, dest, 0, first_length);
629 String* second = cs->second(); 627 String* second = cs->second();
630 WriteToFlat(second, 628 WriteToFlat(second,
631 dest + first_length, 629 dest + first_length,
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 accumulator->Add("<Other heap object (%d)>", map()->instance_type()); 947 accumulator->Add("<Other heap object (%d)>", map()->instance_type());
950 break; 948 break;
951 } 949 }
952 } 950 }
953 951
954 952
955 int HeapObject::SlowSizeFromMap(Map* map) { 953 int HeapObject::SlowSizeFromMap(Map* map) {
956 // Avoid calling functions such as FixedArray::cast during GC, which 954 // Avoid calling functions such as FixedArray::cast during GC, which
957 // read map pointer of this object again. 955 // read map pointer of this object again.
958 InstanceType instance_type = map->instance_type(); 956 InstanceType instance_type = map->instance_type();
957 uint32_t type = static_cast<uint32_t>(instance_type);
959 958
960 if (instance_type < FIRST_NONSTRING_TYPE 959 if (instance_type < FIRST_NONSTRING_TYPE
961 && (StringShape(instance_type).IsSequential())) { 960 && (StringShape(instance_type).IsSequential())) {
962 if (StringShape(instance_type).IsAsciiRepresentation()) { 961 if ((type & kStringEncodingMask) == kAsciiStringTag) {
963 SeqAsciiString* seq_ascii_this = reinterpret_cast<SeqAsciiString*>(this); 962 SeqAsciiString* seq_ascii_this = reinterpret_cast<SeqAsciiString*>(this);
964 return seq_ascii_this->SeqAsciiStringSize(instance_type); 963 return seq_ascii_this->SeqAsciiStringSize(instance_type);
965 } else { 964 } else {
966 SeqTwoByteString* self = reinterpret_cast<SeqTwoByteString*>(this); 965 SeqTwoByteString* self = reinterpret_cast<SeqTwoByteString*>(this);
967 return self->SeqTwoByteStringSize(instance_type); 966 return self->SeqTwoByteStringSize(instance_type);
968 } 967 }
969 } 968 }
970 969
971 switch (instance_type) { 970 switch (instance_type) {
972 case FIXED_ARRAY_TYPE: 971 case FIXED_ARRAY_TYPE:
(...skipping 2255 matching lines...) Expand 10 before | Expand all | Expand 10 after
3228 static StaticResource<StringInputBuffer> string_input_buffer; 3227 static StaticResource<StringInputBuffer> string_input_buffer;
3229 3228
3230 3229
3231 bool String::LooksValid() { 3230 bool String::LooksValid() {
3232 if (!Heap::Contains(this)) return false; 3231 if (!Heap::Contains(this)) return false;
3233 return true; 3232 return true;
3234 } 3233 }
3235 3234
3236 3235
3237 int String::Utf8Length() { 3236 int String::Utf8Length() {
3238 if (StringShape(this).IsAsciiRepresentation()) return length(); 3237 if (IsAsciiRepresentation()) return length();
3239 // Attempt to flatten before accessing the string. It probably 3238 // Attempt to flatten before accessing the string. It probably
3240 // doesn't make Utf8Length faster, but it is very likely that 3239 // doesn't make Utf8Length faster, but it is very likely that
3241 // the string will be accessed later (for example by WriteUtf8) 3240 // the string will be accessed later (for example by WriteUtf8)
3242 // so it's still a good idea. 3241 // so it's still a good idea.
3243 TryFlattenIfNotFlat(); 3242 TryFlattenIfNotFlat();
3244 Access<StringInputBuffer> buffer(&string_input_buffer); 3243 Access<StringInputBuffer> buffer(&string_input_buffer);
3245 buffer->Reset(0, this); 3244 buffer->Reset(0, this);
3246 int result = 0; 3245 int result = 0;
3247 while (buffer->has_more()) 3246 while (buffer->has_more())
3248 result += unibrow::Utf8::Length(buffer->GetNext()); 3247 result += unibrow::Utf8::Length(buffer->GetNext());
3249 return result; 3248 return result;
3250 } 3249 }
3251 3250
3252 3251
3253 Vector<const char> String::ToAsciiVector() { 3252 Vector<const char> String::ToAsciiVector() {
3254 ASSERT(StringShape(this).IsAsciiRepresentation()); 3253 ASSERT(IsAsciiRepresentation());
3255 ASSERT(IsFlat()); 3254 ASSERT(IsFlat());
3256 3255
3257 int offset = 0; 3256 int offset = 0;
3258 int length = this->length(); 3257 int length = this->length();
3259 StringRepresentationTag string_tag = StringShape(this).representation_tag(); 3258 StringRepresentationTag string_tag = StringShape(this).representation_tag();
3260 String* string = this; 3259 String* string = this;
3261 if (string_tag == kSlicedStringTag) { 3260 if (string_tag == kSlicedStringTag) {
3262 SlicedString* sliced = SlicedString::cast(string); 3261 SlicedString* sliced = SlicedString::cast(string);
3263 offset += sliced->start(); 3262 offset += sliced->start();
3264 string = sliced->buffer(); 3263 string = sliced->buffer();
(...skipping 10 matching lines...) Expand all
3275 return Vector<const char>(start + offset, length); 3274 return Vector<const char>(start + offset, length);
3276 } 3275 }
3277 ASSERT(string_tag == kExternalStringTag); 3276 ASSERT(string_tag == kExternalStringTag);
3278 ExternalAsciiString* ext = ExternalAsciiString::cast(string); 3277 ExternalAsciiString* ext = ExternalAsciiString::cast(string);
3279 const char* start = ext->resource()->data(); 3278 const char* start = ext->resource()->data();
3280 return Vector<const char>(start + offset, length); 3279 return Vector<const char>(start + offset, length);
3281 } 3280 }
3282 3281
3283 3282
3284 Vector<const uc16> String::ToUC16Vector() { 3283 Vector<const uc16> String::ToUC16Vector() {
3285 ASSERT(StringShape(this).IsTwoByteRepresentation()); 3284 ASSERT(IsTwoByteRepresentation());
3286 ASSERT(IsFlat()); 3285 ASSERT(IsFlat());
3287 3286
3288 int offset = 0; 3287 int offset = 0;
3289 int length = this->length(); 3288 int length = this->length();
3290 StringRepresentationTag string_tag = StringShape(this).representation_tag(); 3289 StringRepresentationTag string_tag = StringShape(this).representation_tag();
3291 String* string = this; 3290 String* string = this;
3292 if (string_tag == kSlicedStringTag) { 3291 if (string_tag == kSlicedStringTag) {
3293 SlicedString* sliced = SlicedString::cast(string); 3292 SlicedString* sliced = SlicedString::cast(string);
3294 offset += sliced->start(); 3293 offset += sliced->start();
3295 string = String::cast(sliced->buffer()); 3294 string = String::cast(sliced->buffer());
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3378 return ToCString(allow_nulls, robust_flag, 0, -1, length_return); 3377 return ToCString(allow_nulls, robust_flag, 0, -1, length_return);
3379 } 3378 }
3380 3379
3381 3380
3382 const uc16* String::GetTwoByteData() { 3381 const uc16* String::GetTwoByteData() {
3383 return GetTwoByteData(0); 3382 return GetTwoByteData(0);
3384 } 3383 }
3385 3384
3386 3385
3387 const uc16* String::GetTwoByteData(unsigned start) { 3386 const uc16* String::GetTwoByteData(unsigned start) {
3388 ASSERT(!StringShape(this).IsAsciiRepresentation()); 3387 ASSERT(!IsAsciiRepresentation());
3389 switch (StringShape(this).representation_tag()) { 3388 switch (StringShape(this).representation_tag()) {
3390 case kSeqStringTag: 3389 case kSeqStringTag:
3391 return SeqTwoByteString::cast(this)->SeqTwoByteStringGetData(start); 3390 return SeqTwoByteString::cast(this)->SeqTwoByteStringGetData(start);
3392 case kExternalStringTag: 3391 case kExternalStringTag:
3393 return ExternalTwoByteString::cast(this)-> 3392 return ExternalTwoByteString::cast(this)->
3394 ExternalTwoByteStringGetData(start); 3393 ExternalTwoByteStringGetData(start);
3395 case kSlicedStringTag: { 3394 case kSlicedStringTag: {
3396 SlicedString* sliced_string = SlicedString::cast(this); 3395 SlicedString* sliced_string = SlicedString::cast(this);
3397 String* buffer = sliced_string->buffer(); 3396 String* buffer = sliced_string->buffer();
3398 if (StringShape(buffer).IsCons()) { 3397 if (StringShape(buffer).IsCons()) {
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
3673 ReadBlockBuffer* rbb, 3672 ReadBlockBuffer* rbb,
3674 unsigned* offset_ptr, 3673 unsigned* offset_ptr,
3675 unsigned max_chars) { 3674 unsigned max_chars) {
3676 ASSERT(*offset_ptr <= static_cast<unsigned>(input->length())); 3675 ASSERT(*offset_ptr <= static_cast<unsigned>(input->length()));
3677 if (max_chars == 0) { 3676 if (max_chars == 0) {
3678 rbb->remaining = 0; 3677 rbb->remaining = 0;
3679 return NULL; 3678 return NULL;
3680 } 3679 }
3681 switch (StringShape(input).representation_tag()) { 3680 switch (StringShape(input).representation_tag()) {
3682 case kSeqStringTag: 3681 case kSeqStringTag:
3683 if (StringShape(input).IsAsciiRepresentation()) { 3682 if (input->IsAsciiRepresentation()) {
3684 SeqAsciiString* str = SeqAsciiString::cast(input); 3683 SeqAsciiString* str = SeqAsciiString::cast(input);
3685 return str->SeqAsciiStringReadBlock(&rbb->remaining, 3684 return str->SeqAsciiStringReadBlock(&rbb->remaining,
3686 offset_ptr, 3685 offset_ptr,
3687 max_chars); 3686 max_chars);
3688 } else { 3687 } else {
3689 SeqTwoByteString* str = SeqTwoByteString::cast(input); 3688 SeqTwoByteString* str = SeqTwoByteString::cast(input);
3690 str->SeqTwoByteStringReadBlockIntoBuffer(rbb, 3689 str->SeqTwoByteStringReadBlockIntoBuffer(rbb,
3691 offset_ptr, 3690 offset_ptr,
3692 max_chars); 3691 max_chars);
3693 return rbb->util_buffer; 3692 return rbb->util_buffer;
3694 } 3693 }
3695 case kConsStringTag: 3694 case kConsStringTag:
3696 return ConsString::cast(input)->ConsStringReadBlock(rbb, 3695 return ConsString::cast(input)->ConsStringReadBlock(rbb,
3697 offset_ptr, 3696 offset_ptr,
3698 max_chars); 3697 max_chars);
3699 case kSlicedStringTag: 3698 case kSlicedStringTag:
3700 return SlicedString::cast(input)->SlicedStringReadBlock(rbb, 3699 return SlicedString::cast(input)->SlicedStringReadBlock(rbb,
3701 offset_ptr, 3700 offset_ptr,
3702 max_chars); 3701 max_chars);
3703 case kExternalStringTag: 3702 case kExternalStringTag:
3704 if (StringShape(input).IsAsciiRepresentation()) { 3703 if (input->IsAsciiRepresentation()) {
3705 return ExternalAsciiString::cast(input)->ExternalAsciiStringReadBlock( 3704 return ExternalAsciiString::cast(input)->ExternalAsciiStringReadBlock(
3706 &rbb->remaining, 3705 &rbb->remaining,
3707 offset_ptr, 3706 offset_ptr,
3708 max_chars); 3707 max_chars);
3709 } else { 3708 } else {
3710 ExternalTwoByteString::cast(input)-> 3709 ExternalTwoByteString::cast(input)->
3711 ExternalTwoByteStringReadBlockIntoBuffer(rbb, 3710 ExternalTwoByteStringReadBlockIntoBuffer(rbb,
3712 offset_ptr, 3711 offset_ptr,
3713 max_chars); 3712 max_chars);
3714 return rbb->util_buffer; 3713 return rbb->util_buffer;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3747 FlatStringReader::~FlatStringReader() { 3746 FlatStringReader::~FlatStringReader() {
3748 ASSERT_EQ(top_, this); 3747 ASSERT_EQ(top_, this);
3749 top_ = prev_; 3748 top_ = prev_;
3750 } 3749 }
3751 3750
3752 3751
3753 void FlatStringReader::RefreshState() { 3752 void FlatStringReader::RefreshState() {
3754 if (str_ == NULL) return; 3753 if (str_ == NULL) return;
3755 Handle<String> str(str_); 3754 Handle<String> str(str_);
3756 ASSERT(str->IsFlat()); 3755 ASSERT(str->IsFlat());
3757 is_ascii_ = StringShape(*str).IsAsciiRepresentation(); 3756 is_ascii_ = str->IsAsciiRepresentation();
3758 if (is_ascii_) { 3757 if (is_ascii_) {
3759 start_ = str->ToAsciiVector().start(); 3758 start_ = str->ToAsciiVector().start();
3760 } else { 3759 } else {
3761 start_ = str->ToUC16Vector().start(); 3760 start_ = str->ToUC16Vector().start();
3762 } 3761 }
3763 } 3762 }
3764 3763
3765 3764
3766 void FlatStringReader::PostGarbageCollectionProcessing() { 3765 void FlatStringReader::PostGarbageCollectionProcessing() {
3767 FlatStringReader* current = top_; 3766 FlatStringReader* current = top_;
(...skipping 20 matching lines...) Expand all
3788 // to fill up a buffer. 3787 // to fill up a buffer.
3789 void String::ReadBlockIntoBuffer(String* input, 3788 void String::ReadBlockIntoBuffer(String* input,
3790 ReadBlockBuffer* rbb, 3789 ReadBlockBuffer* rbb,
3791 unsigned* offset_ptr, 3790 unsigned* offset_ptr,
3792 unsigned max_chars) { 3791 unsigned max_chars) {
3793 ASSERT(*offset_ptr <= (unsigned)input->length()); 3792 ASSERT(*offset_ptr <= (unsigned)input->length());
3794 if (max_chars == 0) return; 3793 if (max_chars == 0) return;
3795 3794
3796 switch (StringShape(input).representation_tag()) { 3795 switch (StringShape(input).representation_tag()) {
3797 case kSeqStringTag: 3796 case kSeqStringTag:
3798 if (StringShape(input).IsAsciiRepresentation()) { 3797 if (input->IsAsciiRepresentation()) {
3799 SeqAsciiString::cast(input)->SeqAsciiStringReadBlockIntoBuffer(rbb, 3798 SeqAsciiString::cast(input)->SeqAsciiStringReadBlockIntoBuffer(rbb,
3800 offset_ptr, 3799 offset_ptr,
3801 max_chars); 3800 max_chars);
3802 return; 3801 return;
3803 } else { 3802 } else {
3804 SeqTwoByteString::cast(input)->SeqTwoByteStringReadBlockIntoBuffer(rbb, 3803 SeqTwoByteString::cast(input)->SeqTwoByteStringReadBlockIntoBuffer(rbb,
3805 offset_ptr, 3804 offset_ptr,
3806 max_chars); 3805 max_chars);
3807 return; 3806 return;
3808 } 3807 }
3809 case kConsStringTag: 3808 case kConsStringTag:
3810 ConsString::cast(input)->ConsStringReadBlockIntoBuffer(rbb, 3809 ConsString::cast(input)->ConsStringReadBlockIntoBuffer(rbb,
3811 offset_ptr, 3810 offset_ptr,
3812 max_chars); 3811 max_chars);
3813 return; 3812 return;
3814 case kSlicedStringTag: 3813 case kSlicedStringTag:
3815 SlicedString::cast(input)->SlicedStringReadBlockIntoBuffer(rbb, 3814 SlicedString::cast(input)->SlicedStringReadBlockIntoBuffer(rbb,
3816 offset_ptr, 3815 offset_ptr,
3817 max_chars); 3816 max_chars);
3818 return; 3817 return;
3819 case kExternalStringTag: 3818 case kExternalStringTag:
3820 if (StringShape(input).IsAsciiRepresentation()) { 3819 if (input->IsAsciiRepresentation()) {
3821 ExternalAsciiString::cast(input)-> 3820 ExternalAsciiString::cast(input)->
3822 ExternalAsciiStringReadBlockIntoBuffer(rbb, offset_ptr, max_chars); 3821 ExternalAsciiStringReadBlockIntoBuffer(rbb, offset_ptr, max_chars);
3823 } else { 3822 } else {
3824 ExternalTwoByteString::cast(input)-> 3823 ExternalTwoByteString::cast(input)->
3825 ExternalTwoByteStringReadBlockIntoBuffer(rbb, 3824 ExternalTwoByteStringReadBlockIntoBuffer(rbb,
3826 offset_ptr, 3825 offset_ptr,
3827 max_chars); 3826 max_chars);
3828 } 3827 }
3829 return; 3828 return;
3830 default: 3829 default:
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
4140 return (vec.start() == NULL) ? true : false; 4139 return (vec.start() == NULL) ? true : false;
4141 } 4140 }
4142 4141
4143 4142
4144 static StringInputBuffer string_compare_buffer_b; 4143 static StringInputBuffer string_compare_buffer_b;
4145 4144
4146 4145
4147 template <typename IteratorA> 4146 template <typename IteratorA>
4148 static inline bool CompareStringContentsPartial(IteratorA* ia, String* b) { 4147 static inline bool CompareStringContentsPartial(IteratorA* ia, String* b) {
4149 if (b->IsFlat()) { 4148 if (b->IsFlat()) {
4150 if (StringShape(b).IsAsciiRepresentation()) { 4149 if (b->IsAsciiRepresentation()) {
4151 VectorIterator<char> ib(b->ToAsciiVector()); 4150 VectorIterator<char> ib(b->ToAsciiVector());
4152 return CompareStringContents(ia, &ib); 4151 return CompareStringContents(ia, &ib);
4153 } else { 4152 } else {
4154 Vector<const uc16> vb = b->ToUC16Vector(); 4153 Vector<const uc16> vb = b->ToUC16Vector();
4155 if (CheckVectorForBug9746(vb)) return false; 4154 if (CheckVectorForBug9746(vb)) return false;
4156 VectorIterator<uc16> ib(vb); 4155 VectorIterator<uc16> ib(vb);
4157 return CompareStringContents(ia, &ib); 4156 return CompareStringContents(ia, &ib);
4158 } 4157 }
4159 } else { 4158 } else {
4160 string_compare_buffer_b.Reset(0, b); 4159 string_compare_buffer_b.Reset(0, b);
(...skipping 19 matching lines...) Expand all
4180 4179
4181 if (StringShape(this).IsSequentialAscii() && 4180 if (StringShape(this).IsSequentialAscii() &&
4182 StringShape(other).IsSequentialAscii()) { 4181 StringShape(other).IsSequentialAscii()) {
4183 const char* str1 = SeqAsciiString::cast(this)->GetChars(); 4182 const char* str1 = SeqAsciiString::cast(this)->GetChars();
4184 const char* str2 = SeqAsciiString::cast(other)->GetChars(); 4183 const char* str2 = SeqAsciiString::cast(other)->GetChars();
4185 return CompareRawStringContents(Vector<const char>(str1, len), 4184 return CompareRawStringContents(Vector<const char>(str1, len),
4186 Vector<const char>(str2, len)); 4185 Vector<const char>(str2, len));
4187 } 4186 }
4188 4187
4189 if (this->IsFlat()) { 4188 if (this->IsFlat()) {
4190 if (StringShape(this).IsAsciiRepresentation()) { 4189 if (IsAsciiRepresentation()) {
4191 Vector<const char> vec1 = this->ToAsciiVector(); 4190 Vector<const char> vec1 = this->ToAsciiVector();
4192 if (other->IsFlat()) { 4191 if (other->IsFlat()) {
4193 if (StringShape(other).IsAsciiRepresentation()) { 4192 if (other->IsAsciiRepresentation()) {
4194 Vector<const char> vec2 = other->ToAsciiVector(); 4193 Vector<const char> vec2 = other->ToAsciiVector();
4195 return CompareRawStringContents(vec1, vec2); 4194 return CompareRawStringContents(vec1, vec2);
4196 } else { 4195 } else {
4197 VectorIterator<char> buf1(vec1); 4196 VectorIterator<char> buf1(vec1);
4198 Vector<const uc16> vec2 = other->ToUC16Vector(); 4197 Vector<const uc16> vec2 = other->ToUC16Vector();
4199 if (CheckVectorForBug9746(vec2)) return false; 4198 if (CheckVectorForBug9746(vec2)) return false;
4200 VectorIterator<uc16> ib(vec2); 4199 VectorIterator<uc16> ib(vec2);
4201 return CompareStringContents(&buf1, &ib); 4200 return CompareStringContents(&buf1, &ib);
4202 } 4201 }
4203 } else { 4202 } else {
4204 VectorIterator<char> buf1(vec1); 4203 VectorIterator<char> buf1(vec1);
4205 string_compare_buffer_b.Reset(0, other); 4204 string_compare_buffer_b.Reset(0, other);
4206 return CompareStringContents(&buf1, &string_compare_buffer_b); 4205 return CompareStringContents(&buf1, &string_compare_buffer_b);
4207 } 4206 }
4208 } else { 4207 } else {
4209 Vector<const uc16> vec1 = this->ToUC16Vector(); 4208 Vector<const uc16> vec1 = this->ToUC16Vector();
4210 if (CheckVectorForBug9746(vec1)) return false; 4209 if (CheckVectorForBug9746(vec1)) return false;
4211 if (other->IsFlat()) { 4210 if (other->IsFlat()) {
4212 if (StringShape(other).IsAsciiRepresentation()) { 4211 if (other->IsAsciiRepresentation()) {
4213 VectorIterator<uc16> buf1(vec1); 4212 VectorIterator<uc16> buf1(vec1);
4214 VectorIterator<char> ib(other->ToAsciiVector()); 4213 VectorIterator<char> ib(other->ToAsciiVector());
4215 return CompareStringContents(&buf1, &ib); 4214 return CompareStringContents(&buf1, &ib);
4216 } else { 4215 } else {
4217 Vector<const uc16> vec2 = other->ToUC16Vector(); 4216 Vector<const uc16> vec2 = other->ToUC16Vector();
4218 if (CheckVectorForBug9746(vec2)) return false; 4217 if (CheckVectorForBug9746(vec2)) return false;
4219 return CompareRawStringContents(vec1, vec2); 4218 return CompareRawStringContents(vec1, vec2);
4220 } 4219 }
4221 } else { 4220 } else {
4222 VectorIterator<uc16> buf1(vec1); 4221 VectorIterator<uc16> buf1(vec1);
(...skipping 3315 matching lines...) Expand 10 before | Expand all | Expand 10 after
7538 // No break point. 7537 // No break point.
7539 if (break_point_objects()->IsUndefined()) return 0; 7538 if (break_point_objects()->IsUndefined()) return 0;
7540 // Single beak point. 7539 // Single beak point.
7541 if (!break_point_objects()->IsFixedArray()) return 1; 7540 if (!break_point_objects()->IsFixedArray()) return 1;
7542 // Multiple break points. 7541 // Multiple break points.
7543 return FixedArray::cast(break_point_objects())->length(); 7542 return FixedArray::cast(break_point_objects())->length();
7544 } 7543 }
7545 #endif 7544 #endif
7546 7545
7547 } } // namespace v8::internal 7546 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698