JM: Detect MUL overflow on ARM.

RESOLVED DUPLICATE of bug 673314

Status

()

Core
JavaScript Engine
--
enhancement
RESOLVED DUPLICATE of bug 673314
8 years ago
7 years ago

People

(Reporter: jbramley, Assigned: jbramley)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

8 years ago
From jsop_binary:
----
#if defined(JS_CPU_ARM)
        /* ARM cannot detect integer overflow with multiplication. */
        || op == JSOP_MUL
#endif /* JS_CPU_ARM */
----

It is possible using this sequence:

SMULL   rLo, rHi, rA, rB
CMP     rHi, rLo, ASR #31

The 32-bit result will be in rLo. rHi can be any scratch register. The only caveat is that the sequence sets the Z flag, not the V flag.
(Assignee)

Updated

7 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 673314
You need to log in before you can comment on or make changes to this bug.