Merge

Fri, 17 May 2013 16:12:59 -0300

author
jlaskey
date
Fri, 17 May 2013 16:12:59 -0300
changeset 275
a92be4c0063b
parent 274
aa1b6e8c51a0
parent 273
98798a6336de
child 276
1d5a8f1f416e

Merge

src/jdk/nashorn/internal/runtime/regexp/DefaultRegExp.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/regexp/joni/AsmCompiler.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/regexp/joni/AsmCompilerSupport.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/regexp/joni/CaptureTreeNode.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/regexp/joni/NameEntry.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/regexp/joni/NativeMachine.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/regexp/joni/UnsetAddrList.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/regexp/joni/ast/CTypeNode.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/regexp/joni/ast/CallNode.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/regexp/joni/bench/AbstractBench.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/regexp/joni/bench/BenchGreedyBacktrack.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/regexp/joni/bench/BenchRailsRegs.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/regexp/joni/bench/BenchSeveralRegexps.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/regexp/joni/constants/Reduce.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/regexp/joni/encoding/AsciiTables.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/regexp/joni/encoding/PosixBracket.java file | annotate | diff | comparison | revisions
src/jdk/nashorn/internal/runtime/regexp/joni/encoding/Ptr.java file | annotate | diff | comparison | revisions
src/netscape/javascript/JSObject.java file | annotate | diff | comparison | revisions
     1.1 --- a/make/build.xml	Fri May 17 14:30:22 2013 -0300
     1.2 +++ b/make/build.xml	Fri May 17 16:12:59 2013 -0300
     1.3 @@ -305,6 +305,8 @@
     1.4        <include name="**/codegen/*Test.class"/>
     1.5        <include name="**/parser/*Test.class"/>
     1.6        <include name="**/runtime/*Test.class"/>
     1.7 +      <include name="**/runtime/regexp/*Test.class"/>
     1.8 +      <include name="**/runtime/regexp/joni/*Test.class"/>
     1.9        <include name="**/framework/*Test.class"/>
    1.10      </fileset>
    1.11  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/src/jdk/nashorn/api/scripting/JSObject.java	Fri May 17 16:12:59 2013 -0300
     2.3 @@ -0,0 +1,87 @@
     2.4 +/*
     2.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.7 + *
     2.8 + * This code is free software; you can redistribute it and/or modify it
     2.9 + * under the terms of the GNU General Public License version 2 only, as
    2.10 + * published by the Free Software Foundation.  Oracle designates this
    2.11 + * particular file as subject to the "Classpath" exception as provided
    2.12 + * by Oracle in the LICENSE file that accompanied this code.
    2.13 + *
    2.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    2.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    2.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    2.17 + * version 2 for more details (a copy is included in the LICENSE file that
    2.18 + * accompanied this code).
    2.19 + *
    2.20 + * You should have received a copy of the GNU General Public License version
    2.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    2.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    2.23 + *
    2.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    2.25 + * or visit www.oracle.com if you need additional information or have any
    2.26 + * questions.
    2.27 + */
    2.28 +
    2.29 +package jdk.nashorn.api.scripting;
    2.30 +
    2.31 +/**
    2.32 + * netscape.javascript.JSObject-like interface for nashorn script objects.
    2.33 + */
    2.34 +public abstract class JSObject {
    2.35 +    /**
    2.36 +     * Call a JavaScript method
    2.37 +     *
    2.38 +     * @param methodName name of method
    2.39 +     * @param args arguments to method
    2.40 +     * @return result of call
    2.41 +     */
    2.42 +    public abstract Object call(String methodName, Object args[]);
    2.43 +
    2.44 +    /**
    2.45 +     * Evaluate a JavaScript expression
    2.46 +     *
    2.47 +     * @param s JavaScript expression to evaluate
    2.48 +     * @return evaluation result
    2.49 +     */
    2.50 +    public abstract Object eval(String s);
    2.51 +
    2.52 +    /**
    2.53 +     * Retrieves a named member of a JavaScript object.
    2.54 +     *
    2.55 +     * @param name of member
    2.56 +     * @return member
    2.57 +     */
    2.58 +    public abstract Object getMember(String name);
    2.59 +
    2.60 +    /**
    2.61 +     * Retrieves an indexed member of a JavaScript object.
    2.62 +     *
    2.63 +     * @param index index of member slot
    2.64 +     * @return member
    2.65 +     */
    2.66 +    public abstract Object getSlot(int index);
    2.67 +
    2.68 +    /**
    2.69 +     * Remove a named member from a JavaScript object
    2.70 +     *
    2.71 +     * @param name name of member
    2.72 +     */
    2.73 +    public abstract void removeMember(String name);
    2.74 +
    2.75 +    /**
    2.76 +     * Set a named member in a JavaScript object
    2.77 +     *
    2.78 +     * @param name  name of member
    2.79 +     * @param value value of member
    2.80 +     */
    2.81 +    public abstract void setMember(String name, Object value);
    2.82 +
    2.83 +    /**
    2.84 +     * Set an indexed member in a JavaScript object
    2.85 +     *
    2.86 +     * @param index index of member slot
    2.87 +     * @param value value of member
    2.88 +     */
    2.89 +    public abstract void setSlot(int index, Object value);
    2.90 +}
     3.1 --- a/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Fri May 17 14:30:22 2013 -0300
     3.2 +++ b/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Fri May 17 16:12:59 2013 -0300
     3.3 @@ -42,7 +42,6 @@
     3.4  import jdk.nashorn.internal.runtime.ScriptFunction;
     3.5  import jdk.nashorn.internal.runtime.ScriptObject;
     3.6  import jdk.nashorn.internal.runtime.ScriptRuntime;
     3.7 -import netscape.javascript.JSObject;
     3.8  
     3.9  /**
    3.10   * Mirror object that wraps a given ScriptObject instance. User can
     4.1 --- a/src/jdk/nashorn/internal/codegen/Lower.java	Fri May 17 14:30:22 2013 -0300
     4.2 +++ b/src/jdk/nashorn/internal/codegen/Lower.java	Fri May 17 16:12:59 2013 -0300
     4.3 @@ -261,19 +261,25 @@
     4.4          return throwNode;
     4.5      }
     4.6  
     4.7 -    private static Node ensureUniqueLabelsIn(final Node node) {
     4.8 +    private static Node ensureUniqueNamesIn(final LexicalContext lc, final Node node) {
     4.9          return node.accept(new NodeVisitor() {
    4.10 -           @Override
    4.11 -           public Node leaveDefault(final Node labelledNode) {
    4.12 -               return labelledNode.ensureUniqueLabels(getLexicalContext());
    4.13 -           }
    4.14 +            @Override
    4.15 +            public Node leaveFunctionNode(final FunctionNode functionNode) {
    4.16 +                final String name = functionNode.getName();
    4.17 +                return functionNode.setName(getLexicalContext(), lc.getCurrentFunction().uniqueName(name));
    4.18 +            }
    4.19 +
    4.20 +            @Override
    4.21 +            public Node leaveDefault(final Node labelledNode) {
    4.22 +                return labelledNode.ensureUniqueLabels(getLexicalContext());
    4.23 +            }
    4.24          });
    4.25      }
    4.26  
    4.27 -    private static List<Statement> copyFinally(final Block finallyBody) {
    4.28 +    private static List<Statement> copyFinally(final LexicalContext lc, final Block finallyBody) {
    4.29          final List<Statement> newStatements = new ArrayList<>();
    4.30          for (final Statement statement : finallyBody.getStatements()) {
    4.31 -            newStatements.add((Statement)ensureUniqueLabelsIn(statement));
    4.32 +            newStatements.add((Statement)ensureUniqueNamesIn(lc, statement));
    4.33              if (statement.hasTerminalFlags()) {
    4.34                  return newStatements;
    4.35              }
    4.36 @@ -316,9 +322,9 @@
    4.37       * @return new try node after splicing finally code (same if nop)
    4.38       */
    4.39      private Node spliceFinally(final TryNode tryNode, final List<ThrowNode> rethrows, final Block finallyBody) {
    4.40 -        final int finish = tryNode.getFinish();
    4.41 -
    4.42          assert tryNode.getFinallyBody() == null;
    4.43 +        final int            finish = tryNode.getFinish();
    4.44 +        final LexicalContext lc     = getLexicalContext();
    4.45  
    4.46          final TryNode newTryNode = (TryNode)tryNode.accept(new NodeVisitor() {
    4.47              final List<Node> insideTry = new ArrayList<>();
    4.48 @@ -338,7 +344,7 @@
    4.49              @Override
    4.50              public Node leaveThrowNode(final ThrowNode throwNode) {
    4.51                  if (rethrows.contains(throwNode)) {
    4.52 -                    final List<Statement> newStatements = copyFinally(finallyBody);
    4.53 +                    final List<Statement> newStatements = copyFinally(lc, finallyBody);
    4.54                      if (!isTerminal(newStatements)) {
    4.55                          newStatements.add(throwNode);
    4.56                      }
    4.57 @@ -372,7 +378,7 @@
    4.58                      resultNode = null;
    4.59                  }
    4.60  
    4.61 -                newStatements.addAll(copyFinally(finallyBody));
    4.62 +                newStatements.addAll(copyFinally(lc, finallyBody));
    4.63                  if (!isTerminal(newStatements)) {
    4.64                      newStatements.add(expr == null ? returnNode : returnNode.setExpression(resultNode));
    4.65                  }
    4.66 @@ -382,7 +388,7 @@
    4.67  
    4.68              private Node copy(final Statement endpoint, final Node targetNode) {
    4.69                  if (!insideTry.contains(targetNode)) {
    4.70 -                    final List<Statement> newStatements = copyFinally(finallyBody);
    4.71 +                    final List<Statement> newStatements = copyFinally(lc, finallyBody);
    4.72                      if (!isTerminal(newStatements)) {
    4.73                          newStatements.add(endpoint);
    4.74                      }
    4.75 @@ -548,7 +554,7 @@
    4.76                  final FunctionNode currentFunction = getLexicalContext().getCurrentFunction();
    4.77                  return callNode.setEvalArgs(
    4.78                      new CallNode.EvalArgs(
    4.79 -                        ensureUniqueLabelsIn(args.get(0)).accept(this),
    4.80 +                        ensureUniqueNamesIn(getLexicalContext(), args.get(0)).accept(this),
    4.81                          compilerConstant(THIS),
    4.82                          evalLocation(callee),
    4.83                          currentFunction.isStrict()));
     5.1 --- a/src/jdk/nashorn/internal/ir/FunctionNode.java	Fri May 17 14:30:22 2013 -0300
     5.2 +++ b/src/jdk/nashorn/internal/ir/FunctionNode.java	Fri May 17 16:12:59 2013 -0300
     5.3 @@ -250,6 +250,7 @@
     5.4          final FunctionNode functionNode,
     5.5          final long lastToken,
     5.6          final int flags,
     5.7 +        final String name,
     5.8          final Type returnType,
     5.9          final CompileUnit compileUnit,
    5.10          final EnumSet<CompilationState> compilationState,
    5.11 @@ -260,6 +261,7 @@
    5.12          super(functionNode);
    5.13  
    5.14          this.flags            = flags;
    5.15 +        this.name             = name;
    5.16          this.returnType       = returnType;
    5.17          this.compileUnit      = compileUnit;
    5.18          this.lastToken        = lastToken;
    5.19 @@ -271,7 +273,6 @@
    5.20  
    5.21          // the fields below never change - they are final and assigned in constructor
    5.22          this.source          = functionNode.source;
    5.23 -        this.name            = functionNode.name;
    5.24          this.ident           = functionNode.ident;
    5.25          this.namespace       = functionNode.namespace;
    5.26          this.declaredSymbols = functionNode.declaredSymbols;
    5.27 @@ -315,7 +316,7 @@
    5.28          if (this.snapshot == null) {
    5.29              return this;
    5.30          }
    5.31 -        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, returnType, compileUnit, compilationState, body, parameters, null, hints));
    5.32 +        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, null, hints));
    5.33      }
    5.34  
    5.35      /**
    5.36 @@ -331,7 +332,7 @@
    5.37          if (isProgram() || parameters.isEmpty()) {
    5.38              return this; //never specialize anything that won't be recompiled
    5.39          }
    5.40 -        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, returnType, compileUnit, compilationState, body, parameters, this, hints));
    5.41 +        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, this, hints));
    5.42      }
    5.43  
    5.44      /**
    5.45 @@ -389,7 +390,7 @@
    5.46          }
    5.47          final EnumSet<CompilationState> newState = EnumSet.copyOf(this.compilationState);
    5.48          newState.add(state);
    5.49 -        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, returnType, compileUnit, newState, body, parameters, snapshot, hints));
    5.50 +        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, newState, body, parameters, snapshot, hints));
    5.51      }
    5.52  
    5.53      /**
    5.54 @@ -410,7 +411,7 @@
    5.55          if (this.hints == hints) {
    5.56              return this;
    5.57          }
    5.58 -        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, returnType, compileUnit, compilationState, body, parameters, snapshot, hints));
    5.59 +        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints));
    5.60      }
    5.61  
    5.62      /**
    5.63 @@ -463,7 +464,7 @@
    5.64          if (this.flags == flags) {
    5.65              return this;
    5.66          }
    5.67 -        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, returnType, compileUnit, compilationState, body, parameters, snapshot, hints));
    5.68 +        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints));
    5.69      }
    5.70  
    5.71      @Override
    5.72 @@ -529,7 +530,7 @@
    5.73      }
    5.74  
    5.75      /**
    5.76 -     * Get the identifier for this function
    5.77 +     * Get the identifier for this function, this is its symbol.
    5.78       * @return the identifier as an IdentityNode
    5.79       */
    5.80      public IdentNode getIdent() {
    5.81 @@ -572,7 +573,7 @@
    5.82          if(this.body == body) {
    5.83              return this;
    5.84          }
    5.85 -        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, returnType, compileUnit, compilationState, body, parameters, snapshot, hints));
    5.86 +        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints));
    5.87      }
    5.88  
    5.89      /**
    5.90 @@ -640,7 +641,7 @@
    5.91          if (this.lastToken == lastToken) {
    5.92              return this;
    5.93          }
    5.94 -        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, returnType, compileUnit, compilationState, body, parameters, snapshot, hints));
    5.95 +        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints));
    5.96      }
    5.97  
    5.98      /**
    5.99 @@ -651,6 +652,20 @@
   5.100          return name;
   5.101      }
   5.102  
   5.103 +
   5.104 +    /**
   5.105 +     * Set the internal name for this function
   5.106 +     * @param lc    lexical context
   5.107 +     * @param name new name
   5.108 +     * @return new function node if changed, otherwise the same
   5.109 +     */
   5.110 +    public FunctionNode setName(final LexicalContext lc, final String name) {
   5.111 +        if (this.name.equals(name)) {
   5.112 +            return this;
   5.113 +        }
   5.114 +        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints));
   5.115 +    }
   5.116 +
   5.117      /**
   5.118       * Check if this function should have all its variables in its own scope. Scripts, split sub-functions, and
   5.119       * functions having with and/or eval blocks are such.
   5.120 @@ -698,7 +713,7 @@
   5.121          if (this.parameters == parameters) {
   5.122              return this;
   5.123          }
   5.124 -        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, returnType, compileUnit, compilationState, body, parameters, snapshot, hints));
   5.125 +        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints));
   5.126      }
   5.127  
   5.128      /**
   5.129 @@ -762,6 +777,7 @@
   5.130                  this,
   5.131                  lastToken,
   5.132                  flags,
   5.133 +                name,
   5.134                  Type.widest(this.returnType, returnType.isObject() ?
   5.135                      Type.OBJECT :
   5.136                      returnType),
   5.137 @@ -801,7 +817,7 @@
   5.138          if (this.compileUnit == compileUnit) {
   5.139              return this;
   5.140          }
   5.141 -        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, returnType, compileUnit, compilationState, body, parameters, snapshot, hints));
   5.142 +        return Node.replaceInLexicalContext(lc, this, new FunctionNode(this, lastToken, flags, name, returnType, compileUnit, compilationState, body, parameters, snapshot, hints));
   5.143      }
   5.144  
   5.145      /**
     6.1 --- a/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Fri May 17 14:30:22 2013 -0300
     6.2 +++ b/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Fri May 17 16:12:59 2013 -0300
     6.3 @@ -38,7 +38,7 @@
     6.4  import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
     6.5  import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
     6.6  import jdk.nashorn.internal.runtime.JSType;
     6.7 -import netscape.javascript.JSObject;
     6.8 +import jdk.nashorn.api.scripting.JSObject;
     6.9  
    6.10  /**
    6.11   * A Dynalink linker to handle web browser built-in JS (DOM etc.) objects as well
     7.1 --- a/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Fri May 17 14:30:22 2013 -0300
     7.2 +++ b/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Fri May 17 16:12:59 2013 -0300
     7.3 @@ -310,7 +310,34 @@
     7.4                  Type.getMethodDescriptor(Type.VOID_TYPE), null, null));
     7.5  
     7.6          mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getClassOverrides", GET_CLASS_INITIALIZER_DESCRIPTOR);
     7.7 -        // Assign MethodHandle fields through invoking getHandle()
     7.8 +        final Label initGlobal;
     7.9 +        if(samName != null) {
    7.10 +            // If the class is a SAM, allow having a ScriptFunction passed as class overrides
    7.11 +            final Label notAFunction = new Label();
    7.12 +            mv.dup();
    7.13 +            mv.instanceOf(SCRIPT_FUNCTION_TYPE);
    7.14 +            mv.ifeq(notAFunction);
    7.15 +            mv.checkcast(SCRIPT_FUNCTION_TYPE);
    7.16 +
    7.17 +            // Assign MethodHandle fields through invoking getHandle() for a ScriptFunction, only assigning the SAM
    7.18 +            // method(s).
    7.19 +            for (final MethodInfo mi : methodInfos) {
    7.20 +                if(mi.getName().equals(samName)) {
    7.21 +                    mv.dup();
    7.22 +                    mv.aconst(Type.getMethodType(mi.type.toMethodDescriptorString()));
    7.23 +                    mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_FUNCTION_DESCRIPTOR);
    7.24 +                } else {
    7.25 +                    mv.visitInsn(ACONST_NULL);
    7.26 +                }
    7.27 +                mv.putstatic(generatedClassName, mi.methodHandleClassFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
    7.28 +            }
    7.29 +            initGlobal = new Label();
    7.30 +            mv.goTo(initGlobal);
    7.31 +            mv.visitLabel(notAFunction);
    7.32 +        } else {
    7.33 +            initGlobal = null;
    7.34 +        }
    7.35 +        // Assign MethodHandle fields through invoking getHandle() for a ScriptObject
    7.36          for (final MethodInfo mi : methodInfos) {
    7.37              mv.dup();
    7.38              mv.aconst(mi.getName());
    7.39 @@ -319,6 +346,9 @@
    7.40              mv.putstatic(generatedClassName, mi.methodHandleClassFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
    7.41          }
    7.42  
    7.43 +        if(initGlobal != null) {
    7.44 +            mv.visitLabel(initGlobal);
    7.45 +        }
    7.46          // Assign "staticGlobal = Context.getGlobal()"
    7.47          invokeGetGlobalWithNullCheck(mv);
    7.48          mv.putstatic(generatedClassName, STATIC_GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
     8.1 --- a/src/jdk/nashorn/internal/runtime/regexp/DefaultRegExp.java	Fri May 17 14:30:22 2013 -0300
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,163 +0,0 @@
     8.4 -/*
     8.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     8.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.7 - *
     8.8 - * This code is free software; you can redistribute it and/or modify it
     8.9 - * under the terms of the GNU General Public License version 2 only, as
    8.10 - * published by the Free Software Foundation.  Oracle designates this
    8.11 - * particular file as subject to the "Classpath" exception as provided
    8.12 - * by Oracle in the LICENSE file that accompanied this code.
    8.13 - *
    8.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
    8.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    8.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    8.17 - * version 2 for more details (a copy is included in the LICENSE file that
    8.18 - * accompanied this code).
    8.19 - *
    8.20 - * You should have received a copy of the GNU General Public License version
    8.21 - * 2 along with this work; if not, write to the Free Software Foundation,
    8.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    8.23 - *
    8.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    8.25 - * or visit www.oracle.com if you need additional information or have any
    8.26 - * questions.
    8.27 - */
    8.28 -
    8.29 -package jdk.nashorn.internal.runtime.regexp;
    8.30 -
    8.31 -import jdk.nashorn.internal.runtime.ParserException;
    8.32 -
    8.33 -import static java.util.regex.Pattern.CASE_INSENSITIVE;
    8.34 -import static java.util.regex.Pattern.MULTILINE;
    8.35 -import static java.util.regex.Pattern.UNICODE_CASE;
    8.36 -
    8.37 -import java.util.regex.Matcher;
    8.38 -import java.util.regex.Pattern;
    8.39 -import java.util.regex.PatternSyntaxException;
    8.40 -
    8.41 -/**
    8.42 - * Default regular expression implementation based on java.util.regex package.
    8.43 - *
    8.44 - * Note that this class is not thread-safe as it stores the current match result
    8.45 - * and the string being matched in instance fields.
    8.46 - */
    8.47 -public class DefaultRegExp extends RegExp {
    8.48 -
    8.49 -    /** Java regexp pattern to use for match. We compile to one of these */
    8.50 -    private Pattern pattern;
    8.51 -
    8.52 -    /** The matcher */
    8.53 -    private RegExpMatcher matcher;
    8.54 -
    8.55 -    /**
    8.56 -     * Construct a Regular expression from the given {@code source} and {@code flags} strings.
    8.57 -     *
    8.58 -     * @param source RegExp source string
    8.59 -     * @param flags RegExp flag string
    8.60 -     * @throws ParserException if flags is invalid or source string has syntax error.
    8.61 -     */
    8.62 -    public DefaultRegExp(final String source, final String flags) throws ParserException {
    8.63 -        super(source, flags);
    8.64 -
    8.65 -        int intFlags = 0;
    8.66 -
    8.67 -        if (isIgnoreCase()) {
    8.68 -            intFlags |= CASE_INSENSITIVE | UNICODE_CASE;
    8.69 -        }
    8.70 -        if (isMultiline()) {
    8.71 -            intFlags |= MULTILINE;
    8.72 -        }
    8.73 -
    8.74 -        try {
    8.75 -            RegExpScanner parsed;
    8.76 -
    8.77 -            try {
    8.78 -                parsed = RegExpScanner.scan(source);
    8.79 -            } catch (final PatternSyntaxException e) {
    8.80 -                // refine the exception with a better syntax error, if this
    8.81 -                // passes, just rethrow what we have
    8.82 -                Pattern.compile(source, intFlags);
    8.83 -                throw e;
    8.84 -            }
    8.85 -
    8.86 -            if (parsed != null) {
    8.87 -                this.pattern = Pattern.compile(parsed.getJavaPattern(), intFlags);
    8.88 -                this.groupsInNegativeLookahead = parsed.getGroupsInNegativeLookahead();
    8.89 -            }
    8.90 -        } catch (final PatternSyntaxException e2) {
    8.91 -            throwParserException("syntax", e2.getMessage());
    8.92 -        }
    8.93 -    }
    8.94 -
    8.95 -    @Override
    8.96 -    public RegExpMatcher match(final String str) {
    8.97 -        if (pattern == null) {
    8.98 -            return null; // never matches or similar, e.g. a[]
    8.99 -        }
   8.100 -
   8.101 -        RegExpMatcher currentMatcher = this.matcher;
   8.102 -
   8.103 -        if (currentMatcher == null || matcher.getInput() != str) {
   8.104 -            currentMatcher = new DefaultMatcher(str);
   8.105 -            this.matcher  = currentMatcher;
   8.106 -        }
   8.107 -
   8.108 -        return currentMatcher;
   8.109 -    }
   8.110 -
   8.111 -    class DefaultMatcher implements RegExpMatcher {
   8.112 -        final String input;
   8.113 -        final Matcher defaultMatcher;
   8.114 -
   8.115 -        DefaultMatcher(final String input) {
   8.116 -            this.input = input;
   8.117 -            this.defaultMatcher = pattern.matcher(input);
   8.118 -        }
   8.119 -
   8.120 -        @Override
   8.121 -        public boolean search(final int start) {
   8.122 -            return defaultMatcher.find(start);
   8.123 -        }
   8.124 -
   8.125 -        @Override
   8.126 -        public String getInput() {
   8.127 -            return input;
   8.128 -        }
   8.129 -
   8.130 -        @Override
   8.131 -        public int start() {
   8.132 -            return defaultMatcher.start();
   8.133 -        }
   8.134 -
   8.135 -        @Override
   8.136 -        public int start(final int group) {
   8.137 -            return defaultMatcher.start(group);
   8.138 -        }
   8.139 -
   8.140 -        @Override
   8.141 -        public int end() {
   8.142 -            return defaultMatcher.end();
   8.143 -        }
   8.144 -
   8.145 -        @Override
   8.146 -        public int end(final int group) {
   8.147 -            return defaultMatcher.end(group);
   8.148 -        }
   8.149 -
   8.150 -        @Override
   8.151 -        public String group() {
   8.152 -            return defaultMatcher.group();
   8.153 -        }
   8.154 -
   8.155 -        @Override
   8.156 -        public String group(final int group) {
   8.157 -            return defaultMatcher.group(group);
   8.158 -        }
   8.159 -
   8.160 -        @Override
   8.161 -        public int groupCount() {
   8.162 -            return defaultMatcher.groupCount();
   8.163 -        }
   8.164 -    }
   8.165 -
   8.166 -}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/JdkRegExp.java	Fri May 17 16:12:59 2013 -0300
     9.3 @@ -0,0 +1,163 @@
     9.4 +/*
     9.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.7 + *
     9.8 + * This code is free software; you can redistribute it and/or modify it
     9.9 + * under the terms of the GNU General Public License version 2 only, as
    9.10 + * published by the Free Software Foundation.  Oracle designates this
    9.11 + * particular file as subject to the "Classpath" exception as provided
    9.12 + * by Oracle in the LICENSE file that accompanied this code.
    9.13 + *
    9.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    9.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    9.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    9.17 + * version 2 for more details (a copy is included in the LICENSE file that
    9.18 + * accompanied this code).
    9.19 + *
    9.20 + * You should have received a copy of the GNU General Public License version
    9.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    9.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    9.23 + *
    9.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    9.25 + * or visit www.oracle.com if you need additional information or have any
    9.26 + * questions.
    9.27 + */
    9.28 +
    9.29 +package jdk.nashorn.internal.runtime.regexp;
    9.30 +
    9.31 +import jdk.nashorn.internal.runtime.ParserException;
    9.32 +
    9.33 +import static java.util.regex.Pattern.CASE_INSENSITIVE;
    9.34 +import static java.util.regex.Pattern.MULTILINE;
    9.35 +import static java.util.regex.Pattern.UNICODE_CASE;
    9.36 +
    9.37 +import java.util.regex.Matcher;
    9.38 +import java.util.regex.Pattern;
    9.39 +import java.util.regex.PatternSyntaxException;
    9.40 +
    9.41 +/**
    9.42 + * Default regular expression implementation based on java.util.regex package.
    9.43 + *
    9.44 + * Note that this class is not thread-safe as it stores the current match result
    9.45 + * and the string being matched in instance fields.
    9.46 + */
    9.47 +public class JdkRegExp extends RegExp {
    9.48 +
    9.49 +    /** Java regexp pattern to use for match. We compile to one of these */
    9.50 +    private Pattern pattern;
    9.51 +
    9.52 +    /** The matcher */
    9.53 +    private RegExpMatcher matcher;
    9.54 +
    9.55 +    /**
    9.56 +     * Construct a Regular expression from the given {@code source} and {@code flags} strings.
    9.57 +     *
    9.58 +     * @param source RegExp source string
    9.59 +     * @param flags RegExp flag string
    9.60 +     * @throws ParserException if flags is invalid or source string has syntax error.
    9.61 +     */
    9.62 +    public JdkRegExp(final String source, final String flags) throws ParserException {
    9.63 +        super(source, flags);
    9.64 +
    9.65 +        int intFlags = 0;
    9.66 +
    9.67 +        if (isIgnoreCase()) {
    9.68 +            intFlags |= CASE_INSENSITIVE | UNICODE_CASE;
    9.69 +        }
    9.70 +        if (isMultiline()) {
    9.71 +            intFlags |= MULTILINE;
    9.72 +        }
    9.73 +
    9.74 +        try {
    9.75 +            RegExpScanner parsed;
    9.76 +
    9.77 +            try {
    9.78 +                parsed = RegExpScanner.scan(source);
    9.79 +            } catch (final PatternSyntaxException e) {
    9.80 +                // refine the exception with a better syntax error, if this
    9.81 +                // passes, just rethrow what we have
    9.82 +                Pattern.compile(source, intFlags);
    9.83 +                throw e;
    9.84 +            }
    9.85 +
    9.86 +            if (parsed != null) {
    9.87 +                this.pattern = Pattern.compile(parsed.getJavaPattern(), intFlags);
    9.88 +                this.groupsInNegativeLookahead = parsed.getGroupsInNegativeLookahead();
    9.89 +            }
    9.90 +        } catch (final PatternSyntaxException e2) {
    9.91 +            throwParserException("syntax", e2.getMessage());
    9.92 +        }
    9.93 +    }
    9.94 +
    9.95 +    @Override
    9.96 +    public RegExpMatcher match(final String str) {
    9.97 +        if (pattern == null) {
    9.98 +            return null; // never matches or similar, e.g. a[]
    9.99 +        }
   9.100 +
   9.101 +        RegExpMatcher currentMatcher = this.matcher;
   9.102 +
   9.103 +        if (currentMatcher == null || matcher.getInput() != str) {
   9.104 +            currentMatcher = new DefaultMatcher(str);
   9.105 +            this.matcher  = currentMatcher;
   9.106 +        }
   9.107 +
   9.108 +        return currentMatcher;
   9.109 +    }
   9.110 +
   9.111 +    class DefaultMatcher implements RegExpMatcher {
   9.112 +        final String input;
   9.113 +        final Matcher defaultMatcher;
   9.114 +
   9.115 +        DefaultMatcher(final String input) {
   9.116 +            this.input = input;
   9.117 +            this.defaultMatcher = pattern.matcher(input);
   9.118 +        }
   9.119 +
   9.120 +        @Override
   9.121 +        public boolean search(final int start) {
   9.122 +            return defaultMatcher.find(start);
   9.123 +        }
   9.124 +
   9.125 +        @Override
   9.126 +        public String getInput() {
   9.127 +            return input;
   9.128 +        }
   9.129 +
   9.130 +        @Override
   9.131 +        public int start() {
   9.132 +            return defaultMatcher.start();
   9.133 +        }
   9.134 +
   9.135 +        @Override
   9.136 +        public int start(final int group) {
   9.137 +            return defaultMatcher.start(group);
   9.138 +        }
   9.139 +
   9.140 +        @Override
   9.141 +        public int end() {
   9.142 +            return defaultMatcher.end();
   9.143 +        }
   9.144 +
   9.145 +        @Override
   9.146 +        public int end(final int group) {
   9.147 +            return defaultMatcher.end(group);
   9.148 +        }
   9.149 +
   9.150 +        @Override
   9.151 +        public String group() {
   9.152 +            return defaultMatcher.group();
   9.153 +        }
   9.154 +
   9.155 +        @Override
   9.156 +        public String group(final int group) {
   9.157 +            return defaultMatcher.group(group);
   9.158 +        }
   9.159 +
   9.160 +        @Override
   9.161 +        public int groupCount() {
   9.162 +            return defaultMatcher.groupCount();
   9.163 +        }
   9.164 +    }
   9.165 +
   9.166 +}
    10.1 --- a/src/jdk/nashorn/internal/runtime/regexp/JoniRegExp.java	Fri May 17 14:30:22 2013 -0300
    10.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/JoniRegExp.java	Fri May 17 16:12:59 2013 -0300
    10.3 @@ -113,7 +113,7 @@
    10.4      public static class Factory extends RegExpFactory {
    10.5  
    10.6          @Override
    10.7 -        protected RegExp compile(final String pattern, final String flags) throws ParserException {
    10.8 +        public RegExp compile(final String pattern, final String flags) throws ParserException {
    10.9              return new JoniRegExp(pattern, flags);
   10.10          }
   10.11  
    11.1 --- a/src/jdk/nashorn/internal/runtime/regexp/RegExpFactory.java	Fri May 17 14:30:22 2013 -0300
    11.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/RegExpFactory.java	Fri May 17 16:12:59 2013 -0300
    11.3 @@ -29,7 +29,7 @@
    11.4  import jdk.nashorn.internal.runtime.options.Options;
    11.5  
    11.6  /**
    11.7 - * Factory class for regular expressions. This class creates instances of {@link DefaultRegExp}.
    11.8 + * Factory class for regular expressions. This class creates instances of {@link JdkRegExp}.
    11.9   * An alternative factory can be installed using the {@code nashorn.regexp.impl} system property.
   11.10   */
   11.11  public class RegExpFactory {
   11.12 @@ -62,8 +62,8 @@
   11.13       * @return new RegExp
   11.14       * @throws ParserException if flags is invalid or pattern string has syntax error.
   11.15       */
   11.16 -    protected RegExp compile(final String pattern, final String flags) throws ParserException {
   11.17 -        return new DefaultRegExp(pattern, flags);
   11.18 +    public RegExp compile(final String pattern, final String flags) throws ParserException {
   11.19 +        return new JdkRegExp(pattern, flags);
   11.20      }
   11.21  
   11.22      /**
    12.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Analyser.java	Fri May 17 14:30:22 2013 -0300
    12.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Analyser.java	Fri May 17 16:12:59 2013 -0300
    12.3 @@ -21,10 +21,7 @@
    12.4  
    12.5  import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsAll;
    12.6  import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsAt;
    12.7 -import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsClear;
    12.8  import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsOnAt;
    12.9 -import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsOnAtSimple;
   12.10 -import static jdk.nashorn.internal.runtime.regexp.joni.Option.isCaptureGroup;
   12.11  import static jdk.nashorn.internal.runtime.regexp.joni.Option.isFindCondition;
   12.12  import static jdk.nashorn.internal.runtime.regexp.joni.Option.isIgnoreCase;
   12.13  import static jdk.nashorn.internal.runtime.regexp.joni.Option.isMultiline;
   12.14 @@ -36,8 +33,6 @@
   12.15  import jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode;
   12.16  import jdk.nashorn.internal.runtime.regexp.joni.ast.BackRefNode;
   12.17  import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode;
   12.18 -import jdk.nashorn.internal.runtime.regexp.joni.ast.CTypeNode;
   12.19 -import jdk.nashorn.internal.runtime.regexp.joni.ast.CallNode;
   12.20  import jdk.nashorn.internal.runtime.regexp.joni.ast.ConsAltNode;
   12.21  import jdk.nashorn.internal.runtime.regexp.joni.ast.EncloseNode;
   12.22  import jdk.nashorn.internal.runtime.regexp.joni.ast.Node;
   12.23 @@ -49,9 +44,7 @@
   12.24  import jdk.nashorn.internal.runtime.regexp.joni.constants.RegexState;
   12.25  import jdk.nashorn.internal.runtime.regexp.joni.constants.StackPopLevel;
   12.26  import jdk.nashorn.internal.runtime.regexp.joni.constants.TargetInfo;
   12.27 -import jdk.nashorn.internal.runtime.regexp.joni.encoding.CharacterType;
   12.28  import jdk.nashorn.internal.runtime.regexp.joni.encoding.ObjPtr;
   12.29 -import jdk.nashorn.internal.runtime.regexp.joni.encoding.Ptr;
   12.30  
   12.31  final class Analyser extends Parser {
   12.32  
   12.33 @@ -74,38 +67,9 @@
   12.34          //regex.repeatRangeAlloc = 0;
   12.35          regex.repeatRangeLo = null;
   12.36          regex.repeatRangeHi = null;
   12.37 -        regex.numCombExpCheck = 0;
   12.38 -
   12.39 -        if (Config.USE_COMBINATION_EXPLOSION_CHECK) regex.numCombExpCheck = 0;
   12.40  
   12.41          parse();
   12.42  
   12.43 -        if (Config.USE_NAMED_GROUP) {
   12.44 -            /* mixed use named group and no-named group */
   12.45 -            if (env.numNamed > 0 && syntax.captureOnlyNamedGroup() && !isCaptureGroup(regex.options)) {
   12.46 -                if (env.numNamed != env.numMem) {
   12.47 -                    root = disableNoNameGroupCapture(root);
   12.48 -                } else {
   12.49 -                    numberedRefCheck(root);
   12.50 -                }
   12.51 -            }
   12.52 -        } // USE_NAMED_GROUP
   12.53 -
   12.54 -        if (Config.USE_NAMED_GROUP) {
   12.55 -            if (env.numCall > 0) {
   12.56 -                env.unsetAddrList = new UnsetAddrList(env.numCall);
   12.57 -                setupSubExpCall(root);
   12.58 -                // r != 0 ???
   12.59 -                subexpRecursiveCheckTrav(root);
   12.60 -                // r < 0 -< err, FOUND_CALLED_NODE = 1
   12.61 -                subexpInfRecursiveCheckTrav(root);
   12.62 -                // r != 0  recursion infinite ???
   12.63 -                regex.numCall = env.numCall;
   12.64 -            } else {
   12.65 -                regex.numCall = 0;
   12.66 -            }
   12.67 -        } // USE_NAMED_GROUP
   12.68 -
   12.69          if (Config.DEBUG_PARSE_TREE_RAW && Config.DEBUG_PARSE_TREE) {
   12.70              Config.log.println("<RAW TREE>");
   12.71              Config.log.println(root + "\n");
   12.72 @@ -129,27 +93,6 @@
   12.73              regex.btMemEnd |= regex.captureHistory;
   12.74          }
   12.75  
   12.76 -        if (Config.USE_COMBINATION_EXPLOSION_CHECK) {
   12.77 -            if (env.backrefedMem == 0 || (Config.USE_SUBEXP_CALL && env.numCall == 0)) {
   12.78 -                setupCombExpCheck(root, 0);
   12.79 -
   12.80 -                if (Config.USE_SUBEXP_CALL && env.hasRecursion) {
   12.81 -                    env.numCombExpCheck = 0;
   12.82 -                } else { // USE_SUBEXP_CALL
   12.83 -                    if (env.combExpMaxRegNum > 0) {
   12.84 -                        for (int i=1; i<env.combExpMaxRegNum; i++) {
   12.85 -                            if (bsAt(env.backrefedMem, i)) {
   12.86 -                                env.numCombExpCheck = 0;
   12.87 -                                break;
   12.88 -                            }
   12.89 -                        }
   12.90 -                    }
   12.91 -                }
   12.92 -
   12.93 -            } // USE_SUBEXP_CALL
   12.94 -            regex.numCombExpCheck = env.numCombExpCheck;
   12.95 -        } // USE_COMBINATION_EXPLOSION_CHECK
   12.96 -
   12.97          regex.clearOptimizeInfo();
   12.98  
   12.99          if (!Config.DONT_OPTIMIZE) setOptimizedInfoFromTree(root);
  12.100 @@ -167,7 +110,6 @@
  12.101          }
  12.102  
  12.103          if (Config.DEBUG_COMPILE) {
  12.104 -            if (Config.USE_NAMED_GROUP) Config.log.print(regex.nameTableToString());
  12.105              Config.log.println("stack used: " + regex.stackNeeded);
  12.106              if (Config.USE_STRING_TEMPLATES) Config.log.print("templates: " + regex.templateNum + "\n");
  12.107              Config.log.println(new ByteCodePrinter(regex).byteCodeListToString());
  12.108 @@ -177,157 +119,6 @@
  12.109          regex.state = RegexState.NORMAL;
  12.110      }
  12.111  
  12.112 -    private void noNameDisableMapFor_cosAlt(Node node, int[]map, Ptr counter) {
  12.113 -        ConsAltNode can = (ConsAltNode)node;
  12.114 -        do {
  12.115 -            can.setCar(noNameDisableMap(can.car, map, counter));
  12.116 -        } while ((can = can.cdr) != null);
  12.117 -    }
  12.118 -
  12.119 -    private void noNameDisableMapFor_quantifier(Node node, int[]map, Ptr counter) {
  12.120 -        QuantifierNode qn = (QuantifierNode)node;
  12.121 -        Node target = qn.target;
  12.122 -        Node old = target;
  12.123 -        target = noNameDisableMap(target, map, counter);
  12.124 -
  12.125 -        if (target != old) {
  12.126 -            qn.setTarget(target);
  12.127 -            if (target.getType() == NodeType.QTFR) qn.reduceNestedQuantifier((QuantifierNode)target);
  12.128 -        }
  12.129 -    }
  12.130 -
  12.131 -    private Node noNameDisableMapFor_enclose(Node node, int[]map, Ptr counter) {
  12.132 -        EncloseNode en = (EncloseNode)node;
  12.133 -        if (en.type == EncloseType.MEMORY) {
  12.134 -            if (en.isNamedGroup()) {
  12.135 -                counter.p++;
  12.136 -                map[en.regNum] = counter.p;
  12.137 -                en.regNum = counter.p;
  12.138 -                //en.target = noNameDisableMap(en.target, map, counter);
  12.139 -                en.setTarget(noNameDisableMap(en.target, map, counter)); // ???
  12.140 -            } else {
  12.141 -                node = en.target;
  12.142 -                en.target = null; // remove first enclose: /(a)(?<b>c)/
  12.143 -                node = noNameDisableMap(node, map, counter);
  12.144 -            }
  12.145 -        } else {
  12.146 -            //en.target = noNameDisableMap(en.target, map, counter);
  12.147 -            en.setTarget(noNameDisableMap(en.target, map, counter)); // ???
  12.148 -        }
  12.149 -        return node;
  12.150 -    }
  12.151 -
  12.152 -    private void noNameDisableMapFor_anchor(Node node, int[]map, Ptr counter) {
  12.153 -        AnchorNode an = (AnchorNode)node;
  12.154 -        switch (an.type) {
  12.155 -            case AnchorNode.PREC_READ:
  12.156 -            case AnchorNode.PREC_READ_NOT:
  12.157 -            case AnchorNode.LOOK_BEHIND:
  12.158 -            case AnchorNode.LOOK_BEHIND_NOT:
  12.159 -                an.setTarget(noNameDisableMap(an.target, map, counter));
  12.160 -        }
  12.161 -    }
  12.162 -
  12.163 -    private Node noNameDisableMap(Node node, int[]map, Ptr counter) {
  12.164 -        switch (node.getType()) {
  12.165 -        case NodeType.LIST:
  12.166 -        case NodeType.ALT:
  12.167 -            noNameDisableMapFor_cosAlt(node, map, counter);
  12.168 -            break;
  12.169 -        case NodeType.QTFR:
  12.170 -            noNameDisableMapFor_quantifier(node, map, counter);
  12.171 -            break;
  12.172 -        case NodeType.ENCLOSE:
  12.173 -            node = noNameDisableMapFor_enclose(node, map, counter);
  12.174 -            break;
  12.175 -        case NodeType.ANCHOR:
  12.176 -            noNameDisableMapFor_anchor(node, map, counter);
  12.177 -            break;
  12.178 -        } // switch
  12.179 -        return node;
  12.180 -    }
  12.181 -
  12.182 -    private void renumberByMap(Node node, int[]map) {
  12.183 -        switch (node.getType()) {
  12.184 -        case NodeType.LIST:
  12.185 -        case NodeType.ALT:
  12.186 -            ConsAltNode can = (ConsAltNode)node;
  12.187 -            do {
  12.188 -                renumberByMap(can.car, map);
  12.189 -            } while ((can = can.cdr) != null);
  12.190 -            break;
  12.191 -
  12.192 -        case NodeType.QTFR:
  12.193 -            renumberByMap(((QuantifierNode)node).target, map);
  12.194 -            break;
  12.195 -
  12.196 -        case NodeType.ENCLOSE:
  12.197 -            renumberByMap(((EncloseNode)node).target, map);
  12.198 -            break;
  12.199 -
  12.200 -        case NodeType.BREF:
  12.201 -            ((BackRefNode)node).renumber(map);
  12.202 -            break;
  12.203 -        } // switch
  12.204 -    }
  12.205 -
  12.206 -    protected final void numberedRefCheck(Node node) {
  12.207 -        switch (node.getType()) {
  12.208 -        case NodeType.LIST:
  12.209 -        case NodeType.ALT:
  12.210 -            ConsAltNode can = (ConsAltNode)node;
  12.211 -            do {
  12.212 -                numberedRefCheck(can.car);
  12.213 -            } while ((can = can.cdr) != null);
  12.214 -            break;
  12.215 -
  12.216 -        case NodeType.QTFR:
  12.217 -            numberedRefCheck(((QuantifierNode)node).target);
  12.218 -            break;
  12.219 -
  12.220 -        case NodeType.ENCLOSE:
  12.221 -            numberedRefCheck(((EncloseNode)node).target);
  12.222 -            break;
  12.223 -
  12.224 -        case NodeType.BREF:
  12.225 -            BackRefNode br = (BackRefNode)node;
  12.226 -            if (!br.isNameRef()) newValueException(ERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED);
  12.227 -            break;
  12.228 -        } // switch
  12.229 -    }
  12.230 -
  12.231 -    protected final Node disableNoNameGroupCapture(Node root) {
  12.232 -        int[]map = new int[env.numMem + 1];
  12.233 -
  12.234 -        for (int i=1; i<=env.numMem; i++) map[i] = 0;
  12.235 -
  12.236 -        root = noNameDisableMap(root, map, new Ptr(0));
  12.237 -        renumberByMap(root, map);
  12.238 -
  12.239 -        for (int i=1, pos=1; i<=env.numMem; i++) {
  12.240 -            if (map[i] > 0) {
  12.241 -                env.memNodes[pos] = env.memNodes[i];
  12.242 -                pos++;
  12.243 -            }
  12.244 -        }
  12.245 -
  12.246 -        int loc = env.captureHistory;
  12.247 -        env.captureHistory = bsClear();
  12.248 -
  12.249 -        for (int i=1; i<=Config.MAX_CAPTURE_HISTORY_GROUP; i++) {
  12.250 -            if (bsAt(loc, i)) {
  12.251 -                env.captureHistory = bsOnAtSimple(env.captureHistory, map[i]);
  12.252 -            }
  12.253 -        }
  12.254 -
  12.255 -        env.numMem = env.numNamed;
  12.256 -        regex.numMem = env.numNamed;
  12.257 -
  12.258 -        regex.renumberNameTable(map);
  12.259 -
  12.260 -        return root;
  12.261 -    }
  12.262 -
  12.263      private void swap(Node a, Node b) {
  12.264          a.swap(b);
  12.265  
  12.266 @@ -352,17 +143,6 @@
  12.267              } while ((can = can.cdr) != null);
  12.268              break;
  12.269  
  12.270 -        case NodeType.CALL:
  12.271 -            if (Config.USE_SUBEXP_CALL) {
  12.272 -                CallNode cn = (CallNode)node;
  12.273 -                if (cn.isRecursion()) {
  12.274 -                    return TargetInfo.IS_EMPTY_REC; /* tiny version */
  12.275 -                } else {
  12.276 -                    info = quantifiersMemoryInfo(cn.target);
  12.277 -                }
  12.278 -            } // USE_SUBEXP_CALL
  12.279 -            break;
  12.280 -
  12.281          case NodeType.QTFR:
  12.282              QuantifierNode qn = (QuantifierNode)node;
  12.283              if (qn.upper != 0) {
  12.284 @@ -417,18 +197,6 @@
  12.285              }
  12.286              break;
  12.287  
  12.288 -        case NodeType.CALL:
  12.289 -            if (Config.USE_SUBEXP_CALL) {
  12.290 -                CallNode cn = (CallNode)node;
  12.291 -                if (cn.isRecursion()) {
  12.292 -                    EncloseNode en = (EncloseNode)cn.target;
  12.293 -                    if (en.isMinFixed()) min = en.minLength;
  12.294 -                } else {
  12.295 -                    min = getMinMatchLength(cn.target);
  12.296 -                }
  12.297 -            } // USE_SUBEXP_CALL
  12.298 -            break;
  12.299 -
  12.300          case NodeType.LIST:
  12.301              ConsAltNode can = (ConsAltNode)node;
  12.302              do {
  12.303 @@ -474,15 +242,13 @@
  12.304              EncloseNode en = (EncloseNode)node;
  12.305              switch (en.type) {
  12.306              case EncloseType.MEMORY:
  12.307 -                if (Config.USE_SUBEXP_CALL) {
  12.308 -                    if (en.isMinFixed()) {
  12.309 -                        min = en.minLength;
  12.310 -                    } else {
  12.311 -                        min = getMinMatchLength(en.target);
  12.312 -                        en.minLength = min;
  12.313 -                        en.setMinFixed();
  12.314 -                    }
  12.315 -                } // USE_SUBEXP_CALL
  12.316 +                if (en.isMinFixed()) {
  12.317 +                    min = en.minLength;
  12.318 +                } else {
  12.319 +                    min = getMinMatchLength(en.target);
  12.320 +                    en.minLength = min;
  12.321 +                    en.setMinFixed();
  12.322 +                }
  12.323                  break;
  12.324  
  12.325              case EncloseType.OPTION:
  12.326 @@ -547,17 +313,6 @@
  12.327              }
  12.328              break;
  12.329  
  12.330 -        case NodeType.CALL:
  12.331 -            if (Config.USE_SUBEXP_CALL) {
  12.332 -                CallNode cn = (CallNode)node;
  12.333 -                if (!cn.isRecursion()) {
  12.334 -                    max = getMaxMatchLength(cn.target);
  12.335 -                } else {
  12.336 -                    max = MinMaxLen.INFINITE_DISTANCE;
  12.337 -                }
  12.338 -            } // USE_SUBEXP_CALL
  12.339 -            break;
  12.340 -
  12.341          case NodeType.QTFR:
  12.342              QuantifierNode qn = (QuantifierNode)node;
  12.343              if (qn.upper != 0) {
  12.344 @@ -576,15 +331,13 @@
  12.345              EncloseNode en = (EncloseNode)node;
  12.346              switch (en.type) {
  12.347              case EncloseType.MEMORY:
  12.348 -                if (Config.USE_SUBEXP_CALL) {
  12.349 -                    if (en.isMaxFixed()) {
  12.350 -                        max = en.maxLength;
  12.351 -                    } else {
  12.352 -                        max = getMaxMatchLength(en.target);
  12.353 -                        en.maxLength = max;
  12.354 -                        en.setMaxFixed();
  12.355 -                    }
  12.356 -                } // USE_SUBEXP_CALL
  12.357 +                if (en.isMaxFixed()) {
  12.358 +                    max = en.maxLength;
  12.359 +                } else {
  12.360 +                    max = getMaxMatchLength(en.target);
  12.361 +                    en.maxLength = max;
  12.362 +                    en.setMaxFixed();
  12.363 +                }
  12.364                  break;
  12.365  
  12.366              case EncloseType.OPTION:
  12.367 @@ -663,17 +416,6 @@
  12.368              }
  12.369              break;
  12.370  
  12.371 -        case NodeType.CALL:
  12.372 -            if (Config.USE_SUBEXP_CALL) {
  12.373 -                CallNode cn = (CallNode)node;
  12.374 -                if (!cn.isRecursion()) {
  12.375 -                    len = getCharLengthTree(cn.target, level);
  12.376 -                } else {
  12.377 -                    returnCode = GET_CHAR_LEN_VARLEN;
  12.378 -                }
  12.379 -            } // USE_SUBEXP_CALL
  12.380 -            break;
  12.381 -
  12.382          case NodeType.CTYPE:
  12.383              len = 1;
  12.384  
  12.385 @@ -686,17 +428,15 @@
  12.386              EncloseNode en = (EncloseNode)node;
  12.387              switch(en.type) {
  12.388              case EncloseType.MEMORY:
  12.389 -                if (Config.USE_SUBEXP_CALL) {
  12.390 -                    if (en.isCLenFixed()) {
  12.391 -                        len = en.charLength;
  12.392 -                    } else {
  12.393 -                        len = getCharLengthTree(en.target, level);
  12.394 -                        if (returnCode == 0) {
  12.395 -                            en.charLength = len;
  12.396 -                            en.setCLenFixed();
  12.397 -                        }
  12.398 +                if (en.isCLenFixed()) {
  12.399 +                    len = en.charLength;
  12.400 +                } else {
  12.401 +                    len = getCharLengthTree(en.target, level);
  12.402 +                    if (returnCode == 0) {
  12.403 +                        en.charLength = len;
  12.404 +                        en.setCLenFixed();
  12.405                      }
  12.406 -                } // USE_SUBEXP_CALL
  12.407 +                }
  12.408                  break;
  12.409  
  12.410              case EncloseType.OPTION:
  12.411 @@ -727,10 +467,6 @@
  12.412          switch(x.getType()) {
  12.413          case NodeType.CTYPE:
  12.414              switch(yType) {
  12.415 -            case NodeType.CTYPE:
  12.416 -                CTypeNode cny = (CTypeNode)y;
  12.417 -                CTypeNode cnx = (CTypeNode)x;
  12.418 -                return cny.ctype == cnx.ctype && cny.not != cnx.not;
  12.419  
  12.420              case NodeType.CCLASS:
  12.421                  // !swap:!
  12.422 @@ -756,37 +492,6 @@
  12.423              CClassNode xc = (CClassNode)x;
  12.424  
  12.425              switch(yType) {
  12.426 -            case NodeType.CTYPE:
  12.427 -                switch(((CTypeNode)y).ctype) {
  12.428 -                case CharacterType.WORD:
  12.429 -                    if (!((CTypeNode)y).not) {
  12.430 -                        if (xc.mbuf == null && !xc.isNot()) {
  12.431 -                            for (int i=0; i<BitSet.SINGLE_BYTE_SIZE; i++) {
  12.432 -                                if (xc.bs.at(i)) {
  12.433 -                                    if (EncodingHelper.isWord(i)) return false;
  12.434 -                                }
  12.435 -                            }
  12.436 -                            return true;
  12.437 -                        }
  12.438 -                        return false;
  12.439 -                    } else {
  12.440 -                        for (int i=0; i<BitSet.SINGLE_BYTE_SIZE; i++) {
  12.441 -                            if (!EncodingHelper.isWord(i)) {
  12.442 -                                if (!xc.isNot()) {
  12.443 -                                    if (xc.bs.at(i)) return false;
  12.444 -                                } else {
  12.445 -                                    if (!xc.bs.at(i)) return false;
  12.446 -                                }
  12.447 -                            }
  12.448 -                        }
  12.449 -                        return true;
  12.450 -                    }
  12.451 -                    // break; not reached
  12.452 -
  12.453 -                default:
  12.454 -                    break;
  12.455 -                } // inner switch
  12.456 -                break;
  12.457  
  12.458              case NodeType.CCLASS:
  12.459                  CClassNode yc = (CClassNode)y;
  12.460 @@ -820,17 +525,6 @@
  12.461              if (xs.length() == 0) break;
  12.462  
  12.463              switch (yType) {
  12.464 -            case NodeType.CTYPE:
  12.465 -                CTypeNode cy = ((CTypeNode)y);
  12.466 -                switch (cy.ctype) {
  12.467 -                case CharacterType.WORD:
  12.468 -                    return !cy.not;
  12.469 -
  12.470 -                default:
  12.471 -                    break;
  12.472 -
  12.473 -                } // inner switch
  12.474 -                break;
  12.475  
  12.476              case NodeType.CCLASS:
  12.477                  CClassNode cc = (CClassNode)y;
  12.478 @@ -873,9 +567,6 @@
  12.479          case NodeType.CANY:
  12.480              break;
  12.481  
  12.482 -        case NodeType.CALL:
  12.483 -            break; // if (Config.USE_SUBEXP_CALL)
  12.484 -
  12.485          case NodeType.CTYPE:
  12.486          case NodeType.CCLASS:
  12.487              if (!exact) n = node;
  12.488 @@ -977,316 +668,6 @@
  12.489          return invalid;
  12.490      }
  12.491  
  12.492 -    private static final int RECURSION_EXIST       = 1;
  12.493 -    private static final int RECURSION_INFINITE    = 2;
  12.494 -    private int subexpInfRecursiveCheck(Node node, boolean head) {
  12.495 -        int r = 0;
  12.496 -
  12.497 -        switch (node.getType()) {
  12.498 -        case NodeType.LIST:
  12.499 -            int min;
  12.500 -            ConsAltNode x = (ConsAltNode)node;
  12.501 -            do {
  12.502 -                int ret = subexpInfRecursiveCheck(x.car, head);
  12.503 -                if (ret == RECURSION_INFINITE) return ret;
  12.504 -                r |= ret;
  12.505 -                if (head) {
  12.506 -                    min = getMinMatchLength(x.car);
  12.507 -                    if (min != 0) head = false;
  12.508 -                }
  12.509 -            } while ((x = x.cdr) != null);
  12.510 -            break;
  12.511 -
  12.512 -        case NodeType.ALT:
  12.513 -            ConsAltNode can = (ConsAltNode)node;
  12.514 -            r = RECURSION_EXIST;
  12.515 -            do {
  12.516 -                int ret = subexpInfRecursiveCheck(can.car, head);
  12.517 -                if (ret == RECURSION_INFINITE) return ret;
  12.518 -                r &= ret;
  12.519 -            } while ((can = can.cdr) != null);
  12.520 -            break;
  12.521 -
  12.522 -        case NodeType.QTFR:
  12.523 -            QuantifierNode qn = (QuantifierNode)node;
  12.524 -            r = subexpInfRecursiveCheck(qn.target, head);
  12.525 -            if (r == RECURSION_EXIST) {
  12.526 -                if (qn.lower == 0) r = 0;
  12.527 -            }
  12.528 -            break;
  12.529 -
  12.530 -        case NodeType.ANCHOR:
  12.531 -            AnchorNode an = (AnchorNode)node;
  12.532 -            switch (an.type) {
  12.533 -            case AnchorType.PREC_READ:
  12.534 -            case AnchorType.PREC_READ_NOT:
  12.535 -            case AnchorType.LOOK_BEHIND:
  12.536 -            case AnchorType.LOOK_BEHIND_NOT:
  12.537 -                r = subexpInfRecursiveCheck(an.target, head);
  12.538 -                break;
  12.539 -            } // inner switch
  12.540 -            break;
  12.541 -
  12.542 -        case NodeType.CALL:
  12.543 -            r = subexpInfRecursiveCheck(((CallNode)node).target, head);
  12.544 -            break;
  12.545 -
  12.546 -        case NodeType.ENCLOSE:
  12.547 -            EncloseNode en = (EncloseNode)node;
  12.548 -            if (en.isMark2()) {
  12.549 -                return 0;
  12.550 -            } else if (en.isMark1()) {
  12.551 -                return !head ? RECURSION_EXIST : RECURSION_INFINITE;
  12.552 -                // throw exception here ???
  12.553 -            } else {
  12.554 -                en.setMark2();
  12.555 -                r = subexpInfRecursiveCheck(en.target, head);
  12.556 -                en.clearMark2();
  12.557 -            }
  12.558 -            break;
  12.559 -
  12.560 -        default:
  12.561 -            break;
  12.562 -        } // switch
  12.563 -        return r;
  12.564 -    }
  12.565 -
  12.566 -    protected final int subexpInfRecursiveCheckTrav(Node node) {
  12.567 -        int r = 0;
  12.568 -
  12.569 -        switch (node.getType()) {
  12.570 -        case NodeType.LIST:
  12.571 -        case NodeType.ALT:
  12.572 -            ConsAltNode can = (ConsAltNode)node;
  12.573 -            do {
  12.574 -                r = subexpInfRecursiveCheckTrav(can.car);
  12.575 -            } while (r == 0 && (can = can.cdr) != null);
  12.576 -            break;
  12.577 -
  12.578 -        case NodeType.QTFR:
  12.579 -            r = subexpInfRecursiveCheckTrav(((QuantifierNode)node).target);
  12.580 -            break;
  12.581 -
  12.582 -        case NodeType.ANCHOR:
  12.583 -            AnchorNode an = (AnchorNode)node;
  12.584 -            switch (an.type) {
  12.585 -            case AnchorType.PREC_READ:
  12.586 -            case AnchorType.PREC_READ_NOT:
  12.587 -            case AnchorType.LOOK_BEHIND:
  12.588 -            case AnchorType.LOOK_BEHIND_NOT:
  12.589 -                r = subexpInfRecursiveCheckTrav(an.target);
  12.590 -                break;
  12.591 -            } // inner switch
  12.592 -            break;
  12.593 -
  12.594 -        case NodeType.ENCLOSE:
  12.595 -            EncloseNode en = (EncloseNode)node;
  12.596 -            if (en.isRecursion()) {
  12.597 -                en.setMark1();
  12.598 -                r = subexpInfRecursiveCheck(en.target, true);
  12.599 -                if (r > 0) newValueException(ERR_NEVER_ENDING_RECURSION);
  12.600 -                en.clearMark1();
  12.601 -            }
  12.602 -            r = subexpInfRecursiveCheckTrav(en.target);
  12.603 -            break;
  12.604 -
  12.605 -        default:
  12.606 -            break;
  12.607 -        } // switch
  12.608 -
  12.609 -        return r;
  12.610 -    }
  12.611 -
  12.612 -    private int subexpRecursiveCheck(Node node) {
  12.613 -        int r = 0;
  12.614 -
  12.615 -        switch (node.getType()) {
  12.616 -        case NodeType.LIST:
  12.617 -        case NodeType.ALT:
  12.618 -            ConsAltNode can = (ConsAltNode)node;
  12.619 -            do {
  12.620 -                r |= subexpRecursiveCheck(can.car);
  12.621 -            } while ((can = can.cdr) != null);
  12.622 -            break;
  12.623 -
  12.624 -        case NodeType.QTFR:
  12.625 -            r = subexpRecursiveCheck(((QuantifierNode)node).target);
  12.626 -            break;
  12.627 -
  12.628 -        case NodeType.ANCHOR:
  12.629 -            AnchorNode an = (AnchorNode)node;
  12.630 -            switch (an.type) {
  12.631 -            case AnchorType.PREC_READ:
  12.632 -            case AnchorType.PREC_READ_NOT:
  12.633 -            case AnchorType.LOOK_BEHIND:
  12.634 -            case AnchorType.LOOK_BEHIND_NOT:
  12.635 -                r = subexpRecursiveCheck(an.target);
  12.636 -                break;
  12.637 -            } // inner switch
  12.638 -            break;
  12.639 -
  12.640 -        case NodeType.CALL:
  12.641 -            CallNode cn = (CallNode)node;
  12.642 -            r = subexpRecursiveCheck(cn.target);
  12.643 -            if (r != 0) cn.setRecursion();
  12.644 -            break;
  12.645 -
  12.646 -        case NodeType.ENCLOSE:
  12.647 -            EncloseNode en = (EncloseNode)node;
  12.648 -            if (en.isMark2()) {
  12.649 -                return 0;
  12.650 -            } else if (en.isMark1()) {
  12.651 -                return 1; /* recursion */
  12.652 -            } else {
  12.653 -                en.setMark2();
  12.654 -                r = subexpRecursiveCheck(en.target);
  12.655 -                en.clearMark2();
  12.656 -            }
  12.657 -            break;
  12.658 -
  12.659 -        default:
  12.660 -            break;
  12.661 -        } // switch
  12.662 -
  12.663 -        return r;
  12.664 -    }
  12.665 -
  12.666 -    private static final int FOUND_CALLED_NODE  = 1;
  12.667 -    protected final int subexpRecursiveCheckTrav(Node node) {
  12.668 -        int r = 0;
  12.669 -
  12.670 -        switch (node.getType()) {
  12.671 -        case NodeType.LIST:
  12.672 -        case NodeType.ALT:
  12.673 -            ConsAltNode can = (ConsAltNode)node;
  12.674 -            do {
  12.675 -                int ret = subexpRecursiveCheckTrav(can.car);
  12.676 -                if (ret == FOUND_CALLED_NODE) {
  12.677 -                    r = FOUND_CALLED_NODE;
  12.678 -                }
  12.679 -                // else if (ret < 0) return ret; ???
  12.680 -            } while ((can = can.cdr) != null);
  12.681 -            break;
  12.682 -
  12.683 -        case NodeType.QTFR:
  12.684 -            QuantifierNode qn = (QuantifierNode)node;
  12.685 -            r = subexpRecursiveCheckTrav(qn.target);
  12.686 -            if (qn.upper == 0) {
  12.687 -                if (r == FOUND_CALLED_NODE) qn.isRefered = true;
  12.688 -            }
  12.689 -            break;
  12.690 -
  12.691 -        case NodeType.ANCHOR:
  12.692 -            AnchorNode an = (AnchorNode)node;
  12.693 -            switch (an.type) {
  12.694 -            case AnchorType.PREC_READ:
  12.695 -            case AnchorType.PREC_READ_NOT:
  12.696 -            case AnchorType.LOOK_BEHIND:
  12.697 -            case AnchorType.LOOK_BEHIND_NOT:
  12.698 -                r = subexpRecursiveCheckTrav(an.target);
  12.699 -                break;
  12.700 -            } // inner switch
  12.701 -            break;
  12.702 -
  12.703 -        case NodeType.ENCLOSE:
  12.704 -            EncloseNode en = (EncloseNode)node;
  12.705 -            if (!en.isRecursion()) {
  12.706 -                if (en.isCalled()) {
  12.707 -                    en.setMark1();
  12.708 -                    r = subexpRecursiveCheck(en.target);
  12.709 -                    if (r != 0) en.setRecursion();
  12.710 -                    en.clearMark1();
  12.711 -                }
  12.712 -            }
  12.713 -            r = subexpRecursiveCheckTrav(en.target);
  12.714 -            if (en.isCalled()) r |= FOUND_CALLED_NODE;
  12.715 -            break;
  12.716 -
  12.717 -        default:
  12.718 -            break;
  12.719 -        } // switch
  12.720 -
  12.721 -        return r;
  12.722 -    }
  12.723 -
  12.724 -    private void setCallAttr(CallNode cn) {
  12.725 -        cn.target = env.memNodes[cn.groupNum]; // no setTarget in call nodes!
  12.726 -        if (cn.target == null) newValueException(ERR_UNDEFINED_NAME_REFERENCE, cn.nameP, cn.nameEnd);
  12.727 -
  12.728 -        ((EncloseNode)cn.target).setCalled();
  12.729 -        env.btMemStart = BitStatus.bsOnAt(env.btMemStart, cn.groupNum);
  12.730 -        cn.unsetAddrList = env.unsetAddrList;
  12.731 -    }
  12.732 -
  12.733 -    protected final void setupSubExpCall(Node node) {
  12.734 -
  12.735 -        switch(node.getType()) {
  12.736 -        case NodeType.LIST:
  12.737 -            ConsAltNode ln = (ConsAltNode)node;
  12.738 -            do {
  12.739 -                setupSubExpCall(ln.car);
  12.740 -            } while ((ln = ln.cdr) != null);
  12.741 -            break;
  12.742 -
  12.743 -        case NodeType.ALT:
  12.744 -            ConsAltNode can = (ConsAltNode)node;
  12.745 -            do {
  12.746 -                setupSubExpCall(can.car);
  12.747 -            } while ((can = can.cdr) != null);
  12.748 -            break;
  12.749 -
  12.750 -        case NodeType.QTFR:
  12.751 -            setupSubExpCall(((QuantifierNode)node).target);
  12.752 -            break;
  12.753 -
  12.754 -        case NodeType.ENCLOSE:
  12.755 -            setupSubExpCall(((EncloseNode)node).target);
  12.756 -            break;
  12.757 -
  12.758 -        case NodeType.CALL:
  12.759 -            CallNode cn = (CallNode)node;
  12.760 -
  12.761 -            if (cn.groupNum != 0) {
  12.762 -                int gNum = cn.groupNum;
  12.763 -
  12.764 -                if (Config.USE_NAMED_GROUP) {
  12.765 -                    if (env.numNamed > 0 && syntax.captureOnlyNamedGroup() && !isCaptureGroup(env.option)) {
  12.766 -                        newValueException(ERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED);
  12.767 -                    }
  12.768 -                } // USE_NAMED_GROUP
  12.769 -                if (gNum > env.numMem) newValueException(ERR_UNDEFINED_GROUP_REFERENCE, cn.nameP, cn.nameEnd);
  12.770 -                setCallAttr(cn);
  12.771 -            } else {
  12.772 -                if (Config.USE_NAMED_GROUP) {
  12.773 -                    NameEntry ne = regex.nameToGroupNumbers(cn.name, cn.nameP, cn.nameEnd);
  12.774 -
  12.775 -                    if (ne == null) {
  12.776 -                        newValueException(ERR_UNDEFINED_NAME_REFERENCE, cn.nameP, cn.nameEnd);
  12.777 -                    } else if (ne.backNum > 1) {
  12.778 -                        newValueException(ERR_MULTIPLEX_DEFINITION_NAME_CALL, cn.nameP, cn.nameEnd);
  12.779 -                    } else {
  12.780 -                        cn.groupNum = ne.backRef1; // ne.backNum == 1 ? ne.backRef1 : ne.backRefs[0]; // ??? need to check ?
  12.781 -                        setCallAttr(cn);
  12.782 -                    }
  12.783 -                }
  12.784 -            }
  12.785 -            break;
  12.786 -
  12.787 -        case NodeType.ANCHOR:
  12.788 -            AnchorNode an = (AnchorNode)node;
  12.789 -            switch (an.type) {
  12.790 -            case AnchorType.PREC_READ:
  12.791 -            case AnchorType.PREC_READ_NOT:
  12.792 -            case AnchorType.LOOK_BEHIND:
  12.793 -            case AnchorType.LOOK_BEHIND_NOT:
  12.794 -                setupSubExpCall(an.target);
  12.795 -                break;
  12.796 -            }
  12.797 -            break;
  12.798 -
  12.799 -        } // switch
  12.800 -    }
  12.801 -
  12.802      /* divide different length alternatives in look-behind.
  12.803      (?<=A|B) ==> (?<=A)|(?<=B)
  12.804      (?<!A|B) ==> (?<!A)(?<!B)
  12.805 @@ -1523,125 +904,6 @@
  12.806          return xnode;
  12.807      }
  12.808  
  12.809 -    private static final int CEC_THRES_NUM_BIG_REPEAT       = 512;
  12.810 -    private static final int CEC_INFINITE_NUM               = 0x7fffffff;
  12.811 -
  12.812 -    private static final int CEC_IN_INFINITE_REPEAT         = (1<<0);
  12.813 -    private static final int CEC_IN_FINITE_REPEAT           = (1<<1);
  12.814 -    private static final int CEC_CONT_BIG_REPEAT            = (1<<2);
  12.815 -
  12.816 -    protected final int setupCombExpCheck(Node node, int state) {
  12.817 -        int r = state;
  12.818 -        int ret;
  12.819 -
  12.820 -        switch (node.getType()) {
  12.821 -        case NodeType.LIST:
  12.822 -            ConsAltNode ln = (ConsAltNode)node;
  12.823 -
  12.824 -            do {
  12.825 -                r = setupCombExpCheck(ln.car, r);
  12.826 -                //prev = ((ConsAltNode)node).car;
  12.827 -            } while (r >= 0 && (ln = ln.cdr) != null);
  12.828 -            break;
  12.829 -
  12.830 -        case NodeType.ALT:
  12.831 -            ConsAltNode an = (ConsAltNode)node;
  12.832 -            do {
  12.833 -                ret = setupCombExpCheck(an.car, state);
  12.834 -                r |= ret;
  12.835 -            } while (ret >= 0 && (an = an.cdr) != null);
  12.836 -            break;
  12.837 -
  12.838 -        case NodeType.QTFR:
  12.839 -            QuantifierNode qn = (QuantifierNode)node;
  12.840 -            int childState = state;
  12.841 -            int addState = 0;
  12.842 -            int varNum;
  12.843 -
  12.844 -            if (!isRepeatInfinite(qn.upper)) {
  12.845 -                if (qn.upper > 1) {
  12.846 -                    /* {0,1}, {1,1} are allowed */
  12.847 -                    childState |= CEC_IN_FINITE_REPEAT;
  12.848 -
  12.849 -                    /* check (a*){n,m}, (a+){n,m} => (a*){n,n}, (a+){n,n} */
  12.850 -                    if (env.backrefedMem == 0) {
  12.851 -                        if (qn.target.getType() == NodeType.ENCLOSE) {
  12.852 -                            EncloseNode en = (EncloseNode)qn.target;
  12.853 -                            if (en.type == EncloseType.MEMORY) {
  12.854 -                                if (en.target.getType() == NodeType.QTFR) {
  12.855 -                                    QuantifierNode q = (QuantifierNode)en.target;
  12.856 -                                    if (isRepeatInfinite(q.upper) && q.greedy == qn.greedy) {
  12.857 -                                        qn.upper = qn.lower == 0 ? 1 : qn.lower;
  12.858 -                                        if (qn.upper == 1) childState = state;
  12.859 -                                    }
  12.860 -                                }
  12.861 -                            }
  12.862 -                        }
  12.863 -                    }
  12.864 -                }
  12.865 -            }
  12.866 -
  12.867 -            if ((state & CEC_IN_FINITE_REPEAT) != 0) {
  12.868 -                qn.combExpCheckNum = -1;
  12.869 -            } else {
  12.870 -                if (isRepeatInfinite(qn.upper)) {
  12.871 -                    varNum = CEC_INFINITE_NUM;
  12.872 -                    childState |= CEC_IN_INFINITE_REPEAT;
  12.873 -                } else {
  12.874 -                    varNum = qn.upper - qn.lower;
  12.875 -                }
  12.876 -
  12.877 -                if (varNum >= CEC_THRES_NUM_BIG_REPEAT) addState |= CEC_CONT_BIG_REPEAT;
  12.878 -
  12.879 -                if (((state & CEC_IN_INFINITE_REPEAT) != 0 && varNum != 0) ||
  12.880 -                   ((state & CEC_CONT_BIG_REPEAT) != 0 && varNum >= CEC_THRES_NUM_BIG_REPEAT)) {
  12.881 -                    if (qn.combExpCheckNum == 0) {
  12.882 -                        env.numCombExpCheck++;
  12.883 -                        qn.combExpCheckNum = env.numCombExpCheck;
  12.884 -                        if (env.currMaxRegNum > env.combExpMaxRegNum) {
  12.885 -                            env.combExpMaxRegNum = env.currMaxRegNum;
  12.886 -                        }
  12.887 -                    }
  12.888 -                }
  12.889 -            }
  12.890 -            r = setupCombExpCheck(qn.target, childState);
  12.891 -            r |= addState;
  12.892 -            break;
  12.893 -
  12.894 -        case NodeType.ENCLOSE:
  12.895 -            EncloseNode en = (EncloseNode)node;
  12.896 -            switch( en.type) {
  12.897 -            case EncloseNode.MEMORY:
  12.898 -                if (env.currMaxRegNum < en.regNum) {
  12.899 -                    env.currMaxRegNum = en.regNum;
  12.900 -                }
  12.901 -                r = setupCombExpCheck(en.target, state);
  12.902 -                break;
  12.903 -
  12.904 -            default:
  12.905 -                r = setupCombExpCheck(en.target, state);
  12.906 -            } // inner switch
  12.907 -            break;
  12.908 -
  12.909 -        case NodeType.CALL:
  12.910 -            if (Config.USE_SUBEXP_CALL) {
  12.911 -                CallNode cn = (CallNode)node;
  12.912 -                if (cn.isRecursion()) {
  12.913 -                    env.hasRecursion = true;
  12.914 -                } else {
  12.915 -                    r = setupCombExpCheck(cn.target, state);
  12.916 -                }
  12.917 -            } // USE_SUBEXP_CALL
  12.918 -            break;
  12.919 -
  12.920 -        default:
  12.921 -            break;
  12.922 -
  12.923 -        } // switch
  12.924 -
  12.925 -        return r;
  12.926 -    }
  12.927 -
  12.928      private static final int IN_ALT                     = (1<<0);
  12.929      private static final int IN_NOT                     = (1<<1);
  12.930      private static final int IN_REPEAT                  = (1<<2);
  12.931 @@ -1691,20 +953,12 @@
  12.932          case NodeType.CANY:
  12.933              break;
  12.934  
  12.935 -        case NodeType.CALL: // if (Config.USE_SUBEXP_CALL) ?
  12.936 -            break;
  12.937 -
  12.938          case NodeType.BREF:
  12.939              BackRefNode br = (BackRefNode)node;
  12.940              for (int i=0; i<br.backNum; i++) {
  12.941                  if (br.back[i] > env.numMem) newValueException(ERR_INVALID_BACKREF);
  12.942                  env.backrefedMem = bsOnAt(env.backrefedMem, br.back[i]);
  12.943                  env.btMemStart = bsOnAt(env.btMemStart, br.back[i]);
  12.944 -                if (Config.USE_BACKREF_WITH_LEVEL) {
  12.945 -                    if (br.isNestLevel()) {
  12.946 -                        env.btMemEnd = bsOnAt(env.btMemEnd, br.back[i]);
  12.947 -                    }
  12.948 -                } // USE_BACKREF_AT_LEVEL
  12.949                  ((EncloseNode)env.memNodes[br.back[i]]).setMemBackrefed();
  12.950              }
  12.951              break;
  12.952 @@ -1916,37 +1170,6 @@
  12.953              break;
  12.954          }
  12.955  
  12.956 -        case NodeType.CTYPE: {
  12.957 -            int min;
  12.958 -            int max = 1;
  12.959 -            if (max == 1) {
  12.960 -                min = 1;
  12.961 -                CTypeNode cn = (CTypeNode)node;
  12.962 -
  12.963 -                switch (cn.ctype) {
  12.964 -                case CharacterType.WORD:
  12.965 -                    if (cn.not) {
  12.966 -                        for (int i=0; i<BitSet.SINGLE_BYTE_SIZE; i++) {
  12.967 -                            if (!EncodingHelper.isWord(i)) {
  12.968 -                                opt.map.addChar(i);
  12.969 -                            }
  12.970 -                        }
  12.971 -                    } else {
  12.972 -                        for (int i=0; i<BitSet.SINGLE_BYTE_SIZE; i++) {
  12.973 -                            if (EncodingHelper.isWord(i)) {
  12.974 -                                opt.map.addChar(i);
  12.975 -                            }
  12.976 -                        }
  12.977 -                    }
  12.978 -                    break;
  12.979 -                } // inner switch
  12.980 -            } else {
  12.981 -                min = 1;
  12.982 -            }
  12.983 -            opt.length.set(min, max);
  12.984 -            break;
  12.985 -        }
  12.986 -
  12.987          case NodeType.CANY: {
  12.988              opt.length.set(1, 1);
  12.989              break;
  12.990 @@ -2008,20 +1231,6 @@
  12.991              break;
  12.992          }
  12.993  
  12.994 -        case NodeType.CALL: {
  12.995 -            if (Config.USE_SUBEXP_CALL) {
  12.996 -                CallNode cn = (CallNode)node;
  12.997 -                if (cn.isRecursion()) {
  12.998 -                    opt.length.set(0, MinMaxLen.INFINITE_DISTANCE);
  12.999 -                } else {
 12.1000 -                    int safe = oenv.options;
 12.1001 -                    oenv.options = ((EncloseNode)cn.target).option;
 12.1002 -                    optimizeNodeLeft(cn.target, opt, oenv);
 12.1003 -                    oenv.options = safe;
 12.1004 -                }
 12.1005 -            } // USE_SUBEXP_CALL
 12.1006 -            break;
 12.1007 -        }
 12.1008  
 12.1009          case NodeType.QTFR: {
 12.1010              NodeOptInfo nopt = new NodeOptInfo();
 12.1011 @@ -2081,7 +1290,7 @@
 12.1012                  break;
 12.1013  
 12.1014              case EncloseType.MEMORY:
 12.1015 -                if (Config.USE_SUBEXP_CALL && ++en.optCount > MAX_NODE_OPT_INFO_REF_COUNT) {
 12.1016 +                if (++en.optCount > MAX_NODE_OPT_INFO_REF_COUNT) {
 12.1017                      int min = 0;
 12.1018                      int max = MinMaxLen.INFINITE_DISTANCE;
 12.1019                      if (en.isMinFixed()) min = en.minLength;
    13.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java	Fri May 17 14:30:22 2013 -0300
    13.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java	Fri May 17 16:12:59 2013 -0300
    13.3 @@ -28,8 +28,6 @@
    13.4  import jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode;
    13.5  import jdk.nashorn.internal.runtime.regexp.joni.ast.BackRefNode;
    13.6  import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode;
    13.7 -import jdk.nashorn.internal.runtime.regexp.joni.ast.CTypeNode;
    13.8 -import jdk.nashorn.internal.runtime.regexp.joni.ast.CallNode;
    13.9  import jdk.nashorn.internal.runtime.regexp.joni.ast.ConsAltNode;
   13.10  import jdk.nashorn.internal.runtime.regexp.joni.ast.EncloseNode;
   13.11  import jdk.nashorn.internal.runtime.regexp.joni.ast.Node;
   13.12 @@ -71,11 +69,6 @@
   13.13          regex.templates = templates;
   13.14          regex.templateNum = templateNum;
   13.15          regex.factory = MatcherFactory.DEFAULT;
   13.16 -
   13.17 -        if (Config.USE_SUBEXP_CALL && analyser.env.unsetAddrList != null) {
   13.18 -            analyser.env.unsetAddrList.fix(regex);
   13.19 -            analyser.env.unsetAddrList = null;
   13.20 -        }
   13.21      }
   13.22  
   13.23      @Override
   13.24 @@ -119,7 +112,7 @@
   13.25          return isNeedStrLenOpExact(op);
   13.26      }
   13.27  
   13.28 -    private int selectStrOpcode(int mbLength, int strLength, boolean ignoreCase) {
   13.29 +    private int selectStrOpcode(int strLength, boolean ignoreCase) {
   13.30          int op;
   13.31  
   13.32          if (ignoreCase) {
   13.33 @@ -128,31 +121,14 @@
   13.34              default:op = OPCode.EXACTN_IC; break;
   13.35              } // switch
   13.36          } else {
   13.37 -            switch (mbLength) {
   13.38 -            case 1:
   13.39 -                switch (strLength) {
   13.40 -                case 1: op = OPCode.EXACT1; break;
   13.41 -                case 2: op = OPCode.EXACT2; break;
   13.42 -                case 3: op = OPCode.EXACT3; break;
   13.43 -                case 4: op = OPCode.EXACT4; break;
   13.44 -                case 5: op = OPCode.EXACT5; break;
   13.45 -                default:op = OPCode.EXACTN; break;
   13.46 -                } // inner switch
   13.47 -                break;
   13.48 -            case 2:
   13.49 -                switch (strLength) {
   13.50 -                case 1: op = OPCode.EXACTMB2N1; break;
   13.51 -                case 2: op = OPCode.EXACTMB2N2; break;
   13.52 -                case 3: op = OPCode.EXACTMB2N3; break;
   13.53 -                default:op = OPCode.EXACTMB2N;  break;
   13.54 -                } // inner switch
   13.55 -                break;
   13.56 -            case 3:
   13.57 -                op = OPCode.EXACTMB3N;
   13.58 -                break;
   13.59 -            default:
   13.60 -                op = OPCode.EXACTMBN;
   13.61 -            } // switch
   13.62 +            switch (strLength) {
   13.63 +            case 1: op = OPCode.EXACT1; break;
   13.64 +            case 2: op = OPCode.EXACT2; break;
   13.65 +            case 3: op = OPCode.EXACT3; break;
   13.66 +            case 4: op = OPCode.EXACT4; break;
   13.67 +            case 5: op = OPCode.EXACT5; break;
   13.68 +            default:op = OPCode.EXACTN; break;
   13.69 +            } // inner switch
   13.70          }
   13.71          return op;
   13.72      }
   13.73 @@ -185,8 +161,8 @@
   13.74          }
   13.75      }
   13.76  
   13.77 -    private int addCompileStringlength(char[] chars, int p, int mbLength, int strLength, boolean ignoreCase) {
   13.78 -        int op = selectStrOpcode(mbLength, strLength, ignoreCase);
   13.79 +    private int addCompileStringlength(char[] chars, int p, int strLength, boolean ignoreCase) {
   13.80 +        int op = selectStrOpcode(strLength, ignoreCase);
   13.81          int len = OPSize.OPCODE;
   13.82  
   13.83          if (Config.USE_STRING_TEMPLATES && opTemplated(op)) {
   13.84 @@ -194,25 +170,21 @@
   13.85              len += OPSize.LENGTH + OPSize.INDEX + OPSize.INDEX;
   13.86          } else {
   13.87              if (isNeedStrLenOpExact(op)) len += OPSize.LENGTH;
   13.88 -            len += mbLength * strLength;
   13.89 +            len += strLength;
   13.90          }
   13.91          if (op == OPCode.EXACTMBN) len += OPSize.LENGTH;
   13.92          return len;
   13.93      }
   13.94  
   13.95      @Override
   13.96 -    protected final void addCompileString(char[] chars, int p, int mbLength, int strLength, boolean ignoreCase) {
   13.97 -        int op = selectStrOpcode(mbLength, strLength, ignoreCase);
   13.98 +    protected final void addCompileString(char[] chars, int p, int strLength, boolean ignoreCase) {
   13.99 +        int op = selectStrOpcode(strLength, ignoreCase);
  13.100          addOpcode(op);
  13.101  
  13.102 -        if (op == OPCode.EXACTMBN) addLength(mbLength);
  13.103 +        if (op == OPCode.EXACTMBN) addLength(1);
  13.104  
  13.105          if (isNeedStrLenOpExact(op)) {
  13.106 -            if (op == OPCode.EXACTN_IC || op == OPCode.EXACTN_IC_SB) {
  13.107 -                addLength(mbLength * strLength);
  13.108 -            } else {
  13.109 -                addLength(strLength);
  13.110 -            }
  13.111 +            addLength(strLength);
  13.112          }
  13.113  
  13.114          if (Config.USE_STRING_TEMPLATES && opTemplated(op)) {
  13.115 @@ -220,7 +192,7 @@
  13.116              addInt(p);
  13.117              addTemplate(chars);
  13.118          } else {
  13.119 -            addChars(chars, p, mbLength * strLength);
  13.120 +            addChars(chars, p, strLength);
  13.121          }
  13.122      }
  13.123  
  13.124 @@ -242,14 +214,14 @@
  13.125              slen++;
  13.126              p++;
  13.127          }
  13.128 -        int r = addCompileStringlength(chars, prev, 1, slen, ambig);
  13.129 +        int r = addCompileStringlength(chars, prev, slen, ambig);
  13.130          rlen += r;
  13.131          return rlen;
  13.132      }
  13.133  
  13.134      private int compileLengthStringRawNode(StringNode sn) {
  13.135          if (sn.length() <= 0) return 0;
  13.136 -        return addCompileStringlength(sn.chars, sn.p, 1 /*sb*/, sn.length(), false);
  13.137 +        return addCompileStringlength(sn.chars, sn.p, sn.length(), false);
  13.138      }
  13.139  
  13.140      private void addMultiByteCClass(CodeRangeBuffer mbuf) {
  13.141 @@ -312,26 +284,6 @@
  13.142      }
  13.143  
  13.144      @Override
  13.145 -    protected void compileCTypeNode(CTypeNode node) {
  13.146 -        CTypeNode cn = node;
  13.147 -        int op;
  13.148 -        switch (cn.ctype) {
  13.149 -        case CharacterType.WORD:
  13.150 -            if (cn.not) {
  13.151 -                op = OPCode.NOT_WORD;
  13.152 -            } else {
  13.153 -                op = OPCode.WORD;
  13.154 -            }
  13.155 -            break;
  13.156 -
  13.157 -        default:
  13.158 -            newInternalException(ERR_PARSER_BUG);
  13.159 -            return; // not reached
  13.160 -        } // inner switch
  13.161 -        addOpcode(op);
  13.162 -    }
  13.163 -
  13.164 -    @Override
  13.165      protected void compileAnyCharNode() {
  13.166          if (isMultiline(regex.options)) {
  13.167              addOpcode(OPCode.ANYCHAR_ML);
  13.168 @@ -341,30 +293,15 @@
  13.169      }
  13.170  
  13.171      @Override
  13.172 -    protected void compileCallNode(CallNode node) {
  13.173 -        addOpcode(OPCode.CALL);
  13.174 -        node.unsetAddrList.add(codeLength, node.target);
  13.175 -        addAbsAddr(0); /*dummy addr.*/
  13.176 -    }
  13.177 -
  13.178 -    @Override
  13.179      protected void compileBackrefNode(BackRefNode node) {
  13.180          BackRefNode br = node;
  13.181 -        if (Config.USE_BACKREF_WITH_LEVEL && br.isNestLevel()) {
  13.182 -            addOpcode(OPCode.BACKREF_WITH_LEVEL);
  13.183 -            addOption(regex.options & Option.IGNORECASE);
  13.184 -            addLength(br.nestLevel);
  13.185 -            // !goto add_bacref_mems;!
  13.186 -            addLength(br.backNum);
  13.187 -            for (int i=br.backNum-1; i>=0; i--) addMemNum(br.back[i]);
  13.188 -            return;
  13.189 -        } else { // USE_BACKREF_AT_LEVEL
  13.190 -            if (br.backNum == 1) {
  13.191 -                if (isIgnoreCase(regex.options)) {
  13.192 -                    addOpcode(OPCode.BACKREFN_IC);
  13.193 -                    addMemNum(br.back[0]);
  13.194 -                } else {
  13.195 -                    switch (br.back[0]) {
  13.196 +        // USE_BACKREF_AT_LEVEL
  13.197 +        if (br.backNum == 1) {
  13.198 +            if (isIgnoreCase(regex.options)) {
  13.199 +                addOpcode(OPCode.BACKREFN_IC);
  13.200 +                addMemNum(br.back[0]);
  13.201 +            } else {
  13.202 +                switch (br.back[0]) {
  13.203                      case 1:
  13.204                          addOpcode(OPCode.BACKREF1);
  13.205                          break;
  13.206 @@ -375,18 +312,17 @@
  13.207                          addOpcode(OPCode.BACKREFN);
  13.208                          addOpcode(br.back[0]);
  13.209                          break;
  13.210 -                    } // switch
  13.211 -                }
  13.212 +                } // switch
  13.213 +            }
  13.214 +        } else {
  13.215 +            if (isIgnoreCase(regex.options)) {
  13.216 +                addOpcode(OPCode.BACKREF_MULTI_IC);
  13.217              } else {
  13.218 -                if (isIgnoreCase(regex.options)) {
  13.219 -                    addOpcode(OPCode.BACKREF_MULTI_IC);
  13.220 -                } else {
  13.221 -                    addOpcode(OPCode.BACKREF_MULTI);
  13.222 -                }
  13.223 -                // !add_bacref_mems:!
  13.224 -                addLength(br.backNum);
  13.225 -                for (int i=br.backNum-1; i>=0; i--) addMemNum(br.back[i]);
  13.226 +                addOpcode(OPCode.BACKREF_MULTI);
  13.227              }
  13.228 +            // !add_bacref_mems:!
  13.229 +            addLength(br.backNum);
  13.230 +            for (int i=br.backNum-1; i>=0; i--) addMemNum(br.back[i]);
  13.231          }
  13.232      }
  13.233  
  13.234 @@ -419,7 +355,7 @@
  13.235  
  13.236          compileTreeEmptyCheck(qn.target, emptyInfo);
  13.237  
  13.238 -        if ((Config.USE_SUBEXP_CALL && regex.numCall > 0) || qn.isInRepeat()) {
  13.239 +        if (qn.isInRepeat()) {
  13.240              addOpcode(qn.greedy ? OPCode.REPEAT_INC_SG : OPCode.REPEAT_INC_NG_SG);
  13.241          } else {
  13.242              addOpcode(qn.greedy ? OPCode.REPEAT_INC : OPCode.REPEAT_INC_NG);
  13.243 @@ -434,193 +370,6 @@
  13.244          return ckn > 0;
  13.245      }
  13.246  
  13.247 -    private int compileCECLengthQuantifierNode(QuantifierNode qn) {
  13.248 -        boolean infinite = isRepeatInfinite(qn.upper);
  13.249 -        int emptyInfo = qn.targetEmptyInfo;
  13.250 -
  13.251 -        int tlen = compileLengthTree(qn.target);
  13.252 -        int ckn = regex.numCombExpCheck > 0 ? qn.combExpCheckNum : 0;
  13.253 -        int cklen = cknOn(ckn) ? OPSize.STATE_CHECK_NUM : 0;
  13.254 -
  13.255 -        /* anychar repeat */
  13.256 -        if (qn.target.getType() == NodeType.CANY) {
  13.257 -            if (qn.greedy && infinite) {
  13.258 -                if (qn.nextHeadExact != null && !cknOn(ckn)) {
  13.259 -                    return OPSize.ANYCHAR_STAR_PEEK_NEXT + tlen * qn.lower + cklen;
  13.260 -                } else {
  13.261 -                    return OPSize.ANYCHAR_STAR + tlen * qn.lower + cklen;
  13.262 -                }
  13.263 -            }
  13.264 -        }
  13.265 -
  13.266 -        int modTLen;
  13.267 -        if (emptyInfo != 0) {
  13.268 -            modTLen = tlen + (OPSize.NULL_CHECK_START + OPSize.NULL_CHECK_END);
  13.269 -        } else {
  13.270 -            modTLen = tlen;
  13.271 -        }
  13.272 -
  13.273 -        int len;
  13.274 -        if (infinite && qn.lower <= 1) {
  13.275 -            if (qn.greedy) {
  13.276 -                if (qn.lower == 1) {
  13.277 -                    len = OPSize.JUMP;
  13.278 -                } else {
  13.279 -                    len = 0;
  13.280 -                }
  13.281 -                len += OPSize.PUSH + cklen + modTLen + OPSize.JUMP;
  13.282 -            } else {
  13.283 -                if (qn.lower == 0) {
  13.284 -                    len = OPSize.JUMP;
  13.285 -                } else {
  13.286 -                    len = 0;
  13.287 -                }
  13.288 -                len += modTLen + OPSize.PUSH + cklen;
  13.289 -            }
  13.290 -        } else if (qn.upper == 0) {
  13.291 -            if (qn.isRefered) { /* /(?<n>..){0}/ */
  13.292 -                len = OPSize.JUMP + tlen;
  13.293 -            } else {
  13.294 -                len = 0;
  13.295 -            }
  13.296 -        } else if (qn.upper == 1 && qn.greedy) {
  13.297 -            if (qn.lower == 0) {
  13.298 -                if (cknOn(ckn)) {
  13.299 -                    len = OPSize.STATE_CHECK_PUSH + tlen;
  13.300 -                } else {
  13.301 -                    len = OPSize.PUSH + tlen;
  13.302 -                }
  13.303 -            } else {
  13.304 -                len = tlen;
  13.305 -            }
  13.306 -        } else if (!qn.greedy && qn.upper == 1 && qn.lower == 0) { /* '??' */
  13.307 -            len = OPSize.PUSH + cklen + OPSize.JUMP + tlen;
  13.308 -        } else {
  13.309 -            len = OPSize.REPEAT_INC + modTLen + OPSize.OPCODE + OPSize.RELADDR + OPSize.MEMNUM;
  13.310 -
  13.311 -            if (cknOn(ckn)) {
  13.312 -                len += OPSize.STATE_CHECK;
  13.313 -            }
  13.314 -        }
  13.315 -        return len;
  13.316 -    }
  13.317 -
  13.318 -    @Override
  13.319 -    protected void compileCECQuantifierNode(QuantifierNode qn) {
  13.320 -        boolean infinite = isRepeatInfinite(qn.upper);
  13.321 -        int emptyInfo = qn.targetEmptyInfo;
  13.322 -
  13.323 -        int tlen = compileLengthTree(qn.target);
  13.324 -
  13.325 -        int ckn = regex.numCombExpCheck > 0 ? qn.combExpCheckNum : 0;
  13.326 -
  13.327 -        if (qn.isAnyCharStar()) {
  13.328 -            compileTreeNTimes(qn.target, qn.lower);
  13.329 -            if (qn.nextHeadExact != null && !cknOn(ckn)) {
  13.330 -                if (isMultiline(regex.options)) {
  13.331 -                    addOpcode(OPCode.ANYCHAR_ML_STAR_PEEK_NEXT);
  13.332 -                } else {
  13.333 -                    addOpcode(OPCode.ANYCHAR_STAR_PEEK_NEXT);
  13.334 -                }
  13.335 -                if (cknOn(ckn)) {
  13.336 -                    addStateCheckNum(ckn);
  13.337 -                }
  13.338 -                StringNode sn = (StringNode)qn.nextHeadExact;
  13.339 -                addChars(sn.chars, sn.p, 1);
  13.340 -                return;
  13.341 -            } else {
  13.342 -                if (isMultiline(regex.options)) {
  13.343 -                    if (cknOn(ckn)) {
  13.344 -                        addOpcode(OPCode.STATE_CHECK_ANYCHAR_ML_STAR);
  13.345 -                    } else {
  13.346 -                        addOpcode(OPCode.ANYCHAR_ML_STAR);
  13.347 -                    }
  13.348 -                } else {
  13.349 -                    if (cknOn(ckn)) {
  13.350 -                        addOpcode(OPCode.STATE_CHECK_ANYCHAR_STAR);
  13.351 -                    } else {
  13.352 -                        addOpcode(OPCode.ANYCHAR_STAR);
  13.353 -                    }
  13.354 -                }
  13.355 -                if (cknOn(ckn)) {
  13.356 -                    addStateCheckNum(ckn);
  13.357 -                }
  13.358 -                return;
  13.359 -            }
  13.360 -        }
  13.361 -
  13.362 -        int modTLen;
  13.363 -        if (emptyInfo != 0) {
  13.364 -            modTLen = tlen + (OPSize.NULL_CHECK_START + OPSize.NULL_CHECK_END);
  13.365 -        } else {
  13.366 -            modTLen = tlen;
  13.367 -        }
  13.368 -        if (infinite && qn.lower <= 1) {
  13.369 -            if (qn.greedy) {
  13.370 -                if (qn.lower == 1) {
  13.371 -                    addOpcodeRelAddr(OPCode.JUMP, cknOn(ckn) ? OPSize.STATE_CHECK_PUSH :
  13.372 -                                                                     OPSize.PUSH);
  13.373 -                }
  13.374 -                if (cknOn(ckn)) {
  13.375 -                    addOpcode(OPCode.STATE_CHECK_PUSH);
  13.376 -                    addStateCheckNum(ckn);
  13.377 -                    addRelAddr(modTLen + OPSize.JUMP);
  13.378 -                } else {
  13.379 -                    addOpcodeRelAddr(OPCode.PUSH, modTLen + OPSize.JUMP);
  13.380 -                }
  13.381 -                compileTreeEmptyCheck(qn.target, emptyInfo);
  13.382 -                addOpcodeRelAddr(OPCode.JUMP, -(modTLen + OPSize.JUMP + (cknOn(ckn) ?
  13.383 -                                                                               OPSize.STATE_CHECK_PUSH :
  13.384 -                                                                               OPSize.PUSH)));
  13.385 -            } else {
  13.386 -                if (qn.lower == 0) {
  13.387 -                    addOpcodeRelAddr(OPCode.JUMP, modTLen);
  13.388 -                }
  13.389 -                compileTreeEmptyCheck(qn.target, emptyInfo);
  13.390 -                if (cknOn(ckn)) {
  13.391 -                    addOpcode(OPCode.STATE_CHECK_PUSH_OR_JUMP);
  13.392 -                    addStateCheckNum(ckn);
  13.393 -                    addRelAddr(-(modTLen + OPSize.STATE_CHECK_PUSH_OR_JUMP));
  13.394 -                } else {
  13.395 -                    addOpcodeRelAddr(OPCode.PUSH, -(modTLen + OPSize.PUSH));
  13.396 -                }
  13.397 -            }
  13.398 -        } else if (qn.upper == 0) {
  13.399 -            if (qn.isRefered) { /* /(?<n>..){0}/ */
  13.400 -                addOpcodeRelAddr(OPCode.JUMP, tlen);
  13.401 -                compileTree(qn.target);
  13.402 -            } // else r=0 ???
  13.403 -        } else if (qn.upper == 1 && qn.greedy) {
  13.404 -            if (qn.lower == 0) {
  13.405 -                if (cknOn(ckn)) {
  13.406 -                    addOpcode(OPCode.STATE_CHECK_PUSH);
  13.407 -                    addStateCheckNum(ckn);
  13.408 -                    addRelAddr(tlen);
  13.409 -                } else {
  13.410 -                    addOpcodeRelAddr(OPCode.PUSH, tlen);
  13.411 -                }
  13.412 -            }
  13.413 -            compileTree(qn.target);
  13.414 -        } else if (!qn.greedy && qn.upper == 1 && qn.lower == 0){ /* '??' */
  13.415 -            if (cknOn(ckn)) {
  13.416 -                addOpcode(OPCode.STATE_CHECK_PUSH);
  13.417 -                addStateCheckNum(ckn);
  13.418 -                addRelAddr(OPSize.JUMP);
  13.419 -            } else {
  13.420 -                addOpcodeRelAddr(OPCode.PUSH, OPSize.JUMP);
  13.421 -            }
  13.422 -
  13.423 -            addOpcodeRelAddr(OPCode.JUMP, tlen);
  13.424 -            compileTree(qn.target);
  13.425 -        } else {
  13.426 -            compileRangeRepeatNode(qn, modTLen, emptyInfo);
  13.427 -            if (cknOn(ckn)) {
  13.428 -                addOpcode(OPCode.STATE_CHECK);
  13.429 -                addStateCheckNum(ckn);
  13.430 -            }
  13.431 -        }
  13.432 -    }
  13.433 -
  13.434      private int compileNonCECLengthQuantifierNode(QuantifierNode qn) {
  13.435          boolean infinite = isRepeatInfinite(qn.upper);
  13.436          int emptyInfo = qn.targetEmptyInfo;
  13.437 @@ -821,21 +570,12 @@
  13.438          int len;
  13.439          switch (node.type) {
  13.440          case EncloseType.MEMORY:
  13.441 -            if (Config.USE_SUBEXP_CALL && node.isCalled()) {
  13.442 -                len = OPSize.MEMORY_START_PUSH + tlen + OPSize.CALL + OPSize.JUMP + OPSize.RETURN;
  13.443 -                if (bsAt(regex.btMemEnd, node.regNum)) {
  13.444 -                    len += node.isRecursion() ? OPSize.MEMORY_END_PUSH_REC : OPSize.MEMORY_END_PUSH;
  13.445 -                } else {
  13.446 -                    len += node.isRecursion() ? OPSize.MEMORY_END_REC : OPSize.MEMORY_END;
  13.447 -                }
  13.448 -            } else { // USE_SUBEXP_CALL
  13.449 -                if (bsAt(regex.btMemStart, node.regNum)) {
  13.450 -                    len = OPSize.MEMORY_START_PUSH;
  13.451 -                } else {
  13.452 -                    len = OPSize.MEMORY_START;
  13.453 -                }
  13.454 -                len += tlen + (bsAt(regex.btMemEnd, node.regNum) ? OPSize.MEMORY_END_PUSH : OPSize.MEMORY_END);
  13.455 +            if (bsAt(regex.btMemStart, node.regNum)) {
  13.456 +                len = OPSize.MEMORY_START_PUSH;
  13.457 +            } else {
  13.458 +                len = OPSize.MEMORY_START;
  13.459              }
  13.460 +            len += tlen + (bsAt(regex.btMemEnd, node.regNum) ? OPSize.MEMORY_END_PUSH : OPSize.MEMORY_END);
  13.461              break;
  13.462  
  13.463          case EncloseType.STOP_BACKTRACK:
  13.464 @@ -860,23 +600,6 @@
  13.465          int len;
  13.466          switch (node.type) {
  13.467          case EncloseType.MEMORY:
  13.468 -            if (Config.USE_SUBEXP_CALL) {
  13.469 -                if (node.isCalled()) {
  13.470 -                    addOpcode(OPCode.CALL);
  13.471 -                    node.callAddr = codeLength + OPSize.ABSADDR + OPSize.JUMP;
  13.472 -                    node.setAddrFixed();
  13.473 -                    addAbsAddr(node.callAddr);
  13.474 -                    len = compileLengthTree(node.target);
  13.475 -                    len += OPSize.MEMORY_START_PUSH + OPSize.RETURN;
  13.476 -                    if (bsAt(regex.btMemEnd, node.regNum)) {
  13.477 -                        len += node.isRecursion() ? OPSize.MEMORY_END_PUSH_REC : OPSize.MEMORY_END_PUSH;
  13.478 -                    } else {
  13.479 -                        len += node.isRecursion() ? OPSize.MEMORY_END_REC : OPSize.MEMORY_END;
  13.480 -                    }
  13.481 -                    addOpcodeRelAddr(OPCode.JUMP, len);
  13.482 -                }
  13.483 -            } // USE_SUBEXP_CALL
  13.484 -
  13.485              if (bsAt(regex.btMemStart, node.regNum)) {
  13.486                  addOpcode(OPCode.MEMORY_START_PUSH);
  13.487              } else {
  13.488 @@ -886,22 +609,12 @@
  13.489              addMemNum(node.regNum);
  13.490              compileTree(node.target);
  13.491  
  13.492 -            if (Config.USE_SUBEXP_CALL && node.isCalled()) {
  13.493 -                if (bsAt(regex.btMemEnd, node.regNum)) {
  13.494 -                    addOpcode(node.isRecursion() ? OPCode.MEMORY_END_PUSH_REC : OPCode.MEMORY_END_PUSH);
  13.495 -                } else {
  13.496 -                    addOpcode(node.isRecursion() ? OPCode.MEMORY_END_REC : OPCode.MEMORY_END);
  13.497 -                }
  13.498 -                addMemNum(node.regNum);
  13.499 -                addOpcode(OPCode.RETURN);
  13.500 -            } else { // USE_SUBEXP_CALL
  13.501 -                if (bsAt(regex.btMemEnd, node.regNum)) {
  13.502 -                    addOpcode(OPCode.MEMORY_END_PUSH);
  13.503 -                } else {
  13.504 -                    addOpcode(OPCode.MEMORY_END);
  13.505 -                }
  13.506 -                addMemNum(node.regNum);
  13.507 +            if (bsAt(regex.btMemEnd, node.regNum)) {
  13.508 +                addOpcode(OPCode.MEMORY_END_PUSH);
  13.509 +            } else {
  13.510 +                addOpcode(OPCode.MEMORY_END);
  13.511              }
  13.512 +            addMemNum(node.regNum);
  13.513              break;
  13.514  
  13.515          case EncloseType.STOP_BACKTRACK:
  13.516 @@ -1078,32 +791,17 @@
  13.517          case NodeType.BREF:
  13.518              BackRefNode br = (BackRefNode)node;
  13.519  
  13.520 -            if (Config.USE_BACKREF_WITH_LEVEL && br.isNestLevel()) {
  13.521 -                len = OPSize.OPCODE + OPSize.OPTION + OPSize.LENGTH +
  13.522 -                      OPSize.LENGTH + (OPSize.MEMNUM * br.backNum);
  13.523 -            } else { // USE_BACKREF_AT_LEVEL
  13.524 -                if (br.backNum == 1) {
  13.525 -                    len = ((!isIgnoreCase(regex.options) && br.back[0] <= 2)
  13.526 -                            ? OPSize.OPCODE : (OPSize.OPCODE + OPSize.MEMNUM));
  13.527 -                } else {
  13.528 -                    len = OPSize.OPCODE + OPSize.LENGTH + (OPSize.MEMNUM * br.backNum);
  13.529 -                }
  13.530 +            // USE_BACKREF_AT_LEVEL
  13.531 +            if (br.backNum == 1) {
  13.532 +                len = ((!isIgnoreCase(regex.options) && br.back[0] <= 2)
  13.533 +                        ? OPSize.OPCODE : (OPSize.OPCODE + OPSize.MEMNUM));
  13.534 +            } else {
  13.535 +                len = OPSize.OPCODE + OPSize.LENGTH + (OPSize.MEMNUM * br.backNum);
  13.536              }
  13.537              break;
  13.538  
  13.539 -        case NodeType.CALL:
  13.540 -            if (Config.USE_SUBEXP_CALL) {
  13.541 -                len = OPSize.CALL;
  13.542 -                break;
  13.543 -            } // USE_SUBEXP_CALL
  13.544 -            break;
  13.545 -
  13.546          case NodeType.QTFR:
  13.547 -            if (Config.USE_COMBINATION_EXPLOSION_CHECK) {
  13.548 -                len = compileCECLengthQuantifierNode((QuantifierNode)node);
  13.549 -            } else {
  13.550 -                len = compileNonCECLengthQuantifierNode((QuantifierNode)node);
  13.551 -            }
  13.552 +            len = compileNonCECLengthQuantifierNode((QuantifierNode)node);
  13.553              break;
  13.554  
  13.555          case NodeType.ENCLOSE:
    14.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/AsmCompiler.java	Fri May 17 14:30:22 2013 -0300
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,109 +0,0 @@
    14.4 -/*
    14.5 - * Permission is hereby granted, free of charge, to any person obtaining a copy of
    14.6 - * this software and associated documentation files (the "Software"), to deal in
    14.7 - * the Software without restriction, including without limitation the rights to
    14.8 - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
    14.9 - * of the Software, and to permit persons to whom the Software is furnished to do
   14.10 - * so, subject to the following conditions:
   14.11 - *
   14.12 - * The above copyright notice and this permission notice shall be included in all
   14.13 - * copies or substantial portions of the Software.
   14.14 - *
   14.15 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   14.16 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   14.17 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   14.18 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   14.19 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   14.20 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   14.21 - * SOFTWARE.
   14.22 - */
   14.23 -package jdk.nashorn.internal.runtime.regexp.joni;
   14.24 -
   14.25 -import jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode;
   14.26 -import jdk.nashorn.internal.runtime.regexp.joni.ast.BackRefNode;
   14.27 -import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode;
   14.28 -import jdk.nashorn.internal.runtime.regexp.joni.ast.CTypeNode;
   14.29 -import jdk.nashorn.internal.runtime.regexp.joni.ast.CallNode;
   14.30 -import jdk.nashorn.internal.runtime.regexp.joni.ast.ConsAltNode;
   14.31 -import jdk.nashorn.internal.runtime.regexp.joni.ast.EncloseNode;
   14.32 -import jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode;
   14.33 -
   14.34 -final class AsmCompiler extends AsmCompilerSupport {
   14.35 -
   14.36 -    public AsmCompiler(Analyser analyser) {
   14.37 -        super(analyser);
   14.38 -    }
   14.39 -
   14.40 -    @Override
   14.41 -    protected void prepare() {
   14.42 -        REG_NUM++;
   14.43 -        prepareMachine();
   14.44 -        prepareMachineInit();
   14.45 -        prepareMachineMatch();
   14.46 -
   14.47 -        prepareFactory();
   14.48 -        prepareFactoryInit();
   14.49 -    }
   14.50 -
   14.51 -    @Override
   14.52 -    protected void finish() {
   14.53 -        setupFactoryInit();
   14.54 -
   14.55 -        setupMachineInit();
   14.56 -        setupMachineMatch();
   14.57 -
   14.58 -        setupClasses();
   14.59 -    }
   14.60 -
   14.61 -    @Override
   14.62 -    protected void compileAltNode(ConsAltNode node) {
   14.63 -    }
   14.64 -
   14.65 -    @Override
   14.66 -    protected void addCompileString(char[] chars, int p, int mbLength, int strLength, boolean ignoreCase) {
   14.67 -        String template = installTemplate(chars, p, strLength);
   14.68 -    }
   14.69 -
   14.70 -    @Override
   14.71 -    protected void compileCClassNode(CClassNode node) {
   14.72 -        if (node.bs != null) {
   14.73 -            String bitsetName = installBitSet(node.bs.bits);
   14.74 -        }
   14.75 -    }
   14.76 -
   14.77 -    @Override
   14.78 -    protected void compileCTypeNode(CTypeNode node) {
   14.79 -    }
   14.80 -
   14.81 -    @Override
   14.82 -    protected void compileAnyCharNode() {
   14.83 -    }
   14.84 -
   14.85 -    @Override
   14.86 -    protected void compileBackrefNode(BackRefNode node) {
   14.87 -    }
   14.88 -
   14.89 -    @Override
   14.90 -    protected void compileCallNode(CallNode node) {
   14.91 -    }
   14.92 -
   14.93 -    @Override
   14.94 -    protected void compileCECQuantifierNode(QuantifierNode node) {
   14.95 -    }
   14.96 -
   14.97 -    @Override
   14.98 -    protected void compileNonCECQuantifierNode(QuantifierNode node) {
   14.99 -    }
  14.100 -
  14.101 -    @Override
  14.102 -    protected void compileOptionNode(EncloseNode node) {
  14.103 -    }
  14.104 -
  14.105 -    @Override
  14.106 -    protected void compileEncloseNode(EncloseNode node) {
  14.107 -    }
  14.108 -
  14.109 -    @Override
  14.110 -    protected void compileAnchorNode(AnchorNode node) {
  14.111 -    }
  14.112 -}
    15.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/AsmCompilerSupport.java	Fri May 17 14:30:22 2013 -0300
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,267 +0,0 @@
    15.4 -/*
    15.5 - * Permission is hereby granted, free of charge, to any person obtaining a copy of
    15.6 - * this software and associated documentation files (the "Software"), to deal in
    15.7 - * the Software without restriction, including without limitation the rights to
    15.8 - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
    15.9 - * of the Software, and to permit persons to whom the Software is furnished to do
   15.10 - * so, subject to the following conditions:
   15.11 - *
   15.12 - * The above copyright notice and this permission notice shall be included in all
   15.13 - * copies or substantial portions of the Software.
   15.14 - *
   15.15 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   15.16 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   15.17 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   15.18 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   15.19 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   15.20 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   15.21 - * SOFTWARE.
   15.22 - */
   15.23 -package jdk.nashorn.internal.runtime.regexp.joni;
   15.24 -
   15.25 -import java.io.FileOutputStream;
   15.26 -import java.io.IOException;
   15.27 -
   15.28 -import jdk.nashorn.internal.runtime.regexp.joni.constants.AsmConstants;
   15.29 -import jdk.internal.org.objectweb.asm.ClassWriter;
   15.30 -import jdk.internal.org.objectweb.asm.MethodVisitor;
   15.31 -import jdk.internal.org.objectweb.asm.Opcodes;
   15.32 -
   15.33 -abstract class AsmCompilerSupport extends Compiler implements Opcodes, AsmConstants {
   15.34 -    protected ClassWriter factory;      // matcher allocator, also bit set, code rage and string template container
   15.35 -    protected MethodVisitor factoryInit;// factory constructor
   15.36 -    protected String factoryName;
   15.37 -
   15.38 -    protected ClassWriter machine;      // matcher
   15.39 -    protected MethodVisitor machineInit;// matcher constructor
   15.40 -    protected MethodVisitor match;      // actual matcher implementation (the matchAt method)
   15.41 -    protected String machineName;
   15.42 -
   15.43 -    // we will? try to manage visitMaxs ourselves for efficiency
   15.44 -    protected int maxStack = 1;
   15.45 -    protected int maxVars = LAST_INDEX;
   15.46 -
   15.47 -    // for field generation
   15.48 -    protected int bitsets, ranges, templates;
   15.49 -
   15.50 -    // simple class name postfix scheme for now
   15.51 -    static int REG_NUM = 0;
   15.52 -
   15.53 -    // dummy class loader for now
   15.54 -    private static final class DummyClassLoader extends ClassLoader {
   15.55 -        public Class<?> defineClass(String name, byte[] bytes) {
   15.56 -            return super.defineClass(name, bytes, 0, bytes.length);
   15.57 -        }
   15.58 -    };
   15.59 -
   15.60 -    private static final DummyClassLoader loader = new DummyClassLoader();
   15.61 -
   15.62 -    AsmCompilerSupport(Analyser analyser) {
   15.63 -        super(analyser);
   15.64 -    }
   15.65 -
   15.66 -    protected final void prepareFactory() {
   15.67 -        factory = new ClassWriter(ClassWriter.COMPUTE_MAXS);
   15.68 -        factoryName = "jdk/nashorn/internal/runtime/regexp/joni/MatcherFactory" + REG_NUM;
   15.69 -
   15.70 -        factory.visit(V1_4, ACC_PUBLIC + ACC_FINAL, factoryName, null, "jdk/nashorn/internal/runtime/regexp/joni/MatcherFactory", null);
   15.71 -
   15.72 -        MethodVisitor create = factory.visitMethod(ACC_SYNTHETIC, "create", "(Lorg/joni/Regex;[BII)Lorg/joni/Matcher;", null, null);
   15.73 -        create.visitTypeInsn(NEW, machineName);
   15.74 -        create.visitInsn(DUP);          // instance
   15.75 -        create.visitVarInsn(ALOAD, 1);  // Regex
   15.76 -        create.visitVarInsn(ALOAD, 2);  // bytes[]
   15.77 -        create.visitVarInsn(ILOAD, 3);  // p
   15.78 -        create.visitVarInsn(ILOAD, 4);  // end
   15.79 -        create.visitMethodInsn(INVOKESPECIAL, machineName, "<init>", "(Lorg/joni/Regex;[BII)V");
   15.80 -        create.visitInsn(ARETURN);
   15.81 -        create.visitMaxs(0, 0);
   15.82 -        //create.visitMaxs(6, 5);
   15.83 -        create.visitEnd();
   15.84 -    }
   15.85 -
   15.86 -    protected final void prepareFactoryInit() {
   15.87 -        factoryInit = factory.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
   15.88 -        factoryInit.visitVarInsn(ALOAD, 0);
   15.89 -        factoryInit.visitMethodInsn(INVOKESPECIAL, "jdk/nashorn/internal/runtime/regexp/joni/MatcherFactory", "<init>", "()V");
   15.90 -    }
   15.91 -
   15.92 -    protected final void setupFactoryInit() {
   15.93 -        factoryInit.visitInsn(RETURN);
   15.94 -        factoryInit.visitMaxs(0, 0);
   15.95 -        //init.visitMaxs(1, 1);
   15.96 -        factoryInit.visitEnd();
   15.97 -    }
   15.98 -
   15.99 -    protected final void prepareMachine() {
  15.100 -        machine = new ClassWriter(ClassWriter.COMPUTE_MAXS);
  15.101 -        machineName = "jdk/nashorn/internal/runtime/regexp/joni/NativeMachine" + REG_NUM;
  15.102 -    }
  15.103 -
  15.104 -    protected final void prepareMachineInit() {
  15.105 -        machine.visit(V1_4, ACC_PUBLIC + ACC_FINAL, machineName, null, "jdk/nashorn/internal/runtime/regexp/joni/NativeMachine", null);
  15.106 -        machineInit = machine.visitMethod(ACC_PROTECTED, "<init>", "(Lorg/joni/Regex;[BII)V", null, null);
  15.107 -        machineInit.visitVarInsn(ALOAD, THIS);  // this
  15.108 -        machineInit.visitVarInsn(ALOAD, 1);     // Regex
  15.109 -        machineInit.visitVarInsn(ALOAD, 2);     // bytes[]
  15.110 -        machineInit.visitVarInsn(ILOAD, 3);     // p
  15.111 -        machineInit.visitVarInsn(ILOAD, 4);     // end
  15.112 -        machineInit.visitMethodInsn(INVOKESPECIAL, "jdk/nashorn/internal/runtime/regexp/joni/NativeMachine", "<init>", "(Lorg/joni/Regex;[BII)V");
  15.113 -    }
  15.114 -
  15.115 -    protected final void setupMachineInit() {
  15.116 -        if (bitsets + ranges + templates > 0) { // ok, some of these are in use, we'd like to cache the factory
  15.117 -            machine.visitField(ACC_PRIVATE + ACC_FINAL, "factory", "L" + factoryName + ";", null, null);
  15.118 -            machineInit.visitVarInsn(ALOAD, THIS);  // this
  15.119 -            machineInit.visitVarInsn(ALOAD, 1);     // this, Regex
  15.120 -            machineInit.visitFieldInsn(GETFIELD, "jdk/nashorn/internal/runtime/regexp/joni/Regex", "factory", "Lorg/joni/MatcherFactory;"); // this, factory
  15.121 -            machineInit.visitTypeInsn(CHECKCAST, factoryName);
  15.122 -            machineInit.visitFieldInsn(PUTFIELD, machineName, "factory", "L" + factoryName + ";"); // []
  15.123 -        }
  15.124 -
  15.125 -        machineInit.visitInsn(RETURN);
  15.126 -        machineInit.visitMaxs(0, 0);
  15.127 -        //init.visitMaxs(5, 5);
  15.128 -        machineInit.visitEnd();
  15.129 -    }
  15.130 -
  15.131 -    protected final void prepareMachineMatch() {
  15.132 -        match = machine.visitMethod(ACC_SYNTHETIC, "matchAt", "(III)I", null, null);
  15.133 -        move(S, SSTART);        // s = sstart
  15.134 -        load("bytes", "[B");    //
  15.135 -        astore(BYTES);          // byte[]bytes = this.bytes
  15.136 -    }
  15.137 -
  15.138 -    protected final void setupMachineMatch() {
  15.139 -        match.visitInsn(ICONST_M1);
  15.140 -        match.visitInsn(IRETURN);
  15.141 -
  15.142 -        match.visitMaxs(maxStack, maxVars);
  15.143 -        match.visitEnd();
  15.144 -    }
  15.145 -
  15.146 -    protected final void setupClasses() {
  15.147 -        byte[]factoryCode = factory.toByteArray();
  15.148 -        byte[]machineCode = machine.toByteArray();
  15.149 -
  15.150 -        if (Config.DEBUG_ASM) {
  15.151 -            try {
  15.152 -                FileOutputStream fos;
  15.153 -                fos = new FileOutputStream(factoryName.substring(factoryName.lastIndexOf('/') + 1) + ".class");
  15.154 -                fos.write(factoryCode);
  15.155 -                fos.close();
  15.156 -                fos = new FileOutputStream(machineName.substring(machineName.lastIndexOf('/') + 1) + ".class");
  15.157 -                fos.write(machineCode);
  15.158 -                fos.close();
  15.159 -            } catch (IOException ioe) {
  15.160 -                ioe.printStackTrace(Config.err);
  15.161 -            }
  15.162 -        }
  15.163 -
  15.164 -        loader.defineClass(machineName.replace('/', '.'), machineCode);
  15.165 -        Class<?> cls = loader.defineClass(factoryName.replace('/', '.'), factoryCode);
  15.166 -        try {
  15.167 -            regex.factory = (MatcherFactory)cls.newInstance();
  15.168 -        } catch(Exception e) {
  15.169 -            e.printStackTrace(Config.err);
  15.170 -        }
  15.171 -    }
  15.172 -
  15.173 -    protected final void aload(int var) {
  15.174 -        match.visitVarInsn(ALOAD, var);
  15.175 -    }
  15.176 -
  15.177 -    protected final void astore(int var) {
  15.178 -        match.visitVarInsn(ASTORE, var);
  15.179 -    }
  15.180 -
  15.181 -    protected final void loadThis() {
  15.182 -        match.visitVarInsn(ALOAD, THIS);
  15.183 -    }
  15.184 -
  15.185 -    protected final void load(int var) {
  15.186 -        match.visitVarInsn(ILOAD, var);
  15.187 -    }
  15.188 -
  15.189 -    protected final void store(int var) {
  15.190 -        match.visitVarInsn(ISTORE, var);
  15.191 -    }
  15.192 -
  15.193 -    protected final void move(int to, int from) {
  15.194 -        load(from);
  15.195 -        store(to);
  15.196 -    }
  15.197 -
  15.198 -    protected final void load(String field, String singature) {
  15.199 -        loadThis();
  15.200 -        match.visitFieldInsn(GETFIELD, machineName, field, singature);
  15.201 -    }
  15.202 -
  15.203 -    protected final void load(String field) {
  15.204 -        load(field, "I");
  15.205 -    }
  15.206 -
  15.207 -    protected final void store(String field, String singature) {
  15.208 -        loadThis();
  15.209 -        match.visitFieldInsn(PUTFIELD, machineName, field, singature);
  15.210 -    }
  15.211 -
  15.212 -    protected final void store(String field) {
  15.213 -        store(field, "I");
  15.214 -    }
  15.215 -
  15.216 -    protected final String installTemplate(char[] arr, int p, int length) {
  15.217 -        String templateName = TEMPLATE + ++templates;
  15.218 -        installArray(templateName, arr, p, length);
  15.219 -        return templateName;
  15.220 -    }
  15.221 -
  15.222 -    protected final String installCodeRange(int[]arr) {
  15.223 -        String coreRangeName = CODERANGE + ++ranges;
  15.224 -        installArray(coreRangeName, arr);
  15.225 -        return coreRangeName;
  15.226 -    }
  15.227 -
  15.228 -    protected final String installBitSet(int[]arr) {
  15.229 -        String bitsetName = BITSET + ++bitsets;
  15.230 -        installArray(bitsetName, arr);
  15.231 -        return bitsetName;
  15.232 -    }
  15.233 -
  15.234 -    private void installArray(String name, int[]arr) {
  15.235 -        factory.visitField(ACC_PRIVATE + ACC_FINAL, name, "[I", null, null);
  15.236 -        factoryInit.visitVarInsn(ALOAD, THIS);          // this;
  15.237 -        loadInt(factoryInit, arr.length);               // this, length
  15.238 -        factoryInit.visitIntInsn(NEWARRAY, T_INT);      // this, arr
  15.239 -        for (int i=0;i < arr.length; i++) buildArray(i, arr[i], IASTORE);
  15.240 -        factoryInit.visitFieldInsn(PUTFIELD, factoryName, name, "[I");
  15.241 -    }
  15.242 -
  15.243 -    private void installArray(String name, char[]arr, int p, int length) {
  15.244 -        factory.visitField(ACC_PRIVATE + ACC_FINAL, name, "[B", null, null);
  15.245 -        factoryInit.visitVarInsn(ALOAD, THIS);          // this;
  15.246 -        loadInt(factoryInit, arr.length);               // this, length
  15.247 -        factoryInit.visitIntInsn(NEWARRAY, T_BYTE);     // this, arr
  15.248 -        for (int i=p, j=0; i < p + length; i++, j++) buildArray(j, arr[i] & 0xff, BASTORE);
  15.249 -        factoryInit.visitFieldInsn(PUTFIELD, factoryName, name, "[B");
  15.250 -    }
  15.251 -
  15.252 -    private void buildArray(int index, int value, int type) {
  15.253 -        factoryInit.visitInsn(DUP);     // ... arr, arr
  15.254 -        loadInt(factoryInit, index);    // ... arr, arr, index
  15.255 -        loadInt(factoryInit, value);    // ... arr, arr, index, value
  15.256 -        factoryInit.visitInsn(type);    // ... arr
  15.257 -    }
  15.258 -
  15.259 -    private void loadInt(MethodVisitor mv, int value) {
  15.260 -        if (value >= -1 && value <= 5) {
  15.261 -            mv.visitInsn(value + ICONST_0); // ICONST_0 == 3
  15.262 -        } else if (value >= 6 && value <= 127 || value >= -128 && value <= -2) {
  15.263 -            mv.visitIntInsn(BIPUSH, value);
  15.264 -        } else if (value >= 128 && value <= 32767 || value >= -32768 && value <= -129) {
  15.265 -            mv.visitIntInsn(SIPUSH, value);
  15.266 -        } else {
  15.267 -            mv.visitLdcInsn(new Integer(value));
  15.268 -        }
  15.269 -    }
  15.270 -}
    16.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/BitSet.java	Fri May 17 14:30:22 2013 -0300
    16.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/BitSet.java	Fri May 17 16:12:59 2013 -0300
    16.3 @@ -51,10 +51,6 @@
    16.4          bits[pos >>> ROOM_SHIFT] &= ~bit(pos);
    16.5      }
    16.6  
    16.7 -    public void invert(int pos) {
    16.8 -        bits[pos >>> ROOM_SHIFT] ^= bit(pos);
    16.9 -    }
   16.10 -
   16.11      public void clear() {
   16.12          for (int i=0; i<BITSET_SIZE; i++) bits[i]=0;
   16.13      }
   16.14 @@ -70,10 +66,6 @@
   16.15          for (int i=from; i<=to && i < SINGLE_BYTE_SIZE; i++) set(i);
   16.16      }
   16.17  
   16.18 -    public void setAll() {
   16.19 -        for (int i=0; i<BITSET_SIZE; i++) bits[i] = ~0;
   16.20 -    }
   16.21 -
   16.22      public void invert() {
   16.23          for (int i=0; i<BITSET_SIZE; i++) bits[i] = ~bits[i];
   16.24      }
    17.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/BitStatus.java	Fri May 17 14:30:22 2013 -0300
    17.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/BitStatus.java	Fri May 17 16:12:59 2013 -0300
    17.3 @@ -25,12 +25,15 @@
    17.4      public static int bsClear() {
    17.5          return 0;
    17.6      }
    17.7 +
    17.8      public static int bsAll() {
    17.9          return -1;
   17.10      }
   17.11 +
   17.12      public static boolean bsAt(int stats, int n) {
   17.13          return (n < BIT_STATUS_BITS_NUM ? stats & (1 << n) : (stats & 1)) != 0;
   17.14      }
   17.15 +
   17.16      public static int bsOnAt(int stats, int n) {
   17.17          if (n < BIT_STATUS_BITS_NUM) {
   17.18              stats |= (1 << n);
   17.19 @@ -39,10 +42,6 @@
   17.20          }
   17.21          return stats;
   17.22      }
   17.23 -    public static int bsOnAtSimple(int stats, int n) {
   17.24 -        if (n < BIT_STATUS_BITS_NUM) stats |= (1 << n);
   17.25 -        return stats;
   17.26 -    }
   17.27  
   17.28      public static int bsOnOff(int v, int f, boolean negative) {
   17.29          if (negative) {
    18.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java	Fri May 17 14:30:22 2013 -0300
    18.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java	Fri May 17 16:12:59 2013 -0300
    18.3 @@ -53,56 +53,6 @@
    18.4          this.code = regex.code;
    18.5      }
    18.6  
    18.7 -    protected int stkp; // a temporary
    18.8 -    private boolean makeCaptureHistoryTree(CaptureTreeNode node) {
    18.9 -        //CaptureTreeNode child;
   18.10 -        int k = stkp;
   18.11 -        //int k = kp;
   18.12 -
   18.13 -        while (k < stk) {
   18.14 -            StackEntry e = stack[k];
   18.15 -            if (e.type == MEM_START) {
   18.16 -                int n = e.getMemNum();
   18.17 -                if (n <= Config.MAX_CAPTURE_HISTORY_GROUP && bsAt(regex.captureHistory, n)) {
   18.18 -                    CaptureTreeNode child = new CaptureTreeNode();
   18.19 -                    child.group = n;
   18.20 -                    child.beg = e.getMemPStr() - str;
   18.21 -                    node.addChild(child);
   18.22 -                    stkp = k + 1;
   18.23 -                    if (makeCaptureHistoryTree(child)) return true;
   18.24 -
   18.25 -                    k = stkp;
   18.26 -                    child.end = e.getMemPStr() - str;
   18.27 -                }
   18.28 -            } else if (e.type == MEM_END) {
   18.29 -                if (e.getMemNum() == node.group) {
   18.30 -                    node.end = e.getMemPStr() - str;
   18.31 -                    stkp = k;
   18.32 -                    return false;
   18.33 -                }
   18.34 -            }
   18.35 -        }
   18.36 -        return true; /* 1: root node ending. */
   18.37 -    }
   18.38 -
   18.39 -    private void checkCaptureHistory(Region region) {
   18.40 -        CaptureTreeNode node;
   18.41 -        if (region.historyRoot == null) {
   18.42 -            node = region.historyRoot = new CaptureTreeNode();
   18.43 -        } else {
   18.44 -            node = region.historyRoot;
   18.45 -            node.clear();
   18.46 -        }
   18.47 -
   18.48 -        // was clear ???
   18.49 -        node.group = 0;
   18.50 -        node.beg = sstart - str;
   18.51 -        node.end = s      - str;
   18.52 -
   18.53 -        stkp = 0;
   18.54 -        makeCaptureHistoryTree(region.historyRoot);
   18.55 -    }
   18.56 -
   18.57      private boolean stringCmpIC(int caseFlodFlag, int s1, IntHolder ps2, int mbLen, int textEnd) {
   18.58  
   18.59          int s2 = ps2.value;
   18.60 @@ -175,13 +125,6 @@
   18.61                  case OPCode.EXACT5:                     opExact5();                continue;
   18.62                  case OPCode.EXACTN:                     opExactN();                continue;
   18.63  
   18.64 -                case OPCode.EXACTMB2N1:                 opExactMB2N1();            break;
   18.65 -                case OPCode.EXACTMB2N2:                 opExactMB2N2();            continue;
   18.66 -                case OPCode.EXACTMB2N3:                 opExactMB2N3();            continue;
   18.67 -                case OPCode.EXACTMB2N:                  opExactMB2N();             continue;
   18.68 -                case OPCode.EXACTMB3N:                  opExactMB3N();             continue;
   18.69 -                case OPCode.EXACTMBN:                   opExactMBN();              continue;
   18.70 -
   18.71                  case OPCode.EXACT1_IC:                  opExact1IC();              break;
   18.72                  case OPCode.EXACTN_IC:                  opExactNIC();              continue;
   18.73  
   18.74 @@ -199,8 +142,6 @@
   18.75                  case OPCode.ANYCHAR_ML_STAR:            opAnyCharMLStar();         break;
   18.76                  case OPCode.ANYCHAR_STAR_PEEK_NEXT:     opAnyCharStarPeekNext();   break;
   18.77                  case OPCode.ANYCHAR_ML_STAR_PEEK_NEXT:  opAnyCharMLStarPeekNext(); break;
   18.78 -                case OPCode.STATE_CHECK_ANYCHAR_STAR:   opStateCheckAnyCharStar(); break;
   18.79 -                case OPCode.STATE_CHECK_ANYCHAR_ML_STAR:opStateCheckAnyCharMLStar();break;
   18.80  
   18.81                  case OPCode.WORD:                       opWord();                  break;
   18.82                  case OPCode.NOT_WORD:                   opNotWord();               break;
   18.83 @@ -239,11 +180,6 @@
   18.84                  case OPCode.JUMP:                       opJump();                  continue;
   18.85                  case OPCode.PUSH:                       opPush();                  continue;
   18.86  
   18.87 -                // CEC
   18.88 -                case OPCode.STATE_CHECK_PUSH:           opStateCheckPush();        continue;
   18.89 -                case OPCode.STATE_CHECK_PUSH_OR_JUMP:   opStateCheckPushOrJump();  continue;
   18.90 -                case OPCode.STATE_CHECK:                opStateCheck();            continue;
   18.91 -
   18.92                  case OPCode.POP:                        opPop();                   continue;
   18.93                  case OPCode.PUSH_OR_JUMP_EXACT1:        opPushOrJumpExact1();      continue;
   18.94                  case OPCode.PUSH_IF_PEEK_NEXT:          opPushIfPeekNext();        continue;
   18.95 @@ -266,10 +202,6 @@
   18.96                  case OPCode.PUSH_LOOK_BEHIND_NOT:       opPushLookBehindNot();     continue;
   18.97                  case OPCode.FAIL_LOOK_BEHIND_NOT:       opFailLookBehindNot();     continue;
   18.98  
   18.99 -                // USE_SUBEXP_CALL
  18.100 -                case OPCode.CALL:                       opCall();                  continue;
  18.101 -                case OPCode.RETURN:                     opReturn();                continue;
  18.102 -
  18.103                  case OPCode.FINISH:
  18.104                      return finish();
  18.105  
  18.106 @@ -322,9 +254,6 @@
  18.107  
  18.108                  }
  18.109  
  18.110 -                if (Config.USE_CAPTURE_HISTORY) {
  18.111 -                    if (regex.captureHistory != 0) checkCaptureHistory(region);
  18.112 -                }
  18.113              } else {
  18.114                  msaBegin = sstart - str;
  18.115                  msaEnd   = s      - str;
  18.116 @@ -437,125 +366,6 @@
  18.117          sprev = s - 1;
  18.118      }
  18.119  
  18.120 -    private void opExactMB2N1() {
  18.121 -        if (s + 2 > range) {opFail(); return;}
  18.122 -        if (code[ip] != chars[s]) {opFail(); return;}
  18.123 -        ip++; s++;
  18.124 -        if (code[ip] != chars[s]) {opFail(); return;}
  18.125 -        ip++; s++;
  18.126 -        sprev = sbegin; // break;
  18.127 -    }
  18.128 -
  18.129 -    private void opExactMB2N2() {
  18.130 -        if (s + 4 > range) {opFail(); return;}
  18.131 -        if (code[ip] != chars[s]) {opFail(); return;}
  18.132 -        ip++; s++;
  18.133 -        if (code[ip] != chars[s]) {opFail(); return;}
  18.134 -        ip++; s++;
  18.135 -        sprev = s;
  18.136 -        if (code[ip] != chars[s]) {opFail(); return;}
  18.137 -        ip++; s++;
  18.138 -        if (code[ip] != chars[s]) {opFail(); return;}
  18.139 -        ip++; s++;
  18.140 -   }
  18.141 -
  18.142 -    private void opExactMB2N3() {
  18.143 -        if (s + 6 > range) {opFail(); return;}
  18.144 -        if (code[ip] != chars[s]) {opFail(); return;}
  18.145 -        ip++; s++;
  18.146 -        if (code[ip] != chars[s]) {opFail(); return;}
  18.147 -        ip++; s++;
  18.148 -        if (code[ip] != chars[s]) {opFail(); return;}
  18.149 -        ip++; s++;
  18.150 -        if (code[ip] != chars[s]) {opFail(); return;}
  18.151 -        ip++; s++;
  18.152 -        sprev = s;
  18.153 -        if (code[ip] != chars[s]) {opFail(); return;}
  18.154 -        ip++; s++;
  18.155 -        if (code[ip] != chars[s]) {opFail(); return;}
  18.156 -        ip++; s++;
  18.157 -    }
  18.158 -
  18.159 -    private void opExactMB2N() {
  18.160 -        int tlen = code[ip++];
  18.161 -        if (s + tlen * 2 > range) {opFail(); return;}
  18.162 -
  18.163 -        if (Config.USE_STRING_TEMPLATES) {
  18.164 -            char[] bs = regex.templates[code[ip++]];
  18.165 -            int ps = code[ip++];
  18.166 -
  18.167 -            while(tlen-- > 0) {
  18.168 -                if (bs[ps] != chars[s]) {opFail(); return;}
  18.169 -                ps++; s++;
  18.170 -                if (bs[ps] != chars[s]) {opFail(); return;}
  18.171 -                ps++; s++;
  18.172 -            }
  18.173 -        } else {
  18.174 -            while(tlen-- > 0) {
  18.175 -                if (code[ip] != chars[s]) {opFail(); return;}
  18.176 -                ip++; s++;
  18.177 -                if (code[ip] != chars[s]) {opFail(); return;}
  18.178 -                ip++; s++;
  18.179 -            }
  18.180 -        }
  18.181 -        sprev = s - 2;
  18.182 -    }
  18.183 -
  18.184 -    private void opExactMB3N() {
  18.185 -        int tlen = code[ip++];
  18.186 -        if (s + tlen * 3 > range) {opFail(); return;}
  18.187 -
  18.188 -        if (Config.USE_STRING_TEMPLATES) {
  18.189 -            char[] bs = regex.templates[code[ip++]];
  18.190 -            int ps = code[ip++];
  18.191 -
  18.192 -            while (tlen-- > 0) {
  18.193 -                if (bs[ps] != chars[s]) {opFail(); return;}
  18.194 -                ps++; s++;
  18.195 -                if (bs[ps] != chars[s]) {opFail(); return;}
  18.196 -                ps++; s++;
  18.197 -                if (bs[ps] != chars[s]) {opFail(); return;}
  18.198 -                ps++; s++;
  18.199 -            }
  18.200 -        } else {
  18.201 -            while (tlen-- > 0) {
  18.202 -                if (code[ip] != chars[s]) {opFail(); return;}
  18.203 -                ip++; s++;
  18.204 -                if (code[ip] != chars[s]) {opFail(); return;}
  18.205 -                ip++; s++;
  18.206 -                if (code[ip] != chars[s]) {opFail(); return;}
  18.207 -                ip++; s++;
  18.208 -            }
  18.209 -        }
  18.210 -
  18.211 -        sprev = s - 3;
  18.212 -    }
  18.213 -
  18.214 -    private void opExactMBN() {
  18.215 -        int tlen = code[ip++];   /* mb-len */
  18.216 -        int tlen2= code[ip++];   /* string len */
  18.217 -
  18.218 -        tlen2 *= tlen;
  18.219 -        if (s + tlen2 > range) {opFail(); return;}
  18.220 -
  18.221 -        if (Config.USE_STRING_TEMPLATES) {
  18.222 -            char[] bs = regex.templates[code[ip++]];
  18.223 -            int ps = code[ip++];
  18.224 -
  18.225 -            while (tlen2-- > 0) {
  18.226 -                if (bs[ps] != chars[s]) {opFail(); return;}
  18.227 -                ps++; s++;
  18.228 -            }
  18.229 -        } else {
  18.230 -            while (tlen2-- > 0) {
  18.231 -                if (code[ip] != chars[s]) {opFail(); return;}
  18.232 -                ip++; s++;
  18.233 -            }
  18.234 -        }
  18.235 -
  18.236 -        sprev = s - tlen;
  18.237 -    }
  18.238 -
  18.239      private void opExact1IC() {
  18.240          if (s >= range || code[ip] != Character.toLowerCase(chars[s++])) {opFail(); return;}
  18.241          ip++;
  18.242 @@ -748,34 +558,6 @@
  18.243          sprev = sbegin; // break;
  18.244      }
  18.245  
  18.246 -    // CEC
  18.247 -    private void opStateCheckAnyCharStar() {
  18.248 -        int mem = code[ip++];
  18.249 -        final char[] chars = this.chars;
  18.250 -
  18.251 -        while (s < range) {
  18.252 -            if (stateCheckVal(s, mem)) {opFail(); return;}
  18.253 -            pushAltWithStateCheck(ip, s, sprev, mem);
  18.254 -            if (chars[s] == EncodingHelper.NEW_LINE) {opFail(); return;}
  18.255 -            sprev = s;
  18.256 -            s++;
  18.257 -        }
  18.258 -        sprev = sbegin; // break;
  18.259 -    }
  18.260 -
  18.261 -    // CEC
  18.262 -    private void opStateCheckAnyCharMLStar() {
  18.263 -        int mem = code[ip++];
  18.264 -
  18.265 -        while (s < range) {
  18.266 -            if (stateCheckVal(s, mem)) {opFail(); return;}
  18.267 -            pushAltWithStateCheck(ip, s, sprev, mem);
  18.268 -            sprev = s;
  18.269 -            s++;
  18.270 -        }
  18.271 -        sprev = sbegin; // break;
  18.272 -    }
  18.273 -
  18.274      private void opWord() {
  18.275          if (s >= range || !EncodingHelper.isWord(chars[s])) {opFail(); return;}
  18.276          s++;
  18.277 @@ -1223,33 +1005,6 @@
  18.278          pushAlt(ip + addr, s, sprev);
  18.279      }
  18.280  
  18.281 -    // CEC
  18.282 -    private void opStateCheckPush() {
  18.283 -        int mem = code[ip++];
  18.284 -        if (stateCheckVal(s, mem)) {opFail(); return;}
  18.285 -        int addr = code[ip++];
  18.286 -        pushAltWithStateCheck(ip + addr, s, sprev, mem);
  18.287 -    }
  18.288 -
  18.289 -    // CEC
  18.290 -    private void opStateCheckPushOrJump() {
  18.291 -        int mem = code[ip++];
  18.292 -        int addr= code[ip++];
  18.293 -
  18.294 -        if (stateCheckVal(s, mem)) {
  18.295 -            ip += addr;
  18.296 -        } else {
  18.297 -            pushAltWithStateCheck(ip + addr, s, sprev, mem);
  18.298 -        }
  18.299 -    }
  18.300 -
  18.301 -    // CEC
  18.302 -    private void opStateCheck() {
  18.303 -        int mem = code[ip++];
  18.304 -        if (stateCheckVal(s, mem)) {opFail(); return;}
  18.305 -        pushStateCheck(s, mem);
  18.306 -    }
  18.307 -
  18.308      private void opPop() {
  18.309          popOne();
  18.310      }
  18.311 @@ -1425,17 +1180,6 @@
  18.312          opFail();
  18.313      }
  18.314  
  18.315 -    private void opCall() {
  18.316 -        int addr = code[ip++];
  18.317 -        pushCallFrame(ip);
  18.318 -        ip = addr; // absolute address
  18.319 -    }
  18.320 -
  18.321 -    private void opReturn() {
  18.322 -        ip = sreturn();
  18.323 -        pushReturn();
  18.324 -    }
  18.325 -
  18.326      private void opFail() {
  18.327          if (stack == null) {
  18.328              ip = regex.codeLength - 1;
  18.329 @@ -1447,13 +1191,6 @@
  18.330          ip    = e.getStatePCode();
  18.331          s     = e.getStatePStr();
  18.332          sprev = e.getStatePStrPrev();
  18.333 -
  18.334 -        if (Config.USE_COMBINATION_EXPLOSION_CHECK) {
  18.335 -            if (e.getStateCheck() != 0) {
  18.336 -                e.type = STATE_CHECK_MARK;
  18.337 -                stk++;
  18.338 -            }
  18.339 -        }
  18.340      }
  18.341  
  18.342      private int finish() {
    19.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodePrinter.java	Fri May 17 14:30:22 2013 -0300
    19.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodePrinter.java	Fri May 17 16:12:59 2013 -0300
    19.3 @@ -34,6 +34,239 @@
    19.4      int operantCount;
    19.5      WarnCallback warnings;
    19.6  
    19.7 +    private final static String OpCodeNames[] = new String[] {
    19.8 +            "finish", /*OP_FINISH*/
    19.9 +            "end", /*OP_END*/
   19.10 +            "exact1", /*OP_EXACT1*/
   19.11 +            "exact2", /*OP_EXACT2*/
   19.12 +            "exact3", /*OP_EXACT3*/
   19.13 +            "exact4", /*OP_EXACT4*/
   19.14 +            "exact5", /*OP_EXACT5*/
   19.15 +            "exactn", /*OP_EXACTN*/
   19.16 +            "exactmb2-n1", /*OP_EXACTMB2N1*/
   19.17 +            "exactmb2-n2", /*OP_EXACTMB2N2*/
   19.18 +            "exactmb2-n3", /*OP_EXACTMB2N3*/
   19.19 +            "exactmb2-n", /*OP_EXACTMB2N*/
   19.20 +            "exactmb3n", /*OP_EXACTMB3N*/
   19.21 +            "exactmbn", /*OP_EXACTMBN*/
   19.22 +            "exact1-ic", /*OP_EXACT1_IC*/
   19.23 +            "exactn-ic", /*OP_EXACTN_IC*/
   19.24 +            "cclass", /*OP_CCLASS*/
   19.25 +            "cclass-mb", /*OP_CCLASS_MB*/
   19.26 +            "cclass-mix", /*OP_CCLASS_MIX*/
   19.27 +            "cclass-not", /*OP_CCLASS_NOT*/
   19.28 +            "cclass-mb-not", /*OP_CCLASS_MB_NOT*/
   19.29 +            "cclass-mix-not", /*OP_CCLASS_MIX_NOT*/
   19.30 +            "cclass-node", /*OP_CCLASS_NODE*/
   19.31 +            "anychar", /*OP_ANYCHAR*/
   19.32 +            "anychar-ml", /*OP_ANYCHAR_ML*/
   19.33 +            "anychar*", /*OP_ANYCHAR_STAR*/
   19.34 +            "anychar-ml*", /*OP_ANYCHAR_ML_STAR*/
   19.35 +            "anychar*-peek-next", /*OP_ANYCHAR_STAR_PEEK_NEXT*/
   19.36 +            "anychar-ml*-peek-next", /*OP_ANYCHAR_ML_STAR_PEEK_NEXT*/
   19.37 +            "word", /*OP_WORD*/
   19.38 +            "not-word", /*OP_NOT_WORD*/
   19.39 +            "word-bound", /*OP_WORD_BOUND*/
   19.40 +            "not-word-bound", /*OP_NOT_WORD_BOUND*/
   19.41 +            "word-begin", /*OP_WORD_BEGIN*/
   19.42 +            "word-end", /*OP_WORD_END*/
   19.43 +            "begin-buf", /*OP_BEGIN_BUF*/
   19.44 +            "end-buf", /*OP_END_BUF*/
   19.45 +            "begin-line", /*OP_BEGIN_LINE*/
   19.46 +            "end-line", /*OP_END_LINE*/
   19.47 +            "semi-end-buf", /*OP_SEMI_END_BUF*/
   19.48 +            "begin-position", /*OP_BEGIN_POSITION*/
   19.49 +            "backref1", /*OP_BACKREF1*/
   19.50 +            "backref2", /*OP_BACKREF2*/
   19.51 +            "backrefn", /*OP_BACKREFN*/
   19.52 +            "backrefn-ic", /*OP_BACKREFN_IC*/
   19.53 +            "backref_multi", /*OP_BACKREF_MULTI*/
   19.54 +            "backref_multi-ic", /*OP_BACKREF_MULTI_IC*/
   19.55 +            "backref_at_level", /*OP_BACKREF_AT_LEVEL*/
   19.56 +            "mem-start", /*OP_MEMORY_START*/
   19.57 +            "mem-start-push", /*OP_MEMORY_START_PUSH*/
   19.58 +            "mem-end-push", /*OP_MEMORY_END_PUSH*/
   19.59 +            "mem-end-push-rec", /*OP_MEMORY_END_PUSH_REC*/
   19.60 +            "mem-end", /*OP_MEMORY_END*/
   19.61 +            "mem-end-rec", /*OP_MEMORY_END_REC*/
   19.62 +            "fail", /*OP_FAIL*/
   19.63 +            "jump", /*OP_JUMP*/
   19.64 +            "push", /*OP_PUSH*/
   19.65 +            "pop", /*OP_POP*/
   19.66 +            "push-or-jump-e1", /*OP_PUSH_OR_JUMP_EXACT1*/
   19.67 +            "push-if-peek-next", /*OP_PUSH_IF_PEEK_NEXT*/
   19.68 +            "repeat", /*OP_REPEAT*/
   19.69 +            "repeat-ng", /*OP_REPEAT_NG*/
   19.70 +            "repeat-inc", /*OP_REPEAT_INC*/
   19.71 +            "repeat-inc-ng", /*OP_REPEAT_INC_NG*/
   19.72 +            "repeat-inc-sg", /*OP_REPEAT_INC_SG*/
   19.73 +            "repeat-inc-ng-sg", /*OP_REPEAT_INC_NG_SG*/
   19.74 +            "null-check-start", /*OP_NULL_CHECK_START*/
   19.75 +            "null-check-end", /*OP_NULL_CHECK_END*/
   19.76 +            "null-check-end-memst", /*OP_NULL_CHECK_END_MEMST*/
   19.77 +            "null-check-end-memst-push", /*OP_NULL_CHECK_END_MEMST_PUSH*/
   19.78 +            "push-pos", /*OP_PUSH_POS*/
   19.79 +            "pop-pos", /*OP_POP_POS*/
   19.80 +            "push-pos-not", /*OP_PUSH_POS_NOT*/
   19.81 +            "fail-pos", /*OP_FAIL_POS*/
   19.82 +            "push-stop-bt", /*OP_PUSH_STOP_BT*/
   19.83 +            "pop-stop-bt", /*OP_POP_STOP_BT*/
   19.84 +            "look-behind", /*OP_LOOK_BEHIND*/
   19.85 +            "push-look-behind-not", /*OP_PUSH_LOOK_BEHIND_NOT*/
   19.86 +            "fail-look-behind-not", /*OP_FAIL_LOOK_BEHIND_NOT*/
   19.87 +            "call", /*OP_CALL*/
   19.88 +            "return", /*OP_RETURN*/
   19.89 +            "state-check-push", /*OP_STATE_CHECK_PUSH*/
   19.90 +            "state-check-push-or-jump", /*OP_STATE_CHECK_PUSH_OR_JUMP*/
   19.91 +            "state-check", /*OP_STATE_CHECK*/
   19.92 +            "state-check-anychar*", /*OP_STATE_CHECK_ANYCHAR_STAR*/
   19.93 +            "state-check-anychar-ml*", /*OP_STATE_CHECK_ANYCHAR_ML_STAR*/
   19.94 +            "set-option-push", /*OP_SET_OPTION_PUSH*/
   19.95 +            "set-option", /*OP_SET_OPTION*/
   19.96 +
   19.97 +            // single byte versions
   19.98 +            "anychar-sb", /*OP_ANYCHAR*/
   19.99 +            "anychar-ml-sb", /*OP_ANYCHAR_ML*/
  19.100 +            "anychar*-sb", /*OP_ANYCHAR_STAR*/
  19.101 +            "anychar-ml*-sb", /*OP_ANYCHAR_ML_STAR*/
  19.102 +            "anychar*-peek-next-sb", /*OP_ANYCHAR_STAR_PEEK_NEXT*/
  19.103 +            "anychar-ml*-peek-next-sb", /*OP_ANYCHAR_ML_STAR_PEEK_NEXT*/
  19.104 +            "state-check-anychar*-sb", /*OP_STATE_CHECK_ANYCHAR_STAR*/
  19.105 +            "state-check-anychar-ml*-sb", /*OP_STATE_CHECK_ANYCHAR_ML_STAR*/
  19.106 +
  19.107 +            "cclass-sb", /*OP_CCLASS*/
  19.108 +            "cclass-not-sb", /*OP_CCLASS_NOT*/
  19.109 +
  19.110 +            "word-sb", /*OP_WORD*/
  19.111 +            "not-word-sb", /*OP_NOT_WORD*/
  19.112 +            "word-bound-sb", /*OP_WORD_BOUND*/
  19.113 +            "not-word-bound-sb", /*OP_NOT_WORD_BOUND*/
  19.114 +            "word-begin-sb", /*OP_WORD_BEGIN*/
  19.115 +            "word-end-sb", /*OP_WORD_END*/
  19.116 +
  19.117 +            "look-behind-sb", /*OP_LOOK_BEHIND*/
  19.118 +
  19.119 +            "exact1-ic-sb", /*OP_EXACT1_IC*/
  19.120 +            "exactn-ic-sb", /*OP_EXACTN_IC*/
  19.121 +
  19.122 +    };
  19.123 +
  19.124 +    private final static int OpCodeArgTypes[] = new int[] {
  19.125 +            Arguments.NON, /*OP_FINISH*/
  19.126 +            Arguments.NON, /*OP_END*/
  19.127 +            Arguments.SPECIAL, /*OP_EXACT1*/
  19.128 +            Arguments.SPECIAL, /*OP_EXACT2*/
  19.129 +            Arguments.SPECIAL, /*OP_EXACT3*/
  19.130 +            Arguments.SPECIAL, /*OP_EXACT4*/
  19.131 +            Arguments.SPECIAL, /*OP_EXACT5*/
  19.132 +            Arguments.SPECIAL, /*OP_EXACTN*/
  19.133 +            Arguments.SPECIAL, /*OP_EXACTMB2N1*/
  19.134 +            Arguments.SPECIAL, /*OP_EXACTMB2N2*/
  19.135 +            Arguments.SPECIAL, /*OP_EXACTMB2N3*/
  19.136 +            Arguments.SPECIAL, /*OP_EXACTMB2N*/
  19.137 +            Arguments.SPECIAL, /*OP_EXACTMB3N*/
  19.138 +            Arguments.SPECIAL, /*OP_EXACTMBN*/
  19.139 +            Arguments.SPECIAL, /*OP_EXACT1_IC*/
  19.140 +            Arguments.SPECIAL, /*OP_EXACTN_IC*/
  19.141 +            Arguments.SPECIAL, /*OP_CCLASS*/
  19.142 +            Arguments.SPECIAL, /*OP_CCLASS_MB*/
  19.143 +            Arguments.SPECIAL, /*OP_CCLASS_MIX*/
  19.144 +            Arguments.SPECIAL, /*OP_CCLASS_NOT*/
  19.145 +            Arguments.SPECIAL, /*OP_CCLASS_MB_NOT*/
  19.146 +            Arguments.SPECIAL, /*OP_CCLASS_MIX_NOT*/
  19.147 +            Arguments.SPECIAL, /*OP_CCLASS_NODE*/
  19.148 +            Arguments.NON, /*OP_ANYCHAR*/
  19.149 +            Arguments.NON, /*OP_ANYCHAR_ML*/
  19.150 +            Arguments.NON, /*OP_ANYCHAR_STAR*/
  19.151 +            Arguments.NON, /*OP_ANYCHAR_ML_STAR*/
  19.152 +            Arguments.SPECIAL, /*OP_ANYCHAR_STAR_PEEK_NEXT*/
  19.153 +            Arguments.SPECIAL, /*OP_ANYCHAR_ML_STAR_PEEK_NEXT*/
  19.154 +            Arguments.NON, /*OP_WORD*/
  19.155 +            Arguments.NON, /*OP_NOT_WORD*/
  19.156 +            Arguments.NON, /*OP_WORD_BOUND*/
  19.157 +            Arguments.NON, /*OP_NOT_WORD_BOUND*/
  19.158 +            Arguments.NON, /*OP_WORD_BEGIN*/
  19.159 +            Arguments.NON, /*OP_WORD_END*/
  19.160 +            Arguments.NON, /*OP_BEGIN_BUF*/
  19.161 +            Arguments.NON, /*OP_END_BUF*/
  19.162 +            Arguments.NON, /*OP_BEGIN_LINE*/
  19.163 +            Arguments.NON, /*OP_END_LINE*/
  19.164 +            Arguments.NON, /*OP_SEMI_END_BUF*/
  19.165 +            Arguments.NON, /*OP_BEGIN_POSITION*/
  19.166 +            Arguments.NON, /*OP_BACKREF1*/
  19.167 +            Arguments.NON, /*OP_BACKREF2*/
  19.168 +            Arguments.MEMNUM, /*OP_BACKREFN*/
  19.169 +            Arguments.SPECIAL, /*OP_BACKREFN_IC*/
  19.170 +            Arguments.SPECIAL, /*OP_BACKREF_MULTI*/
  19.171 +            Arguments.SPECIAL, /*OP_BACKREF_MULTI_IC*/
  19.172 +            Arguments.SPECIAL, /*OP_BACKREF_AT_LEVEL*/
  19.173 +            Arguments.MEMNUM, /*OP_MEMORY_START*/
  19.174 +            Arguments.MEMNUM, /*OP_MEMORY_START_PUSH*/
  19.175 +            Arguments.MEMNUM, /*OP_MEMORY_END_PUSH*/
  19.176 +            Arguments.MEMNUM, /*OP_MEMORY_END_PUSH_REC*/
  19.177 +            Arguments.MEMNUM, /*OP_MEMORY_END*/
  19.178 +            Arguments.MEMNUM, /*OP_MEMORY_END_REC*/
  19.179 +            Arguments.NON, /*OP_FAIL*/
  19.180 +            Arguments.RELADDR, /*OP_JUMP*/
  19.181 +            Arguments.RELADDR, /*OP_PUSH*/
  19.182 +            Arguments.NON, /*OP_POP*/
  19.183 +            Arguments.SPECIAL, /*OP_PUSH_OR_JUMP_EXACT1*/
  19.184 +            Arguments.SPECIAL, /*OP_PUSH_IF_PEEK_NEXT*/
  19.185 +            Arguments.SPECIAL, /*OP_REPEAT*/
  19.186 +            Arguments.SPECIAL, /*OP_REPEAT_NG*/
  19.187 +            Arguments.MEMNUM, /*OP_REPEAT_INC*/
  19.188 +            Arguments.MEMNUM, /*OP_REPEAT_INC_NG*/
  19.189 +            Arguments.MEMNUM, /*OP_REPEAT_INC_SG*/
  19.190 +            Arguments.MEMNUM, /*OP_REPEAT_INC_NG_SG*/
  19.191 +            Arguments.MEMNUM, /*OP_NULL_CHECK_START*/
  19.192 +            Arguments.MEMNUM, /*OP_NULL_CHECK_END*/
  19.193 +            Arguments.MEMNUM, /*OP_NULL_CHECK_END_MEMST*/
  19.194 +            Arguments.MEMNUM, /*OP_NULL_CHECK_END_MEMST_PUSH*/
  19.195 +            Arguments.NON, /*OP_PUSH_POS*/
  19.196 +            Arguments.NON, /*OP_POP_POS*/
  19.197 +            Arguments.RELADDR, /*OP_PUSH_POS_NOT*/
  19.198 +            Arguments.NON, /*OP_FAIL_POS*/
  19.199 +            Arguments.NON, /*OP_PUSH_STOP_BT*/
  19.200 +            Arguments.NON, /*OP_POP_STOP_BT*/
  19.201 +            Arguments.SPECIAL, /*OP_LOOK_BEHIND*/
  19.202 +            Arguments.SPECIAL, /*OP_PUSH_LOOK_BEHIND_NOT*/
  19.203 +            Arguments.NON, /*OP_FAIL_LOOK_BEHIND_NOT*/
  19.204 +            Arguments.ABSADDR, /*OP_CALL*/
  19.205 +            Arguments.NON, /*OP_RETURN*/
  19.206 +            Arguments.SPECIAL, /*OP_STATE_CHECK_PUSH*/
  19.207 +            Arguments.SPECIAL, /*OP_STATE_CHECK_PUSH_OR_JUMP*/
  19.208 +            Arguments.STATE_CHECK, /*OP_STATE_CHECK*/
  19.209 +            Arguments.STATE_CHECK, /*OP_STATE_CHECK_ANYCHAR_STAR*/
  19.210 +            Arguments.STATE_CHECK, /*OP_STATE_CHECK_ANYCHAR_ML_STAR*/
  19.211 +            Arguments.OPTION, /*OP_SET_OPTION_PUSH*/
  19.212 +            Arguments.OPTION, /*OP_SET_OPTION*/
  19.213 +
  19.214 +            // single byte versions
  19.215 +            Arguments.NON, /*OP_ANYCHAR*/
  19.216 +            Arguments.NON, /*OP_ANYCHAR_ML*/
  19.217 +            Arguments.NON, /*OP_ANYCHAR_STAR*/
  19.218 +            Arguments.NON, /*OP_ANYCHAR_ML_STAR*/
  19.219 +            Arguments.SPECIAL, /*OP_ANYCHAR_STAR_PEEK_NEXT*/
  19.220 +            Arguments.SPECIAL, /*OP_ANYCHAR_ML_STAR_PEEK_NEXT*/
  19.221 +            Arguments.STATE_CHECK, /*OP_STATE_CHECK_ANYCHAR_STAR*/
  19.222 +            Arguments.STATE_CHECK, /*OP_STATE_CHECK_ANYCHAR_ML_STAR*/
  19.223 +
  19.224 +            Arguments.SPECIAL, /*OP_CCLASS*/
  19.225 +            Arguments.SPECIAL, /*OP_CCLASS_NOT*/
  19.226 +
  19.227 +            Arguments.NON, /*OP_WORD*/
  19.228 +            Arguments.NON, /*OP_NOT_WORD*/
  19.229 +            Arguments.NON, /*OP_WORD_BOUND*/
  19.230 +            Arguments.NON, /*OP_NOT_WORD_BOUND*/
  19.231 +            Arguments.NON, /*OP_WORD_BEGIN*/
  19.232 +            Arguments.NON, /*OP_WORD_END*/
  19.233 +
  19.234 +            Arguments.SPECIAL, /*OP_LOOK_BEHIND*/
  19.235 +
  19.236 +            Arguments.SPECIAL, /*OP_EXACT1_IC*/
  19.237 +            Arguments.SPECIAL, /*OP_EXACTN_IC*/
  19.238 +    };
  19.239 +
  19.240      public ByteCodePrinter(Regex regex) {
  19.241          code = regex.code;
  19.242          codeLength = regex.codeLength;
  19.243 @@ -76,8 +309,8 @@
  19.244          CClassNode cc;
  19.245          int tm, idx;
  19.246  
  19.247 -        sb.append("[" + OPCode.OpCodeNames[code[bp]]);
  19.248 -        int argType = OPCode.OpCodeArgTypes[code[bp]];
  19.249 +        sb.append("[" + OpCodeNames[code[bp]]);
  19.250 +        int argType = OpCodeArgTypes[code[bp]];
  19.251          int ip = bp;
  19.252          if (argType != Arguments.SPECIAL) {
  19.253              bp++;
    20.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/CaptureTreeNode.java	Fri May 17 14:30:22 2013 -0300
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,74 +0,0 @@
    20.4 -/*
    20.5 - * Permission is hereby granted, free of charge, to any person obtaining a copy of
    20.6 - * this software and associated documentation files (the "Software"), to deal in
    20.7 - * the Software without restriction, including without limitation the rights to
    20.8 - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
    20.9 - * of the Software, and to permit persons to whom the Software is furnished to do
   20.10 - * so, subject to the following conditions:
   20.11 - *
   20.12 - * The above copyright notice and this permission notice shall be included in all
   20.13 - * copies or substantial portions of the Software.
   20.14 - *
   20.15 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   20.16 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   20.17 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   20.18 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   20.19 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   20.20 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   20.21 - * SOFTWARE.
   20.22 - */
   20.23 -package jdk.nashorn.internal.runtime.regexp.joni;
   20.24 -
   20.25 -public class CaptureTreeNode {
   20.26 -
   20.27 -
   20.28 -    int group;
   20.29 -    int beg;
   20.30 -    int end;
   20.31 -    // int allocated;
   20.32 -    int numChildren;
   20.33 -    CaptureTreeNode[]children;
   20.34 -
   20.35 -    CaptureTreeNode() {
   20.36 -        beg = Region.REGION_NOTPOS;
   20.37 -        end = Region.REGION_NOTPOS;
   20.38 -        group = -1;
   20.39 -    }
   20.40 -
   20.41 -    static final int HISTORY_TREE_INIT_ALLOC_SIZE = 8;
   20.42 -    void addChild(CaptureTreeNode child) {
   20.43 -        if (children == null) {
   20.44 -            children = new CaptureTreeNode[HISTORY_TREE_INIT_ALLOC_SIZE];
   20.45 -        } else if (numChildren >= children.length) {
   20.46 -            CaptureTreeNode[]tmp = new CaptureTreeNode[children.length << 1];
   20.47 -            System.arraycopy(children, 0, tmp, 0, children.length);
   20.48 -            children = tmp;
   20.49 -        }
   20.50 -
   20.51 -        children[numChildren] = child;
   20.52 -        numChildren++;
   20.53 -    }
   20.54 -
   20.55 -    void clear() {
   20.56 -        for (int i=0; i<numChildren; i++) {
   20.57 -            children[i] = null; // ???
   20.58 -        }
   20.59 -        numChildren = 0;
   20.60 -        beg = end = Region.REGION_NOTPOS;
   20.61 -        group = -1;
   20.62 -    }
   20.63 -
   20.64 -    CaptureTreeNode cloneTree() {
   20.65 -        CaptureTreeNode clone = new CaptureTreeNode();
   20.66 -        clone.beg = beg;
   20.67 -        clone.end = end;
   20.68 -
   20.69 -        for (int i=0; i<numChildren; i++) {
   20.70 -            CaptureTreeNode child = children[i].cloneTree();
   20.71 -            clone.addChild(child);
   20.72 -        }
   20.73 -        return clone;
   20.74 -    }
   20.75 -
   20.76 -
   20.77 -}
    21.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java	Fri May 17 14:30:22 2013 -0300
    21.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java	Fri May 17 16:12:59 2013 -0300
    21.3 @@ -22,8 +22,6 @@
    21.4  import jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode;
    21.5  import jdk.nashorn.internal.runtime.regexp.joni.ast.BackRefNode;
    21.6  import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode;
    21.7 -import jdk.nashorn.internal.runtime.regexp.joni.ast.CTypeNode;
    21.8 -import jdk.nashorn.internal.runtime.regexp.joni.ast.CallNode;
    21.9  import jdk.nashorn.internal.runtime.regexp.joni.ast.ConsAltNode;
   21.10  import jdk.nashorn.internal.runtime.regexp.joni.ast.EncloseNode;
   21.11  import jdk.nashorn.internal.runtime.regexp.joni.ast.Node;
   21.12 @@ -56,7 +54,7 @@
   21.13  
   21.14      private void compileStringRawNode(StringNode sn) {
   21.15          if (sn.length() <= 0) return;
   21.16 -        addCompileString(sn.chars, sn.p, 1 /*sb*/, sn.length(), false);
   21.17 +        addCompileString(sn.chars, sn.p, sn.length(), false);
   21.18      }
   21.19  
   21.20      private void compileStringNode(StringNode node) {
   21.21 @@ -76,17 +74,14 @@
   21.22              slen++;
   21.23              p++;
   21.24          }
   21.25 -        addCompileString(chars, prev, 1, slen, ambig);
   21.26 +        addCompileString(chars, prev, slen, ambig);
   21.27      }
   21.28  
   21.29 -    protected abstract void addCompileString(char[] chars, int p, int mbLength, int strLength, boolean ignoreCase);
   21.30 +    protected abstract void addCompileString(char[] chars, int p, int strLength, boolean ignoreCase);
   21.31  
   21.32      protected abstract void compileCClassNode(CClassNode node);
   21.33 -    protected abstract void compileCTypeNode(CTypeNode node);
   21.34      protected abstract void compileAnyCharNode();
   21.35 -    protected abstract void compileCallNode(CallNode node);
   21.36      protected abstract void compileBackrefNode(BackRefNode node);
   21.37 -    protected abstract void compileCECQuantifierNode(QuantifierNode node);
   21.38      protected abstract void compileNonCECQuantifierNode(QuantifierNode node);
   21.39      protected abstract void compileOptionNode(EncloseNode node);
   21.40      protected abstract void compileEncloseNode(EncloseNode node);
   21.41 @@ -118,10 +113,6 @@
   21.42              compileCClassNode((CClassNode)node);
   21.43              break;
   21.44  
   21.45 -        case NodeType.CTYPE:
   21.46 -            compileCTypeNode((CTypeNode)node);
   21.47 -            break;
   21.48 -
   21.49          case NodeType.CANY:
   21.50              compileAnyCharNode();
   21.51              break;
   21.52 @@ -130,19 +121,8 @@
   21.53              compileBackrefNode((BackRefNode)node);
   21.54              break;
   21.55  
   21.56 -        case NodeType.CALL:
   21.57 -            if (Config.USE_SUBEXP_CALL) {
   21.58 -                compileCallNode((CallNode)node);
   21.59 -                break;
   21.60 -            } // USE_SUBEXP_CALL
   21.61 -            break;
   21.62 -
   21.63          case NodeType.QTFR:
   21.64 -            if (Config.USE_COMBINATION_EXPLOSION_CHECK) {
   21.65 -                compileCECQuantifierNode((QuantifierNode)node);
   21.66 -            } else {
   21.67 -                compileNonCECQuantifierNode((QuantifierNode)node);
   21.68 -            }
   21.69 +            compileNonCECQuantifierNode((QuantifierNode)node);
   21.70              break;
   21.71  
   21.72          case NodeType.ENCLOSE:
    22.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Config.java	Fri May 17 14:30:22 2013 -0300
    22.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Config.java	Fri May 17 16:12:59 2013 -0300
    22.3 @@ -31,10 +31,6 @@
    22.4      final int ENC_CASE_FOLD_DEFAULT = ENC_CASE_FOLD_MIN;
    22.5      final boolean USE_CRNL_AS_LINE_TERMINATOR = false;
    22.6  
    22.7 -    final boolean USE_NAMED_GROUP = true;
    22.8 -    final boolean USE_SUBEXP_CALL = true;
    22.9 -    final boolean USE_BACKREF_WITH_LEVEL = true;                            /* \k<name+n>, \k<name-n> */
   22.10 -
   22.11      final boolean USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT = true; /* /(?:()|())*\2/ */
   22.12      final boolean USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE = true;     /* /\n$/ =~ "\n" */
   22.13      final boolean USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR = false;
   22.14 @@ -42,12 +38,10 @@
   22.15      final boolean CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS = true;
   22.16  
   22.17      final boolean USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE = false;
   22.18 -    final boolean USE_CAPTURE_HISTORY = false;
   22.19      final boolean USE_VARIABLE_META_CHARS = true;
   22.20      final boolean USE_WORD_BEGIN_END = true;                                /* "\<": word-begin, "\>": word-end */
   22.21 -    final boolean USE_POSIX_API_REGION_OPTION = true;                           /* needed for POSIX API support */
   22.22 +    final boolean USE_POSIX_API_REGION_OPTION = false;                           /* needed for POSIX API support */
   22.23      final boolean USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE = true;
   22.24 -    final boolean USE_COMBINATION_EXPLOSION_CHECK = false;
   22.25  
   22.26      final int NREGION                   = 10;
   22.27      final int MAX_BACKREF_NUM           = 1000;
   22.28 @@ -73,13 +67,6 @@
   22.29  
   22.30      final boolean USE_STRING_TEMPLATES              = true; // use embeded string templates in Regex object as byte arrays instead of compiling them into int bytecode array
   22.31  
   22.32 -
   22.33 -    final int MAX_CAPTURE_HISTORY_GROUP             = 31;
   22.34 -
   22.35 -
   22.36 -    final int CHECK_STRING_THRESHOLD_LEN            = 7;
   22.37 -    final int CHECK_BUFF_MAX_SIZE                   = 0x4000;
   22.38 -
   22.39      final boolean NON_UNICODE_SDW                   = true;
   22.40  
   22.41  
   22.42 @@ -95,6 +82,4 @@
   22.43      final boolean DEBUG_COMPILE_BYTE_CODE_INFO      = DEBUG_ALL;
   22.44      final boolean DEBUG_SEARCH                      = DEBUG_ALL;
   22.45      final boolean DEBUG_MATCH                       = DEBUG_ALL;
   22.46 -    final boolean DEBUG_ASM                         = true;
   22.47 -    final boolean DEBUG_ASM_EXEC                    = true;
   22.48  }
    23.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/EncodingHelper.java	Fri May 17 14:30:22 2013 -0300
    23.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/EncodingHelper.java	Fri May 17 16:12:59 2013 -0300
    23.3 @@ -95,20 +95,6 @@
    23.4         return s;
    23.5      }
    23.6  
    23.7 -    /* onigenc_with_ascii_strncmp */
    23.8 -    public static int strNCmp(char[] chars1, int p1, int end, char[] chars2, int p2, int n) {
    23.9 -        while (n-- > 0) {
   23.10 -            if (p1 >= end) return chars2[p2];
   23.11 -            int c = chars1[p1];
   23.12 -            int x = chars2[p2] - c;
   23.13 -            if (x != 0) return x;
   23.14 -
   23.15 -            p2++;
   23.16 -            p1++;
   23.17 -        }
   23.18 -        return 0;
   23.19 -    }
   23.20 -
   23.21      public static int mbcToCode(byte[] bytes, int p, int end) {
   23.22          int code = 0;
   23.23          for (int i = p; i < end; i++) {
    24.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Lexer.java	Fri May 17 14:30:22 2013 -0300
    24.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Lexer.java	Fri May 17 16:12:59 2013 -0300
    24.3 @@ -27,10 +27,7 @@
    24.4  import jdk.nashorn.internal.runtime.regexp.joni.constants.MetaChar;
    24.5  import jdk.nashorn.internal.runtime.regexp.joni.constants.TokenType;
    24.6  import jdk.nashorn.internal.runtime.regexp.joni.encoding.CharacterType;
    24.7 -import jdk.nashorn.internal.runtime.regexp.joni.encoding.PosixBracket;
    24.8 -import jdk.nashorn.internal.runtime.regexp.joni.encoding.Ptr;
    24.9  import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages;
   24.10 -import jdk.nashorn.internal.runtime.regexp.joni.exception.JOniException;
   24.11  
   24.12  class Lexer extends ScannerSupport {
   24.13      protected final ScanEnvironment env;
   24.14 @@ -215,198 +212,6 @@
   24.15          \k<-num+n>, \k<-num-n>
   24.16       */
   24.17  
   24.18 -    // value implicit (rnameEnd)
   24.19 -    private boolean fetchNameWithLevel(int startCode, Ptr rbackNum, Ptr rlevel) {
   24.20 -        int src = p;
   24.21 -        boolean existLevel = false;
   24.22 -        int isNum = 0;
   24.23 -        int sign = 1;
   24.24 -
   24.25 -        int endCode = nameEndCodePoint(startCode);
   24.26 -        int pnumHead = p;
   24.27 -        int nameEnd = stop;
   24.28 -
   24.29 -        String err = null;
   24.30 -        if (!left()) {
   24.31 -            newValueException(ERR_EMPTY_GROUP_NAME);
   24.32 -        } else {
   24.33 -            fetch();
   24.34 -            if (c == endCode) newValueException(ERR_EMPTY_GROUP_NAME);
   24.35 -            if (Character.isDigit(c)) {
   24.36 -                isNum = 1;
   24.37 -            } else if (c == '-') {
   24.38 -                isNum = 2;
   24.39 -                sign = -1;
   24.40 -                pnumHead = p;
   24.41 -            } else if (!EncodingHelper.isWord(c)) {
   24.42 -                err = ERR_INVALID_GROUP_NAME;
   24.43 -            }
   24.44 -        }
   24.45 -
   24.46 -        while (left()) {
   24.47 -            nameEnd = p;
   24.48 -            fetch();
   24.49 -            if (c == endCode || c == ')' || c == '+' || c == '-') {
   24.50 -                if (isNum == 2) err = ERR_INVALID_GROUP_NAME;
   24.51 -                break;
   24.52 -            }
   24.53 -
   24.54 -            if (isNum != 0) {
   24.55 -                if (EncodingHelper.isDigit(c)) {
   24.56 -                    isNum = 1;
   24.57 -                } else {
   24.58 -                    err = ERR_INVALID_GROUP_NAME;
   24.59 -                    // isNum = 0;
   24.60 -                }
   24.61 -            } else if (!EncodingHelper.isWord(c)) {
   24.62 -                err = ERR_INVALID_CHAR_IN_GROUP_NAME;
   24.63 -            }
   24.64 -        }
   24.65 -
   24.66 -        boolean isEndCode = false;
   24.67 -        if (err == null && c != endCode) {
   24.68 -            if (c == '+' || c == '-') {
   24.69 -                int flag = c == '-' ? -1 : 1;
   24.70 -
   24.71 -                fetch();
   24.72 -                if (!EncodingHelper.isDigit(c)) newValueException(ERR_INVALID_GROUP_NAME, src, stop);
   24.73 -                unfetch();
   24.74 -                int level = scanUnsignedNumber();
   24.75 -                if (level < 0) newValueException(ERR_TOO_BIG_NUMBER);
   24.76 -                rlevel.p = level * flag;
   24.77 -                existLevel = true;
   24.78 -
   24.79 -                fetch();
   24.80 -                isEndCode = c == endCode;
   24.81 -            }
   24.82 -
   24.83 -            if (!isEndCode) {
   24.84 -                err = ERR_INVALID_GROUP_NAME;
   24.85 -                nameEnd = stop;
   24.86 -            }
   24.87 -        }
   24.88 -
   24.89 -        if (err == null) {
   24.90 -            if (isNum != 0) {
   24.91 -                mark();
   24.92 -                p = pnumHead;
   24.93 -                int backNum = scanUnsignedNumber();
   24.94 -                restore();
   24.95 -                if (backNum < 0) {
   24.96 -                    newValueException(ERR_TOO_BIG_NUMBER);
   24.97 -                } else if (backNum == 0) {
   24.98 -                    newValueException(ERR_INVALID_GROUP_NAME, src, stop);
   24.99 -                }
  24.100 -                rbackNum.p = backNum * sign;
  24.101 -            }
  24.102 -            value = nameEnd;
  24.103 -            return existLevel;
  24.104 -        } else {
  24.105 -            newValueException(ERR_INVALID_GROUP_NAME, src, nameEnd);
  24.106 -            return false; // not reached
  24.107 -        }
  24.108 -    }
  24.109 -
  24.110 -    // USE_NAMED_GROUP
  24.111 -    // ref: 0 -> define name    (don't allow number name)
  24.112 -    //      1 -> reference name (allow number name)
  24.113 -    private int fetchNameForNamedGroup(int startCode, boolean ref) {
  24.114 -        int src = p;
  24.115 -        value = 0;
  24.116 -
  24.117 -        int isNum = 0;
  24.118 -        int sign = 1;
  24.119 -
  24.120 -        int endCode = nameEndCodePoint(startCode);
  24.121 -        int pnumHead = p;
  24.122 -        int nameEnd = stop;
  24.123 -
  24.124 -        String err = null;
  24.125 -        if (!left()) {
  24.126 -            newValueException(ERR_EMPTY_GROUP_NAME);
  24.127 -        } else {
  24.128 -            fetch();
  24.129 -            if (c == endCode) newValueException(ERR_EMPTY_GROUP_NAME);
  24.130 -            if (EncodingHelper.isDigit(c)) {
  24.131 -                if (ref) {
  24.132 -                    isNum = 1;
  24.133 -                } else {
  24.134 -                    err = ERR_INVALID_GROUP_NAME;
  24.135 -                    // isNum = 0;
  24.136 -                }
  24.137 -            } else if (c == '-') {
  24.138 -                if (ref) {
  24.139 -                    isNum = 2;
  24.140 -                    sign = -1;
  24.141 -                    pnumHead = p;
  24.142 -                } else {
  24.143 -                    err = ERR_INVALID_GROUP_NAME;
  24.144 -                    // isNum = 0;
  24.145 -                }
  24.146 -            } else if (!EncodingHelper.isWord(c)) {
  24.147 -                err = ERR_INVALID_CHAR_IN_GROUP_NAME;
  24.148 -            }
  24.149 -        }
  24.150 -
  24.151 -        if (err == null) {
  24.152 -            while (left()) {
  24.153 -                nameEnd = p;
  24.154 -                fetch();
  24.155 -                if (c == endCode || c == ')') {
  24.156 -                    if (isNum == 2) err = ERR_INVALID_GROUP_NAME;
  24.157 -                    break;
  24.158 -                }
  24.159 -
  24.160 -                if (isNum != 0) {
  24.161 -                    if (EncodingHelper.isDigit(c)) {
  24.162 -                        isNum = 1;
  24.163 -                    } else {
  24.164 -                        if (!EncodingHelper.isWord(c)) {
  24.165 -                            err = ERR_INVALID_CHAR_IN_GROUP_NAME;
  24.166 -                        } else {
  24.167 -                            err = ERR_INVALID_GROUP_NAME;
  24.168 -                        }
  24.169 -                        // isNum = 0;
  24.170 -                    }
  24.171 -                } else {
  24.172 -                    if (!EncodingHelper.isWord(c)) {
  24.173 -                        err = ERR_INVALID_CHAR_IN_GROUP_NAME;
  24.174 -                    }
  24.175 -                }
  24.176 -            }
  24.177 -
  24.178 -            if (c != endCode) {
  24.179 -                err = ERR_INVALID_GROUP_NAME;
  24.180 -                nameEnd = stop;
  24.181 -            }
  24.182 -
  24.183 -            int backNum = 0;
  24.184 -            if (isNum != 0) {
  24.185 -                mark();
  24.186 -                p = pnumHead;
  24.187 -                backNum = scanUnsignedNumber();
  24.188 -                restore();
  24.189 -                if (backNum < 0) {
  24.190 -                    newValueException(ERR_TOO_BIG_NUMBER);
  24.191 -                } else if (backNum == 0) {
  24.192 -                    newValueException(ERR_INVALID_GROUP_NAME, src, nameEnd);
  24.193 -                }
  24.194 -                backNum *= sign;
  24.195 -            }
  24.196 -            value = nameEnd;
  24.197 -            return backNum;
  24.198 -        } else {
  24.199 -            while (left()) {
  24.200 -                nameEnd = p;
  24.201 -                fetch();
  24.202 -                if (c == endCode || c == ')') break;
  24.203 -            }
  24.204 -            if (!left()) nameEnd = stop;
  24.205 -            newValueException(err, src, nameEnd);
  24.206 -            return 0; // not reached
  24.207 -        }
  24.208 -    }
  24.209 -
  24.210      // #else USE_NAMED_GROUP
  24.211      // make it return nameEnd!
  24.212      private final int fetchNameForNoNamedGroup(int startCode, boolean ref) {
  24.213 @@ -472,11 +277,7 @@
  24.214      }
  24.215  
  24.216      protected final int fetchName(int startCode, boolean ref) {
  24.217 -        if (Config.USE_NAMED_GROUP) {
  24.218 -            return fetchNameForNamedGroup(startCode, ref);
  24.219 -        } else {
  24.220 -            return fetchNameForNoNamedGroup(startCode, ref);
  24.221 -        }
  24.222 +        return fetchNameForNoNamedGroup(startCode, ref);
  24.223      }
  24.224  
  24.225      private boolean strExistCheckWithEsc(int[]s, int n, int bad) {
  24.226 @@ -519,26 +320,6 @@
  24.227          token.setPropNot(flag);
  24.228      }
  24.229  
  24.230 -    private void fetchTokenInCCFor_p() {
  24.231 -        int c2 = peek(); // !!! migrate to peekIs
  24.232 -        if (c2 == '{' && syntax.op2EscPBraceCharProperty()) {
  24.233 -            inc();
  24.234 -            token.type = TokenType.CHAR_PROPERTY;
  24.235 -            token.setPropNot(c == 'P');
  24.236 -
  24.237 -            if (syntax.op2EscPBraceCircumflexNot()) {
  24.238 -                c2 = fetchTo();
  24.239 -                if (c2 == '^') {
  24.240 -                    token.setPropNot(!token.getPropNot());
  24.241 -                } else {
  24.242 -                    unfetch();
  24.243 -                }
  24.244 -            }
  24.245 -        } else {
  24.246 -            syntaxWarn(Warnings.INVALID_UNICODE_PROPERTY, (char)c);
  24.247 -        }
  24.248 -    }
  24.249 -
  24.250      private void fetchTokenInCCFor_x() {
  24.251          if (!left()) return;
  24.252          int last = p;
  24.253 @@ -604,30 +385,6 @@
  24.254          }
  24.255      }
  24.256  
  24.257 -    private void fetchTokenInCCFor_posixBracket() {
  24.258 -        if (syntax.opPosixBracket() && peekIs(':')) {
  24.259 -            token.backP = p; /* point at '[' is readed */
  24.260 -            inc();
  24.261 -            if (strExistCheckWithEsc(send, send.length, ']')) {
  24.262 -                token.type = TokenType.POSIX_BRACKET_OPEN;
  24.263 -            } else {
  24.264 -                unfetch();
  24.265 -                // remove duplication, goto cc_in_cc;
  24.266 -                if (syntax.op2CClassSetOp()) {
  24.267 -                    token.type = TokenType.CC_CC_OPEN;
  24.268 -                } else {
  24.269 -                    env.ccEscWarn("[");
  24.270 -                }
  24.271 -            }
  24.272 -        } else { // cc_in_cc:
  24.273 -            if (syntax.op2CClassSetOp()) {
  24.274 -                token.type = TokenType.CC_CC_OPEN;
  24.275 -            } else {
  24.276 -                env.ccEscWarn("[");
  24.277 -            }
  24.278 -        }
  24.279 -    }
  24.280 -
  24.281      private void fetchTokenInCCFor_and() {
  24.282          if (syntax.op2CClassSetOp() && left() && peekIs('&')) {
  24.283              inc();
  24.284 @@ -683,10 +440,6 @@
  24.285              case 'H':
  24.286                  if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(true, CharacterType.XDIGIT);
  24.287                  break;
  24.288 -            case 'p':
  24.289 -            case 'P':
  24.290 -                fetchTokenInCCFor_p();
  24.291 -                break;
  24.292              case 'x':
  24.293                  fetchTokenInCCFor_x();
  24.294                  break;
  24.295 @@ -714,18 +467,12 @@
  24.296                  break;
  24.297              } // switch
  24.298  
  24.299 -        } else if (c == '[') {
  24.300 -            fetchTokenInCCFor_posixBracket();
  24.301          } else if (c == '&') {
  24.302              fetchTokenInCCFor_and();
  24.303          }
  24.304          return token.type;
  24.305      }
  24.306  
  24.307 -    protected final int backrefRelToAbs(int relNo) {
  24.308 -        return env.numMem + 1 + relNo;
  24.309 -    }
  24.310 -
  24.311      private void fetchTokenFor_repeat(int lower, int upper) {
  24.312          token.type = TokenType.OP_REPEAT;
  24.313          token.setRepeatLower(lower);
  24.314 @@ -815,7 +562,6 @@
  24.315              token.setBackrefNum(1);
  24.316              token.setBackrefRef1(num);
  24.317              token.setBackrefByName(false);
  24.318 -            if (Config.USE_BACKREF_WITH_LEVEL) token.setBackrefExistLevel(false);
  24.319              return;
  24.320          }
  24.321  
  24.322 @@ -845,76 +591,6 @@
  24.323          }
  24.324      }
  24.325  
  24.326 -    private void fetchTokenFor_namedBackref() {
  24.327 -        if (syntax.op2EscKNamedBackref()) {
  24.328 -            if (left()) {
  24.329 -                fetch();
  24.330 -                if (c =='<' || c == '\'') {
  24.331 -                    int last = p;
  24.332 -                    int backNum;
  24.333 -                    if (Config.USE_BACKREF_WITH_LEVEL) {
  24.334 -                        Ptr rbackNum = new Ptr();
  24.335 -                        Ptr rlevel = new Ptr();
  24.336 -                        token.setBackrefExistLevel(fetchNameWithLevel(c, rbackNum, rlevel));
  24.337 -                        token.setBackrefLevel(rlevel.p);
  24.338 -                        backNum = rbackNum.p;
  24.339 -                    } else {
  24.340 -                        backNum = fetchName(c, true);
  24.341 -                    } // USE_BACKREF_AT_LEVEL
  24.342 -                    int nameEnd = value; // set by fetchNameWithLevel/fetchName
  24.343 -
  24.344 -                    if (backNum != 0) {
  24.345 -                        if (backNum < 0) {
  24.346 -                            backNum = backrefRelToAbs(backNum);
  24.347 -                            if (backNum <= 0) newValueException(ERR_INVALID_BACKREF);
  24.348 -                        }
  24.349 -
  24.350 -                        if (syntax.strictCheckBackref() && (backNum > env.numMem || env.memNodes == null)) {
  24.351 -                            newValueException(ERR_INVALID_BACKREF);
  24.352 -                        }
  24.353 -                        token.type = TokenType.BACKREF;
  24.354 -                        token.setBackrefByName(false);
  24.355 -                        token.setBackrefNum(1);
  24.356 -                        token.setBackrefRef1(backNum);
  24.357 -                    } else {
  24.358 -                        NameEntry e = env.reg.nameToGroupNumbers(chars, last, nameEnd);
  24.359 -                        if (e == null) newValueException(ERR_UNDEFINED_NAME_REFERENCE, last, nameEnd);
  24.360 -
  24.361 -                        if (syntax.strictCheckBackref()) {
  24.362 -                            if (e.backNum == 1) {
  24.363 -                                if (e.backRef1 > env.numMem ||
  24.364 -                                    env.memNodes == null ||
  24.365 -                                    env.memNodes[e.backRef1] == null) newValueException(ERR_INVALID_BACKREF);
  24.366 -                            } else {
  24.367 -                                for (int i=0; i<e.backNum; i++) {
  24.368 -                                    if (e.backRefs[i] > env.numMem ||
  24.369 -                                        env.memNodes == null ||
  24.370 -                                        env.memNodes[e.backRefs[i]] == null) newValueException(ERR_INVALID_BACKREF);
  24.371 -                                }
  24.372 -                            }
  24.373 -                        }
  24.374 -
  24.375 -                        token.type = TokenType.BACKREF;
  24.376 -                        token.setBackrefByName(true);
  24.377 -
  24.378 -                        if (e.backNum == 1) {
  24.379 -                            token.setBackrefNum(1);
  24.380 -                            token.setBackrefRef1(e.backRef1);
  24.381 -                        } else {
  24.382 -                            token.setBackrefNum(e.backNum);
  24.383 -                            token.setBackrefRefs(e.backRefs);
  24.384 -                        }
  24.385 -                    }
  24.386 -                } else {
  24.387 -                    unfetch();
  24.388 -                    syntaxWarn(Warnings.INVALID_BACKREFERENCE);
  24.389 -                }
  24.390 -            } else {
  24.391 -                syntaxWarn(Warnings.INVALID_BACKREFERENCE);
  24.392 -            }
  24.393 -        }
  24.394 -    }
  24.395 -
  24.396      private void fetchTokenFor_subexpCall() {
  24.397          if (syntax.op2EscGSubexpCall()) {
  24.398              if (left()) {
  24.399 @@ -937,25 +613,6 @@
  24.400          }
  24.401      }
  24.402  
  24.403 -    private void fetchTokenFor_charProperty() {
  24.404 -        if (peekIs('{') && syntax.op2EscPBraceCharProperty()) {
  24.405 -            inc();
  24.406 -            token.type = TokenType.CHAR_PROPERTY;
  24.407 -            token.setPropNot(c == 'P');
  24.408 -
  24.409 -            if (syntax.op2EscPBraceCircumflexNot()) {
  24.410 -                fetch();
  24.411 -                if (c == '^') {
  24.412 -                    token.setPropNot(!token.getPropNot());
  24.413 -                } else {
  24.414 -                    unfetch();
  24.415 -                }
  24.416 -            }
  24.417 -        } else {
  24.418 -            syntaxWarn(Warnings.INVALID_UNICODE_PROPERTY, (char)c);
  24.419 -        }
  24.420 -    }
  24.421 -
  24.422      private void fetchTokenFor_metaChars() {
  24.423          if (c == syntax.metaCharTable.anyChar) {
  24.424              token.type = TokenType.ANYCHAR;
  24.425 @@ -1091,19 +748,6 @@
  24.426                  case '0':
  24.427                      fetchTokenFor_zero();
  24.428                      break;
  24.429 -                case 'k':
  24.430 -                    if (Config.USE_NAMED_GROUP) fetchTokenFor_namedBackref();
  24.431 -                    break;
  24.432 -                case 'g':
  24.433 -                    if (Config.USE_SUBEXP_CALL) fetchTokenFor_subexpCall();
  24.434 -                    break;
  24.435 -                case 'Q':
  24.436 -                    if (syntax.op2EscCapitalQQuote()) token.type = TokenType.QUOTE_OPEN;
  24.437 -                    break;
  24.438 -                case 'p':
  24.439 -                case 'P':
  24.440 -                    fetchTokenFor_charProperty();
  24.441 -                    break;
  24.442  
  24.443                  default:
  24.444                      unfetch();
  24.445 @@ -1244,24 +888,6 @@
  24.446          }
  24.447      }
  24.448  
  24.449 -    protected final int fetchCharPropertyToCType() {
  24.450 -        mark();
  24.451 -
  24.452 -        while (left()) {
  24.453 -            int last = p;
  24.454 -            fetch();
  24.455 -            if (c == '}') {
  24.456 -                String name = new String(chars, _p, last - _p);
  24.457 -                return PosixBracket.propertyNameToCType(name);
  24.458 -            } else if (c == '(' || c == ')' || c == '{' || c == '|') {
  24.459 -                String name = new String(chars, _p, last - _p);
  24.460 -                throw new JOniException(ERR_INVALID_CHAR_PROPERTY_NAME.replaceAll("%n", name));
  24.461 -            }
  24.462 -        }
  24.463 -        newInternalException(ERR_PARSER_BUG);
  24.464 -        return 0; // not reached
  24.465 -    }
  24.466 -
  24.467      protected final void syntaxWarn(String message, char c) {
  24.468          syntaxWarn(message.replace("<%n>", Character.toString(c)));
  24.469      }
    25.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Matcher.java	Fri May 17 14:30:22 2013 -0300
    25.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Matcher.java	Fri May 17 16:12:59 2013 -0300
    25.3 @@ -58,17 +58,10 @@
    25.4      // main matching method
    25.5      protected abstract int matchAt(int range, int sstart, int sprev);
    25.6  
    25.7 -    protected abstract void stateCheckBuffInit(int strLength, int offset, int stateNum);
    25.8 -    protected abstract void stateCheckBuffClear();
    25.9 -
   25.10      public final Region getRegion() {
   25.11          return msaRegion;
   25.12      }
   25.13  
   25.14 -    public final Region getEagerRegion() {
   25.15 -        return msaRegion != null ? msaRegion : new Region(msaBegin, msaEnd);
   25.16 -    }
   25.17 -
   25.18      public final int getBegin() {
   25.19          return msaBegin;
   25.20      }
   25.21 @@ -86,11 +79,6 @@
   25.22      public final int match(int at, int range, int option) {
   25.23          msaInit(option, at);
   25.24  
   25.25 -        if (Config.USE_COMBINATION_EXPLOSION_CHECK) {
   25.26 -            int offset = at = str;
   25.27 -            stateCheckBuffInit(end - str, offset, regex.numCombExpCheck); // move it to construction?
   25.28 -        } // USE_COMBINATION_EXPLOSION_CHECK
   25.29 -
   25.30          int prev = EncodingHelper.prevCharHead(str, at);
   25.31  
   25.32          if (Config.USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE) {
   25.33 @@ -377,8 +365,6 @@
   25.34                  prev = -1;
   25.35                  msaInit(option, start);
   25.36  
   25.37 -                if (Config.USE_COMBINATION_EXPLOSION_CHECK) stateCheckBuffClear();
   25.38 -
   25.39                  if (matchCheck(end, s, prev)) return match(s);
   25.40                  return mismatch();
   25.41              }
   25.42 @@ -393,10 +379,6 @@
   25.43          }
   25.44  
   25.45          msaInit(option, origStart);
   25.46 -        if (Config.USE_COMBINATION_EXPLOSION_CHECK) {
   25.47 -            int offset = Math.min(start, range) - str;
   25.48 -            stateCheckBuffInit(end - str, offset, regex.numCombExpCheck);
   25.49 -        }
   25.50  
   25.51          s = start;
   25.52          if (range > start) {    /* forward search */
    26.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/NameEntry.java	Fri May 17 14:30:22 2013 -0300
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,97 +0,0 @@
    26.4 -/*
    26.5 - * Permission is hereby granted, free of charge, to any person obtaining a copy of
    26.6 - * this software and associated documentation files (the "Software"), to deal in
    26.7 - * the Software without restriction, including without limitation the rights to
    26.8 - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
    26.9 - * of the Software, and to permit persons to whom the Software is furnished to do
   26.10 - * so, subject to the following conditions:
   26.11 - *
   26.12 - * The above copyright notice and this permission notice shall be included in all
   26.13 - * copies or substantial portions of the Software.
   26.14 - *
   26.15 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   26.16 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   26.17 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   26.18 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   26.19 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   26.20 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   26.21 - * SOFTWARE.
   26.22 - */
   26.23 -package jdk.nashorn.internal.runtime.regexp.joni;
   26.24 -
   26.25 -public final class NameEntry {
   26.26 -    static final int INIT_NAME_BACKREFS_ALLOC_NUM = 8;
   26.27 -
   26.28 -    public final char[] name;
   26.29 -    public final int nameP;
   26.30 -    public final int nameEnd;
   26.31 -
   26.32 -    int backNum;
   26.33 -    int backRef1;
   26.34 -    int backRefs[];
   26.35 -
   26.36 -    public NameEntry(char[] chars, int p, int end) {
   26.37 -        name = chars;
   26.38 -        nameP = p;
   26.39 -        nameEnd = end;
   26.40 -    }
   26.41 -
   26.42 -    public int[] getBackRefs() {
   26.43 -        switch (backNum) {
   26.44 -        case 0:
   26.45 -            return new int[]{};
   26.46 -        case 1:
   26.47 -            return new int[]{backRef1};
   26.48 -        default:
   26.49 -            int[]result = new int[backNum];
   26.50 -            System.arraycopy(backRefs, 0, result, 0, backNum);
   26.51 -            return result;
   26.52 -        }
   26.53 -    }
   26.54 -
   26.55 -    private void alloc() {
   26.56 -        backRefs = new int[INIT_NAME_BACKREFS_ALLOC_NUM];
   26.57 -    }
   26.58 -
   26.59 -    private void ensureSize() {
   26.60 -        if (backNum > backRefs.length) {
   26.61 -            int[]tmp = new int[backRefs.length << 1];
   26.62 -            System.arraycopy(backRefs, 0, tmp, 0, backRefs.length);
   26.63 -            backRefs = tmp;
   26.64 -        }
   26.65 -    }
   26.66 -
   26.67 -    public void addBackref(int backRef) {
   26.68 -        backNum++;
   26.69 -
   26.70 -        switch (backNum) {
   26.71 -            case 1:
   26.72 -                backRef1 = backRef;
   26.73 -                break;
   26.74 -            case 2:
   26.75 -                alloc();
   26.76 -                backRefs[0] = backRef1;
   26.77 -                backRefs[1] = backRef;
   26.78 -                break;
   26.79 -            default:
   26.80 -                ensureSize();
   26.81 -                backRefs[backNum - 1] = backRef;
   26.82 -        }
   26.83 -    }
   26.84 -
   26.85 -    public String toString() {
   26.86 -        StringBuilder buff = new StringBuilder(new String(name, nameP, nameEnd - nameP) + " ");
   26.87 -        if (backNum == 0) {
   26.88 -            buff.append("-");
   26.89 -        } else if (backNum == 1){
   26.90 -            buff.append(backRef1);
   26.91 -        } else {
   26.92 -            for (int i=0; i<backNum; i++){
   26.93 -                if (i > 0) buff.append(", ");
   26.94 -                buff.append(backRefs[i]);
   26.95 -            }
   26.96 -        }
   26.97 -        return buff.toString();
   26.98 -    }
   26.99 -
  26.100 -}
    27.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/NativeMachine.java	Fri May 17 14:30:22 2013 -0300
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,27 +0,0 @@
    27.4 -/*
    27.5 - * Permission is hereby granted, free of charge, to any person obtaining a copy of
    27.6 - * this software and associated documentation files (the "Software"), to deal in
    27.7 - * the Software without restriction, including without limitation the rights to
    27.8 - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
    27.9 - * of the Software, and to permit persons to whom the Software is furnished to do
   27.10 - * so, subject to the following conditions:
   27.11 - *
   27.12 - * The above copyright notice and this permission notice shall be included in all
   27.13 - * copies or substantial portions of the Software.
   27.14 - *
   27.15 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   27.16 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   27.17 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   27.18 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   27.19 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   27.20 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   27.21 - * SOFTWARE.
   27.22 - */
   27.23 -package jdk.nashorn.internal.runtime.regexp.joni;
   27.24 -
   27.25 -public abstract class NativeMachine extends Matcher {
   27.26 -
   27.27 -    protected NativeMachine(Regex regex, char[] chars, int p, int end) {
   27.28 -        super(regex, chars, p, end);
   27.29 -    }
   27.30 -}
    28.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Parser.java	Fri May 17 14:30:22 2013 -0300
    28.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Parser.java	Fri May 17 16:12:59 2013 -0300
    28.3 @@ -19,20 +19,15 @@
    28.4   */
    28.5  package jdk.nashorn.internal.runtime.regexp.joni;
    28.6  
    28.7 -import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsOnAtSimple;
    28.8  import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsOnOff;
    28.9  import static jdk.nashorn.internal.runtime.regexp.joni.Option.isDontCaptureGroup;
   28.10  import static jdk.nashorn.internal.runtime.regexp.joni.Option.isIgnoreCase;
   28.11  
   28.12  import jdk.nashorn.internal.runtime.regexp.joni.encoding.CharacterType;
   28.13 -import jdk.nashorn.internal.runtime.regexp.joni.encoding.PosixBracket;
   28.14 -import jdk.nashorn.internal.runtime.regexp.joni.encoding.Ptr;
   28.15  import jdk.nashorn.internal.runtime.regexp.joni.ast.AnchorNode;
   28.16  import jdk.nashorn.internal.runtime.regexp.joni.ast.AnyCharNode;
   28.17  import jdk.nashorn.internal.runtime.regexp.joni.ast.BackRefNode;
   28.18  import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode;
   28.19 -import jdk.nashorn.internal.runtime.regexp.joni.ast.CTypeNode;
   28.20 -import jdk.nashorn.internal.runtime.regexp.joni.ast.CallNode;
   28.21  import jdk.nashorn.internal.runtime.regexp.joni.ast.ConsAltNode;
   28.22  import jdk.nashorn.internal.runtime.regexp.joni.ast.EncloseNode;
   28.23  import jdk.nashorn.internal.runtime.regexp.joni.ast.Node;
   28.24 @@ -66,65 +61,6 @@
   28.25          return root;
   28.26      }
   28.27  
   28.28 -    private static final int POSIX_BRACKET_NAME_MIN_LEN            = 4;
   28.29 -    private static final int POSIX_BRACKET_CHECK_LIMIT_LENGTH      = 20;
   28.30 -    private static final char BRACKET_END[]                        = ":]".toCharArray();
   28.31 -    private boolean parsePosixBracket(CClassNode cc) {
   28.32 -        mark();
   28.33 -
   28.34 -        boolean not;
   28.35 -        if (peekIs('^')) {
   28.36 -            inc();
   28.37 -            not = true;
   28.38 -        } else {
   28.39 -            not = false;
   28.40 -        }
   28.41 -        if (stop - p >= POSIX_BRACKET_NAME_MIN_LEN + 3) { // else goto not_posix_bracket
   28.42 -            char[][] pbs = PosixBracket.PBSNamesLower;
   28.43 -            for (int i=0; i<pbs.length; i++) {
   28.44 -                char[] name = pbs[i];
   28.45 -                // hash lookup here ?
   28.46 -                if (EncodingHelper.strNCmp(chars, p, stop, name, 0, name.length) == 0) {
   28.47 -                    p += name.length;
   28.48 -                    if (EncodingHelper.strNCmp(chars, p, stop, BRACKET_END, 0, BRACKET_END.length) != 0) {
   28.49 -                        newSyntaxException(ERR_INVALID_POSIX_BRACKET_TYPE);
   28.50 -                    }
   28.51 -                    cc.addCType(PosixBracket.PBSValues[i], not, env, this);
   28.52 -                    inc();
   28.53 -                    inc();
   28.54 -                    return false;
   28.55 -                }
   28.56 -            }
   28.57 -
   28.58 -        }
   28.59 -
   28.60 -        // not_posix_bracket:
   28.61 -        c = 0;
   28.62 -        int i= 0;
   28.63 -        while (left() && ((c=peek()) != ':') && c != ']') {
   28.64 -            inc();
   28.65 -            if (++i > POSIX_BRACKET_CHECK_LIMIT_LENGTH) break;
   28.66 -        }
   28.67 -
   28.68 -        if (c == ':' && left()) {
   28.69 -            inc();
   28.70 -            if (left()) {
   28.71 -                fetch();
   28.72 -                if (c == ']') newSyntaxException(ERR_INVALID_POSIX_BRACKET_TYPE);
   28.73 -            }
   28.74 -        }
   28.75 -        restore();
   28.76 -        return true; /* 1: is not POSIX bracket, but no error. */
   28.77 -    }
   28.78 -
   28.79 -    private CClassNode parseCharProperty() {
   28.80 -        int ctype = fetchCharPropertyToCType();
   28.81 -        CClassNode n = new CClassNode();
   28.82 -        n.addCType(ctype, false, env, this);
   28.83 -        if (token.getPropNot()) n.setNot();
   28.84 -        return n;
   28.85 -    }
   28.86 -
   28.87      private boolean codeExistCheck(int code, boolean ignoreEscaped) {
   28.88          mark();
   28.89  
   28.90 @@ -225,29 +161,11 @@
   28.91                  parseCharClassValEntry(cc, arg); // val_entry:, val_entry2
   28.92                  break;
   28.93  
   28.94 -            case POSIX_BRACKET_OPEN:
   28.95 -                if (parsePosixBracket(cc)) { /* true: is not POSIX bracket */
   28.96 -                    env.ccEscWarn("[");
   28.97 -                    p = token.backP;
   28.98 -                    arg.v = token.getC();
   28.99 -                    arg.vIsRaw = false;
  28.100 -                    parseCharClassValEntry(cc, arg); // goto val_entry
  28.101 -                    break;
  28.102 -                }
  28.103 -                cc.nextStateClass(arg, env); // goto next_class
  28.104 -                break;
  28.105 -
  28.106              case CHAR_TYPE:
  28.107                  cc.addCType(token.getPropCType(), token.getPropNot(), env, this);
  28.108                  cc.nextStateClass(arg, env); // next_class:
  28.109                  break;
  28.110  
  28.111 -            case CHAR_PROPERTY:
  28.112 -                int ctype = fetchCharPropertyToCType();
  28.113 -                cc.addCType(ctype, token.getPropNot(), env, this);
  28.114 -                cc.nextStateClass(arg, env); // goto next_class
  28.115 -                break;
  28.116 -
  28.117              case CC_RANGE:
  28.118                  if (arg.state == CCSTATE.VALUE) {
  28.119                      fetchTokenInCC();
  28.120 @@ -413,15 +331,6 @@
  28.121                  node = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose
  28.122                  break;
  28.123              case '\'':
  28.124 -                if (Config.USE_NAMED_GROUP) {
  28.125 -                    if (syntax.op2QMarkLtNamedGroup()) {
  28.126 -                        listCapture = false; // goto named_group1
  28.127 -                        node = parseEncloseNamedGroup2(listCapture);
  28.128 -                        break;
  28.129 -                    } else {
  28.130 -                        newSyntaxException(ERR_UNDEFINED_GROUP_OPTION);
  28.131 -                    }
  28.132 -                } // USE_NAMED_GROUP
  28.133                  break;
  28.134              case '<':  /* look behind (?<=...), (?<!...) */
  28.135                  fetch();
  28.136 @@ -430,36 +339,12 @@
  28.137                  } else if (c == '!') {
  28.138                      node = new AnchorNode(AnchorType.LOOK_BEHIND_NOT);
  28.139                  } else {
  28.140 -                    if (Config.USE_NAMED_GROUP) {
  28.141 -                        if (syntax.op2QMarkLtNamedGroup()) {
  28.142 -                            unfetch();
  28.143 -                            c = '<';
  28.144 -
  28.145 -                            listCapture = false; // named_group1:
  28.146 -                            node = parseEncloseNamedGroup2(listCapture); // named_group2:
  28.147 -                            break;
  28.148 -                        } else {
  28.149 -                            newSyntaxException(ERR_UNDEFINED_GROUP_OPTION);
  28.150 -                        }
  28.151 -
  28.152 -                    } else { // USE_NAMED_GROUP
  28.153 -                        newSyntaxException(ERR_UNDEFINED_GROUP_OPTION);
  28.154 -                    } // USE_NAMED_GROUP
  28.155 +                    newSyntaxException(ERR_UNDEFINED_GROUP_OPTION);
  28.156                  }
  28.157                  break;
  28.158              case '@':
  28.159                  if (syntax.op2AtMarkCaptureHistory()) {
  28.160 -                    if (Config.USE_NAMED_GROUP) {
  28.161 -                        if (syntax.op2QMarkLtNamedGroup()) {
  28.162 -                            fetch();
  28.163 -                            if (c == '<' || c == '\'') {
  28.164 -                                listCapture = true;
  28.165 -                                node = parseEncloseNamedGroup2(listCapture); // goto named_group2 /* (?@<name>...) */
  28.166 -                            }
  28.167 -                            unfetch();
  28.168 -                        }
  28.169 -                    } // USE_NAMED_GROUP
  28.170 -                    EncloseNode en = new EncloseNode(env.option, false); // node_new_enclose_memory
  28.171 +                    EncloseNode en = new EncloseNode(); // node_new_enclose_memory
  28.172                      int num = env.addMemEntry();
  28.173                      if (num >= BitStatus.BIT_STATUS_BITS_NUM) newValueException(ERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY);
  28.174                      en.regNum = num;
  28.175 @@ -546,7 +431,7 @@
  28.176                  returnCode = 1; /* group */
  28.177                  return node;
  28.178              }
  28.179 -            EncloseNode en = new EncloseNode(env.option, false); // node_new_enclose_memory
  28.180 +            EncloseNode en = new EncloseNode(); // node_new_enclose_memory
  28.181              int num = env.addMemEntry();
  28.182              en.regNum = num;
  28.183              node = en;
  28.184 @@ -570,48 +455,6 @@
  28.185          return node; // ??
  28.186      }
  28.187  
  28.188 -    private Node parseEncloseNamedGroup2(boolean listCapture) {
  28.189 -        int nm = p;
  28.190 -        int num = fetchName(c, false);
  28.191 -        int nameEnd = value;
  28.192 -        num = env.addMemEntry();
  28.193 -        if (listCapture && num >= BitStatus.BIT_STATUS_BITS_NUM) newValueException(ERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY);
  28.194 -
  28.195 -        regex.nameAdd(chars, nm, nameEnd, num, syntax);
  28.196 -        EncloseNode en = new EncloseNode(env.option, true); // node_new_enclose_memory
  28.197 -        en.regNum = num;
  28.198 -
  28.199 -        Node node = en;
  28.200 -
  28.201 -        if (listCapture) env.captureHistory = bsOnAtSimple(env.captureHistory, num);
  28.202 -        env.numNamed++;
  28.203 -        return node;
  28.204 -    }
  28.205 -
  28.206 -    private int findStrPosition(int[]s, int n, int from, int to, Ptr nextChar) {
  28.207 -        int x;
  28.208 -        int q;
  28.209 -        int p = from;
  28.210 -        int i = 0;
  28.211 -        while (p < to) {
  28.212 -            x = chars[p];
  28.213 -            q = p + 1;
  28.214 -            if (x == s[0]) {
  28.215 -                for (i=1; i<n && q<to; i++) {
  28.216 -                    x = chars[q];
  28.217 -                    if (x != s[i]) break;
  28.218 -                    q++;
  28.219 -                }
  28.220 -                if (i >= n) {
  28.221 -                    if (chars[nextChar.p] != 0) nextChar.p = q; // we may need zero term semantics...
  28.222 -                    return p;
  28.223 -                }
  28.224 -            }
  28.225 -            p = q;
  28.226 -        }
  28.227 -        return -1;
  28.228 -    }
  28.229 -
  28.230      private Node parseExp(TokenType term) {
  28.231          if (token.type == term) return StringNode.EMPTY; // goto end_of_token
  28.232  
  28.233 @@ -656,16 +499,6 @@
  28.234              node = new StringNode(buf, 0, 1);
  28.235              break;
  28.236  
  28.237 -        case QUOTE_OPEN:
  28.238 -            int[] endOp = new int[] {syntax.metaCharTable.esc, 'E'};
  28.239 -            int qstart = p;
  28.240 -            Ptr nextChar = new Ptr();
  28.241 -            int qend = findStrPosition(endOp, endOp.length, qstart, stop, nextChar);
  28.242 -            if (qend == -1) nextChar.p = qend = stop;
  28.243 -            node = new StringNode(chars, qstart, qend);
  28.244 -            p = nextChar.p;
  28.245 -            break;
  28.246 -
  28.247          case CHAR_TYPE:
  28.248              switch(token.getPropCType()) {
  28.249              case CharacterType.D:
  28.250 @@ -679,10 +512,6 @@
  28.251                  }
  28.252                  break;
  28.253  
  28.254 -            case CharacterType.WORD:
  28.255 -                node = new CTypeNode(token.getPropCType(), token.getPropNot());
  28.256 -                break;
  28.257 -
  28.258              case CharacterType.SPACE:
  28.259              case CharacterType.DIGIT:
  28.260              case CharacterType.XDIGIT:
  28.261 @@ -699,10 +528,6 @@
  28.262              } // inner switch
  28.263              break;
  28.264  
  28.265 -        case CHAR_PROPERTY:
  28.266 -            node = parseCharProperty();
  28.267 -            break;
  28.268 -
  28.269          case CC_CC_OPEN:
  28.270              CClassNode cc = parseCharClass();
  28.271              node = cc;
  28.272 @@ -735,20 +560,6 @@
  28.273                              token.getBackrefExistLevel(), // #ifdef USE_BACKREF_AT_LEVEL
  28.274                              token.getBackrefLevel(),      // ...
  28.275                              env);
  28.276 -
  28.277 -            break;
  28.278 -
  28.279 -        case CALL:
  28.280 -            if (Config.USE_SUBEXP_CALL) {
  28.281 -                int gNum = token.getCallGNum();
  28.282 -
  28.283 -                if (gNum < 0) {
  28.284 -                    gNum = backrefRelToAbs(gNum);
  28.285 -                    if (gNum <= 0) newValueException(ERR_INVALID_BACKREF);
  28.286 -                }
  28.287 -                node = new CallNode(chars, token.getCallNameP(), token.getCallNameEnd(), gNum);
  28.288 -                env.numCall++;
  28.289 -            } // USE_SUBEXP_CALL
  28.290              break;
  28.291  
  28.292          case ANCHOR:
    29.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Regex.java	Fri May 17 14:30:22 2013 -0300
    29.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Regex.java	Fri May 17 16:12:59 2013 -0300
    29.3 @@ -23,9 +23,11 @@
    29.4  import static jdk.nashorn.internal.runtime.regexp.joni.Option.isCaptureGroup;
    29.5  import static jdk.nashorn.internal.runtime.regexp.joni.Option.isDontCaptureGroup;
    29.6  
    29.7 +import java.nio.file.Files;
    29.8  import java.util.HashMap;
    29.9  import java.util.Iterator;
   29.10  
   29.11 +import jdk.nashorn.internal.runtime.regexp.joni.ast.Node;
   29.12  import jdk.nashorn.internal.runtime.regexp.joni.constants.AnchorType;
   29.13  import jdk.nashorn.internal.runtime.regexp.joni.constants.RegexState;
   29.14  import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages;
   29.15 @@ -44,7 +46,6 @@
   29.16      int numMem;             /* used memory(...) num counted from 1 */
   29.17      int numRepeat;          /* OP_REPEAT/OP_REPEAT_NG id-counter */
   29.18      int numNullCheck;       /* OP_NULL_CHECK_START/END id counter */
   29.19 -    int numCombExpCheck;    /* combination explosion check */
   29.20      int numCall;            /* number of subexp call */
   29.21      int captureHistory;     /* (?@...) flag (1-31) */
   29.22      int btMemStart;         /* need backtrack flag */
   29.23 @@ -57,7 +58,7 @@
   29.24  
   29.25      WarnCallback warnings;
   29.26      MatcherFactory factory;
   29.27 -    private Analyser analyser;
   29.28 +    protected Analyser analyser;
   29.29  
   29.30      int options;
   29.31      int userOptions;
   29.32 @@ -65,8 +66,6 @@
   29.33      //final Syntax syntax;
   29.34      final int caseFoldFlag;
   29.35  
   29.36 -    HashMap<String,NameEntry> nameTable;        // named entries
   29.37 -
   29.38      /* optimization info (string search, char-map and anchors) */
   29.39      SearchAlgorithm searchAlgorithm;        /* optimize flag */
   29.40      int thresholdLength;                    /* search str-length for apply optimize */
   29.41 @@ -172,112 +171,6 @@
   29.42          return numMem;
   29.43      }
   29.44  
   29.45 -    public int numberOfCaptureHistories() {
   29.46 -        if (Config.USE_CAPTURE_HISTORY) {
   29.47 -            int n = 0;
   29.48 -            for (int i=0; i<=Config.MAX_CAPTURE_HISTORY_GROUP; i++) {
   29.49 -                if (bsAt(captureHistory, i)) n++;
   29.50 -            }
   29.51 -            return n;
   29.52 -        } else {
   29.53 -            return 0;
   29.54 -        }
   29.55 -    }
   29.56 -
   29.57 -    String nameTableToString() {
   29.58 -        StringBuilder sb = new StringBuilder();
   29.59 -
   29.60 -        if (nameTable != null) {
   29.61 -            sb.append("name table\n");
   29.62 -            for (NameEntry ne : nameTable.values()) {
   29.63 -                sb.append("  " + ne + "\n");
   29.64 -            }
   29.65 -            sb.append("\n");
   29.66 -        }
   29.67 -        return sb.toString();
   29.68 -    }
   29.69 -
   29.70 -    NameEntry nameFind(char[] name, int nameP, int nameEnd) {
   29.71 -        if (nameTable != null) return nameTable.get(new String(name, nameP, nameEnd - nameP));
   29.72 -        return null;
   29.73 -    }
   29.74 -
   29.75 -    void renumberNameTable(int[]map) {
   29.76 -        if (nameTable != null) {
   29.77 -            for (NameEntry e : nameTable.values()) {
   29.78 -                if (e.backNum > 1) {
   29.79 -                    for (int i=0; i<e.backNum; i++) {
   29.80 -                        e.backRefs[i] = map[e.backRefs[i]];
   29.81 -                    }
   29.82 -                } else if (e.backNum == 1) {
   29.83 -                    e.backRef1 = map[e.backRef1];
   29.84 -                }
   29.85 -            }
   29.86 -        }
   29.87 -    }
   29.88 -
   29.89 -    public int numberOfNames() {
   29.90 -        return nameTable == null ? 0 : nameTable.size();
   29.91 -    }
   29.92 -
   29.93 -    void nameAdd(char[] name, int nameP, int nameEnd, int backRef, Syntax syntax) {
   29.94 -        if (nameEnd - nameP <= 0) throw new ValueException(ErrorMessages.ERR_EMPTY_GROUP_NAME);
   29.95 -
   29.96 -        NameEntry e = null;
   29.97 -        if (nameTable == null) {
   29.98 -            nameTable = new HashMap<String,NameEntry>(); // 13, oni defaults to 5
   29.99 -        } else {
  29.100 -            e = nameFind(name, nameP, nameEnd);
  29.101 -        }
  29.102 -
  29.103 -        if (e == null) {
  29.104 -            // dup the name here as oni does ?, what for ? (it has to manage it, we don't)
  29.105 -            e = new NameEntry(name, nameP, nameEnd);
  29.106 -            nameTable.put(new String(name, nameP, nameEnd - nameP), e);
  29.107 -        } else if (e.backNum >= 1 && !syntax.allowMultiplexDefinitionName()) {
  29.108 -            throw new ValueException(ErrorMessages.ERR_MULTIPLEX_DEFINED_NAME, new String(name, nameP, nameEnd - nameP));
  29.109 -        }
  29.110 -
  29.111 -        e.addBackref(backRef);
  29.112 -    }
  29.113 -
  29.114 -    NameEntry nameToGroupNumbers(char[] name, int nameP, int nameEnd) {
  29.115 -        return nameFind(name, nameP, nameEnd);
  29.116 -    }
  29.117 -
  29.118 -    public int nameToBackrefNumber(char[] name, int nameP, int nameEnd, Region region) {
  29.119 -        NameEntry e = nameToGroupNumbers(name, nameP, nameEnd);
  29.120 -        if (e == null) throw new ValueException(ErrorMessages.ERR_UNDEFINED_NAME_REFERENCE,
  29.121 -                                                new String(name, nameP, nameEnd - nameP));
  29.122 -
  29.123 -        switch(e.backNum) {
  29.124 -        case 0:
  29.125 -            throw new InternalException(ErrorMessages.ERR_PARSER_BUG);
  29.126 -        case 1:
  29.127 -            return e.backRef1;
  29.128 -        default:
  29.129 -            if (region != null) {
  29.130 -                for (int i = e.backNum - 1; i >= 0; i--) {
  29.131 -                    if (region.beg[e.backRefs[i]] != Region.REGION_NOTPOS) return e.backRefs[i];
  29.132 -                }
  29.133 -            }
  29.134 -            return e.backRefs[e.backNum - 1];
  29.135 -        }
  29.136 -    }
  29.137 -
  29.138 -    public Iterator<NameEntry> namedBackrefIterator() {
  29.139 -        return nameTable.values().iterator();
  29.140 -    }
  29.141 -
  29.142 -    public boolean noNameGroupIsActive(Syntax syntax) {
  29.143 -        if (isDontCaptureGroup(options)) return false;
  29.144 -
  29.145 -        if (Config.USE_NAMED_GROUP) {
  29.146 -            if (numberOfNames() > 0 && syntax.captureOnlyNamedGroup() && !isCaptureGroup(options)) return false;
  29.147 -        }
  29.148 -        return true;
  29.149 -    }
  29.150 -
  29.151      /* set skip map for Boyer-Moor search */
  29.152      void setupBMSkipMap() {
  29.153          char[] chars = exact;
  29.154 @@ -353,16 +246,6 @@
  29.155          exactP = exactEnd = 0;
  29.156      }
  29.157  
  29.158 -    public String encStringToString(byte[]bytes, int p, int end) {
  29.159 -        StringBuilder sb = new StringBuilder("\nPATTERN: /");
  29.160 -
  29.161 -        while (p < end) {
  29.162 -            sb.append(new String(new byte[]{bytes[p]}));
  29.163 -            p++;
  29.164 -        }
  29.165 -        return sb.append("/").toString();
  29.166 -    }
  29.167 -
  29.168      public String optimizeInfoToString() {
  29.169          String s = "";
  29.170          s += "optimize: " + searchAlgorithm.getName() + "\n";
  29.171 @@ -410,19 +293,13 @@
  29.172          return options;
  29.173      }
  29.174  
  29.175 -    public void setUserOptions(int options) {
  29.176 -        this.userOptions = options;
  29.177 +    public String dumpTree() {
  29.178 +        return analyser == null ? null : analyser.root.toString();
  29.179      }
  29.180  
  29.181 -    public int getUserOptions() {
  29.182 -        return userOptions;
  29.183 +    public String dumpByteCode() {
  29.184 +        compile();
  29.185 +        return new ByteCodePrinter(this).byteCodeListToString();
  29.186      }
  29.187  
  29.188 -    public void setUserObject(Object object) {
  29.189 -        this.userObject = object;
  29.190 -    }
  29.191 -
  29.192 -    public Object getUserObject() {
  29.193 -        return userObject;
  29.194 -    }
  29.195  }
    30.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Region.java	Fri May 17 14:30:22 2013 -0300
    30.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Region.java	Fri May 17 16:12:59 2013 -0300
    30.3 @@ -25,7 +25,6 @@
    30.4      public final int numRegs;
    30.5      public final int[]beg;
    30.6      public final int[]end;
    30.7 -    public CaptureTreeNode historyRoot;
    30.8  
    30.9      public Region(int num) {
   30.10          this.numRegs = num;
   30.11 @@ -33,20 +32,6 @@
   30.12          this.end = new int[num];
   30.13      }
   30.14  
   30.15 -    public Region(int begin, int end) {
   30.16 -        this.numRegs = 1;
   30.17 -        this.beg = new int[]{begin};
   30.18 -        this.end = new int[]{end};
   30.19 -    }
   30.20 -
   30.21 -    public Region clone() {
   30.22 -        Region region = new Region(numRegs);
   30.23 -        System.arraycopy(beg, 0, region.beg, 0, beg.length);
   30.24 -        System.arraycopy(end, 0, region.end, 0, end.length);
   30.25 -        if (historyRoot != null) region.historyRoot = historyRoot.cloneTree();
   30.26 -        return region;
   30.27 -    }
   30.28 -
   30.29      public String toString() {
   30.30          StringBuilder sb = new StringBuilder();
   30.31          sb.append("Region: \n");
   30.32 @@ -54,10 +39,6 @@
   30.33          return sb.toString();
   30.34      }
   30.35  
   30.36 -    CaptureTreeNode getCaptureTree() {
   30.37 -        return historyRoot;
   30.38 -    }
   30.39 -
   30.40      void clear() {
   30.41          for (int i=0; i<beg.length; i++) {
   30.42              beg[i] = end[i] = REGION_NOTPOS;
    31.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ScanEnvironment.java	Fri May 17 14:30:22 2013 -0300
    31.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ScanEnvironment.java	Fri May 17 16:12:59 2013 -0300
    31.3 @@ -40,16 +40,10 @@
    31.4      final public Regex reg;
    31.5  
    31.6      int numCall;
    31.7 -    UnsetAddrList unsetAddrList; // USE_SUBEXP_CALL
    31.8      public int numMem;
    31.9  
   31.10 -    int numNamed; // USE_NAMED_GROUP
   31.11 -
   31.12      public Node memNodes[];
   31.13  
   31.14 -    // USE_COMBINATION_EXPLOSION_CHECK
   31.15 -    int numCombExpCheck;
   31.16 -    int combExpMaxRegNum;
   31.17      int currMaxRegNum;
   31.18      boolean hasRecursion;
   31.19  
   31.20 @@ -69,12 +63,8 @@
   31.21          numCall = 0;
   31.22          numMem = 0;
   31.23  
   31.24 -        numNamed = 0;
   31.25 -
   31.26          memNodes = null;
   31.27  
   31.28 -        numCombExpCheck = 0;
   31.29 -        combExpMaxRegNum = 0;
   31.30          currMaxRegNum = 0;
   31.31          hasRecursion = false;
   31.32      }
    32.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ScannerSupport.java	Fri May 17 14:30:22 2013 -0300
    32.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ScannerSupport.java	Fri May 17 16:12:59 2013 -0300
    32.3 @@ -37,6 +37,8 @@
    32.4      private final int end;              // pattern end position for reset() support
    32.5      protected int _p;                   // used by mark()/restore() to mark positions
    32.6  
    32.7 +    private final static int INT_SIGN_BIT = 1 << 31;
    32.8 +
    32.9      protected ScannerSupport(char[] chars, int p, int end) {
   32.10          this.chars = chars;
   32.11          this.begin = p;
   32.12 @@ -53,8 +55,6 @@
   32.13          return end;
   32.14      }
   32.15  
   32.16 -    private final int INT_SIGN_BIT = 1 << 31;
   32.17 -
   32.18      protected final int scanUnsignedNumber() {
   32.19          int last = c;
   32.20          int num = 0; // long ???
    33.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java	Fri May 17 14:30:22 2013 -0300
    33.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java	Fri May 17 16:12:59 2013 -0300
    33.3 @@ -22,7 +22,6 @@
    33.4  import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsAt;
    33.5  
    33.6  import java.lang.ref.WeakReference;
    33.7 -import java.util.Arrays;
    33.8  
    33.9  import jdk.nashorn.internal.runtime.regexp.joni.constants.StackPopLevel;
   33.10  import jdk.nashorn.internal.runtime.regexp.joni.constants.StackType;
   33.11 @@ -36,10 +35,6 @@
   33.12      protected final int[]repeatStk;
   33.13      protected final int memStartStk, memEndStk;
   33.14  
   33.15 -    // CEC
   33.16 -    protected byte[] stateCheckBuff; // move to int[] ?
   33.17 -    int stateCheckBuffSize;
   33.18 -
   33.19      protected StackMachine(Regex regex, char[] chars, int p , int end) {
   33.20          super(regex, chars, p, end);
   33.21  
   33.22 @@ -104,67 +99,12 @@
   33.23          stk++;
   33.24      }
   33.25  
   33.26 -    // CEC
   33.27 -
   33.28 -    // STATE_CHECK_POS
   33.29 -    private int stateCheckPos(int s, int snum) {
   33.30 -        return (s - str) * regex.numCombExpCheck + (snum - 1);
   33.31 -    }
   33.32 -
   33.33 -    // STATE_CHECK_VAL
   33.34 -    protected final boolean stateCheckVal(int s, int snum) {
   33.35 -        if (stateCheckBuff != null) {
   33.36 -            int x = stateCheckPos(s, snum);
   33.37 -            return (stateCheckBuff[x / 8] & (1 << (x % 8))) != 0;
   33.38 -        }
   33.39 -        return false;
   33.40 -    }
   33.41 -
   33.42 -    // ELSE_IF_STATE_CHECK_MARK
   33.43 -    private void stateCheckMark() {
   33.44 -        StackEntry e = stack[stk];
   33.45 -        int x = stateCheckPos(e.getStatePStr(), e.getStateCheck());
   33.46 -        stateCheckBuff[x / 8] |= (1 << (x % 8));
   33.47 -    }
   33.48 -
   33.49 -    // STATE_CHECK_BUFF_INIT
   33.50 -    private static final int STATE_CHECK_BUFF_MALLOC_THRESHOLD_SIZE = 16;
   33.51 -    protected final void stateCheckBuffInit(int strLength, int offset, int stateNum) {
   33.52 -        if (stateNum > 0 && strLength >= Config.CHECK_STRING_THRESHOLD_LEN) {
   33.53 -            int size = ((strLength + 1) * stateNum + 7) >>> 3;
   33.54 -            offset = (offset * stateNum) >>> 3;
   33.55 -
   33.56 -            if (size > 0 && offset < size && size < Config.CHECK_BUFF_MAX_SIZE) {
   33.57 -                if (size >= STATE_CHECK_BUFF_MALLOC_THRESHOLD_SIZE) {
   33.58 -                    stateCheckBuff = new byte[size];
   33.59 -                } else {
   33.60 -                    // same impl, reduce...
   33.61 -                    stateCheckBuff = new byte[size];
   33.62 -                }
   33.63 -                Arrays.fill(stateCheckBuff, offset, (size - offset), (byte)0);
   33.64 -                stateCheckBuffSize = size;
   33.65 -            } else {
   33.66 -                stateCheckBuff = null; // reduce
   33.67 -                stateCheckBuffSize = 0;
   33.68 -            }
   33.69 -        } else {
   33.70 -            stateCheckBuff = null; // reduce
   33.71 -            stateCheckBuffSize = 0;
   33.72 -        }
   33.73 -    }
   33.74 -
   33.75 -    protected final void stateCheckBuffClear() {
   33.76 -        stateCheckBuff = null;
   33.77 -        stateCheckBuffSize = 0;
   33.78 -    }
   33.79 -
   33.80      private void push(int type, int pat, int s, int prev) {
   33.81          StackEntry e = ensure1();
   33.82          e.type = type;
   33.83          e.setStatePCode(pat);
   33.84          e.setStatePStr(s);
   33.85          e.setStatePStrPrev(prev);
   33.86 -        if (Config.USE_COMBINATION_EXPLOSION_CHECK) e.setStateCheck(0);
   33.87          stk++;
   33.88      }
   33.89  
   33.90 @@ -172,30 +112,9 @@
   33.91          StackEntry e = stack[stk];
   33.92          e.type = type;
   33.93          e.setStatePCode(pat);
   33.94 -        if (Config.USE_COMBINATION_EXPLOSION_CHECK) e.setStateCheck(0);
   33.95          stk++;
   33.96      }
   33.97  
   33.98 -    protected final void pushAltWithStateCheck(int pat, int s, int sprev, int snum) {
   33.99 -        StackEntry e = ensure1();
  33.100 -        e.type = ALT;
  33.101 -        e.setStatePCode(pat);
  33.102 -        e.setStatePStr(s);
  33.103 -        e.setStatePStrPrev(sprev);
  33.104 -        if (Config.USE_COMBINATION_EXPLOSION_CHECK) e.setStateCheck(stateCheckBuff != null ? snum : 0);
  33.105 -        stk++;
  33.106 -    }
  33.107 -
  33.108 -    protected final void pushStateCheck(int s, int snum) {
  33.109 -        if (stateCheckBuff != null) {
  33.110 -            StackEntry e = ensure1();
  33.111 -            e.type = STATE_CHECK_MARK;
  33.112 -            e.setStatePStr(s);
  33.113 -            e.setStateCheck(snum);
  33.114 -            stk++;
  33.115 -        }
  33.116 -    }
  33.117 -
  33.118      protected final void pushAlt(int pat, int s, int prev) {
  33.119          push(ALT, pat, s, prev);
  33.120      }
  33.121 @@ -294,19 +213,6 @@
  33.122          stk++;
  33.123      }
  33.124  
  33.125 -    protected final void pushCallFrame(int pat) {
  33.126 -        StackEntry e = ensure1();
  33.127 -        e.type = CALL_FRAME;
  33.128 -        e.setCallFrameRetAddr(pat);
  33.129 -        stk++;
  33.130 -    }
  33.131 -
  33.132 -    protected final void pushReturn() {
  33.133 -        StackEntry e = ensure1();
  33.134 -        e.type = RETURN;
  33.135 -        stk++;
  33.136 -    }
  33.137 -
  33.138      // stack debug routines here
  33.139      // ...
  33.140  
  33.141 @@ -331,8 +237,6 @@
  33.142  
  33.143              if ((e.type & MASK_POP_USED) != 0) {
  33.144                  return e;
  33.145 -            } else if (Config.USE_COMBINATION_EXPLOSION_CHECK) {
  33.146 -                if (e.type == STATE_CHECK_MARK) stateCheckMark();
  33.147              }
  33.148          }
  33.149      }
  33.150 @@ -346,8 +250,6 @@
  33.151              } else if (e.type == MEM_START) {
  33.152                  repeatStk[memStartStk + e.getMemNum()] = e.getMemStart();
  33.153                  repeatStk[memEndStk + e.getMemNum()] = e.getMemEnd();
  33.154 -            } else if (Config.USE_COMBINATION_EXPLOSION_CHECK) {
  33.155 -                if (e.type == STATE_CHECK_MARK) stateCheckMark();
  33.156              }
  33.157          }
  33.158      }
  33.159 @@ -368,8 +270,6 @@
  33.160              } else if (e.type == MEM_END) {
  33.161                  repeatStk[memStartStk + e.getMemNum()] = e.getMemStart();
  33.162                  repeatStk[memEndStk + e.getMemNum()] = e.getMemEnd();
  33.163 -            } else if (Config.USE_COMBINATION_EXPLOSION_CHECK) {
  33.164 -                if (e.type == STATE_CHECK_MARK) stateCheckMark();
  33.165              }
  33.166          }
  33.167      }
  33.168 @@ -391,8 +291,6 @@
  33.169              } else if (e.type == MEM_END){
  33.170                  repeatStk[memStartStk + e.getMemNum()] = e.getMemStart();
  33.171                  repeatStk[memEndStk + e.getMemNum()] = e.getMemStart();
  33.172 -            } else if (Config.USE_COMBINATION_EXPLOSION_CHECK) {
  33.173 -                if (e.type == STATE_CHECK_MARK) stateCheckMark();
  33.174              }
  33.175          }
  33.176      }
  33.177 @@ -414,8 +312,6 @@
  33.178              } else if (e.type == MEM_END) {
  33.179                  repeatStk[memStartStk + e.getMemNum()] = e.getMemStart();
  33.180                  repeatStk[memEndStk + e.getMemNum()] = e.getMemEnd();
  33.181 -            } else if (Config.USE_COMBINATION_EXPLOSION_CHECK) {
  33.182 -                if (e.type == STATE_CHECK_MARK) stateCheckMark();
  33.183              }
  33.184          }
  33.185      }
    34.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/Syntax.java	Fri May 17 14:30:22 2013 -0300
    34.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/Syntax.java	Fri May 17 16:12:59 2013 -0300
    34.3 @@ -609,7 +609,7 @@
    34.4          OP_ESC_CONTROL_CHARS | OP_ESC_C_CONTROL | OP_ESC_X_HEX2)
    34.5          & ~OP_ESC_LTGT_WORD_BEGIN_END ),
    34.6  
    34.7 -        ( OP2_QMARK_GROUP_EFFECT | OP2_CCLASS_SET_OP |
    34.8 +        ( OP2_QMARK_GROUP_EFFECT |
    34.9          OP2_ESC_V_VTAB | OP2_ESC_U_HEX4 ),
   34.10  
   34.11          ( GNU_REGEX_BV | DIFFERENT_LEN_ALT_LOOK_BEHIND ),
    35.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/UnsetAddrList.java	Fri May 17 14:30:22 2013 -0300
    35.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.3 @@ -1,69 +0,0 @@
    35.4 -/*
    35.5 - * Permission is hereby granted, free of charge, to any person obtaining a copy of
    35.6 - * this software and associated documentation files (the "Software"), to deal in
    35.7 - * the Software without restriction, including without limitation the rights to
    35.8 - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
    35.9 - * of the Software, and to permit persons to whom the Software is furnished to do
   35.10 - * so, subject to the following conditions:
   35.11 - *
   35.12 - * The above copyright notice and this permission notice shall be included in all
   35.13 - * copies or substantial portions of the Software.
   35.14 - *
   35.15 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   35.16 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   35.17 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   35.18 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   35.19 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   35.20 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   35.21 - * SOFTWARE.
   35.22 - */
   35.23 -package jdk.nashorn.internal.runtime.regexp.joni;
   35.24 -
   35.25 -import jdk.nashorn.internal.runtime.regexp.joni.ast.EncloseNode;
   35.26 -import jdk.nashorn.internal.runtime.regexp.joni.ast.Node;
   35.27 -import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages;
   35.28 -import jdk.nashorn.internal.runtime.regexp.joni.exception.InternalException;
   35.29 -
   35.30 -public final class UnsetAddrList {
   35.31 -    int num;
   35.32 -    Node[]targets;
   35.33 -    int[]offsets;
   35.34 -
   35.35 -    public UnsetAddrList(int size) {
   35.36 -        targets = new Node[size];
   35.37 -        offsets = new int[size];
   35.38 -    }
   35.39 -
   35.40 -    public void add(int offset, Node node) {
   35.41 -        if (num >= offsets.length) {
   35.42 -            Node []ttmp = new Node[targets.length << 1];
   35.43 -            System.arraycopy(targets, 0, ttmp, 0, num);
   35.44 -            targets = ttmp;
   35.45 -            int[]otmp = new int[offsets.length << 1];
   35.46 -            System.arraycopy(offsets, 0, otmp, 0, num);
   35.47 -            offsets = otmp;
   35.48 -        }
   35.49 -        targets[num] = node;
   35.50 -        offsets[num] = offset;
   35.51 -
   35.52 -        num++;
   35.53 -    }
   35.54 -
   35.55 -    public void fix(Regex regex) {
   35.56 -        for (int i=0; i<num; i++) {
   35.57 -            EncloseNode en = (EncloseNode)targets[i];
   35.58 -            if (!en.isAddrFixed()) new InternalException(ErrorMessages.ERR_PARSER_BUG);
   35.59 -            regex.code[offsets[i]] = en.callAddr; // is this safe ?
   35.60 -        }
   35.61 -    }
   35.62 -
   35.63 -    public String toString() {
   35.64 -        StringBuilder value = new StringBuilder();
   35.65 -        if (num > 0) {
   35.66 -            for (int i=0; i<num; i++) {
   35.67 -                value.append("offset + " + offsets[i] + " target: " + targets[i].getAddressName());
   35.68 -            }
   35.69 -        }
   35.70 -        return value.toString();
   35.71 -    }
   35.72 -}
    36.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/CClassNode.java	Fri May 17 14:30:22 2013 -0300
    36.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/CClassNode.java	Fri May 17 16:12:59 2013 -0300
    36.3 @@ -22,7 +22,6 @@
    36.4  import jdk.nashorn.internal.runtime.regexp.joni.*;
    36.5  import jdk.nashorn.internal.runtime.regexp.joni.constants.CCSTATE;
    36.6  import jdk.nashorn.internal.runtime.regexp.joni.constants.CCVALTYPE;
    36.7 -import jdk.nashorn.internal.runtime.regexp.joni.encoding.AsciiTables;
    36.8  import jdk.nashorn.internal.runtime.regexp.joni.encoding.CharacterType;
    36.9  import jdk.nashorn.internal.runtime.regexp.joni.encoding.IntHolder;
   36.10  import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages;
   36.11 @@ -40,6 +39,41 @@
   36.12  
   36.13      private int ctype;                      // for hashing purposes
   36.14  
   36.15 +    private final static short AsciiCtypeTable[] = {
   36.16 +            0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
   36.17 +            0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008,
   36.18 +            0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
   36.19 +            0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
   36.20 +            0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
   36.21 +            0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
   36.22 +            0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0,
   36.23 +            0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
   36.24 +            0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2,
   36.25 +            0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
   36.26 +            0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
   36.27 +            0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0,
   36.28 +            0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2,
   36.29 +            0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
   36.30 +            0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
   36.31 +            0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008,
   36.32 +            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   36.33 +            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   36.34 +            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   36.35 +            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   36.36 +            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   36.37 +            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   36.38 +            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   36.39 +            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   36.40 +            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   36.41 +            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   36.42 +            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   36.43 +            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   36.44 +            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   36.45 +            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   36.46 +            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   36.47 +            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
   36.48 +    };
   36.49 +
   36.50      // node_new_cclass
   36.51      public CClassNode() {}
   36.52  
   36.53 @@ -330,13 +364,13 @@
   36.54                  if (not) {
   36.55                      for (int c = 0; c < BitSet.SINGLE_BYTE_SIZE; c++) {
   36.56                          // if (!ASCIIEncoding.INSTANCE.isCodeCType(c, ctype)) bs.set(c);
   36.57 -                        if ((AsciiTables.AsciiCtypeTable[c] & (1 << ctype)) == 0) bs.set(c);
   36.58 +                        if ((AsciiCtypeTable[c] & (1 << ctype)) == 0) bs.set(c);
   36.59                      }
   36.60                      addAllMultiByteRange();
   36.61                  } else {
   36.62                      for (int c = 0; c < BitSet.SINGLE_BYTE_SIZE; c++) {
   36.63                          // if (ASCIIEncoding.INSTANCE.isCodeCType(c, ctype)) bs.set(c);
   36.64 -                        if ((AsciiTables.AsciiCtypeTable[c] & (1 << ctype)) != 0) bs.set(c);
   36.65 +                        if ((AsciiCtypeTable[c] & (1 << ctype)) != 0) bs.set(c);
   36.66                      }
   36.67                  }
   36.68                  return;
    37.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/CTypeNode.java	Fri May 17 14:30:22 2013 -0300
    37.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.3 @@ -1,50 +0,0 @@
    37.4 -/*
    37.5 - * Permission is hereby granted, free of charge, to any person obtaining a copy of
    37.6 - * this software and associated documentation files (the "Software"), to deal in
    37.7 - * the Software without restriction, including without limitation the rights to
    37.8 - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
    37.9 - * of the Software, and to permit persons to whom the Software is furnished to do
   37.10 - * so, subject to the following conditions:
   37.11 - *
   37.12 - * The above copyright notice and this permission notice shall be included in all
   37.13 - * copies or substantial portions of the Software.
   37.14 - *
   37.15 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   37.16 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   37.17 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   37.18 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   37.19 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   37.20 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   37.21 - * SOFTWARE.
   37.22 - */
   37.23 -package jdk.nashorn.internal.runtime.regexp.joni.ast;
   37.24 -
   37.25 -public final class CTypeNode extends Node {
   37.26 -    public int ctype;
   37.27 -    public boolean not;
   37.28 -
   37.29 -    public CTypeNode(int type, boolean not) {
   37.30 -        this.ctype= type;
   37.31 -        this.not = not;
   37.32 -    }
   37.33 -
   37.34 -    @Override
   37.35 -    public int getType() {
   37.36 -        return CTYPE;
   37.37 -    }
   37.38 -
   37.39 -    @Override
   37.40 -    public String getName() {
   37.41 -        return "Character Type";
   37.42 -    }
   37.43 -
   37.44 -    @Override
   37.45 -    public String toString(int level) {
   37.46 -        StringBuilder value = new StringBuilder();
   37.47 -        value.append("\n  ctype: " + ctype);
   37.48 -        value.append("\n  not: " + not);
   37.49 -
   37.50 -        return value.toString();
   37.51 -    }
   37.52 -
   37.53 -}
    38.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/CallNode.java	Fri May 17 14:30:22 2013 -0300
    38.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.3 @@ -1,86 +0,0 @@
    38.4 -/*
    38.5 - * Permission is hereby granted, free of charge, to any person obtaining a copy of
    38.6 - * this software and associated documentation files (the "Software"), to deal in
    38.7 - * the Software without restriction, including without limitation the rights to
    38.8 - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
    38.9 - * of the Software, and to permit persons to whom the Software is furnished to do
   38.10 - * so, subject to the following conditions:
   38.11 - *
   38.12 - * The above copyright notice and this permission notice shall be included in all
   38.13 - * copies or substantial portions of the Software.
   38.14 - *
   38.15 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   38.16 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   38.17 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   38.18 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   38.19 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   38.20 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   38.21 - * SOFTWARE.
   38.22 - */
   38.23 -package jdk.nashorn.internal.runtime.regexp.joni.ast;
   38.24 -
   38.25 -import java.util.Set;
   38.26 -
   38.27 -import jdk.nashorn.internal.runtime.regexp.joni.UnsetAddrList;
   38.28 -import jdk.nashorn.internal.runtime.regexp.joni.WarnCallback;
   38.29 -
   38.30 -public final class CallNode extends StateNode {
   38.31 -    public char[] name;
   38.32 -    public int nameP;
   38.33 -    public int nameEnd;
   38.34 -
   38.35 -    public int groupNum;
   38.36 -    public Node target;             // is it an EncloseNode always ?
   38.37 -    public UnsetAddrList unsetAddrList;
   38.38 -
   38.39 -    public CallNode(char[] name, int nameP, int nameEnd, int gnum) {
   38.40 -        this.name = name;
   38.41 -        this.nameP = nameP;
   38.42 -        this.nameEnd = nameEnd;
   38.43 -        this.groupNum = gnum; /* call by number if gnum != 0 */
   38.44 -    }
   38.45 -
   38.46 -    @Override
   38.47 -    public int getType() {
   38.48 -        return CALL;
   38.49 -    }
   38.50 -
   38.51 -    @Override
   38.52 -    protected void setChild(Node newChild) {
   38.53 -        target = newChild;
   38.54 -    }
   38.55 -
   38.56 -    @Override
   38.57 -    protected Node getChild() {
   38.58 -        return target;
   38.59 -    }
   38.60 -
   38.61 -    public void setTarget(Node tgt) {
   38.62 -        target = tgt;
   38.63 -        tgt.parent = this;
   38.64 -    }
   38.65 -
   38.66 -    @Override
   38.67 -    public String getName() {
   38.68 -        return "Call";
   38.69 -    }
   38.70 -
   38.71 -    @Override
   38.72 -    public void verifyTree(Set<Node> set, WarnCallback warnings) {
   38.73 -        if (target == null || target.parent == this)
   38.74 -            warnings.warn(this.getAddressName() + " doesn't point to a target or the target has been stolen");
   38.75 -        // do not recurse here
   38.76 -    }
   38.77 -
   38.78 -    @Override
   38.79 -    public String toString(int level) {
   38.80 -        StringBuilder value = new StringBuilder(super.toString(level));
   38.81 -        value.append("\n  name: " + new String(name, nameP, nameEnd - nameP));
   38.82 -        value.append("\n  groupNum: " + groupNum);
   38.83 -        value.append("\n  target: " + pad(target.getAddressName(), level + 1));
   38.84 -        value.append("\n  unsetAddrList: " + pad(unsetAddrList, level + 1));
   38.85 -
   38.86 -        return value.toString();
   38.87 -    }
   38.88 -
   38.89 -}
    39.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/EncloseNode.java	Fri May 17 14:30:22 2013 -0300
    39.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/EncloseNode.java	Fri May 17 16:12:59 2013 -0300
    39.3 @@ -25,7 +25,7 @@
    39.4  
    39.5  public final class EncloseNode extends StateNode implements EncloseType {
    39.6  
    39.7 -    public int type;                // enclose type
    39.8 +    public final int type;                // enclose type
    39.9      public int regNum;
   39.10      public int option;
   39.11      public Node target;             /* EncloseNode : ENCLOSE_MEMORY */
   39.12 @@ -42,10 +42,8 @@
   39.13      }
   39.14  
   39.15      // node_new_enclose_memory
   39.16 -    public EncloseNode(int option, boolean isNamed) {
   39.17 +    public EncloseNode() {
   39.18          this(MEMORY);
   39.19 -        if (isNamed) setNamedGroup();
   39.20 -        if (Config.USE_SUBEXP_CALL) this.option = option;
   39.21      }
   39.22  
   39.23      // node_new_option
   39.24 @@ -104,46 +102,14 @@
   39.25          return types.toString();
   39.26      }
   39.27  
   39.28 -    public void setEncloseStatus(int flag) {
   39.29 -        state |= flag;
   39.30 -    }
   39.31 -
   39.32 -    public void clearEncloseStatus(int flag) {
   39.33 -        state &= ~flag;
   39.34 -    }
   39.35 -
   39.36 -    public void clearMemory() {
   39.37 -        type &= ~MEMORY;
   39.38 -    }
   39.39 -
   39.40 -    public void setMemory() {
   39.41 -        type |= MEMORY;
   39.42 -    }
   39.43 -
   39.44      public boolean isMemory() {
   39.45          return (type & MEMORY) != 0;
   39.46      }
   39.47  
   39.48 -    public void clearOption() {
   39.49 -        type &= ~OPTION;
   39.50 -    }
   39.51 -
   39.52 -    public void setOption() {
   39.53 -        type |= OPTION;
   39.54 -    }
   39.55 -
   39.56      public boolean isOption() {
   39.57          return (type & OPTION) != 0;
   39.58      }
   39.59  
   39.60 -    public void clearStopBacktrack() {
   39.61 -        type &= ~STOP_BACKTRACK;
   39.62 -    }
   39.63 -
   39.64 -    public void setStopBacktrack() {
   39.65 -        type |= STOP_BACKTRACK;
   39.66 -    }
   39.67 -
   39.68      public boolean isStopBacktrack() {
   39.69          return (type & STOP_BACKTRACK) != 0;
   39.70      }
    40.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/QuantifierNode.java	Fri May 17 14:30:22 2013 -0300
    40.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/QuantifierNode.java	Fri May 17 16:12:59 2013 -0300
    40.3 @@ -21,9 +21,10 @@
    40.4  
    40.5  import jdk.nashorn.internal.runtime.regexp.joni.Config;
    40.6  import jdk.nashorn.internal.runtime.regexp.joni.ScanEnvironment;
    40.7 -import jdk.nashorn.internal.runtime.regexp.joni.constants.Reduce;
    40.8  import jdk.nashorn.internal.runtime.regexp.joni.constants.TargetInfo;
    40.9  
   40.10 +import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.ReduceType.*;
   40.11 +
   40.12  public final class QuantifierNode extends StateNode {
   40.13  
   40.14      public Node target;
   40.15 @@ -37,8 +38,33 @@
   40.16      public Node nextHeadExact;
   40.17      public boolean isRefered;           /* include called node. don't eliminate even if {0} */
   40.18  
   40.19 -    // USE_COMBINATION_EXPLOSION_CHECK
   40.20 -    public int  combExpCheckNum;        /* 1,2,3...: check,  0: no check  */
   40.21 +    enum ReduceType {
   40.22 +        ASIS,       /* as is */
   40.23 +        DEL,        /* delete parent */
   40.24 +        A,          /* to '*'    */
   40.25 +        AQ,         /* to '*?'   */
   40.26 +        QQ,         /* to '??'   */
   40.27 +        P_QQ,       /* to '+)??' */
   40.28 +        PQ_Q,       /* to '+?)?' */
   40.29 +    }
   40.30 +
   40.31 +    private final static ReduceType[][] REDUCE_TABLE = {
   40.32 +            {DEL,     A,      A,      QQ,     AQ,     ASIS}, /* '?'  */
   40.33 +            {DEL,     DEL,    DEL,    P_QQ,   P_QQ,   DEL},  /* '*'  */
   40.34 +            {A,       A,      DEL,    ASIS,   P_QQ,   DEL},  /* '+'  */
   40.35 +            {DEL,     AQ,     AQ,     DEL,    AQ,     AQ},   /* '??' */
   40.36 +            {DEL,     DEL,    DEL,    DEL,    DEL,    DEL},  /* '*?' */
   40.37 +            {ASIS,    PQ_Q,   DEL,    AQ,     AQ,     DEL}   /* '+?' */
   40.38 +    };
   40.39 +
   40.40 +    private final static String PopularQStr[] = new String[] {
   40.41 +            "?", "*", "+", "??", "*?", "+?"
   40.42 +    };
   40.43 +
   40.44 +    private final static String ReduceQStr[]= new String[] {
   40.45 +            "", "", "*", "*?", "??", "+ and ??", "+? and ?"
   40.46 +    };
   40.47 +
   40.48  
   40.49      public QuantifierNode(int lower, int upper, boolean byNumber) {
   40.50          this.lower = lower;
   40.51 @@ -92,7 +118,6 @@
   40.52          value.append("\n  headExact: " + pad(headExact, level + 1));
   40.53          value.append("\n  nextHeadExact: " + pad(nextHeadExact, level + 1));
   40.54          value.append("\n  isRefered: " + isRefered);
   40.55 -        value.append("\n  combExpCheckNum: " + combExpCheckNum);
   40.56  
   40.57          return value.toString();
   40.58      }
   40.59 @@ -134,7 +159,6 @@
   40.60          headExact = other.headExact;
   40.61          nextHeadExact = other.nextHeadExact;
   40.62          isRefered = other.isRefered;
   40.63 -        combExpCheckNum = other.combExpCheckNum;
   40.64      }
   40.65  
   40.66      public void reduceNestedQuantifier(QuantifierNode other) {
   40.67 @@ -143,7 +167,7 @@
   40.68  
   40.69          if (pnum < 0 || cnum < 0) return;
   40.70  
   40.71 -        switch(Reduce.REDUCE_TABLE[cnum][pnum]) {
   40.72 +        switch(REDUCE_TABLE[cnum][pnum]) {
   40.73          case DEL:
   40.74              // no need to set the parent here...
   40.75              // swap ?
   40.76 @@ -226,7 +250,7 @@
   40.77  
   40.78              if (Config.USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR) {
   40.79                  if (!isByNumber() && !qnt.isByNumber() && env.syntax.warnReduntantNestedRepeat()) {
   40.80 -                    switch(Reduce.REDUCE_TABLE[targetQNum][nestQNum]) {
   40.81 +                    switch(REDUCE_TABLE[targetQNum][nestQNum]) {
   40.82                      case ASIS:
   40.83                          break;
   40.84  
   40.85 @@ -237,9 +261,9 @@
   40.86  
   40.87                      default:
   40.88                          env.reg.getWarnings().warn(new String(chars, p, end) +
   40.89 -                                " nested repeat operator " + Reduce.PopularQStr[targetQNum] +
   40.90 -                                " and " + Reduce.PopularQStr[nestQNum] + " was replaced with '" +
   40.91 -                                Reduce.ReduceQStr[Reduce.REDUCE_TABLE[targetQNum][nestQNum].ordinal()] + "'");
   40.92 +                                " nested repeat operator " + PopularQStr[targetQNum] +
   40.93 +                                " and " + PopularQStr[nestQNum] + " was replaced with '" +
   40.94 +                                ReduceQStr[REDUCE_TABLE[targetQNum][nestQNum].ordinal()] + "'");
   40.95                      }
   40.96                  }
   40.97              } // USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR
    41.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/StateNode.java	Fri May 17 14:30:22 2013 -0300
    41.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/StateNode.java	Fri May 17 16:12:59 2013 -0300
    41.3 @@ -40,7 +40,6 @@
    41.4          if (isRecursion()) states.append("RECURSION ");
    41.5          if (isCalled()) states.append("CALLED ");
    41.6          if (isAddrFixed()) states.append("ADDR_FIXED ");
    41.7 -        if (isNamedGroup()) states.append("NAMED_GROUP ");
    41.8          if (isNameRef()) states.append("NAME_REF ");
    41.9          if (isInRepeat()) states.append("IN_REPEAT ");
   41.10          if (isNestLevel()) states.append("NEST_LEVEL ");
   41.11 @@ -57,10 +56,6 @@
   41.12          state |= NST_MIN_FIXED;
   41.13      }
   41.14  
   41.15 -    public void clearMinFixed() {
   41.16 -        state &= ~NST_MIN_FIXED;
   41.17 -    }
   41.18 -
   41.19      public boolean isMaxFixed() {
   41.20          return (state & NST_MAX_FIXED) != 0;
   41.21      }
   41.22 @@ -69,10 +64,6 @@
   41.23          state |= NST_MAX_FIXED;
   41.24      }
   41.25  
   41.26 -    public void clearMaxFixed() {
   41.27 -        state &= ~NST_MAX_FIXED;
   41.28 -    }
   41.29 -
   41.30      public boolean isCLenFixed() {
   41.31          return (state & NST_CLEN_FIXED) != 0;
   41.32      }
   41.33 @@ -81,10 +72,6 @@
   41.34          state |= NST_CLEN_FIXED;
   41.35      }
   41.36  
   41.37 -    public void clearCLenFixed() {
   41.38 -        state &= ~NST_CLEN_FIXED;
   41.39 -    }
   41.40 -
   41.41      public boolean isMark1() {
   41.42          return (state & NST_MARK1) != 0;
   41.43      }
   41.44 @@ -93,10 +80,6 @@
   41.45          state |= NST_MARK1;
   41.46      }
   41.47  
   41.48 -    public void clearMark1() {
   41.49 -        state &= ~NST_MARK1;
   41.50 -    }
   41.51 -
   41.52      public boolean isMark2() {
   41.53          return (state & NST_MARK2) != 0;
   41.54      }
   41.55 @@ -117,10 +100,6 @@
   41.56          state |= NST_MEM_BACKREFED;
   41.57      }
   41.58  
   41.59 -    public void clearMemBackrefed() {
   41.60 -        state &= ~NST_MEM_BACKREFED;
   41.61 -    }
   41.62 -
   41.63      public boolean isStopBtSimpleRepeat() {
   41.64          return (state & NST_STOP_BT_SIMPLE_REPEAT) != 0;
   41.65      }
   41.66 @@ -129,10 +108,6 @@
   41.67          state |= NST_STOP_BT_SIMPLE_REPEAT;
   41.68      }
   41.69  
   41.70 -    public void clearStopBtSimpleRepeat() {
   41.71 -        state &= ~NST_STOP_BT_SIMPLE_REPEAT;
   41.72 -    }
   41.73 -
   41.74      public boolean isRecursion() {
   41.75          return (state & NST_RECURSION) != 0;
   41.76      }
   41.77 @@ -141,10 +116,6 @@
   41.78          state |= NST_RECURSION;
   41.79      }
   41.80  
   41.81 -    public void clearRecursion() {
   41.82 -        state &= ~NST_RECURSION;
   41.83 -    }
   41.84 -
   41.85      public boolean isCalled() {
   41.86          return (state & NST_CALLED) != 0;
   41.87      }
   41.88 @@ -153,10 +124,6 @@
   41.89          state |= NST_CALLED;
   41.90      }
   41.91  
   41.92 -    public void clearCAlled() {
   41.93 -        state &= ~NST_CALLED;
   41.94 -    }
   41.95 -
   41.96      public boolean isAddrFixed() {
   41.97          return (state & NST_ADDR_FIXED) != 0;
   41.98      }
   41.99 @@ -165,22 +132,6 @@
  41.100          state |= NST_ADDR_FIXED;
  41.101      }
  41.102  
  41.103 -    public void clearAddrFixed() {
  41.104 -        state &= ~NST_ADDR_FIXED;
  41.105 -    }
  41.106 -
  41.107 -    public boolean isNamedGroup() {
  41.108 -        return (state & NST_NAMED_GROUP) != 0;
  41.109 -    }
  41.110 -
  41.111 -    public void setNamedGroup() {
  41.112 -        state |= NST_NAMED_GROUP;
  41.113 -    }
  41.114 -
  41.115 -    public void clearNamedGroup() {
  41.116 -        state &= ~NST_NAMED_GROUP;
  41.117 -    }
  41.118 -
  41.119      public boolean isNameRef() {
  41.120          return (state & NST_NAME_REF) != 0;
  41.121      }
  41.122 @@ -189,10 +140,6 @@
  41.123          state |= NST_NAME_REF;
  41.124      }
  41.125  
  41.126 -    public void clearNameRef() {
  41.127 -        state &= ~NST_NAME_REF;
  41.128 -    }
  41.129 -
  41.130      public boolean isInRepeat() {
  41.131          return (state & NST_IN_REPEAT) != 0;
  41.132      }
  41.133 @@ -201,10 +148,6 @@
  41.134          state |= NST_IN_REPEAT;
  41.135      }
  41.136  
  41.137 -    public void clearInRepeat() {
  41.138 -        state &= ~NST_IN_REPEAT;
  41.139 -    }
  41.140 -
  41.141      public boolean isNestLevel() {
  41.142          return (state & NST_NEST_LEVEL) != 0;
  41.143      }
  41.144 @@ -213,10 +156,6 @@
  41.145          state |= NST_NEST_LEVEL;
  41.146      }
  41.147  
  41.148 -    public void clearNestLevel() {
  41.149 -        state &= ~NST_NEST_LEVEL;
  41.150 -    }
  41.151 -
  41.152      public boolean isByNumber() {
  41.153          return (state & NST_BY_NUMBER) != 0;
  41.154      }
  41.155 @@ -225,8 +164,4 @@
  41.156          state |= NST_BY_NUMBER;
  41.157      }
  41.158  
  41.159 -    public void clearByNumber() {
  41.160 -        state &= ~NST_BY_NUMBER;
  41.161 -    }
  41.162 -
  41.163  }
    42.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/bench/AbstractBench.java	Fri May 17 14:30:22 2013 -0300
    42.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.3 @@ -1,49 +0,0 @@
    42.4 -package jdk.nashorn.internal.runtime.regexp.joni.bench;
    42.5 -
    42.6 -import jdk.nashorn.internal.runtime.regexp.joni.Option;
    42.7 -import jdk.nashorn.internal.runtime.regexp.joni.Regex;
    42.8 -import jdk.nashorn.internal.runtime.regexp.joni.Syntax;
    42.9 -
   42.10 -public abstract class AbstractBench {
   42.11 -    protected void bench(String _reg, String _str, int warmup, int times) throws Exception {
   42.12 -        char[] reg = _reg.toCharArray();
   42.13 -        char[] str = _str.toCharArray();
   42.14 -
   42.15 -        Regex p = new Regex(reg,0,reg.length,Option.DEFAULT,Syntax.DEFAULT);
   42.16 -
   42.17 -        System.err.println("::: /" + _reg + "/ =~ \"" + _str + "\", " + warmup + " * " + times + " times");
   42.18 -
   42.19 -        for(int j=0;j<warmup;j++) {
   42.20 -            long before = System.currentTimeMillis();
   42.21 -            for(int i = 0; i < times; i++) {
   42.22 -                p.matcher(str, 0, str.length).search(0, str.length, Option.NONE);
   42.23 -            }
   42.24 -            long time = System.currentTimeMillis() - before;
   42.25 -            System.err.println(":  " + time + "ms");
   42.26 -        }
   42.27 -    }
   42.28 -
   42.29 -    protected void benchBestOf(String _reg, String _str, int warmup, int times) throws Exception {
   42.30 -        char[] reg = _reg.toCharArray();
   42.31 -        char[] str = _str.toCharArray();
   42.32 -
   42.33 -        Regex p = new Regex(reg,0,reg.length,Option.DEFAULT,Syntax.DEFAULT);
   42.34 -
   42.35 -        System.err.println("::: /" + _reg + "/ =~ \"" + _str + "\", " + warmup + " * " + times + " times");
   42.36 -
   42.37 -        long best = Long.MAX_VALUE;
   42.38 -
   42.39 -        for(int j=0;j<warmup;j++) {
   42.40 -            long before = System.currentTimeMillis();
   42.41 -            for(int i = 0; i < times; i++) {
   42.42 -                p.matcher(str, 0, str.length).search(0, str.length, Option.NONE);
   42.43 -            }
   42.44 -            long time = System.currentTimeMillis() - before;
   42.45 -            if(time < best) {
   42.46 -                best = time;
   42.47 -            }
   42.48 -            System.err.print(".");
   42.49 -        }
   42.50 -        System.err.println(":  " + best + "ms");
   42.51 -    }
   42.52 -}
    43.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/bench/BenchGreedyBacktrack.java	Fri May 17 14:30:22 2013 -0300
    43.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.3 @@ -1,7 +0,0 @@
    43.4 -package jdk.nashorn.internal.runtime.regexp.joni.bench;
    43.5 -
    43.6 -public class BenchGreedyBacktrack extends AbstractBench {
    43.7 -    public static void main(String[] args) throws Exception {
    43.8 -        new BenchGreedyBacktrack().bench(".*_p","_petstore_session_id=1b341ffe23b5298676d535fcabd3d0d7; path=/",10,1000000);
    43.9 -    }
   43.10 -}
    44.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/bench/BenchRailsRegs.java	Fri May 17 14:30:22 2013 -0300
    44.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.3 @@ -1,31 +0,0 @@
    44.4 -package jdk.nashorn.internal.runtime.regexp.joni.bench;
    44.5 -
    44.6 -public class BenchRailsRegs extends AbstractBench {
    44.7 -    public static void main(String[] args) throws Exception {
    44.8 -        final String[][] regexps = {{"a.*?[b-z]{2,4}aaaaaa","afdgdsgderaabxxaaaaaaaaaaaaaaaaaaaaaaaa"},
    44.9 -                                    {"://","/shop/viewCategory.shtml?category=DOGS"},
   44.10 -                                    {"^\\w+\\://[^/]+(/.*|$)$","/shop/viewCategory.shtml?category=DOGS"},
   44.11 -                                    {"\\A/?\\Z","/shop/viewCategory.shtml"},
   44.12 -                                    {"\\A/shop/signonForm\\.shtml/?\\Z","/shop/viewCategory.shtml"},
   44.13 -                                    {"\\A/shop/newAccountForm\\.shtml/?\\Z","/shop/viewCategory.shtml"},
   44.14 -                                    {"\\A/shop/newAccount\\.shtml/?\\Z","/shop/viewCategory.shtml"},
   44.15 -                                    {"\\A/shop/viewCart\\.shtml/?\\Z","/shop/viewCategory.shtml"},
   44.16 -                                    {"\\A/shop/index\\.shtml/?\\Z","/shop/viewCategory.shtml"},
   44.17 -                                    {"\\A/shop/viewCategory\\.shtml/?\\Z","/shop/viewCategory.shtml"},
   44.18 -                                    {"\\A(?:::)?([A-Z]\\w*(?:::[A-Z]\\w*)*)\\z","CategoriesController"},
   44.19 -                                    {"\\Ainsert","SELECT * FROM sessions WHERE (session_id = '1b341ffe23b5298676d535fcabd3d0d7')  LIMIT 1"},
   44.20 -                                    {"\\A\\(?\\s*(select|show)","SELECT * FROM sessions WHERE (session_id = '1b341ffe23b5298676d535fcabd3d0d7')  LIMIT 1"},
   44.21 -                                    {".*?\n","1b341ffe23b5298676d535fcabd3d0d7"},
   44.22 -                                    {"^find_(all_by|by)_([_a-zA-Z]\\w*)$","find_by_string_id"},
   44.23 -                                    {"\\.rjs$","categories/show.rhtml"},
   44.24 -                                    {"^[-a-z]+://","petstore.css"},
   44.25 -                                    {"^get$",""},
   44.26 -                                    {"^post$",""},
   44.27 -                                    {"^[^:]+","www.example.com"},
   44.28 -                                    {"(=|\\?|_before_type_cast)$", "updated_on"},
   44.29 -                                    {"^(.*?)=(.*?);","_petstore_session_id=1b341ffe23b5298676d535fcabd3d0d7; path=/"}};
   44.30 -        for(String[] reg : regexps) {
   44.31 -            new BenchRailsRegs().benchBestOf(reg[0],reg[1],10,1000000);
   44.32 -        }
   44.33 -    }
   44.34 -}
    45.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/bench/BenchSeveralRegexps.java	Fri May 17 14:30:22 2013 -0300
    45.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.3 @@ -1,17 +0,0 @@
    45.4 -package jdk.nashorn.internal.runtime.regexp.joni.bench;
    45.5 -
    45.6 -public class BenchSeveralRegexps extends AbstractBench {
    45.7 -    public static void main(String[] args) throws Exception {
    45.8 -        int BASE = 1000000;
    45.9 -
   45.10 -        new BenchSeveralRegexps().benchBestOf("a"," a",10,4*BASE);
   45.11 -
   45.12 -        new BenchSeveralRegexps().benchBestOf(".*?=","_petstore_session_id=1b341ffe23b5298676d535fcabd3d0d7; path=/",10,BASE);
   45.13 -
   45.14 -        new BenchSeveralRegexps().benchBestOf("^(.*?)=(.*?);","_petstore_session_id=1b341ffe23b5298676d535fcabd3d0d7; path=/",10,BASE);
   45.15 -
   45.16 -        new BenchSeveralRegexps().benchBestOf(".*_p","_petstore_session_id=1b341ffe23b5298676d535fcabd3d0d7; path=/",10,4*BASE);
   45.17 -
   45.18 -        new BenchSeveralRegexps().benchBestOf(".*=","_petstore_session_id=1b341ffe23b5298676d535fcabd3d0d7; path=/",10,4*BASE);
   45.19 -    }
   45.20 -}
    46.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/OPCode.java	Fri May 17 14:30:22 2013 -0300
    46.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/constants/OPCode.java	Fri May 17 16:12:59 2013 -0300
    46.3 @@ -19,8 +19,6 @@
    46.4   */
    46.5  package jdk.nashorn.internal.runtime.regexp.joni.constants;
    46.6  
    46.7 -import jdk.nashorn.internal.runtime.regexp.joni.Config;
    46.8 -
    46.9  public interface OPCode {
   46.10      final int FINISH                        = 0;            /* matching process terminator (no more alternative) */
   46.11      final int END                           = 1;            /* pattern code terminator (success end) */
   46.12 @@ -151,237 +149,4 @@
   46.13      final int EXACT1_IC_SB                  = 105;           /* single byte, N = 1, ignore case */
   46.14      final int EXACTN_IC_SB                  = 106;           /* single byte,        ignore case */
   46.15  
   46.16 -
   46.17 -    public final String OpCodeNames[] = Config.DEBUG_COMPILE ? new String[] {
   46.18 -        "finish", /*OP_FINISH*/
   46.19 -        "end", /*OP_END*/
   46.20 -        "exact1", /*OP_EXACT1*/
   46.21 -        "exact2", /*OP_EXACT2*/
   46.22 -        "exact3", /*OP_EXACT3*/
   46.23 -        "exact4", /*OP_EXACT4*/
   46.24 -        "exact5", /*OP_EXACT5*/
   46.25 -        "exactn", /*OP_EXACTN*/
   46.26 -        "exactmb2-n1", /*OP_EXACTMB2N1*/
   46.27 -        "exactmb2-n2", /*OP_EXACTMB2N2*/
   46.28 -        "exactmb2-n3", /*OP_EXACTMB2N3*/
   46.29 -        "exactmb2-n", /*OP_EXACTMB2N*/
   46.30 -        "exactmb3n", /*OP_EXACTMB3N*/
   46.31 -        "exactmbn", /*OP_EXACTMBN*/
   46.32 -        "exact1-ic", /*OP_EXACT1_IC*/
   46.33 -        "exactn-ic", /*OP_EXACTN_IC*/
   46.34 -        "cclass", /*OP_CCLASS*/
   46.35 -        "cclass-mb", /*OP_CCLASS_MB*/
   46.36 -        "cclass-mix", /*OP_CCLASS_MIX*/
   46.37 -        "cclass-not", /*OP_CCLASS_NOT*/
   46.38 -        "cclass-mb-not", /*OP_CCLASS_MB_NOT*/
   46.39 -        "cclass-mix-not", /*OP_CCLASS_MIX_NOT*/
   46.40 -        "cclass-node", /*OP_CCLASS_NODE*/
   46.41 -        "anychar", /*OP_ANYCHAR*/
   46.42 -        "anychar-ml", /*OP_ANYCHAR_ML*/
   46.43 -        "anychar*", /*OP_ANYCHAR_STAR*/
   46.44 -        "anychar-ml*", /*OP_ANYCHAR_ML_STAR*/
   46.45 -        "anychar*-peek-next", /*OP_ANYCHAR_STAR_PEEK_NEXT*/
   46.46 -        "anychar-ml*-peek-next", /*OP_ANYCHAR_ML_STAR_PEEK_NEXT*/
   46.47 -        "word", /*OP_WORD*/
   46.48 -        "not-word", /*OP_NOT_WORD*/
   46.49 -        "word-bound", /*OP_WORD_BOUND*/
   46.50 -        "not-word-bound", /*OP_NOT_WORD_BOUND*/
   46.51 -        "word-begin", /*OP_WORD_BEGIN*/
   46.52 -        "word-end", /*OP_WORD_END*/
   46.53 -        "begin-buf", /*OP_BEGIN_BUF*/
   46.54 -        "end-buf", /*OP_END_BUF*/
   46.55 -        "begin-line", /*OP_BEGIN_LINE*/
   46.56 -        "end-line", /*OP_END_LINE*/
   46.57 -        "semi-end-buf", /*OP_SEMI_END_BUF*/
   46.58 -        "begin-position", /*OP_BEGIN_POSITION*/
   46.59 -        "backref1", /*OP_BACKREF1*/
   46.60 -        "backref2", /*OP_BACKREF2*/
   46.61 -        "backrefn", /*OP_BACKREFN*/
   46.62 -        "backrefn-ic", /*OP_BACKREFN_IC*/
   46.63 -        "backref_multi", /*OP_BACKREF_MULTI*/
   46.64 -        "backref_multi-ic", /*OP_BACKREF_MULTI_IC*/
   46.65 -        "backref_at_level", /*OP_BACKREF_AT_LEVEL*/
   46.66 -        "mem-start", /*OP_MEMORY_START*/
   46.67 -        "mem-start-push", /*OP_MEMORY_START_PUSH*/
   46.68 -        "mem-end-push", /*OP_MEMORY_END_PUSH*/
   46.69 -        "mem-end-push-rec", /*OP_MEMORY_END_PUSH_REC*/
   46.70 -        "mem-end", /*OP_MEMORY_END*/
   46.71 -        "mem-end-rec", /*OP_MEMORY_END_REC*/
   46.72 -        "fail", /*OP_FAIL*/
   46.73 -        "jump", /*OP_JUMP*/
   46.74 -        "push", /*OP_PUSH*/
   46.75 -        "pop", /*OP_POP*/
   46.76 -        "push-or-jump-e1", /*OP_PUSH_OR_JUMP_EXACT1*/
   46.77 -        "push-if-peek-next", /*OP_PUSH_IF_PEEK_NEXT*/
   46.78 -        "repeat", /*OP_REPEAT*/
   46.79 -        "repeat-ng", /*OP_REPEAT_NG*/
   46.80 -        "repeat-inc", /*OP_REPEAT_INC*/
   46.81 -        "repeat-inc-ng", /*OP_REPEAT_INC_NG*/
   46.82 -        "repeat-inc-sg", /*OP_REPEAT_INC_SG*/
   46.83 -        "repeat-inc-ng-sg", /*OP_REPEAT_INC_NG_SG*/
   46.84 -        "null-check-start", /*OP_NULL_CHECK_START*/
   46.85 -        "null-check-end", /*OP_NULL_CHECK_END*/
   46.86 -        "null-check-end-memst", /*OP_NULL_CHECK_END_MEMST*/
   46.87 -        "null-check-end-memst-push", /*OP_NULL_CHECK_END_MEMST_PUSH*/
   46.88 -        "push-pos", /*OP_PUSH_POS*/
   46.89 -        "pop-pos", /*OP_POP_POS*/
   46.90 -        "push-pos-not", /*OP_PUSH_POS_NOT*/
   46.91 -        "fail-pos", /*OP_FAIL_POS*/
   46.92 -        "push-stop-bt", /*OP_PUSH_STOP_BT*/
   46.93 -        "pop-stop-bt", /*OP_POP_STOP_BT*/
   46.94 -        "look-behind", /*OP_LOOK_BEHIND*/
   46.95 -        "push-look-behind-not", /*OP_PUSH_LOOK_BEHIND_NOT*/
   46.96 -        "fail-look-behind-not", /*OP_FAIL_LOOK_BEHIND_NOT*/
   46.97 -        "call", /*OP_CALL*/
   46.98 -        "return", /*OP_RETURN*/
   46.99 -        "state-check-push", /*OP_STATE_CHECK_PUSH*/
  46.100 -        "state-check-push-or-jump", /*OP_STATE_CHECK_PUSH_OR_JUMP*/
  46.101 -        "state-check", /*OP_STATE_CHECK*/
  46.102 -        "state-check-anychar*", /*OP_STATE_CHECK_ANYCHAR_STAR*/
  46.103 -        "state-check-anychar-ml*", /*OP_STATE_CHECK_ANYCHAR_ML_STAR*/
  46.104 -        "set-option-push", /*OP_SET_OPTION_PUSH*/
  46.105 -        "set-option", /*OP_SET_OPTION*/
  46.106 -
  46.107 -        // single byte versions
  46.108 -        "anychar-sb", /*OP_ANYCHAR*/
  46.109 -        "anychar-ml-sb", /*OP_ANYCHAR_ML*/
  46.110 -        "anychar*-sb", /*OP_ANYCHAR_STAR*/
  46.111 -        "anychar-ml*-sb", /*OP_ANYCHAR_ML_STAR*/
  46.112 -        "anychar*-peek-next-sb", /*OP_ANYCHAR_STAR_PEEK_NEXT*/
  46.113 -        "anychar-ml*-peek-next-sb", /*OP_ANYCHAR_ML_STAR_PEEK_NEXT*/
  46.114 -        "state-check-anychar*-sb", /*OP_STATE_CHECK_ANYCHAR_STAR*/
  46.115 -        "state-check-anychar-ml*-sb", /*OP_STATE_CHECK_ANYCHAR_ML_STAR*/
  46.116 -
  46.117 -        "cclass-sb", /*OP_CCLASS*/
  46.118 -        "cclass-not-sb", /*OP_CCLASS_NOT*/
  46.119 -
  46.120 -        "word-sb", /*OP_WORD*/
  46.121 -        "not-word-sb", /*OP_NOT_WORD*/
  46.122 -        "word-bound-sb", /*OP_WORD_BOUND*/
  46.123 -        "not-word-bound-sb", /*OP_NOT_WORD_BOUND*/
  46.124 -        "word-begin-sb", /*OP_WORD_BEGIN*/
  46.125 -        "word-end-sb", /*OP_WORD_END*/
  46.126 -
  46.127 -        "look-behind-sb", /*OP_LOOK_BEHIND*/
  46.128 -
  46.129 -        "exact1-ic-sb", /*OP_EXACT1_IC*/
  46.130 -        "exactn-ic-sb", /*OP_EXACTN_IC*/
  46.131 -
  46.132 -    } : null;
  46.133 -
  46.134 -    public final int OpCodeArgTypes[] = Config.DEBUG_COMPILE ? new int[] {
  46.135 -        Arguments.NON, /*OP_FINISH*/
  46.136 -        Arguments.NON, /*OP_END*/
  46.137 -        Arguments.SPECIAL, /*OP_EXACT1*/
  46.138 -        Arguments.SPECIAL, /*OP_EXACT2*/
  46.139 -        Arguments.SPECIAL, /*OP_EXACT3*/
  46.140 -        Arguments.SPECIAL, /*OP_EXACT4*/
  46.141 -        Arguments.SPECIAL, /*OP_EXACT5*/
  46.142 -        Arguments.SPECIAL, /*OP_EXACTN*/
  46.143 -        Arguments.SPECIAL, /*OP_EXACTMB2N1*/
  46.144 -        Arguments.SPECIAL, /*OP_EXACTMB2N2*/
  46.145 -        Arguments.SPECIAL, /*OP_EXACTMB2N3*/
  46.146 -        Arguments.SPECIAL, /*OP_EXACTMB2N*/
  46.147 -        Arguments.SPECIAL, /*OP_EXACTMB3N*/
  46.148 -        Arguments.SPECIAL, /*OP_EXACTMBN*/
  46.149 -        Arguments.SPECIAL, /*OP_EXACT1_IC*/
  46.150 -        Arguments.SPECIAL, /*OP_EXACTN_IC*/
  46.151 -        Arguments.SPECIAL, /*OP_CCLASS*/
  46.152 -        Arguments.SPECIAL, /*OP_CCLASS_MB*/
  46.153 -        Arguments.SPECIAL, /*OP_CCLASS_MIX*/
  46.154 -        Arguments.SPECIAL, /*OP_CCLASS_NOT*/
  46.155 -        Arguments.SPECIAL, /*OP_CCLASS_MB_NOT*/
  46.156 -        Arguments.SPECIAL, /*OP_CCLASS_MIX_NOT*/
  46.157 -        Arguments.SPECIAL, /*OP_CCLASS_NODE*/
  46.158 -        Arguments.NON, /*OP_ANYCHAR*/
  46.159 -        Arguments.NON, /*OP_ANYCHAR_ML*/
  46.160 -        Arguments.NON, /*OP_ANYCHAR_STAR*/
  46.161 -        Arguments.NON, /*OP_ANYCHAR_ML_STAR*/
  46.162 -        Arguments.SPECIAL, /*OP_ANYCHAR_STAR_PEEK_NEXT*/
  46.163 -        Arguments.SPECIAL, /*OP_ANYCHAR_ML_STAR_PEEK_NEXT*/
  46.164 -        Arguments.NON, /*OP_WORD*/
  46.165 -        Arguments.NON, /*OP_NOT_WORD*/
  46.166 -        Arguments.NON, /*OP_WORD_BOUND*/
  46.167 -        Arguments.NON, /*OP_NOT_WORD_BOUND*/
  46.168 -        Arguments.NON, /*OP_WORD_BEGIN*/
  46.169 -        Arguments.NON, /*OP_WORD_END*/
  46.170 -        Arguments.NON, /*OP_BEGIN_BUF*/
  46.171 -        Arguments.NON, /*OP_END_BUF*/
  46.172 -        Arguments.NON, /*OP_BEGIN_LINE*/
  46.173 -        Arguments.NON, /*OP_END_LINE*/
  46.174 -        Arguments.NON, /*OP_SEMI_END_BUF*/
  46.175 -        Arguments.NON, /*OP_BEGIN_POSITION*/
  46.176 -        Arguments.NON, /*OP_BACKREF1*/
  46.177 -        Arguments.NON, /*OP_BACKREF2*/
  46.178 -        Arguments.MEMNUM, /*OP_BACKREFN*/
  46.179 -        Arguments.SPECIAL, /*OP_BACKREFN_IC*/
  46.180 -        Arguments.SPECIAL, /*OP_BACKREF_MULTI*/
  46.181 -        Arguments.SPECIAL, /*OP_BACKREF_MULTI_IC*/
  46.182 -        Arguments.SPECIAL, /*OP_BACKREF_AT_LEVEL*/
  46.183 -        Arguments.MEMNUM, /*OP_MEMORY_START*/
  46.184 -        Arguments.MEMNUM, /*OP_MEMORY_START_PUSH*/
  46.185 -        Arguments.MEMNUM, /*OP_MEMORY_END_PUSH*/
  46.186 -        Arguments.MEMNUM, /*OP_MEMORY_END_PUSH_REC*/
  46.187 -        Arguments.MEMNUM, /*OP_MEMORY_END*/
  46.188 -        Arguments.MEMNUM, /*OP_MEMORY_END_REC*/
  46.189 -        Arguments.NON, /*OP_FAIL*/
  46.190 -        Arguments.RELADDR, /*OP_JUMP*/
  46.191 -        Arguments.RELADDR, /*OP_PUSH*/
  46.192 -        Arguments.NON, /*OP_POP*/
  46.193 -        Arguments.SPECIAL, /*OP_PUSH_OR_JUMP_EXACT1*/
  46.194 -        Arguments.SPECIAL, /*OP_PUSH_IF_PEEK_NEXT*/
  46.195 -        Arguments.SPECIAL, /*OP_REPEAT*/
  46.196 -        Arguments.SPECIAL, /*OP_REPEAT_NG*/
  46.197 -        Arguments.MEMNUM, /*OP_REPEAT_INC*/
  46.198 -        Arguments.MEMNUM, /*OP_REPEAT_INC_NG*/
  46.199 -        Arguments.MEMNUM, /*OP_REPEAT_INC_SG*/
  46.200 -        Arguments.MEMNUM, /*OP_REPEAT_INC_NG_SG*/
  46.201 -        Arguments.MEMNUM, /*OP_NULL_CHECK_START*/
  46.202 -        Arguments.MEMNUM, /*OP_NULL_CHECK_END*/
  46.203 -        Arguments.MEMNUM, /*OP_NULL_CHECK_END_MEMST*/
  46.204 -        Arguments.MEMNUM, /*OP_NULL_CHECK_END_MEMST_PUSH*/
  46.205 -        Arguments.NON, /*OP_PUSH_POS*/
  46.206 -        Arguments.NON, /*OP_POP_POS*/
  46.207 -        Arguments.RELADDR, /*OP_PUSH_POS_NOT*/
  46.208 -        Arguments.NON, /*OP_FAIL_POS*/
  46.209 -        Arguments.NON, /*OP_PUSH_STOP_BT*/
  46.210 -        Arguments.NON, /*OP_POP_STOP_BT*/
  46.211 -        Arguments.SPECIAL, /*OP_LOOK_BEHIND*/
  46.212 -        Arguments.SPECIAL, /*OP_PUSH_LOOK_BEHIND_NOT*/
  46.213 -        Arguments.NON, /*OP_FAIL_LOOK_BEHIND_NOT*/
  46.214 -        Arguments.ABSADDR, /*OP_CALL*/
  46.215 -        Arguments.NON, /*OP_RETURN*/
  46.216 -        Arguments.SPECIAL, /*OP_STATE_CHECK_PUSH*/
  46.217 -        Arguments.SPECIAL, /*OP_STATE_CHECK_PUSH_OR_JUMP*/
  46.218 -        Arguments.STATE_CHECK, /*OP_STATE_CHECK*/
  46.219 -        Arguments.STATE_CHECK, /*OP_STATE_CHECK_ANYCHAR_STAR*/
  46.220 -        Arguments.STATE_CHECK, /*OP_STATE_CHECK_ANYCHAR_ML_STAR*/
  46.221 -        Arguments.OPTION, /*OP_SET_OPTION_PUSH*/
  46.222 -        Arguments.OPTION, /*OP_SET_OPTION*/
  46.223 -
  46.224 -        // single byte versions
  46.225 -        Arguments.NON, /*OP_ANYCHAR*/
  46.226 -        Arguments.NON, /*OP_ANYCHAR_ML*/
  46.227 -        Arguments.NON, /*OP_ANYCHAR_STAR*/
  46.228 -        Arguments.NON, /*OP_ANYCHAR_ML_STAR*/
  46.229 -        Arguments.SPECIAL, /*OP_ANYCHAR_STAR_PEEK_NEXT*/
  46.230 -        Arguments.SPECIAL, /*OP_ANYCHAR_ML_STAR_PEEK_NEXT*/
  46.231 -        Arguments.STATE_CHECK, /*OP_STATE_CHECK_ANYCHAR_STAR*/
  46.232 -        Arguments.STATE_CHECK, /*OP_STATE_CHECK_ANYCHAR_ML_STAR*/
  46.233 -
  46.234 -        Arguments.SPECIAL, /*OP_CCLASS*/
  46.235 -        Arguments.SPECIAL, /*OP_CCLASS_NOT*/
  46.236 -
  46.237 -        Arguments.NON, /*OP_WORD*/
  46.238 -        Arguments.NON, /*OP_NOT_WORD*/
  46.239 -        Arguments.NON, /*OP_WORD_BOUND*/
  46.240 -        Arguments.NON, /*OP_NOT_WORD_BOUND*/
  46.241 -        Arguments.NON, /*OP_WORD_BEGIN*/
  46.242 -        Arguments.NON, /*OP_WORD_END*/
  46.243 -
  46.244 -        Arguments.SPECIAL, /*OP_LOOK_BEHIND*/
  46.245 -
  46.246 -        Arguments.SPECIAL, /*OP_EXACT1_IC*/
  46.247 -        Arguments.SPECIAL, /*OP_EXACTN_IC*/
  46.248 -    } : null;
  46.249  }
    47.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/constants/Reduce.java	Fri May 17 14:30:22 2013 -0300
    47.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.3 @@ -1,61 +0,0 @@
    47.4 -/*
    47.5 - * Permission is hereby granted, free of charge, to any person obtaining a copy of
    47.6 - * this software and associated documentation files (the "Software"), to deal in
    47.7 - * the Software without restriction, including without limitation the rights to
    47.8 - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
    47.9 - * of the Software, and to permit persons to whom the Software is furnished to do
   47.10 - * so, subject to the following conditions:
   47.11 - *
   47.12 - * The above copyright notice and this permission notice shall be included in all
   47.13 - * copies or substantial portions of the Software.
   47.14 - *
   47.15 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   47.16 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   47.17 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   47.18 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   47.19 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   47.20 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   47.21 - * SOFTWARE.
   47.22 - */
   47.23 -package jdk.nashorn.internal.runtime.regexp.joni.constants;
   47.24 -
   47.25 -import static jdk.nashorn.internal.runtime.regexp.joni.constants.Reduce.ReduceType.A;
   47.26 -import static jdk.nashorn.internal.runtime.regexp.joni.constants.Reduce.ReduceType.AQ;
   47.27 -import static jdk.nashorn.internal.runtime.regexp.joni.constants.Reduce.ReduceType.ASIS;
   47.28 -import static jdk.nashorn.internal.runtime.regexp.joni.constants.Reduce.ReduceType.DEL;
   47.29 -import static jdk.nashorn.internal.runtime.regexp.joni.constants.Reduce.ReduceType.PQ_Q;
   47.30 -import static jdk.nashorn.internal.runtime.regexp.joni.constants.Reduce.ReduceType.P_QQ;
   47.31 -import static jdk.nashorn.internal.runtime.regexp.joni.constants.Reduce.ReduceType.QQ;
   47.32 -
   47.33 -public interface Reduce {
   47.34 -
   47.35 -    enum ReduceType {
   47.36 -        ASIS,       /* as is */
   47.37 -        DEL,        /* delete parent */
   47.38 -        A,          /* to '*'    */
   47.39 -        AQ,         /* to '*?'   */
   47.40 -        QQ,         /* to '??'   */
   47.41 -        P_QQ,       /* to '+)??' */
   47.42 -        PQ_Q,       /* to '+?)?' */
   47.43 -    }
   47.44 -
   47.45 -    final ReduceType[][]REDUCE_TABLE = {
   47.46 -      {DEL,     A,      A,      QQ,     AQ,     ASIS}, /* '?'  */
   47.47 -      {DEL,     DEL,    DEL,    P_QQ,   P_QQ,   DEL},  /* '*'  */
   47.48 -      {A,       A,      DEL,    ASIS,   P_QQ,   DEL},  /* '+'  */
   47.49 -      {DEL,     AQ,     AQ,     DEL,    AQ,     AQ},   /* '??' */
   47.50 -      {DEL,     DEL,    DEL,    DEL,    DEL,    DEL},  /* '*?' */
   47.51 -      {ASIS,    PQ_Q,   DEL,    AQ,     AQ,     DEL}   /* '+?' */
   47.52 -    };
   47.53 -
   47.54 -
   47.55 -    final String PopularQStr[] = new String[] {
   47.56 -        "?", "*", "+", "??", "*?", "+?"
   47.57 -    };
   47.58 -
   47.59 -    String ReduceQStr[]= new String[] {
   47.60 -        "", "", "*", "*?", "??", "+ and ??", "+? and ?"
   47.61 -    };
   47.62 -
   47.63 -}
   47.64 -
    48.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/encoding/AsciiTables.java	Fri May 17 14:30:22 2013 -0300
    48.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.3 @@ -1,157 +0,0 @@
    48.4 -/*
    48.5 - * Permission is hereby granted, free of charge, to any person obtaining a copy of
    48.6 - * this software and associated documentation files (the "Software"), to deal in
    48.7 - * the Software without restriction, including without limitation the rights to
    48.8 - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
    48.9 - * of the Software, and to permit persons to whom the Software is furnished to do
   48.10 - * so, subject to the following conditions:
   48.11 - *
   48.12 - * The above copyright notice and this permission notice shall be included in all
   48.13 - * copies or substantial portions of the Software.
   48.14 - *
   48.15 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   48.16 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   48.17 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   48.18 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   48.19 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   48.20 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   48.21 - * SOFTWARE.
   48.22 - */
   48.23 -package jdk.nashorn.internal.runtime.regexp.joni.encoding;
   48.24 -
   48.25 -public class AsciiTables {
   48.26 -
   48.27 -    public static final short AsciiCtypeTable[] = {
   48.28 -            0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
   48.29 -            0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008,
   48.30 -            0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
   48.31 -            0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
   48.32 -            0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
   48.33 -            0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
   48.34 -            0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0,
   48.35 -            0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
   48.36 -            0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2,
   48.37 -            0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
   48.38 -            0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
   48.39 -            0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0,
   48.40 -            0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2,
   48.41 -            0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
   48.42 -            0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
   48.43 -            0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008,
   48.44 -            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   48.45 -            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   48.46 -            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   48.47 -            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   48.48 -            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   48.49 -            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   48.50 -            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   48.51 -            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   48.52 -            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   48.53 -            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   48.54 -            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   48.55 -            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   48.56 -            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   48.57 -            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   48.58 -            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
   48.59 -            0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
   48.60 -    };
   48.61 -
   48.62 -    public static final byte ToLowerCaseTable[] = {
   48.63 -            (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007',
   48.64 -            (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017',
   48.65 -            (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027',
   48.66 -            (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037',
   48.67 -            (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047',
   48.68 -            (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057',
   48.69 -            (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067',
   48.70 -            (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077',
   48.71 -            (byte)'\100', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147',
   48.72 -            (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157',
   48.73 -            (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167',
   48.74 -            (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137',
   48.75 -            (byte)'\140', (byte)'\141', (byte)'\142', (byte)'\143', (byte)'\144', (byte)'\145', (byte)'\146', (byte)'\147',
   48.76 -            (byte)'\150', (byte)'\151', (byte)'\152', (byte)'\153', (byte)'\154', (byte)'\155', (byte)'\156', (byte)'\157',
   48.77 -            (byte)'\160', (byte)'\161', (byte)'\162', (byte)'\163', (byte)'\164', (byte)'\165', (byte)'\166', (byte)'\167',
   48.78 -            (byte)'\170', (byte)'\171', (byte)'\172', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177',
   48.79 -            (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207',
   48.80 -            (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217',
   48.81 -            (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227',
   48.82 -            (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237',
   48.83 -            (byte)'\240', (byte)'\241', (byte)'\242', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\246', (byte)'\247',
   48.84 -            (byte)'\250', (byte)'\251', (byte)'\252', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\257',
   48.85 -            (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267',
   48.86 -            (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\275', (byte)'\276', (byte)'\277',
   48.87 -            (byte)'\300', (byte)'\301', (byte)'\302', (byte)'\303', (byte)'\304', (byte)'\305', (byte)'\306', (byte)'\307',
   48.88 -            (byte)'\310', (byte)'\311', (byte)'\312', (byte)'\313', (byte)'\314', (byte)'\315', (byte)'\316', (byte)'\317',
   48.89 -            (byte)'\320', (byte)'\321', (byte)'\322', (byte)'\323', (byte)'\324', (byte)'\325', (byte)'\326', (byte)'\327',
   48.90 -            (byte)'\330', (byte)'\331', (byte)'\332', (byte)'\333', (byte)'\334', (byte)'\335', (byte)'\336', (byte)'\337',
   48.91 -            (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347',
   48.92 -            (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357',
   48.93 -            (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367',
   48.94 -            (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377',
   48.95 -    };
   48.96 -
   48.97 -    public static final byte ToUpperCaseTable[] = {
   48.98 -            (byte)'\000', (byte)'\001', (byte)'\002', (byte)'\003', (byte)'\004', (byte)'\005', (byte)'\006', (byte)'\007',
   48.99 -            (byte)'\010', (byte)'\011', (byte)'\012', (byte)'\013', (byte)'\014', (byte)'\015', (byte)'\016', (byte)'\017',
  48.100 -            (byte)'\020', (byte)'\021', (byte)'\022', (byte)'\023', (byte)'\024', (byte)'\025', (byte)'\026', (byte)'\027',
  48.101 -            (byte)'\030', (byte)'\031', (byte)'\032', (byte)'\033', (byte)'\034', (byte)'\035', (byte)'\036', (byte)'\037',
  48.102 -            (byte)'\040', (byte)'\041', (byte)'\042', (byte)'\043', (byte)'\044', (byte)'\045', (byte)'\046', (byte)'\047',
  48.103 -            (byte)'\050', (byte)'\051', (byte)'\052', (byte)'\053', (byte)'\054', (byte)'\055', (byte)'\056', (byte)'\057',
  48.104 -            (byte)'\060', (byte)'\061', (byte)'\062', (byte)'\063', (byte)'\064', (byte)'\065', (byte)'\066', (byte)'\067',
  48.105 -            (byte)'\070', (byte)'\071', (byte)'\072', (byte)'\073', (byte)'\074', (byte)'\075', (byte)'\076', (byte)'\077',
  48.106 -            (byte)'\100', (byte)'\101', (byte)'\102', (byte)'\103', (byte)'\104', (byte)'\105', (byte)'\106', (byte)'\107',
  48.107 -            (byte)'\110', (byte)'\111', (byte)'\112', (byte)'\113', (byte)'\114', (byte)'\115', (byte)'\116', (byte)'\117',
  48.108 -            (byte)'\120', (byte)'\121', (byte)'\122', (byte)'\123', (byte)'\124', (byte)'\125', (byte)'\126', (byte)'\127',
  48.109 -            (byte)'\130', (byte)'\131', (byte)'\132', (byte)'\133', (byte)'\134', (byte)'\135', (byte)'\136', (byte)'\137',
  48.110 -            (byte)'\140', (byte)'\101', (byte)'\102', (byte)'\103', (byte)'\104', (byte)'\105', (byte)'\106', (byte)'\107',
  48.111 -            (byte)'\110', (byte)'\111', (byte)'\112', (byte)'\113', (byte)'\114', (byte)'\115', (byte)'\116', (byte)'\117',
  48.112 -            (byte)'\120', (byte)'\121', (byte)'\122', (byte)'\123', (byte)'\124', (byte)'\125', (byte)'\126', (byte)'\127',
  48.113 -            (byte)'\130', (byte)'\131', (byte)'\132', (byte)'\173', (byte)'\174', (byte)'\175', (byte)'\176', (byte)'\177',
  48.114 -            (byte)'\200', (byte)'\201', (byte)'\202', (byte)'\203', (byte)'\204', (byte)'\205', (byte)'\206', (byte)'\207',
  48.115 -            (byte)'\210', (byte)'\211', (byte)'\212', (byte)'\213', (byte)'\214', (byte)'\215', (byte)'\216', (byte)'\217',
  48.116 -            (byte)'\220', (byte)'\221', (byte)'\222', (byte)'\223', (byte)'\224', (byte)'\225', (byte)'\226', (byte)'\227',
  48.117 -            (byte)'\230', (byte)'\231', (byte)'\232', (byte)'\233', (byte)'\234', (byte)'\235', (byte)'\236', (byte)'\237',
  48.118 -            (byte)'\240', (byte)'\241', (byte)'\242', (byte)'\243', (byte)'\244', (byte)'\245', (byte)'\246', (byte)'\247',
  48.119 -            (byte)'\250', (byte)'\251', (byte)'\252', (byte)'\253', (byte)'\254', (byte)'\255', (byte)'\256', (byte)'\257',
  48.120 -            (byte)'\260', (byte)'\261', (byte)'\262', (byte)'\263', (byte)'\264', (byte)'\265', (byte)'\266', (byte)'\267',
  48.121 -            (byte)'\270', (byte)'\271', (byte)'\272', (byte)'\273', (byte)'\274', (byte)'\275', (byte)'\276', (byte)'\277',
  48.122 -            (byte)'\300', (byte)'\301', (byte)'\302', (byte)'\303', (byte)'\304', (byte)'\305', (byte)'\306', (byte)'\307',
  48.123 -            (byte)'\310', (byte)'\311', (byte)'\312', (byte)'\313', (byte)'\314', (byte)'\315', (byte)'\316', (byte)'\317',
  48.124 -            (byte)'\320', (byte)'\321', (byte)'\322', (byte)'\323', (byte)'\324', (byte)'\325', (byte)'\326', (byte)'\327',
  48.125 -            (byte)'\330', (byte)'\331', (byte)'\332', (byte)'\333', (byte)'\334', (byte)'\335', (byte)'\336', (byte)'\337',
  48.126 -            (byte)'\340', (byte)'\341', (byte)'\342', (byte)'\343', (byte)'\344', (byte)'\345', (byte)'\346', (byte)'\347',
  48.127 -            (byte)'\350', (byte)'\351', (byte)'\352', (byte)'\353', (byte)'\354', (byte)'\355', (byte)'\356', (byte)'\357',
  48.128 -            (byte)'\360', (byte)'\361', (byte)'\362', (byte)'\363', (byte)'\364', (byte)'\365', (byte)'\366', (byte)'\367',
  48.129 -            (byte)'\370', (byte)'\371', (byte)'\372', (byte)'\373', (byte)'\374', (byte)'\375', (byte)'\376', (byte)'\377',
  48.130 -    };
  48.131 -
  48.132 -    public static final int LowerMap[][] = {
  48.133 -            {0x41, 0x61},
  48.134 -            {0x42, 0x62},
  48.135 -            {0x43, 0x63},
  48.136 -            {0x44, 0x64},
  48.137 -            {0x45, 0x65},
  48.138 -            {0x46, 0x66},
  48.139 -            {0x47, 0x67},
  48.140 -            {0x48, 0x68},
  48.141 -            {0x49, 0x69},
  48.142 -            {0x4a, 0x6a},
  48.143 -            {0x4b, 0x6b},
  48.144 -            {0x4c, 0x6c},
  48.145 -            {0x4d, 0x6d},
  48.146 -            {0x4e, 0x6e},
  48.147 -            {0x4f, 0x6f},
  48.148 -            {0x50, 0x70},
  48.149 -            {0x51, 0x71},
  48.150 -            {0x52, 0x72},
  48.151 -            {0x53, 0x73},
  48.152 -            {0x54, 0x74},
  48.153 -            {0x55, 0x75},
  48.154 -            {0x56, 0x76},
  48.155 -            {0x57, 0x77},
  48.156 -            {0x58, 0x78},
  48.157 -            {0x59, 0x79},
  48.158 -            {0x5a, 0x7a}
  48.159 -    };
  48.160 -}
    49.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/encoding/ObjPtr.java	Fri May 17 14:30:22 2013 -0300
    49.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/encoding/ObjPtr.java	Fri May 17 16:12:59 2013 -0300
    49.3 @@ -30,6 +30,5 @@
    49.4  
    49.5      public T p;
    49.6  
    49.7 -    static final ObjPtr<Void> NULL = new ObjPtr<Void>();
    49.8  }
    49.9  
    50.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/encoding/PosixBracket.java	Fri May 17 14:30:22 2013 -0300
    50.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.3 @@ -1,77 +0,0 @@
    50.4 -/*
    50.5 - * Permission is hereby granted, free of charge, to any person obtaining a copy of
    50.6 - * this software and associated documentation files (the "Software"), to deal in
    50.7 - * the Software without restriction, including without limitation the rights to
    50.8 - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
    50.9 - * of the Software, and to permit persons to whom the Software is furnished to do
   50.10 - * so, subject to the following conditions:
   50.11 - *
   50.12 - * The above copyright notice and this permission notice shall be included in all
   50.13 - * copies or substantial portions of the Software.
   50.14 - *
   50.15 - * THE SOFTWARE IS PROVIDED "AS IS".toCharArray(), WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   50.16 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   50.17 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   50.18 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   50.19 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   50.20 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   50.21 - * SOFTWARE.
   50.22 - */
   50.23 -package jdk.nashorn.internal.runtime.regexp.joni.encoding;
   50.24 -
   50.25 -import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages;
   50.26 -import jdk.nashorn.internal.runtime.regexp.joni.exception.JOniException;
   50.27 -
   50.28 -import java.util.HashMap;
   50.29 -
   50.30 -public class PosixBracket {
   50.31 -
   50.32 -    public static final char[][] PBSNamesLower = {
   50.33 -            "alnum".toCharArray(),
   50.34 -            "alpha".toCharArray(),
   50.35 -            "blank".toCharArray(),
   50.36 -            "cntrl".toCharArray(),
   50.37 -            "digit".toCharArray(),
   50.38 -            "graph".toCharArray(),
   50.39 -            "lower".toCharArray(),
   50.40 -            "print".toCharArray(),
   50.41 -            "punct".toCharArray(),
   50.42 -            "space".toCharArray(),
   50.43 -            "upper".toCharArray(),
   50.44 -            "xdigit".toCharArray(),
   50.45 -            "ascii".toCharArray(),
   50.46 -            "word".toCharArray()
   50.47 -    };
   50.48 -
   50.49 -    public static final int PBSValues[] = {
   50.50 -            CharacterType.ALNUM,
   50.51 -            CharacterType.ALPHA,
   50.52 -            CharacterType.BLANK,
   50.53 -            CharacterType.CNTRL,
   50.54 -            CharacterType.DIGIT,
   50.55 -            CharacterType.GRAPH,
   50.56 -            CharacterType.LOWER,
   50.57 -            CharacterType.PRINT,
   50.58 -            CharacterType.PUNCT,
   50.59 -            CharacterType.SPACE,
   50.60 -            CharacterType.UPPER,
   50.61 -            CharacterType.XDIGIT,
   50.62 -            CharacterType.ASCII,
   50.63 -            CharacterType.WORD,
   50.64 -    };
   50.65 -
   50.66 -    public static int propertyNameToCType(String name) {
   50.67 -        name = name.toLowerCase();
   50.68 -        if (!PBSTableUpper.containsKey(name)) {
   50.69 -            throw new JOniException(ErrorMessages.ERR_INVALID_CHAR_PROPERTY_NAME.replaceAll("%n", name));
   50.70 -        }
   50.71 -        return PBSTableUpper.get(name);
   50.72 -    }
   50.73 -
   50.74 -    private static final HashMap<String,Integer> PBSTableUpper = new HashMap<String,Integer>();
   50.75 -
   50.76 -    static {
   50.77 -        for (int i=0; i<PBSValues.length; i++) PBSTableUpper.put(new String(PBSNamesLower[i]), PBSValues[i]);
   50.78 -    }
   50.79 -
   50.80 -}
    51.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/encoding/Ptr.java	Fri May 17 14:30:22 2013 -0300
    51.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.3 @@ -1,35 +0,0 @@
    51.4 -/*
    51.5 - * Permission is hereby granted, free of charge, to any person obtaining a copy of
    51.6 - * this software and associated documentation files (the "Software"), to deal in
    51.7 - * the Software without restriction, including without limitation the rights to
    51.8 - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
    51.9 - * of the Software, and to permit persons to whom the Software is furnished to do
   51.10 - * so, subject to the following conditions:
   51.11 - *
   51.12 - * The above copyright notice and this permission notice shall be included in all
   51.13 - * copies or substantial portions of the Software.
   51.14 - *
   51.15 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   51.16 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   51.17 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   51.18 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   51.19 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   51.20 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   51.21 - * SOFTWARE.
   51.22 - */
   51.23 -package jdk.nashorn.internal.runtime.regexp.joni.encoding;
   51.24 -
   51.25 -public final class Ptr {
   51.26 -    public Ptr() {
   51.27 -        this(0);
   51.28 -    }
   51.29 -
   51.30 -    public Ptr(int p) {
   51.31 -        this.p = p;
   51.32 -    }
   51.33 -
   51.34 -    public int p;
   51.35 -
   51.36 -    public static final Ptr NULL = new Ptr(0);
   51.37 -}
   51.38 -
    52.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java	Fri May 17 14:30:22 2013 -0300
    52.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java	Fri May 17 16:12:59 2013 -0300
    52.3 @@ -22,28 +22,16 @@
    52.4  import jdk.nashorn.internal.runtime.regexp.joni.Config;
    52.5  
    52.6  public interface ErrorMessages {
    52.7 -    final String MISMATCH = "mismatch";
    52.8 -    final String NO_SUPPORT_CONFIG = "no support in this configuration";
    52.9  
   52.10      /* from jcodings */
   52.11 -    final String ERR_INVALID_CHAR_PROPERTY_NAME = "invalid character property name <%n>";
   52.12      final String ERR_INVALID_CODE_POINT_VALUE = "invalid code point value";
   52.13      final String ERR_TOO_BIG_WIDE_CHAR_VALUE = "too big wide-char value";
   52.14      final String ERR_TOO_LONG_WIDE_CHAR_VALUE = "too long wide-char value";
   52.15  
   52.16      /* internal error */
   52.17 -    final String ERR_MEMORY = "fail to memory allocation";
   52.18 -    final String ERR_MATCH_STACK_LIMIT_OVER = "match-stack limit over";
   52.19 -    final String ERR_TYPE_BUG = "undefined type (bug)";
   52.20      final String ERR_PARSER_BUG = "internal parser error (bug)";
   52.21 -    final String ERR_STACK_BUG = "stack error (bug)";
   52.22      final String ERR_UNDEFINED_BYTECODE = "undefined bytecode (bug)";
   52.23      final String ERR_UNEXPECTED_BYTECODE = "unexpected bytecode (bug)";
   52.24 -    final String ERR_DEFAULT_ENCODING_IS_NOT_SETTED = "default multibyte-encoding is not setted";
   52.25 -    final String ERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR = "can't convert to wide-char on specified multibyte-encoding";
   52.26 -
   52.27 -    /* general error */
   52.28 -    final String ERR_INVALID_ARGUMENT = "invalid argument";
   52.29  
   52.30      /* syntax error */
   52.31      final String ERR_END_PATTERN_AT_LEFT_BRACE = "end pattern at left brace";
   52.32 @@ -56,11 +44,9 @@
   52.33      final String ERR_META_CODE_SYNTAX = "invalid meta-code syntax";
   52.34      final String ERR_CONTROL_CODE_SYNTAX = "invalid control-code syntax";
   52.35      final String ERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE = "char-class value at end of range";
   52.36 -    final String ERR_CHAR_CLASS_VALUE_AT_START_OF_RANGE = "char-class value at start of range";
   52.37      final String ERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS = "unmatched range specifier in char-class";
   52.38      final String ERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED = "target of repeat operator is not specified";
   52.39      final String ERR_TARGET_OF_REPEAT_OPERATOR_INVALID = "target of repeat operator is invalid";
   52.40 -    final String ERR_NESTED_REPEAT_OPERATOR = "nested repeat operator";
   52.41      final String ERR_UNMATCHED_CLOSE_PARENTHESIS = "unmatched close parenthesis";
   52.42      final String ERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS = "end pattern with unmatched parenthesis";
   52.43      final String ERR_END_PATTERN_IN_GROUP = "end pattern in group";
   52.44 @@ -74,25 +60,14 @@
   52.45      final String ERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE = "too big number for repeat range";
   52.46      final String ERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE = "upper is smaller than lower in repeat range";
   52.47      final String ERR_EMPTY_RANGE_IN_CHAR_CLASS = "empty range in char class";
   52.48 -    final String ERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE = "mismatch multibyte code length in char-class range";
   52.49      final String ERR_TOO_MANY_MULTI_BYTE_RANGES = "too many multibyte code ranges are specified";
   52.50      final String ERR_TOO_SHORT_MULTI_BYTE_STRING = "too short multibyte code string";
   52.51 -    final String ERR_TOO_BIG_BACKREF_NUMBER = "too big backref number";
   52.52 -    final String ERR_INVALID_BACKREF = Config.USE_NAMED_GROUP ? "invalid backref number/name" : "invalid backref number";
   52.53 +    final String ERR_INVALID_BACKREF = "invalid backref number";
   52.54      final String ERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED = "numbered backref/call is not allowed. (use name)";
   52.55 -    final String ERR_INVALID_WIDE_CHAR_VALUE = "invalid wide-char value";
   52.56      final String ERR_EMPTY_GROUP_NAME = "group name is empty";
   52.57      final String ERR_INVALID_GROUP_NAME = "invalid group name <%n>";
   52.58 -    final String ERR_INVALID_CHAR_IN_GROUP_NAME = Config.USE_NAMED_GROUP ? "invalid char in group name <%n>" : "invalid char in group number <%n>";
   52.59 -    final String ERR_UNDEFINED_NAME_REFERENCE = "undefined name <%n> reference";
   52.60 -    final String ERR_UNDEFINED_GROUP_REFERENCE = "undefined group <%n> reference";
   52.61 -    final String ERR_MULTIPLEX_DEFINED_NAME = "multiplex defined name <%n>";
   52.62 -    final String ERR_MULTIPLEX_DEFINITION_NAME_CALL = "multiplex definition name <%n> call";
   52.63 -    final String ERR_NEVER_ENDING_RECURSION = "never ending recursion";
   52.64 +    final String ERR_INVALID_CHAR_IN_GROUP_NAME = "invalid char in group number <%n>";
   52.65      final String ERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY = "group number is too big for capture history";
   52.66 -    final String ERR_NOT_SUPPORTED_ENCODING_COMBINATION = "not supported encoding combination";
   52.67      final String ERR_INVALID_COMBINATION_OF_OPTIONS = "invalid combination of options";
   52.68 -    final String ERR_OVER_THREAD_PASS_LIMIT_COUNT = "over thread pass limit count";
   52.69 -    final String ERR_TOO_BIG_SB_CHAR_VALUE = "too big singlebyte char value";
   52.70  
   52.71  }
    53.1 --- a/src/jdk/nashorn/internal/runtime/regexp/joni/exception/ValueException.java	Fri May 17 14:30:22 2013 -0300
    53.2 +++ b/src/jdk/nashorn/internal/runtime/regexp/joni/exception/ValueException.java	Fri May 17 16:12:59 2013 -0300
    53.3 @@ -30,8 +30,4 @@
    53.4          super(message.replaceAll("%n", str));
    53.5      }
    53.6  
    53.7 -    public ValueException(String message, byte[]bytes, int p, int end) {
    53.8 -        this(message, new String(bytes, p, end - p));
    53.9 -    }
   53.10 -
   53.11  }
    54.1 --- a/src/netscape/javascript/JSObject.java	Fri May 17 14:30:22 2013 -0300
    54.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.3 @@ -1,101 +0,0 @@
    54.4 -/*
    54.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    54.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    54.7 - *
    54.8 - * This code is free software; you can redistribute it and/or modify it
    54.9 - * under the terms of the GNU General Public License version 2 only, as
   54.10 - * published by the Free Software Foundation.  Oracle designates this
   54.11 - * particular file as subject to the "Classpath" exception as provided
   54.12 - * by Oracle in the LICENSE file that accompanied this code.
   54.13 - *
   54.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
   54.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   54.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   54.17 - * version 2 for more details (a copy is included in the LICENSE file that
   54.18 - * accompanied this code).
   54.19 - *
   54.20 - * You should have received a copy of the GNU General Public License version
   54.21 - * 2 along with this work; if not, write to the Free Software Foundation,
   54.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   54.23 - *
   54.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   54.25 - * or visit www.oracle.com if you need additional information or have any
   54.26 - * questions.
   54.27 - */
   54.28 -
   54.29 -package netscape.javascript;
   54.30 -
   54.31 -import java.applet.Applet;
   54.32 -
   54.33 -/**
   54.34 - * Stub for JSObject to get compilation going.
   54.35 - */
   54.36 -public abstract class JSObject {
   54.37 -
   54.38 -    /**
   54.39 -     * Get the window for an {@link Applet}. Not supported
   54.40 -     * by Nashorn
   54.41 -     *
   54.42 -     * @param a applet
   54.43 -     * @return the window instance
   54.44 -     */
   54.45 -    public static JSObject getWindow(final Applet a) {
   54.46 -        throw new UnsupportedOperationException("getWindow");
   54.47 -    }
   54.48 -
   54.49 -    /**
   54.50 -     * Call a JavaScript method
   54.51 -     *
   54.52 -     * @param methodName name of method
   54.53 -     * @param args arguments to method
   54.54 -     * @return result of call
   54.55 -     */
   54.56 -    public abstract Object call(String methodName, Object args[]);
   54.57 -
   54.58 -    /**
   54.59 -     * Evaluate a JavaScript expression
   54.60 -     *
   54.61 -     * @param s JavaScript expression to evaluate
   54.62 -     * @return evaluation result
   54.63 -     */
   54.64 -    public abstract Object eval(String s);
   54.65 -
   54.66 -    /**
   54.67 -     * Retrieves a named member of a JavaScript object.
   54.68 -     *
   54.69 -     * @param name of member
   54.70 -     * @return member
   54.71 -     */
   54.72 -    public abstract Object getMember(String name);
   54.73 -
   54.74 -    /**
   54.75 -     * Retrieves an indexed member of a JavaScript object.
   54.76 -     *
   54.77 -     * @param index index of member slot
   54.78 -     * @return member
   54.79 -     */
   54.80 -    public abstract Object getSlot(int index);
   54.81 -
   54.82 -    /**
   54.83 -     * Remove a named member from a JavaScript object
   54.84 -     *
   54.85 -     * @param name name of member
   54.86 -     */
   54.87 -    public abstract void removeMember(String name);
   54.88 -
   54.89 -    /**
   54.90 -     * Set a named member in a JavaScript object
   54.91 -     *
   54.92 -     * @param name  name of member
   54.93 -     * @param value value of member
   54.94 -     */
   54.95 -    public abstract void setMember(String name, Object value);
   54.96 -
   54.97 -    /**
   54.98 -     * Set an indexed member in a JavaScript object
   54.99 -     *
  54.100 -     * @param index index of member slot
  54.101 -     * @param value value of member
  54.102 -     */
  54.103 -    public abstract void setSlot(int index, Object value);
  54.104 -}
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/test/script/basic/JDK-8013919.js	Fri May 17 16:12:59 2013 -0300
    55.3 @@ -0,0 +1,39 @@
    55.4 +/*
    55.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    55.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    55.7 + * 
    55.8 + * This code is free software; you can redistribute it and/or modify it
    55.9 + * under the terms of the GNU General Public License version 2 only, as
   55.10 + * published by the Free Software Foundation.
   55.11 + * 
   55.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   55.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   55.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   55.15 + * version 2 for more details (a copy is included in the LICENSE file that
   55.16 + * accompanied this code).
   55.17 + * 
   55.18 + * You should have received a copy of the GNU General Public License version
   55.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   55.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   55.21 + * 
   55.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   55.23 + * or visit www.oracle.com if you need additional information or have any
   55.24 + * questions.
   55.25 + */
   55.26 +
   55.27 +/**
   55.28 + * JDK-8013913: finally cloning of function node declarations caused
   55.29 + * method collissions
   55.30 + *
   55.31 + * @test
   55.32 + * @run
   55.33 + */
   55.34 +
   55.35 +try {
   55.36 +    print("a");
   55.37 +} finally {
   55.38 +    var b = function() {
   55.39 +	print("b");
   55.40 +    }
   55.41 +    b();
   55.42 +}
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/test/script/basic/JDK-8013919.js.EXPECTED	Fri May 17 16:12:59 2013 -0300
    56.3 @@ -0,0 +1,2 @@
    56.4 +a
    56.5 +b
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/test/script/basic/JDK-8014647.js	Fri May 17 16:12:59 2013 -0300
    57.3 @@ -0,0 +1,40 @@
    57.4 +/*
    57.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    57.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    57.7 + * 
    57.8 + * This code is free software; you can redistribute it and/or modify it
    57.9 + * under the terms of the GNU General Public License version 2 only, as
   57.10 + * published by the Free Software Foundation.
   57.11 + * 
   57.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   57.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   57.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   57.15 + * version 2 for more details (a copy is included in the LICENSE file that
   57.16 + * accompanied this code).
   57.17 + * 
   57.18 + * You should have received a copy of the GNU General Public License version
   57.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   57.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   57.21 + * 
   57.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   57.23 + * or visit www.oracle.com if you need additional information or have any
   57.24 + * questions.
   57.25 + */
   57.26 +
   57.27 +/**
   57.28 + * JDK-8014647: Allow class-based overrides to be initialized with a ScriptFunction
   57.29 + *
   57.30 + * @test
   57.31 + * @run
   57.32 + */
   57.33 +
   57.34 +var RunnableImpl1 = Java.extend(java.lang.Runnable, function() { print("I'm runnable 1!") })
   57.35 +var RunnableImpl2 = Java.extend(java.lang.Runnable, function() { print("I'm runnable 2!") })
   57.36 +var r1 = new RunnableImpl1()
   57.37 +var r2 = new RunnableImpl2()
   57.38 +var r3 = new RunnableImpl2(function() { print("I'm runnable 3!") })
   57.39 +r1.run()
   57.40 +r2.run()
   57.41 +r3.run()
   57.42 +print("r1.class === r2.class: " + (r1.class === r2.class))
   57.43 +print("r2.class === r3.class: " + (r2.class === r3.class))
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/test/script/basic/JDK-8014647.js.EXPECTED	Fri May 17 16:12:59 2013 -0300
    58.3 @@ -0,0 +1,5 @@
    58.4 +I'm runnable 1!
    58.5 +I'm runnable 2!
    58.6 +I'm runnable 3!
    58.7 +r1.class === r2.class: false
    58.8 +r2.class === r3.class: true
    59.1 --- a/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Fri May 17 14:30:22 2013 -0300
    59.2 +++ b/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Fri May 17 16:12:59 2013 -0300
    59.3 @@ -47,7 +47,6 @@
    59.4  import javax.script.ScriptEngineManager;
    59.5  import javax.script.ScriptException;
    59.6  import javax.script.SimpleScriptContext;
    59.7 -import netscape.javascript.JSObject;
    59.8  import org.testng.Assert;
    59.9  import org.testng.annotations.Test;
   59.10  
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/test/src/jdk/nashorn/internal/runtime/regexp/JdkRegExpTest.java	Fri May 17 16:12:59 2013 -0300
    60.3 @@ -0,0 +1,61 @@
    60.4 +/*
    60.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    60.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    60.7 + *
    60.8 + * This code is free software; you can redistribute it and/or modify it
    60.9 + * under the terms of the GNU General Public License version 2 only, as
   60.10 + * published by the Free Software Foundation.  Oracle designates this
   60.11 + * particular file as subject to the "Classpath" exception as provided
   60.12 + * by Oracle in the LICENSE file that accompanied this code.
   60.13 + *
   60.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   60.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   60.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   60.17 + * version 2 for more details (a copy is included in the LICENSE file that
   60.18 + * accompanied this code).
   60.19 + *
   60.20 + * You should have received a copy of the GNU General Public License version
   60.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   60.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   60.23 + *
   60.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   60.25 + * or visit www.oracle.com if you need additional information or have any
   60.26 + * questions.
   60.27 + */
   60.28 +
   60.29 +package jdk.nashorn.internal.runtime.regexp;
   60.30 +
   60.31 +import static org.testng.Assert.assertEquals;
   60.32 +import static org.testng.Assert.assertNotNull;
   60.33 +import static org.testng.Assert.assertTrue;
   60.34 +
   60.35 +import jdk.nashorn.internal.runtime.ParserException;
   60.36 +import org.testng.annotations.Test;
   60.37 +
   60.38 +/**
   60.39 + * Basic tests for the JDK based RegExp implementation.
   60.40 + *
   60.41 + * @test
   60.42 + * @run testng jdk.nashorn.internal.runtime.regexp.JdkRegExpTest
   60.43 + */
   60.44 +public class JdkRegExpTest {
   60.45 +
   60.46 +    /**
   60.47 +     * Compile a regular expression using the JDK implementation
   60.48 +     */
   60.49 +    @Test
   60.50 +    public void testMatcher() {
   60.51 +        RegExp regexp = new RegExpFactory().compile("f(o)o", "");
   60.52 +        RegExpMatcher matcher = regexp.match("foo");
   60.53 +        assertNotNull(matcher);
   60.54 +        assertTrue(matcher.search(0));
   60.55 +        assertEquals(matcher.getInput(), "foo");
   60.56 +        assertEquals(matcher.groupCount(), 1);
   60.57 +        assertEquals(matcher.group(), "foo");
   60.58 +        assertEquals(matcher.start(), 0);
   60.59 +        assertEquals(matcher.end(), 3);
   60.60 +        assertEquals(matcher.group(1), "o");
   60.61 +        assertEquals(matcher.start(1), 1);
   60.62 +        assertEquals(matcher.end(1), 2);
   60.63 +    }
   60.64 +}
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/test/src/jdk/nashorn/internal/runtime/regexp/joni/JoniTest.java	Fri May 17 16:12:59 2013 -0300
    61.3 @@ -0,0 +1,52 @@
    61.4 +/*
    61.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    61.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    61.7 + *
    61.8 + * This code is free software; you can redistribute it and/or modify it
    61.9 + * under the terms of the GNU General Public License version 2 only, as
   61.10 + * published by the Free Software Foundation.  Oracle designates this
   61.11 + * particular file as subject to the "Classpath" exception as provided
   61.12 + * by Oracle in the LICENSE file that accompanied this code.
   61.13 + *
   61.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   61.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   61.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   61.17 + * version 2 for more details (a copy is included in the LICENSE file that
   61.18 + * accompanied this code).
   61.19 + *
   61.20 + * You should have received a copy of the GNU General Public License version
   61.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   61.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   61.23 + *
   61.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   61.25 + * or visit www.oracle.com if you need additional information or have any
   61.26 + * questions.
   61.27 + */
   61.28 +
   61.29 +package jdk.nashorn.internal.runtime.regexp.joni;
   61.30 +
   61.31 +import static org.testng.Assert.assertEquals;
   61.32 +import static org.testng.Assert.assertTrue;
   61.33 +
   61.34 +import org.testng.annotations.Test;
   61.35 +
   61.36 +/**
   61.37 + * Joni coverage tests
   61.38 + *
   61.39 + * @test
   61.40 + * @run testng jdk.nashorn.internal.runtime.regexp.joni.JoniTest
   61.41 + */
   61.42 +public class JoniTest {
   61.43 +
   61.44 +    @Test
   61.45 +    public void testDump() {
   61.46 +        new Regex("^a{3,}(.*)[z]++\\s\\1x$").dumpTree();
   61.47 +        new Regex("^a{3,}(.*)[z]++\\s\\1x$").dumpByteCode();
   61.48 +        new Regex("(abc){4,}{2,5}").dumpTree();
   61.49 +        new Regex("(abc){4,}{2,5}").dumpByteCode();
   61.50 +        new Regex("aaa|aa|bbbb|ccc").dumpTree();
   61.51 +        new Regex("aaa|aa|bbbb|ccc").dumpByteCode();
   61.52 +        new Regex("(?:ZFVR.(\\d+\\.\\d+))|(?:(?:Sversbk|TenaCnenqvfb|Vprjrnfry).(\\d+\\.\\d+))|(?:Bcren.(\\d+\\.\\d+))|(?:NccyrJroXvg.(\\d+(?:\\.\\d+)?))").dumpTree();
   61.53 +        new Regex("(?:ZFVR.(\\d+\\.\\d+))|(?:(?:Sversbk|TenaCnenqvfb|Vprjrnfry).(\\d+\\.\\d+))|(?:Bcren.(\\d+\\.\\d+))|(?:NccyrJroXvg.(\\d+(?:\\.\\d+)?))").dumpByteCode();
   61.54 +    }
   61.55 +}

mercurial