Closed Bug 1190446 Opened 9 years ago Closed 9 years ago

Add Code Coverage support to Baseline.

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox42 --- affected
firefox43 --- fixed

People

(Reporter: nbp, Assigned: nbp)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

Currently PCCounts is only in the Interpreter, we should also update the counters in Baseline too, such that we can avoid slowing down the execution by staying in the Interpreter.
This patch updates the numExec counters of the PCCounts, while running in
Baseline.  With the current scheme of updating the numExec counter for each
bytecode, this puts the overhead to 11% of the non-instrumented execution
(on the jsreftest execution).
Attachment #8642470 - Flags: review?(jdemooij)
Comment on attachment 8642470 [details] [diff] [review]
Update Coverage information in Baseline.

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

::: js/src/jit/BaselineCompiler.cpp
@@ +808,5 @@
> +BaselineCompiler::emitCoverage(jsbytecode* pc)
> +{
> +    double* counterAddr = &script->getPCCounts(pc).numExec();
> +    AllocatableRegisterSet regs(RegisterSet::Volatile());
> +    Register counterAddrReg = regs.takeAnyGeneral();

We can keep stack values in R0/R1 between ops, I think using counterAddrReg without saving it could clobber those. Fortunately you can use R2.scratchReg(), it should be available.

@@ +972,5 @@
>          // Emit traps for breakpoints and step mode.
>          if (compileDebugInstrumentation_ && !emitDebugTrap())
>              return Method_Error;
>  
> +        // Emit code coverage code, to fill the same data as the interepreter.

interpreter

@@ +974,5 @@
>              return Method_Error;
>  
> +        // Emit code coverage code, to fill the same data as the interepreter.
> +        if (compileCoverage && !emitCoverage(pc))
> +            return Method_Error;

emitCoverage always returns true so we can just change this to:

if (...)
    emitCoverage();
Attachment #8642470 - Flags: review?(jdemooij)
Side note, the code of emitCovergae is later replaced by an int64 increment, in Bug 1190454.
Attachment #8642470 - Attachment is obsolete: true
Attachment #8646463 - Flags: review?(jdemooij)
Attachment #8646463 - Flags: review?(jdemooij) → review+
https://hg.mozilla.org/mozilla-central/rev/8b68a9f000b3
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
No longer depends on: 1204700
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: