From 34304f5463df7e1bbfc1c628d461d1f510d61ca1 Mon Sep 17 00:00:00 2001 From: "igor%mir2.org" Date: Fri, 14 Feb 2003 23:56:34 +0000 Subject: [PATCH] Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=191276 : The reason for the bug was that omj/optimizer/Optimizer.java when optimizing code for this[name] (see GETELEM switch, line 665) assumed a number context for GETELEM index node unconditionally which is wrong. The fix uses number context only if [] argument is known for sure to be a number. git-svn-id: svn://10.0.0.236/trunk@137832 18797224-902f-48f8-a5cc-f745e15eee43 --- .../org/mozilla/javascript/optimizer/Optimizer.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mozilla/js/rhino/src/org/mozilla/javascript/optimizer/Optimizer.java b/mozilla/js/rhino/src/org/mozilla/javascript/optimizer/Optimizer.java index d08eb40f027..f4392e747fe 100644 --- a/mozilla/js/rhino/src/org/mozilla/javascript/optimizer/Optimizer.java +++ b/mozilla/js/rhino/src/org/mozilla/javascript/optimizer/Optimizer.java @@ -676,11 +676,12 @@ public class Optimizer { } int indexType = rewriteForNumberVariables(arrayIndex); if (indexType == TypeEvent.NumberType) { - // setting the ISNUMBER_PROP signals the codegen - // to use the scriptRuntime.getElem that takes - // a double index - n.putIntProp(Node.ISNUMBER_PROP, Node.RIGHT); - markDCPNumberContext(arrayIndex); + if (!convertParameter(arrayIndex)) { + // setting the ISNUMBER_PROP signals the codegen + // to use the scriptRuntime.getElem that takes + // a double index + n.putIntProp(Node.ISNUMBER_PROP, Node.RIGHT); + } } return TypeEvent.NoType; }