TEMPLATE_PERIODIC_PROFILING.S revision a8b91c52fd8a90b784835dfe1f8898035266c4dd
1    /*
2     * Increment profile counter for this trace, and decrement
3     * sample counter.  If sample counter goes below zero, turn
4     * off profiling.
5     *
6     * On entry
7     * (ra-16) is address of pointer to counter.  Note: the counter
8     *    actually exists 16 bytes before the return target for mips.
9     *     - 4 bytes for prof count addr.
10     *     - 4 bytes for chain cell offset (2bytes 32 bit aligned).
11     *     - 4 bytes for call TEMPLATE_PERIODIC_PROFILING.
12     *     - 4 bytes for call delay slot.
13     */
14     lw     a0, -16(ra)
15     lw     a1, offThread_pProfileCountdown(rSELF)
16     lw     a2, 0(a0)                   # get counter
17     lw     a3, 0(a1)                   # get countdown timer
18     addu   a2, 1
19     sub    a3, 1                       # FIXME - bug in ARM code???
20     bltz   a3, .L${opcode}_disable_profiling
21     sw     a2, 0(a0)
22     sw     a3, 0(a1)
23     RETURN
24.L${opcode}_disable_profiling:
25     move   rTEMP, ra                   # preserve ra
26     la     a0, dvmJitTraceProfilingOff
27     JALR(a0)
28     jr     rTEMP
29