зеркало из https://github.com/mozilla/pjs.git
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.
This commit is contained in:
Родитель
41b3e5345d
Коммит
c0bc03b5bf
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче