From 2f3233a446a8119b1a739750a1b6e64312fee001 Mon Sep 17 00:00:00 2001 From: Tom Schuster Date: Sun, 17 May 2020 18:59:46 +0000 Subject: [PATCH] Bug 1638586 - Transpile Math.abs in Warp. r=iain Differential Revision: https://phabricator.services.mozilla.com/D75692 --- js/src/jit/CacheIROps.yaml | 4 ++-- js/src/jit/WarpCacheIRTranspiler.cpp | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/js/src/jit/CacheIROps.yaml b/js/src/jit/CacheIROps.yaml index 2fc196a58d21..83dc41a4b3b6 100644 --- a/js/src/jit/CacheIROps.yaml +++ b/js/src/jit/CacheIROps.yaml @@ -658,13 +658,13 @@ - name: MathAbsInt32Result shared: true - transpile: false + transpile: true args: input: Int32Id - name: MathAbsNumberResult shared: true - transpile: false + transpile: true args: input: NumberId diff --git a/js/src/jit/WarpCacheIRTranspiler.cpp b/js/src/jit/WarpCacheIRTranspiler.cpp index c8c8ba817185..8f75c311a5fd 100644 --- a/js/src/jit/WarpCacheIRTranspiler.cpp +++ b/js/src/jit/WarpCacheIRTranspiler.cpp @@ -942,6 +942,26 @@ bool WarpCacheIRTranspiler::emitCompareStringResult(JSOp op, return emitCompareResult(op, lhsId, rhsId, MCompare::Compare_String); } +bool WarpCacheIRTranspiler::emitMathAbsInt32Result(Int32OperandId inputId) { + MDefinition* input = getOperand(inputId); + + auto* ins = MAbs::New(alloc(), input, MIRType::Int32); + add(ins); + + pushResult(ins); + return true; +} + +bool WarpCacheIRTranspiler::emitMathAbsNumberResult(NumberOperandId inputId) { + MDefinition* input = getOperand(inputId); + + auto* ins = MAbs::New(alloc(), input, MIRType::Double); + add(ins); + + pushResult(ins); + return true; +} + bool WarpCacheIRTranspiler::emitLoadArgumentFixedSlot(ValOperandId resultId, uint8_t slotIndex) { // Reverse of GetIndexOfArgument specialized to !hasArgumentArray.