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

Side by Side Diff: src/objects.cc

Issue 42499: Added a few sanity-assertions about flat strings underlying buffers. (Closed)
Patch Set: Created 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/regexp-macro-assembler-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 String* buf = ss->buffer(); 611 String* buf = ss->buffer();
612 ASSERT(!buf->IsSlicedString()); 612 ASSERT(!buf->IsSlicedString());
613 Object* ok = buf->TryFlatten(); 613 Object* ok = buf->TryFlatten();
614 if (ok->IsFailure()) return ok; 614 if (ok->IsFailure()) return ok;
615 // Under certain circumstances (TryFlattenIfNotFlat fails in 615 // Under certain circumstances (TryFlattenIfNotFlat fails in
616 // String::Slice) we can have a cons string under a slice. 616 // String::Slice) we can have a cons string under a slice.
617 // In this case we need to get the flat string out of the cons! 617 // In this case we need to get the flat string out of the cons!
618 if (StringShape(String::cast(ok)).IsCons()) { 618 if (StringShape(String::cast(ok)).IsCons()) {
619 ss->set_buffer(ConsString::cast(ok)->first()); 619 ss->set_buffer(ConsString::cast(ok)->first());
620 } 620 }
621 ASSERT(StringShape(this).IsAsciiRepresentation() ==
622 StringShape(ss->buffer()).IsAsciiRepresentation());
621 return this; 623 return this;
622 } 624 }
623 case kConsStringTag: { 625 case kConsStringTag: {
624 ConsString* cs = ConsString::cast(this); 626 ConsString* cs = ConsString::cast(this);
625 if (cs->second()->length() == 0) { 627 if (cs->second()->length() == 0) {
626 return this; 628 return this;
627 } 629 }
628 // There's little point in putting the flat string in new space if the 630 // There's little point in putting the flat string in new space if the
629 // cons string is in old space. It can never get GCed until there is 631 // cons string is in old space. It can never get GCed until there is
630 // an old space GC. 632 // an old space GC.
(...skipping 6744 matching lines...) Expand 10 before | Expand all | Expand 10 after
7375 // No break point. 7377 // No break point.
7376 if (break_point_objects()->IsUndefined()) return 0; 7378 if (break_point_objects()->IsUndefined()) return 0;
7377 // Single beak point. 7379 // Single beak point.
7378 if (!break_point_objects()->IsFixedArray()) return 1; 7380 if (!break_point_objects()->IsFixedArray()) return 1;
7379 // Multiple break points. 7381 // Multiple break points.
7380 return FixedArray::cast(break_point_objects())->length(); 7382 return FixedArray::cast(break_point_objects())->length();
7381 } 7383 }
7382 7384
7383 7385
7384 } } // namespace v8::internal 7386 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/regexp-macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698