Merge
This commit is contained in:
commit
68a60ffc92
@ -77,6 +77,7 @@ final class WeighNodes extends NodeOperatorVisitor<LexicalContext> {
|
||||
static final long CALL_WEIGHT = 10;
|
||||
static final long CATCH_WEIGHT = 10;
|
||||
static final long COMPARE_WEIGHT = 6;
|
||||
static final long CONST_WEIGHT = 2;
|
||||
static final long CONTINUE_WEIGHT = 1;
|
||||
static final long IF_WEIGHT = 2;
|
||||
static final long LITERAL_WEIGHT = 10;
|
||||
@ -185,7 +186,7 @@ final class WeighNodes extends NodeOperatorVisitor<LexicalContext> {
|
||||
|
||||
@Override
|
||||
public Node leaveIdentNode(final IdentNode identNode) {
|
||||
weight += ACCESS_WEIGHT + identNode.getName().length() * 2;
|
||||
weight += ACCESS_WEIGHT;
|
||||
return identNode;
|
||||
}
|
||||
|
||||
@ -210,6 +211,11 @@ final class WeighNodes extends NodeOperatorVisitor<LexicalContext> {
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public boolean enterLiteralNode(final LiteralNode literalNode) {
|
||||
if (literalNode instanceof LiteralNode.PrimitiveLiteralNode) {
|
||||
weight += CONST_WEIGHT;
|
||||
return false;
|
||||
}
|
||||
|
||||
weight += LITERAL_WEIGHT;
|
||||
|
||||
if (literalNode instanceof ArrayLiteralNode) {
|
||||
|
@ -35,9 +35,13 @@ var File = Java.type("java.io.File");
|
||||
var FilenameFilter = Java.type("java.io.FilenameFilter");
|
||||
var SourceHelper = Java.type("jdk.nashorn.test.models.SourceHelper")
|
||||
|
||||
var skippedTests = {
|
||||
"JDK-8169481.js": true // deep AST can cause stack overflow
|
||||
};
|
||||
|
||||
// Filter out non .js files
|
||||
var files = new File(__DIR__).listFiles(new FilenameFilter() {
|
||||
accept: function(f, n) { return n.endsWith(".js") }
|
||||
accept: function(f, n) { return n.endsWith(".js") && !(n in skippedTests) }
|
||||
});
|
||||
|
||||
// load parser API
|
||||
|
@ -31,7 +31,7 @@
|
||||
var str = "";
|
||||
|
||||
// large code to force splitting
|
||||
for (i = 0; i < 1000; ++i)
|
||||
for (i = 0; i < 2000; ++i)
|
||||
str +="o = new Object()\n";
|
||||
|
||||
str +="g()";
|
||||
|
1043
nashorn/test/script/basic/JDK-8169481.js
Normal file
1043
nashorn/test/script/basic/JDK-8169481.js
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user