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

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

Issue 23824005: revert thread isolate in PreallocatedStorageAllocationPolicy (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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/list.h ('k') | src/zone.h » ('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 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 DebugObjectCache* debug_object_cache = Isolate::Current()-> 197 DebugObjectCache* debug_object_cache = Isolate::Current()->
198 string_stream_debug_object_cache(); 198 string_stream_debug_object_cache();
199 for (int i = 0; i < debug_object_cache->length(); i++) { 199 for (int i = 0; i < debug_object_cache->length(); i++) {
200 if ((*debug_object_cache)[i] == o) { 200 if ((*debug_object_cache)[i] == o) {
201 Add("#%d#", i); 201 Add("#%d#", i);
202 return; 202 return;
203 } 203 }
204 } 204 }
205 if (debug_object_cache->length() < kMentionedObjectCacheMaxSize) { 205 if (debug_object_cache->length() < kMentionedObjectCacheMaxSize) {
206 Add("#%d#", debug_object_cache->length()); 206 Add("#%d#", debug_object_cache->length());
207 HeapObject* ho = HeapObject::cast(o); 207 debug_object_cache->Add(HeapObject::cast(o));
208 PreallocatedStorageAllocationPolicy policy(ho->GetIsolate());
209 debug_object_cache->Add(ho, policy);
210 } else { 208 } else {
211 Add("@%p", o); 209 Add("@%p", o);
212 } 210 }
213 } 211 }
214 } 212 }
215 213
216 214
217 void StringStream::Add(const char* format) { 215 void StringStream::Add(const char* format) {
218 Add(CStrVector(format)); 216 Add(CStrVector(format));
219 } 217 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 Handle<String> StringStream::ToString() { 292 Handle<String> StringStream::ToString() {
295 Factory* factory = Isolate::Current()->factory(); 293 Factory* factory = Isolate::Current()->factory();
296 return factory->NewStringFromUtf8(Vector<const char>(buffer_, length_)); 294 return factory->NewStringFromUtf8(Vector<const char>(buffer_, length_));
297 } 295 }
298 296
299 297
300 void StringStream::ClearMentionedObjectCache() { 298 void StringStream::ClearMentionedObjectCache() {
301 Isolate* isolate = Isolate::Current(); 299 Isolate* isolate = Isolate::Current();
302 isolate->set_string_stream_current_security_token(NULL); 300 isolate->set_string_stream_current_security_token(NULL);
303 if (isolate->string_stream_debug_object_cache() == NULL) { 301 if (isolate->string_stream_debug_object_cache() == NULL) {
304 PreallocatedStorageAllocationPolicy policy(isolate);
305 isolate->set_string_stream_debug_object_cache( 302 isolate->set_string_stream_debug_object_cache(
306 new(policy) DebugObjectCache(policy)); 303 new List<HeapObject*, PreallocatedStorageAllocationPolicy>(0));
307 } 304 }
308 isolate->string_stream_debug_object_cache()->Clear(); 305 isolate->string_stream_debug_object_cache()->Clear();
309 } 306 }
310 307
311 308
312 #ifdef DEBUG 309 #ifdef DEBUG
313 bool StringStream::IsMentionedObjectCacheClear() { 310 bool StringStream::IsMentionedObjectCacheClear() {
314 return ( 311 return (
315 Isolate::Current()->string_stream_debug_object_cache()->length() == 0); 312 Isolate::Current()->string_stream_debug_object_cache()->length() == 0);
316 } 313 }
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 593
597 // Only grow once to the maximum allowable size. 594 // Only grow once to the maximum allowable size.
598 char* NoAllocationStringAllocator::grow(unsigned* bytes) { 595 char* NoAllocationStringAllocator::grow(unsigned* bytes) {
599 ASSERT(size_ >= *bytes); 596 ASSERT(size_ >= *bytes);
600 *bytes = size_; 597 *bytes = size_;
601 return space_; 598 return space_;
602 } 599 }
603 600
604 601
605 } } // namespace v8::internal 602 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/list.h ('k') | src/zone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698