https://codereview.chromium.org/424973004/diff/120001/test/cctest/test-cpu-profiler.cc
File test/cctest/test-cpu-profiler.cc (right):

https://codereview.chromium.org/424973004/diff/120001/test/cctest/test-cpu-profiler.cc#newcode1134
test/cctest/test-cpu-profiler.cc:1134: CHECK_NE(NULL, line_info);
Yes, you're right.
I debugged the test and found out:
1. There are two ways to get 'code' using JSFunction object (jsf is type
of JSFunction):
 (a) jsf->code()
 (b) jsf->shared()->code()
2. When optimized code is compiled that both
JSFunction::ReplaceCode(Code* code)and
SharedFunctionInfo::ReplaceCode(Code* value) function are called. As the
result, the 'code' objects returned by (a) and (b) contains relocations.
3. Then, optimized version of code is generated and only
SFunction::ReplaceCode(Code* code) is called.
Note that I use func->code() instead of func->shared()->code():

   for (i::RelocIterator it(func->code()); !it.done(); it.next()) {
     i::RelocInfo::Mode mode = it.rinfo()->rmode();
     if (i::RelocInfo::IsPosition(mode)) positions++;
   }

 That's why my previous approach (GetFunctionInfoFromHeap) always works
but new one (OpenHandle) causes a test failure.

 Possible solutions:

 1) For testing purpose, always use unoptimized version of code (e.g.
 func->shared()->code())
    + allows to make the test more deterministic
    - optimized code is not tested

 2) Set FLAG_hydrogen_track_positions flag as true by default before
CompileRun for this test.
    I checked on Windows and see that number of positions is increased
from 9 to 19 for 'func' function from the test.

 I think that the flag should be turned on always to achieve better
mapping to source lines for generated optimized code. We can add a
runtime switch to turn
it on before profiling starts. It's a subject for a separate patch.

Can you suggest other ideas? If not that which of the above is the best?

https://codereview.chromium.org/424973004/

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to