From 2de8122c49831ed035988d703bb2d4dbcb030322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 15 Apr 2020 10:05:09 +0000 Subject: [PATCH] Bug 1628836: Add missing JSOp::Pow case for string-int32 arithmetic in CacheIR. r=jandem Differential Revision: https://phabricator.services.mozilla.com/D70807 --HG-- extra : moz-landing-system : lando --- js/src/jit-test/tests/cacheir/string-int32-arith.js | 3 +++ js/src/jit/CacheIR.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/js/src/jit-test/tests/cacheir/string-int32-arith.js b/js/src/jit-test/tests/cacheir/string-int32-arith.js index 1a82ffb4134f..21de7e0d2932 100644 --- a/js/src/jit-test/tests/cacheir/string-int32-arith.js +++ b/js/src/jit-test/tests/cacheir/string-int32-arith.js @@ -13,6 +13,9 @@ function test(zero, one) { assertEq(one / 1, 1); assertEq(10 % one, 0); assertEq(one % 1, 0); + + assertEq(10 ** one, 10); + assertEq(one ** 4, 1); } for (var i = 0; i < 10; i++) { diff --git a/js/src/jit/CacheIR.cpp b/js/src/jit/CacheIR.cpp index 2365b6522c28..ce13af8a38a0 100644 --- a/js/src/jit/CacheIR.cpp +++ b/js/src/jit/CacheIR.cpp @@ -7036,6 +7036,10 @@ AttachDecision BinaryArithIRGenerator::tryAttachStringInt32Arith() { writer.int32ModResult(lhsIntId, rhsIntId); trackAttached("BinaryArith.StringInt32.Mod"); break; + case JSOp::Pow: + writer.int32PowResult(lhsIntId, rhsIntId); + trackAttached("BinaryArith.StringInt32.Pow"); + break; default: MOZ_CRASH("Unhandled op in tryAttachStringInt32Arith"); }