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

Side by Side Diff: src/string-stream.cc

Issue 347002: Derive string size constants... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month 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-inl.h ('k') | test/cctest/test-api.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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 181 }
182 182
183 // Verify that the buffer is 0-terminated 183 // Verify that the buffer is 0-terminated
184 ASSERT(buffer_[length_] == '\0'); 184 ASSERT(buffer_[length_] == '\0');
185 } 185 }
186 186
187 187
188 void StringStream::PrintObject(Object* o) { 188 void StringStream::PrintObject(Object* o) {
189 o->ShortPrint(this); 189 o->ShortPrint(this);
190 if (o->IsString()) { 190 if (o->IsString()) {
191 if (String::cast(o)->length() <= String::kMaxMediumStringSize) { 191 if (String::cast(o)->length() <= String::kMaxMediumSize) {
192 return; 192 return;
193 } 193 }
194 } else if (o->IsNumber() || o->IsOddball()) { 194 } else if (o->IsNumber() || o->IsOddball()) {
195 return; 195 return;
196 } 196 }
197 if (o->IsHeapObject()) { 197 if (o->IsHeapObject()) {
198 for (int i = 0; i < debug_object_cache->length(); i++) { 198 for (int i = 0; i < debug_object_cache->length(); i++) {
199 if ((*debug_object_cache)[i] == o) { 199 if ((*debug_object_cache)[i] == o) {
200 Add("#%d#", i); 200 Add("#%d#", i);
201 return; 201 return;
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 575
576 // Only grow once to the maximum allowable size. 576 // Only grow once to the maximum allowable size.
577 char* NoAllocationStringAllocator::grow(unsigned* bytes) { 577 char* NoAllocationStringAllocator::grow(unsigned* bytes) {
578 ASSERT(size_ >= *bytes); 578 ASSERT(size_ >= *bytes);
579 *bytes = size_; 579 *bytes = size_;
580 return space_; 580 return space_;
581 } 581 }
582 582
583 583
584 } } // namespace v8::internal 584 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698