From 49c9ac30f6b5c937613f96e0fa65b2668173eb54 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Tue, 22 Mar 2011 12:35:05 -0700 Subject: [PATCH] [INFER] Don't push a constant value in JSOP_TYPEOF, bug 643733. r=bhackett --- js/src/jit-test/tests/basic/bug643733.js | 4 ++++ js/src/methodjit/FastOps.cpp | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 js/src/jit-test/tests/basic/bug643733.js diff --git a/js/src/jit-test/tests/basic/bug643733.js b/js/src/jit-test/tests/basic/bug643733.js new file mode 100644 index 00000000000..89a6695b3d6 --- /dev/null +++ b/js/src/jit-test/tests/basic/bug643733.js @@ -0,0 +1,4 @@ +var x; +assertEq(-(typeof (x+x)), NaN); +assertEq(-(typeof Math.abs()), NaN); + diff --git a/js/src/methodjit/FastOps.cpp b/js/src/methodjit/FastOps.cpp index f37b9219a96..0d89e588503 100644 --- a/js/src/methodjit/FastOps.cpp +++ b/js/src/methodjit/FastOps.cpp @@ -798,8 +798,10 @@ mjit::Compiler::jsop_typeof() } if (atom) { + RegisterID reg = frame.allocReg(); + masm.move(ImmPtr(ATOM_TO_STRING(atom)), reg); frame.pop(); - frame.push(StringValue(ATOM_TO_STRING(atom))); + frame.pushTypedPayload(JSVAL_TYPE_STRING, reg); return; } }