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

Side by Side Diff: src/objects.cc

Issue 294019: Verify correctness of external string only if slow asserts are enabled. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 2 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 | « no previous file | 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 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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 return this; 744 return this;
745 } 745 }
746 default: 746 default:
747 return this; 747 return this;
748 } 748 }
749 } 749 }
750 750
751 751
752 bool String::MakeExternal(v8::String::ExternalStringResource* resource) { 752 bool String::MakeExternal(v8::String::ExternalStringResource* resource) {
753 #ifdef DEBUG 753 #ifdef DEBUG
754 { // NOLINT (presubmit.py gets confused about if and braces) 754 if (FLAG_enable_slow_asserts) {
755 // Assert that the resource and the string are equivalent. 755 // Assert that the resource and the string are equivalent.
756 ASSERT(static_cast<size_t>(this->length()) == resource->length()); 756 ASSERT(static_cast<size_t>(this->length()) == resource->length());
757 SmartPointer<uc16> smart_chars = this->ToWideCString(); 757 SmartPointer<uc16> smart_chars = this->ToWideCString();
758 ASSERT(memcmp(*smart_chars, 758 ASSERT(memcmp(*smart_chars,
759 resource->data(), 759 resource->data(),
760 resource->length() * sizeof(**smart_chars)) == 0); 760 resource->length() * sizeof(**smart_chars)) == 0);
761 } 761 }
762 #endif // DEBUG 762 #endif // DEBUG
763 763
764 int size = this->Size(); // Byte size of the original string. 764 int size = this->Size(); // Byte size of the original string.
(...skipping 22 matching lines...) Expand all
787 787
788 // Fill the remainder of the string with dead wood. 788 // Fill the remainder of the string with dead wood.
789 int new_size = this->Size(); // Byte size of the external String object. 789 int new_size = this->Size(); // Byte size of the external String object.
790 Heap::CreateFillerObjectAt(this->address() + new_size, size - new_size); 790 Heap::CreateFillerObjectAt(this->address() + new_size, size - new_size);
791 return true; 791 return true;
792 } 792 }
793 793
794 794
795 bool String::MakeExternal(v8::String::ExternalAsciiStringResource* resource) { 795 bool String::MakeExternal(v8::String::ExternalAsciiStringResource* resource) {
796 #ifdef DEBUG 796 #ifdef DEBUG
797 { // NOLINT (presubmit.py gets confused about if and braces) 797 if (FLAG_enable_slow_asserts) {
798 // Assert that the resource and the string are equivalent. 798 // Assert that the resource and the string are equivalent.
799 ASSERT(static_cast<size_t>(this->length()) == resource->length()); 799 ASSERT(static_cast<size_t>(this->length()) == resource->length());
800 SmartPointer<char> smart_chars = this->ToCString(); 800 SmartPointer<char> smart_chars = this->ToCString();
801 ASSERT(memcmp(*smart_chars, 801 ASSERT(memcmp(*smart_chars,
802 resource->data(), 802 resource->data(),
803 resource->length()*sizeof(**smart_chars)) == 0); 803 resource->length()*sizeof(**smart_chars)) == 0);
804 } 804 }
805 #endif // DEBUG 805 #endif // DEBUG
806 806
807 int size = this->Size(); // Byte size of the original string. 807 int size = this->Size(); // Byte size of the original string.
(...skipping 7173 matching lines...) Expand 10 before | Expand all | Expand 10 after
7981 if (break_point_objects()->IsUndefined()) return 0; 7981 if (break_point_objects()->IsUndefined()) return 0;
7982 // Single beak point. 7982 // Single beak point.
7983 if (!break_point_objects()->IsFixedArray()) return 1; 7983 if (!break_point_objects()->IsFixedArray()) return 1;
7984 // Multiple break points. 7984 // Multiple break points.
7985 return FixedArray::cast(break_point_objects())->length(); 7985 return FixedArray::cast(break_point_objects())->length();
7986 } 7986 }
7987 #endif 7987 #endif
7988 7988
7989 7989
7990 } } // namespace v8::internal 7990 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698