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

Side by Side Diff: bleeding_edge/src/heap-profiler.cc

Issue 500092: Don't bother callling into the ProducerHeapProfile methods... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years 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 | « bleeding_edge/src/heap-profiler.h ('k') | 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 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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 LOG(HeapSampleEndEvent("Heap", "allocated")); 660 LOG(HeapSampleEndEvent("Heap", "allocated"));
661 } 661 }
662 662
663 663
664 bool ProducerHeapProfile::can_log_ = false; 664 bool ProducerHeapProfile::can_log_ = false;
665 665
666 void ProducerHeapProfile::Setup() { 666 void ProducerHeapProfile::Setup() {
667 can_log_ = true; 667 can_log_ = true;
668 } 668 }
669 669
670 void ProducerHeapProfile::RecordJSObjectAllocation(Object* obj) { 670 void ProducerHeapProfile::DoRecordJSObjectAllocation(Object* obj) {
671 if (!can_log_ || !FLAG_log_producers) return; 671 ASSERT(FLAG_log_producers);
672 if (!can_log_) return;
672 int framesCount = 0; 673 int framesCount = 0;
673 for (JavaScriptFrameIterator it; !it.done(); it.Advance()) { 674 for (JavaScriptFrameIterator it; !it.done(); it.Advance()) {
674 ++framesCount; 675 ++framesCount;
675 } 676 }
676 if (framesCount == 0) return; 677 if (framesCount == 0) return;
677 ++framesCount; // Reserve place for the terminator item. 678 ++framesCount; // Reserve place for the terminator item.
678 Vector<Address> stack(NewArray<Address>(framesCount), framesCount); 679 Vector<Address> stack(NewArray<Address>(framesCount), framesCount);
679 int i = 0; 680 int i = 0;
680 for (JavaScriptFrameIterator it; !it.done(); it.Advance()) { 681 for (JavaScriptFrameIterator it; !it.done(); it.Advance()) {
681 stack[i++] = it.frame()->pc(); 682 stack[i++] = it.frame()->pc();
682 } 683 }
683 stack[i] = NULL; 684 stack[i] = NULL;
684 Handle<Object> handle = GlobalHandles::Create(obj); 685 Handle<Object> handle = GlobalHandles::Create(obj);
685 GlobalHandles::MakeWeak(handle.location(), 686 GlobalHandles::MakeWeak(handle.location(),
686 static_cast<void*>(stack.start()), 687 static_cast<void*>(stack.start()),
687 StackWeakReferenceCallback); 688 StackWeakReferenceCallback);
688 } 689 }
689 690
690 691
691 #endif // ENABLE_LOGGING_AND_PROFILING 692 #endif // ENABLE_LOGGING_AND_PROFILING
692 693
693 694
694 } } // namespace v8::internal 695 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « bleeding_edge/src/heap-profiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698