Closed Bug 775782 Opened 12 years ago Closed 12 years ago

IonMonkey: Instrument pro/epilogue for the SPS profiler

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: u443197, Assigned: u443197)

References

Details

Attachments

(1 file, 2 obsolete files)

As with JaegerMonkey, add instrumentation to IonMonkey JIT code which instruments pro/epilogue to track function entry/exits.
Assignee: general → acrichton
Status: NEW → ASSIGNED
Blocks: 774767
Blocks: 736299
Attached patch patch (obsolete) — Splinter Review
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.
Attachment #644182 - Flags: review?(nicolas.b.pierron)
Attachment #644182 - Flags: review?(luke)
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!
Attached patch patch2 (obsolete) — Splinter Review
Added things to use add32 with an Address, and moved Probes::enterScript for when argument checking fails.
Attachment #644182 - Attachment is obsolete: true
Attachment #644182 - Flags: review?(nicolas.b.pierron)
Attachment #644182 - Flags: review?(luke)
Attachment #644201 - Flags: review?(nicolas.b.pierron)
Attachment #644201 - Flags: review?(luke)
Comment on attachment 644201 [details] [diff] [review]
patch2

I know pretty much nothing about this code so I'll defer.
Attachment #644201 - Flags: review?(luke) → review?(dvander)
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 ;)
Attachment #644201 - Flags: review?(nicolas.b.pierron) → review+
Attached patch patch3Splinter Review
Incorporates Nicolas' requested renamings and such.
Attachment #644201 - Attachment is obsolete: true
Attachment #644201 - Flags: review?(dvander)
Attachment #644527 - Flags: review?(dvander)
Attachment #644527 - Flags: review?(dvander) → review+
http://hg.mozilla.org/projects/ionmonkey/rev/23a84dbb258f
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.