JS: fix array optimization

This commit is contained in:
Alexey Andreev 2021-03-19 14:16:29 +03:00
parent 93d807809d
commit b2b7a603b4
2 changed files with 3 additions and 3 deletions

View File

@ -697,7 +697,9 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
return false; return false;
} }
optimization.unwrappedArrayVariable = ((VariableExpr) assign.getLeftValue()).getIndex(); optimization.unwrappedArrayVariable = ((VariableExpr) assign.getLeftValue()).getIndex();
if (writeFrequencies[optimization.unwrappedArrayVariable] != 1) { if (writeFrequencies[optimization.unwrappedArrayVariable] != 1
|| preservedVars[optimization.unwrappedArrayVariable]
|| readFrequencies[optimization.unwrappedArrayVariable] != optimization.arraySize) {
return false; return false;
} }

View File

@ -21,7 +21,6 @@ import net.java.html.json.tests.KnockoutTest;
import net.java.html.json.tests.MinesTest; import net.java.html.json.tests.MinesTest;
import net.java.html.json.tests.OperationsTest; import net.java.html.json.tests.OperationsTest;
import net.java.html.json.tests.WebSocketTest; import net.java.html.json.tests.WebSocketTest;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.teavm.junit.SkipJVM; import org.teavm.junit.SkipJVM;
@ -35,7 +34,6 @@ import org.teavm.junit.WholeClassCompilation;
@RunWith(TeaVMTestRunner.class) @RunWith(TeaVMTestRunner.class)
@SkipJVM @SkipJVM
@WholeClassCompilation @WholeClassCompilation
@Ignore
public class KnockoutTCKTest { public class KnockoutTCKTest {
private final ConvertTypesTest convertTypesTest = new ConvertTypesTest(); private final ConvertTypesTest convertTypesTest = new ConvertTypesTest();
private final JSONTest jsonTest = new JSONTest(); private final JSONTest jsonTest = new JSONTest();