OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 HeapProfiler::HeapProfiler() | 319 HeapProfiler::HeapProfiler() |
320 : snapshots_(new HeapSnapshotsCollection()), | 320 : snapshots_(new HeapSnapshotsCollection()), |
321 next_snapshot_uid_(1) { | 321 next_snapshot_uid_(1) { |
322 } | 322 } |
323 | 323 |
324 | 324 |
325 HeapProfiler::~HeapProfiler() { | 325 HeapProfiler::~HeapProfiler() { |
326 delete snapshots_; | 326 delete snapshots_; |
327 } | 327 } |
328 | 328 |
| 329 #endif // ENABLE_LOGGING_AND_PROFILING |
329 | 330 |
330 void HeapProfiler::Setup() { | 331 void HeapProfiler::Setup() { |
| 332 #ifdef ENABLE_LOGGING_AND_PROFILING |
331 if (singleton_ == NULL) { | 333 if (singleton_ == NULL) { |
332 singleton_ = new HeapProfiler(); | 334 singleton_ = new HeapProfiler(); |
333 } | 335 } |
| 336 #endif |
334 } | 337 } |
335 | 338 |
336 | 339 |
337 void HeapProfiler::TearDown() { | 340 void HeapProfiler::TearDown() { |
| 341 #ifdef ENABLE_LOGGING_AND_PROFILING |
338 delete singleton_; | 342 delete singleton_; |
339 singleton_ = NULL; | 343 singleton_ = NULL; |
| 344 #endif |
340 } | 345 } |
341 | 346 |
342 | 347 |
| 348 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 349 |
343 HeapSnapshot* HeapProfiler::TakeSnapshot(const char* name) { | 350 HeapSnapshot* HeapProfiler::TakeSnapshot(const char* name) { |
344 ASSERT(singleton_ != NULL); | 351 ASSERT(singleton_ != NULL); |
345 return singleton_->TakeSnapshotImpl(name); | 352 return singleton_->TakeSnapshotImpl(name); |
346 } | 353 } |
347 | 354 |
348 | 355 |
349 HeapSnapshot* HeapProfiler::TakeSnapshot(String* name) { | 356 HeapSnapshot* HeapProfiler::TakeSnapshot(String* name) { |
350 ASSERT(singleton_ != NULL); | 357 ASSERT(singleton_ != NULL); |
351 return singleton_->TakeSnapshotImpl(name); | 358 return singleton_->TakeSnapshotImpl(name); |
352 } | 359 } |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 GlobalHandles::MakeWeak(handle.location(), | 762 GlobalHandles::MakeWeak(handle.location(), |
756 static_cast<void*>(stack.start()), | 763 static_cast<void*>(stack.start()), |
757 StackWeakReferenceCallback); | 764 StackWeakReferenceCallback); |
758 } | 765 } |
759 | 766 |
760 | 767 |
761 #endif // ENABLE_LOGGING_AND_PROFILING | 768 #endif // ENABLE_LOGGING_AND_PROFILING |
762 | 769 |
763 | 770 |
764 } } // namespace v8::internal | 771 } } // namespace v8::internal |
OLD | NEW |