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

Issue 50052: Support profiler stack sampling in any situation. (Closed)

Created:
11 years, 9 months ago by Mikhail Naganov
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

Support profiler stack sampling in any situation. After this change, almost all profiler ticks (except GC ones) have a stack sample data associated. Tested under Linux, OS X, and Windows. Committed: http://code.google.com/p/v8/source/detail?r=1565

Patch Set 1 #

Total comments: 28

Patch Set 2 : Fixes according to comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+332 lines, -157 lines) Patch
M SConstruct View 4 chunks +4 lines, -4 lines 0 comments Download
M src/frames.h View 1 15 chunks +41 lines, -13 lines 0 comments Download
M src/frames.cc View 1 9 chunks +100 lines, -35 lines 0 comments Download
M src/frames-arm.h View 1 1 chunk +2 lines, -4 lines 0 comments Download
M src/frames-ia32.h View 1 1 chunk +2 lines, -4 lines 0 comments Download
M src/frames-inl.h View 1 1 chunk +14 lines, -0 lines 0 comments Download
M src/log.h View 1 chunk +1 line, -1 line 0 comments Download
M src/log.cc View 1 2 chunks +11 lines, -22 lines 0 comments Download
M src/platform-win32.cc View 2 chunks +4 lines, -1 line 0 comments Download
M test/cctest/test-log-ia32.cc View 1 8 chunks +153 lines, -73 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Mikhail Naganov
SConstruct has only trailing spaces removed. Sorry for that.
11 years, 9 months ago (2009-03-20 11:15:13 UTC) #1
Søren Thygesen Gjesse
LGTM There is a lot of details in this CL, so I might have missed ...
11 years, 9 months ago (2009-03-20 13:31:32 UTC) #2
Mikhail Naganov
11 years, 9 months ago (2009-03-20 14:39:39 UTC) #3
Thanks! OK, I will migrate to using Addresses in TickSampler.

http://codereview.chromium.org/50052/diff/1/6
File src/frames.cc (right):

http://codereview.chromium.org/50052/diff/1/6#newcode86
Line 86: if (use_top || fp != NULL) {
On 2009/03/20 13:31:33, Søren Gjesse wrote:
> Isn't fp != NULL sufficient?

No. It is possible to have a case when neither Top, nor registers contain valid
pointers. Then we do nothing.

http://codereview.chromium.org/50052/diff/1/6#newcode208
Line 208: StackFrame* frame = iterator_.frame();
On 2009/03/20 13:31:33, Søren Gjesse wrote:
> Maybe call this variable last_frame and prev_frame for frame.

Done.

http://codereview.chromium.org/50052/diff/1/6#newcode222
Line 222: bool SafeStackFrameIterator::IsValidFrame(StackFrame* frame) const {
On 2009/03/20 13:31:33, Søren Gjesse wrote:
> Add a comment on this check (JavaScript frame needs a valid function whereas
> other frames does not)

Done.

http://codereview.chromium.org/50052/diff/1/6#newcode348
Line 348: (void)GetCallerState(state);
On 2009/03/20 13:31:33, Søren Gjesse wrote:
> Is the (void) cast required?

No. Just to indicate that the result is thrown away. Ok, removed.

http://codereview.chromium.org/50052/diff/1/7
File src/frames.h (right):

http://codereview.chromium.org/50052/diff/1/7#newcode422
Line 422: inline Object* function_no_check() const;
On 2009/03/20 13:31:33, Søren Gjesse wrote:
> How about naming this function_slot_object instead?

Done.

http://codereview.chromium.org/50052/diff/1/7#newcode523
Line 523: explicit StackFrameIterator(bool use_top, Address fp, Address sp);
On 2009/03/20 13:31:33, Søren Gjesse wrote:
> explicit not needed anymore.

Done.

http://codereview.chromium.org/50052/diff/1/7#newcode545
Line 545: void (StackFrameIterator::*advance_)(void);
On 2009/03/20 13:31:33, Søren Gjesse wrote:
> (void) -> ()

Done.

http://codereview.chromium.org/50052/diff/1/7#newcode621
Line 621: Address low_bound, Address high_bound);
On 2009/03/20 13:31:33, Søren Gjesse wrote:
> explicit not required.

Done.

http://codereview.chromium.org/50052/diff/1/8
File src/log.cc (right):

http://codereview.chromium.org/50052/diff/1/8#newcode928
Line 928: msg.Append(",0x%x", reinterpret_cast<int>(sample->stack[i]));
On 2009/03/20 13:31:33, Søren Gjesse wrote:
> Change int to uint32_t. Btw. why does %p now work anymore?

Done. Under Windows %p doesn't produce the "0x" prefix.

http://codereview.chromium.org/50052/diff/1/10
File src/platform-win32.cc (right):

http://codereview.chromium.org/50052/diff/1/10#newcode1763
Line 1763: if (sampler_->IsProfiling()) {
On 2009/03/20 13:31:33, Søren Gjesse wrote:
> Good move!

Yes. Otherwise we are sampling the moving stack ;)

http://codereview.chromium.org/50052/diff/1/11
File test/cctest/test-log-ia32.cc (right):

http://codereview.chromium.org/50052/diff/1/11#newcode4
Line 4: 
On 2009/03/20 13:31:33, Søren Gjesse wrote:
> How about changing unsigned int to Address where it is an address in this
file?
> Then use casting in the use of CHECK_GE macros, or add a CHECK_ADDR_GE macros.
> In test-debug.cc I have added helpers for the CHECK_EQ macros for Address, but
> these will not help as you need CHECK_GE unless we change these to call
helpers
> as well, which might be overkill for this.

Let's make this change together with using Address in TickSample.

http://codereview.chromium.org/50052/diff/1/11#newcode34
Line 34: StackTracer* tracer;
On 2009/03/20 13:31:33, Søren Gjesse wrote:
> Initialize tracer and sampler to NULL.

Done.

http://codereview.chromium.org/50052/diff/1/11#newcode49
Line 49: reinterpret_cast<unsigned int>(trace_env.sample) - 10240;
On 2009/03/20 13:31:33, Søren Gjesse wrote:
> Why is 100 not enough any more?

The main change here is to use Sample's address as a base (remember, Sample's
address is used as the lower bound), because FP can contain garbage. 100 then
becomes insufficient.

http://codereview.chromium.org/50052/diff/1/11#newcode210
Line 210: 
On 2009/03/20 13:31:33, Søren Gjesse wrote:
> Please describe this function (e.g. create a JS function which calls another
JS
> function with the current fp value).

Done.

Powered by Google App Engine
This is Rietveld 408576698