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

Side by Side Diff: src/sampler.cc

Issue 14208012: Move StackTracer to sampler.h (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Updated refs Created 7 years, 8 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
« src/sampler.h ('K') | « src/sampler.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include <mach/mach.h> 52 #include <mach/mach.h>
53 53
54 #elif defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__) 54 #elif defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
55 55
56 #include "win32-headers.h" 56 #include "win32-headers.h"
57 57
58 #endif 58 #endif
59 59
60 #include "v8.h" 60 #include "v8.h"
61 61
62 #include "frames-inl.h"
62 #include "log.h" 63 #include "log.h"
63 #include "platform.h" 64 #include "platform.h"
64 #include "simulator.h" 65 #include "simulator.h"
65 #include "v8threads.h" 66 #include "v8threads.h"
66 67
67 68
68 namespace v8 { 69 namespace v8 {
69 namespace internal { 70 namespace internal {
70 71
71 72
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 ASSERT(IsActive()); 635 ASSERT(IsActive());
635 SamplerThread::RemoveActiveSampler(this); 636 SamplerThread::RemoveActiveSampler(this);
636 SetActive(false); 637 SetActive(false);
637 } 638 }
638 639
639 void Sampler::SampleStack(TickSample* sample) { 640 void Sampler::SampleStack(TickSample* sample) {
640 StackTracer::Trace(isolate_, sample); 641 StackTracer::Trace(isolate_, sample);
641 if (++samples_taken_ < 0) samples_taken_ = 0; 642 if (++samples_taken_ < 0) samples_taken_ = 0;
642 } 643 }
643 644
645 //
646 // StackTracer implementation
647 //
648 DISABLE_ASAN void StackTracer::Trace(Isolate* isolate, TickSample* sample) {
649 ASSERT(isolate->IsInitialized());
650
651 // Avoid collecting traces while doing GC.
652 if (sample->state == GC) return;
653
654 const Address js_entry_sp =
655 Isolate::js_entry_sp(isolate->thread_local_top());
656 if (js_entry_sp == 0) {
657 // Not executing JS now.
658 return;
659 }
660
661 sample->external_callback = isolate->external_callback();
662
663 SafeStackTraceFrameIterator it(isolate,
664 sample->fp, sample->sp,
665 sample->sp, js_entry_sp);
666 int i = 0;
667 while (!it.done() && i < TickSample::kMaxFramesCount) {
668 sample->stack[i++] = it.frame()->pc();
669 it.Advance();
670 }
671 sample->frames_count = i;
672 }
673
644 } } // namespace v8::internal 674 } } // namespace v8::internal
OLDNEW
« src/sampler.h ('K') | « src/sampler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698