Closed Bug 956402 Opened 11 years ago Closed 11 years ago

OdinMonkey: refactoring: add Float to NumLit

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: luke, Assigned: luke)

Details

Attachments

(1 file)

I just noticed that we could simplify the float logic by having float literals use the same NumLit/IsNumericLiteral/ExtractNumericLiteral machinery as everything else. Doing this caused a cascade of minor simplifications which altogether remove 40 lines. The patch would've been shorter if I hadn't had to move NumLit et al to be under ModuleCompiler (b/c they now depend on the definition of ModuleCompiler).
Attachment #8355647 - Flags: review?(benj)
Comment on attachment 8355647 [details] [diff] [review] factor-f32-literal Review of attachment 8355647 [details] [diff] [review]: ----------------------------------------------------------------- Thanks! That's a great refactoring, it integrates way cleaner with the pre-existing code. ::: js/src/jit/AsmJS.cpp @@ +1672,5 @@ > + > +// Represents the type and value of an asm.js numeric literal. > +// > +// A literal is a double iff the literal contains an exponent or decimal point > +// (even if the fractional part is 0). Otherwise, integers may be classified: This comment asks for an update. @@ +1716,5 @@ > + } > + > + float toFloat() const { > + JS_ASSERT(which_ == Float); > + return (float)v_.toDouble(); nit: wouldn't you prefer a C++-er conversion, like return float(v_.toDouble()); though it probably doesn't make a difference for the compiler.
Attachment #8355647 - Flags: review?(benj) → review+
Assignee: nobody → luke
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: