aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/jdk/nashorn/internal/codegen/Attr.java9
-rw-r--r--src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java2
-rw-r--r--src/jdk/nashorn/internal/runtime/regexp/joni/encoding/AsciiTables.java2
-rw-r--r--test/script/basic/JDK-8017010.js68
-rw-r--r--test/script/basic/JDK-8017010.js.EXPECTED3
-rw-r--r--test/script/basic/NASHORN-258.js12
-rw-r--r--test/script/basic/NASHORN-258.js.EXPECTED1
7 files changed, 93 insertions, 4 deletions
diff --git a/src/jdk/nashorn/internal/codegen/Attr.java b/src/jdk/nashorn/internal/codegen/Attr.java
index 93805598..9ecf7c89 100644
--- a/src/jdk/nashorn/internal/codegen/Attr.java
+++ b/src/jdk/nashorn/internal/codegen/Attr.java
@@ -577,7 +577,7 @@ final class Attr extends NodeOperatorVisitor {
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
- newTemporary(Type.OBJECT, indexNode); //TORO
+ newTemporary(Type.OBJECT, indexNode); //TODO
return indexNode;
}
@@ -1470,8 +1470,13 @@ final class Attr extends NodeOperatorVisitor {
assignmentDest.accept(new NodeVisitor() {
@Override
public Node leaveIndexNode(final IndexNode indexNode) {
+ assert indexNode.getSymbol().isTemp();
final Node index = indexNode.getIndex();
- index.getSymbol().setNeedsSlot(!index.getSymbol().isConstant());
+ //only temps can be set as needing slots. the others will self resolve
+ //it is illegal to take a scope var and force it to be a slot, that breaks
+ if (index.getSymbol().isTemp() && !index.getSymbol().isConstant()) {
+ index.getSymbol().setNeedsSlot(true);
+ }
return indexNode;
}
});
diff --git a/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java b/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java
index 8aaabe2d..43cc5188 100644
--- a/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java
+++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java
@@ -1459,4 +1459,4 @@ class ByteCodeMachine extends StackMachine {
private int finish() {
return bestLen;
}
-} \ No newline at end of file
+}
diff --git a/src/jdk/nashorn/internal/runtime/regexp/joni/encoding/AsciiTables.java b/src/jdk/nashorn/internal/runtime/regexp/joni/encoding/AsciiTables.java
index 77eba2de..3dec4ba2 100644
--- a/src/jdk/nashorn/internal/runtime/regexp/joni/encoding/AsciiTables.java
+++ b/src/jdk/nashorn/internal/runtime/regexp/joni/encoding/AsciiTables.java
@@ -154,4 +154,4 @@ public class AsciiTables {
{0x59, 0x79},
{0x5a, 0x7a}
};
-} \ No newline at end of file
+}
diff --git a/test/script/basic/JDK-8017010.js b/test/script/basic/JDK-8017010.js
new file mode 100644
index 00000000..aa6e61a9
--- /dev/null
+++ b/test/script/basic/JDK-8017010.js
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8010710 - slot/scope problem with temporary expressions
+ * as array index in self modifying assigns
+ *
+ * @test
+ * @run
+ */
+function zero() {
+ return 0;
+}
+
+//try complex self modifying assignment and force slots to temporary value index operators
+var a = [1, 2, 3, 4, 5];
+var b = [a, a];
+print(b[zero() + 1][2 + a[0]] += 10);
+
+//repro for NASHORN-258 that never made it
+function AddRoundKey() {
+ var r=0;
+ state[r][1] &= 17;
+}
+
+var srcFiles = [];
+for(i=0;i<100;i++) {
+ srcFiles.push('dummy');
+}
+var added = '';
+
+//this broke the javafx build system. verify it works
+function bouncingBall() {
+ for (j=0; j<100; j++) {
+ added += srcFiles[j];
+ }
+}
+bouncingBall();
+print(added);
+
+//this is how they should have done it for speed, that works always, verify this too
+function bouncingBall2() {
+ for (var k=0; k<100; k++) {
+ added += srcFiles[k];
+ }
+}
+bouncingBall2();
+print(added);
diff --git a/test/script/basic/JDK-8017010.js.EXPECTED b/test/script/basic/JDK-8017010.js.EXPECTED
new file mode 100644
index 00000000..296c81e5
--- /dev/null
+++ b/test/script/basic/JDK-8017010.js.EXPECTED
@@ -0,0 +1,3 @@
+14
+dummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummy
+dummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummydummy
diff --git a/test/script/basic/NASHORN-258.js b/test/script/basic/NASHORN-258.js
index 0f4f674b..6d71266a 100644
--- a/test/script/basic/NASHORN-258.js
+++ b/test/script/basic/NASHORN-258.js
@@ -29,6 +29,16 @@
*/
function test3(a) {
+ for (i = 0; i < a.length ; i++) {
+ for (j = 0; j < a[i].length ; j++) {
+ for (k = 0; k < a[i][j].length ; k++) {
+ a[i][j][k] *= 8;
+ }
+ }
+ }
+}
+
+function test3local(a) {
for (var i = 0; i < a.length ; i++) {
for (var j = 0; j < a[i].length ; j++) {
for (var k = 0; k < a[i][j].length ; k++) {
@@ -45,6 +55,8 @@ var array = [ [[1,1,1],[1,1,1],[1,1,1]],
test3(array);
print(array);
+test3local(array);
+print(array);
function outer() {
diff --git a/test/script/basic/NASHORN-258.js.EXPECTED b/test/script/basic/NASHORN-258.js.EXPECTED
index 8c95c914..5986c471 100644
--- a/test/script/basic/NASHORN-258.js.EXPECTED
+++ b/test/script/basic/NASHORN-258.js.EXPECTED
@@ -1,2 +1,3 @@
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
+64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64
1,1,8,1,1,8,1,1,8,1,1,8,1,1,8,1,1,8,1,1,8,1,1,8,1,1,8