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

Side by Side Diff: src/objects-debug.cc

Issue 10407090: Ensure integrity of ASCII strings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments. Created 8 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
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 void String::StringVerify() { 451 void String::StringVerify() {
452 CHECK(IsString()); 452 CHECK(IsString());
453 CHECK(length() >= 0 && length() <= Smi::kMaxValue); 453 CHECK(length() >= 0 && length() <= Smi::kMaxValue);
454 if (IsSymbol()) { 454 if (IsSymbol()) {
455 CHECK(!HEAP->InNewSpace(this)); 455 CHECK(!HEAP->InNewSpace(this));
456 } 456 }
457 if (IsConsString()) { 457 if (IsConsString()) {
458 ConsString::cast(this)->ConsStringVerify(); 458 ConsString::cast(this)->ConsStringVerify();
459 } else if (IsSlicedString()) { 459 } else if (IsSlicedString()) {
460 SlicedString::cast(this)->SlicedStringVerify(); 460 SlicedString::cast(this)->SlicedStringVerify();
461 } else if (IsSeqAsciiString()) {
462 SeqAsciiString::cast(this)->SeqAsciiStringVerify();
461 } 463 }
462 } 464 }
463 465
464 466
467 void SeqAsciiString::SeqAsciiStringVerify() {
468 CHECK(String::IsAscii(GetChars(), length()));
469 }
470
471
465 void ConsString::ConsStringVerify() { 472 void ConsString::ConsStringVerify() {
466 CHECK(this->first()->IsString()); 473 CHECK(this->first()->IsString());
467 CHECK(this->second() == GetHeap()->empty_string() || 474 CHECK(this->second() == GetHeap()->empty_string() ||
468 this->second()->IsString()); 475 this->second()->IsString());
469 CHECK(this->length() >= ConsString::kMinLength); 476 CHECK(this->length() >= ConsString::kMinLength);
470 if (this->IsFlat()) { 477 if (this->IsFlat()) {
471 // A flat cons can only be created by String::SlowTryFlatten. 478 // A flat cons can only be created by String::SlowTryFlatten.
472 // Afterwards, the first part may be externalized. 479 // Afterwards, the first part may be externalized.
473 CHECK(this->first()->IsSeqString() || this->first()->IsExternalString()); 480 CHECK(this->first()->IsSeqString() || this->first()->IsExternalString());
474 } 481 }
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 FixedArray* proto_transitions = prototype_transitions(); 1017 FixedArray* proto_transitions = prototype_transitions();
1011 MemsetPointer(proto_transitions->data_start(), 1018 MemsetPointer(proto_transitions->data_start(),
1012 GetHeap()->the_hole_value(), 1019 GetHeap()->the_hole_value(),
1013 proto_transitions->length()); 1020 proto_transitions->length());
1014 } 1021 }
1015 1022
1016 1023
1017 #endif // DEBUG 1024 #endif // DEBUG
1018 1025
1019 } } // namespace v8::internal 1026 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698