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

Issue 28112: Adding unit tests for profiler's stack tracer. (Closed)

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

Description

Adding unit tests for profiler's stack tracer. The testing is a bit tricky because we need to obtain a frame pointer (EBP on IA-32) from inside of a function. This is especially interesting in case of a compiled JavaScript function.

Patch Set 1 #

Total comments: 12

Patch Set 2 : Changes according to comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+254 lines, -16 lines) Patch
M src/log.h View 1 1 chunk +11 lines, -0 lines 0 comments Download
M src/log.cc View 3 chunks +19 lines, -15 lines 0 comments Download
M test/cctest/SConscript View 1 chunk +1 line, -1 line 0 comments Download
A test/cctest/test-log-ia32.cc View 1 1 chunk +219 lines, -0 lines 0 comments Download
M tools/visual_studio/v8_cctest.vcproj View 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Mikhail Naganov
11 years, 10 months ago (2009-02-25 10:42:32 UTC) #1
Søren Thygesen Gjesse
Starting to add unit tests for the profiler is an excelent idea. However I think ...
11 years, 10 months ago (2009-02-25 12:34:54 UTC) #2
Søren Thygesen Gjesse
Missed the inline comments. http://codereview.chromium.org/28112/diff/1/3 File src/log.h (right): http://codereview.chromium.org/28112/diff/1/3#newcode276 Line 276: class StackTracer { Please ...
11 years, 10 months ago (2009-02-25 12:36:13 UTC) #3
Mikhail Naganov
11 years, 10 months ago (2009-02-25 15:40:38 UTC) #4
http://codereview.chromium.org/28112/diff/1/3
File src/log.h (right):

http://codereview.chromium.org/28112/diff/1/3#newcode276
Line 276: class StackTracer {
On 2009/02/25 12:36:13, Søren Gjesse wrote:
> Please add BASE_EMBEDDED.

Done.

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

http://codereview.chromium.org/28112/diff/1/5#newcode141
Line 141: static Handle<JSFunction> Compile(const char* source) {
On 2009/02/25 12:36:13, Søren Gjesse wrote:
> For compiling JavaScript I think you should stick to using the public API when
> possible instead of using internal functions, e.g. CompileFunction in
> test-debug.cc. You can always later convert API objects to their internal
> counterparts when required.

Thanks to your suggestion I removed dozen lines of code. I simply didn't knew
about OpenHandle / ToApi utilities before.

http://codereview.chromium.org/28112/diff/1/5#newcode150
Line 150: static void CompileRun(const char* source) {
On 2009/02/25 12:36:13, Søren Gjesse wrote:
> Again use the public API for this.

Done.

http://codereview.chromium.org/28112/diff/1/5#newcode208
Line 208: original, patch, sizeof(patch)));
On 2009/02/25 12:36:13, Søren Gjesse wrote:
> This code patching seems risky and changes to the compiler might break it. How
> about adding a runtime function to return the FP of the caller?

OK, maybe we will get rid of this in the next iteration. E.g. I didn't know
about inline runtime functions.

http://codereview.chromium.org/28112/diff/1/5#newcode210
Line 210: SetGlobalProperty("JSFuncDoTrace", *call_trace);
On 2009/02/25 12:36:13, Søren Gjesse wrote:
> Look at CompileFunction in test-debug.cc to compile 'function JSFuncDOTrace()
{
> ... }'.
> 

I tried this already, but because of lazy compilation, I haven't got a real
compiled code but instead a stub that calls LazyCompile. And running the
function prior to patching is not an option here.

http://codereview.chromium.org/28112/diff/1/5#newcode212
Line 212: SetGlobalProperty("sample", Smi::FromInt(PtrToSmi(&sample)));
On 2009/02/25 12:36:13, Søren Gjesse wrote:
> I don't see the need to store these values in the JS global object. Can't they
> just be global variables in C++? They are only used from C++ code in this
file.

Good idea! Done.

Powered by Google App Engine
This is Rietveld 408576698