Last Comment Bug 775782 - IonMonkey: Instrument pro/epilogue for the SPS profiler
: IonMonkey: Instrument pro/epilogue for the SPS profiler
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
: -- normal (vote)
: ---
Assigned To: u443197
:
: Jason Orendorff [:jorendorff]
Mentors:
Depends on:
Blocks: 736299 774767
  Show dependency treegraph
 
Reported: 2012-07-19 16:45 PDT by u443197
Modified: 2012-07-20 17:18 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (30.27 KB, patch)
2012-07-19 22:47 PDT, u443197
no flags Details | Diff | Splinter Review
patch2 (27.51 KB, patch)
2012-07-20 00:05 PDT, u443197
nicolas.b.pierron: review+
Details | Diff | Splinter Review
patch3 (30.66 KB, patch)
2012-07-20 16:50 PDT, u443197
dvander: review+
Details | Diff | Splinter Review

Description u443197 2012-07-19 16:45:30 PDT
As with JaegerMonkey, add instrumentation to IonMonkey JIT code which instruments pro/epilogue to track function entry/exits.
Comment 1 u443197 2012-07-19 22:47:59 PDT
Created attachment 644182 [details] [diff] [review]
patch

Currently running through try. Last run in try had some ARM build failures that should be fixed now, and some sporadic failures of tests which also fail if I roll back my changes.

I'll do a follow-up patch which respects the slowAssertions field of the SPSProfiler unless it's more appropriate to do here.
Comment 2 David Anderson [:dvander] 2012-07-19 23:33:14 PDT
Comment on attachment 644182 [details] [diff] [review]
patch

Review of attachment 644182 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/ion/Bailouts.cpp
@@ +571,5 @@
> +    // When bailing out from an argument check, none of the code of the
> +    // function has run yet. When profiling, this means that the function
> +    // hasn't flagged its entry just yet. It has been "entered," however, so we
> +    // flag it here manually that the entry has happened.
> +    if (br->bailoutKind() == Bailout_ArgumentCheck) {

Drive-by comment: is it possible to move this check earlier? The less state about bailouts we have to communicate around, the better.

::: js/src/ion/arm/CodeGenerator-arm.cpp
@@ +1424,5 @@
> +bool
> +CodeGeneratorARM::generateCounterAdd(Register temp, void *addr, int32_t delta)
> +{
> +    masm.load32(AbsoluteAddress(addr), temp);
> +    masm.ma_add(Imm32(delta), temp);

drive-by comment: It looks like you can use add32 and move this function to CodeGenerator.h/cpp (and if add32 doesn't exist, feel free to add a helper to MacroAssembler)

Looks great otherwise!
Comment 3 u443197 2012-07-20 00:05:20 PDT
Created attachment 644201 [details] [diff] [review]
patch2

Added things to use add32 with an Address, and moved Probes::enterScript for when argument checking fails.
Comment 4 Luke Wagner [:luke] 2012-07-20 03:11:48 PDT
Comment on attachment 644201 [details] [diff] [review]
patch2

I know pretty much nothing about this code so I'll defer.
Comment 5 Nicolas B. Pierron [:nbp] 2012-07-20 11:30:00 PDT
Comment on attachment 644201 [details] [diff] [review]
patch2

Review of attachment 644201 [details] [diff] [review]:
-----------------------------------------------------------------

Sounds good.

::: js/src/ion/CodeGenerator.cpp
@@ +3730,5 @@
> +    Register base = ToRegister(lir->temp2()->output());
> +
> +    // Check if there's still space on the stack
> +    masm.movePtr(ImmWord(profiler->size()), size);
> +    masm.load32(Address(size, 0), size);

I think you should rename your "size" function to something which map with the idea of a pointer such as sizePointer.

@@ +3732,5 @@
> +    // Check if there's still space on the stack
> +    masm.movePtr(ImmWord(profiler->size()), size);
> +    masm.load32(Address(size, 0), size);
> +    Label stackFull;
> +    masm.branch32(Assembler::GreaterThanOrEqual, size, Imm32(profiler->maxSize()),

uint32_t *size() { return size_; }
uint32_t maxSize() { return max_; }

Because here, I am lost.

::: js/src/ion/IonBuilder.cpp
@@ +2540,5 @@
>          break;
>      }
>  
> +    if (instrumentedProfiling())
> +        current->add(MInstrumentationExit::New());

You might want to look at JSOP_STOP too.

::: js/src/ion/IonFrames.cpp
@@ +307,1 @@
>                  CloseLiveIterators(cx, frames);

CloseLiveIterator is part of the frame, you might want to move it before you declare the exitScript.

::: js/src/ion/LOpcodes.h
@@ +155,5 @@
>      _(InstanceOfO)                  \
>      _(InstanceOfV)                  \
> +    _(InterruptCheck)               \
> +    _(InstrumentationEnter)         \
> +    _(InstrumentationExit)

nit: May be something like SPSProfilerPush & SPSProfilerPop would be more helpful ;)
Comment 6 u443197 2012-07-20 16:50:44 PDT
Created attachment 644527 [details] [diff] [review]
patch3

Incorporates Nicolas' requested renamings and such.

Note You need to log in before you can comment on or make changes to this bug.