| OLD | NEW |
| 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 Loading... |
| 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 debug_object_cache->Add(HeapObject::cast(o)); | 207 HeapObject* ho = HeapObject::cast(o); |
| 208 PreallocatedStorageAllocationPolicy policy(ho->GetIsolate()); |
| 209 debug_object_cache->Add(ho, policy); |
| 208 } else { | 210 } else { |
| 209 Add("@%p", o); | 211 Add("@%p", o); |
| 210 } | 212 } |
| 211 } | 213 } |
| 212 } | 214 } |
| 213 | 215 |
| 214 | 216 |
| 215 void StringStream::Add(const char* format) { | 217 void StringStream::Add(const char* format) { |
| 216 Add(CStrVector(format)); | 218 Add(CStrVector(format)); |
| 217 } | 219 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 Handle<String> StringStream::ToString() { | 294 Handle<String> StringStream::ToString() { |
| 293 Factory* factory = Isolate::Current()->factory(); | 295 Factory* factory = Isolate::Current()->factory(); |
| 294 return factory->NewStringFromUtf8(Vector<const char>(buffer_, length_)); | 296 return factory->NewStringFromUtf8(Vector<const char>(buffer_, length_)); |
| 295 } | 297 } |
| 296 | 298 |
| 297 | 299 |
| 298 void StringStream::ClearMentionedObjectCache() { | 300 void StringStream::ClearMentionedObjectCache() { |
| 299 Isolate* isolate = Isolate::Current(); | 301 Isolate* isolate = Isolate::Current(); |
| 300 isolate->set_string_stream_current_security_token(NULL); | 302 isolate->set_string_stream_current_security_token(NULL); |
| 301 if (isolate->string_stream_debug_object_cache() == NULL) { | 303 if (isolate->string_stream_debug_object_cache() == NULL) { |
| 304 PreallocatedStorageAllocationPolicy policy(isolate); |
| 302 isolate->set_string_stream_debug_object_cache( | 305 isolate->set_string_stream_debug_object_cache( |
| 303 new List<HeapObject*, PreallocatedStorageAllocationPolicy>(0)); | 306 new(policy) DebugObjectCache(policy)); |
| 304 } | 307 } |
| 305 isolate->string_stream_debug_object_cache()->Clear(); | 308 isolate->string_stream_debug_object_cache()->Clear(); |
| 306 } | 309 } |
| 307 | 310 |
| 308 | 311 |
| 309 #ifdef DEBUG | 312 #ifdef DEBUG |
| 310 bool StringStream::IsMentionedObjectCacheClear() { | 313 bool StringStream::IsMentionedObjectCacheClear() { |
| 311 return ( | 314 return ( |
| 312 Isolate::Current()->string_stream_debug_object_cache()->length() == 0); | 315 Isolate::Current()->string_stream_debug_object_cache()->length() == 0); |
| 313 } | 316 } |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 | 596 |
| 594 // Only grow once to the maximum allowable size. | 597 // Only grow once to the maximum allowable size. |
| 595 char* NoAllocationStringAllocator::grow(unsigned* bytes) { | 598 char* NoAllocationStringAllocator::grow(unsigned* bytes) { |
| 596 ASSERT(size_ >= *bytes); | 599 ASSERT(size_ >= *bytes); |
| 597 *bytes = size_; | 600 *bytes = size_; |
| 598 return space_; | 601 return space_; |
| 599 } | 602 } |
| 600 | 603 |
| 601 | 604 |
| 602 } } // namespace v8::internal | 605 } } // namespace v8::internal |
| OLD | NEW |