changeset 2:da1e581c933b

8005403: Open-source Nashorn Reviewed-by: attila, hannesw, lagergren, sundar Contributed-by: james.laskey@oracle.com, akhil.arora@oracle.com, andreas.woess@jku.at, attila.szegedi@oracle.com, hannes.wallnoefer@oracle.com, henry.jen@oracle.com, marcus.lagergren@oracle.com, pavel.semenov@oracle.com, pavel.stepanov@oracle.com, petr.hejl@oracle.com, petr.pisl@oracle.com, sundararajan.athijegannathan@oracle.com
author jlaskey
date Fri, 21 Dec 2012 16:36:24 -0400
parents 6031a0bc0ae2
children b4b05457b8b2
files .hgignore ASSEMBLY_EXCEPTION LICENSE README RELEASE_README THIRD_PARTY_README bin/checkintest.sh bin/fixorphantests.sh bin/fixwhitespace.sh bin/jjs bin/jjs.bat bin/jjssecure bin/jjssecure.bat bin/nashorn bin/nashorn.bat bin/rm-non-tracked.sh bin/verbose_octane.bat bin/verbose_octane.sh buildtools/nasgen/README buildtools/nasgen/build.xml buildtools/nasgen/nasgen.iml buildtools/nasgen/project.properties buildtools/nasgen/src/META-INF/MANIFEST.MF buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/Main.java buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/NullVisitor.java buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/PrototypeGenerator.java buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfo.java buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfoCollector.java buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/StringConstants.java docs/DEVELOPER_README docs/genshelldoc.js make/Makefile make/build-benchmark.xml make/build-nasgen.xml make/build.xml make/nbproject/ide-file-targets.xml make/nbproject/ide-targets.xml make/nbproject/jdk.xml make/nbproject/nbjdk.properties make/nbproject/nbjdk.xml make/nbproject/project.xml make/project.properties samples/counters.js samples/letter.js samples/parser.js samples/shell.js samples/test.js samples/uniq.js src/META-INF/MANIFEST.MF src/META-INF/services/javax.script.ScriptEngineFactory src/jdk/nashorn/api/scripting/NashornException.java src/jdk/nashorn/api/scripting/NashornScriptEngine.java src/jdk/nashorn/api/scripting/NashornScriptEngineFactory.java src/jdk/nashorn/api/scripting/ScriptObjectMirror.java src/jdk/nashorn/api/scripting/package-info.java src/jdk/nashorn/api/scripting/resources/engine.js src/jdk/nashorn/internal/codegen/AccessSpecializer.java src/jdk/nashorn/internal/codegen/BranchOptimizer.java src/jdk/nashorn/internal/codegen/ClassEmitter.java src/jdk/nashorn/internal/codegen/CodeGenerator.java src/jdk/nashorn/internal/codegen/CompileUnit.java src/jdk/nashorn/internal/codegen/Compiler.java src/jdk/nashorn/internal/codegen/CompilerConstants.java src/jdk/nashorn/internal/codegen/ConstantData.java src/jdk/nashorn/internal/codegen/Emitter.java src/jdk/nashorn/internal/codegen/Frame.java src/jdk/nashorn/internal/codegen/FunctionSignature.java src/jdk/nashorn/internal/codegen/Lower.java src/jdk/nashorn/internal/codegen/MethodEmitter.java src/jdk/nashorn/internal/codegen/Namespace.java src/jdk/nashorn/internal/codegen/RuntimeCallSite.java src/jdk/nashorn/internal/codegen/SharedScopeCall.java src/jdk/nashorn/internal/codegen/Splitter.java src/jdk/nashorn/internal/codegen/Transform.java src/jdk/nashorn/internal/codegen/WeighNodes.java src/jdk/nashorn/internal/codegen/objects/FieldObjectCreator.java src/jdk/nashorn/internal/codegen/objects/FunctionObjectCreator.java src/jdk/nashorn/internal/codegen/objects/MapCreator.java src/jdk/nashorn/internal/codegen/objects/ObjectClassGenerator.java src/jdk/nashorn/internal/codegen/objects/ObjectCreator.java src/jdk/nashorn/internal/codegen/objects/ObjectMapCreator.java src/jdk/nashorn/internal/codegen/types/ArrayType.java src/jdk/nashorn/internal/codegen/types/BitwiseType.java src/jdk/nashorn/internal/codegen/types/BooleanType.java src/jdk/nashorn/internal/codegen/types/BytecodeArrayOps.java src/jdk/nashorn/internal/codegen/types/BytecodeBitwiseOps.java src/jdk/nashorn/internal/codegen/types/BytecodeNumericOps.java src/jdk/nashorn/internal/codegen/types/BytecodeOps.java src/jdk/nashorn/internal/codegen/types/IntType.java src/jdk/nashorn/internal/codegen/types/LongType.java src/jdk/nashorn/internal/codegen/types/NumberType.java src/jdk/nashorn/internal/codegen/types/NumericType.java src/jdk/nashorn/internal/codegen/types/ObjectType.java src/jdk/nashorn/internal/codegen/types/Type.java src/jdk/nashorn/internal/ir/AccessNode.java src/jdk/nashorn/internal/ir/Assignment.java src/jdk/nashorn/internal/ir/BaseNode.java src/jdk/nashorn/internal/ir/BinaryNode.java src/jdk/nashorn/internal/ir/Block.java src/jdk/nashorn/internal/ir/BreakNode.java src/jdk/nashorn/internal/ir/BreakableNode.java src/jdk/nashorn/internal/ir/CallNode.java src/jdk/nashorn/internal/ir/CaseNode.java src/jdk/nashorn/internal/ir/CatchNode.java src/jdk/nashorn/internal/ir/ContinueNode.java src/jdk/nashorn/internal/ir/DoWhileNode.java src/jdk/nashorn/internal/ir/EmptyNode.java src/jdk/nashorn/internal/ir/ExecuteNode.java src/jdk/nashorn/internal/ir/ForNode.java src/jdk/nashorn/internal/ir/FunctionCall.java src/jdk/nashorn/internal/ir/FunctionNode.java src/jdk/nashorn/internal/ir/IdentNode.java src/jdk/nashorn/internal/ir/IfNode.java src/jdk/nashorn/internal/ir/IndexNode.java src/jdk/nashorn/internal/ir/LabelNode.java src/jdk/nashorn/internal/ir/LabeledNode.java src/jdk/nashorn/internal/ir/LineNumberNode.java src/jdk/nashorn/internal/ir/LiteralNode.java src/jdk/nashorn/internal/ir/Location.java src/jdk/nashorn/internal/ir/Node.java src/jdk/nashorn/internal/ir/ObjectNode.java src/jdk/nashorn/internal/ir/PropertyKey.java src/jdk/nashorn/internal/ir/PropertyNode.java src/jdk/nashorn/internal/ir/ReferenceNode.java src/jdk/nashorn/internal/ir/ReturnNode.java src/jdk/nashorn/internal/ir/RuntimeNode.java src/jdk/nashorn/internal/ir/SplitNode.java src/jdk/nashorn/internal/ir/SwitchNode.java src/jdk/nashorn/internal/ir/Symbol.java src/jdk/nashorn/internal/ir/TernaryNode.java src/jdk/nashorn/internal/ir/ThrowNode.java src/jdk/nashorn/internal/ir/TryNode.java src/jdk/nashorn/internal/ir/TypeOverride.java src/jdk/nashorn/internal/ir/UnaryNode.java src/jdk/nashorn/internal/ir/VarNode.java src/jdk/nashorn/internal/ir/WhileNode.java src/jdk/nashorn/internal/ir/WithNode.java src/jdk/nashorn/internal/ir/annotations/ChildNode.java src/jdk/nashorn/internal/ir/annotations/Ignore.java src/jdk/nashorn/internal/ir/annotations/ParentNode.java src/jdk/nashorn/internal/ir/annotations/Reference.java src/jdk/nashorn/internal/ir/debug/ASTWriter.java src/jdk/nashorn/internal/ir/debug/JSONWriter.java src/jdk/nashorn/internal/ir/debug/PrintVisitor.java src/jdk/nashorn/internal/ir/visitor/NodeOperatorVisitor.java src/jdk/nashorn/internal/ir/visitor/NodeVisitor.java src/jdk/nashorn/internal/objects/AccessorPropertyDescriptor.java src/jdk/nashorn/internal/objects/ArrayBufferView.java src/jdk/nashorn/internal/objects/DataPropertyDescriptor.java src/jdk/nashorn/internal/objects/DateParser.java src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java src/jdk/nashorn/internal/objects/Global.java src/jdk/nashorn/internal/objects/NativeArguments.java src/jdk/nashorn/internal/objects/NativeArray.java src/jdk/nashorn/internal/objects/NativeArrayBuffer.java src/jdk/nashorn/internal/objects/NativeBoolean.java src/jdk/nashorn/internal/objects/NativeDate.java src/jdk/nashorn/internal/objects/NativeDebug.java src/jdk/nashorn/internal/objects/NativeError.java src/jdk/nashorn/internal/objects/NativeEvalError.java src/jdk/nashorn/internal/objects/NativeFloat32Array.java src/jdk/nashorn/internal/objects/NativeFloat64Array.java src/jdk/nashorn/internal/objects/NativeFunction.java src/jdk/nashorn/internal/objects/NativeInt16Array.java src/jdk/nashorn/internal/objects/NativeInt32Array.java src/jdk/nashorn/internal/objects/NativeInt8Array.java src/jdk/nashorn/internal/objects/NativeJSAdapter.java src/jdk/nashorn/internal/objects/NativeJSON.java src/jdk/nashorn/internal/objects/NativeJava.java src/jdk/nashorn/internal/objects/NativeJavaImporter.java src/jdk/nashorn/internal/objects/NativeMath.java src/jdk/nashorn/internal/objects/NativeNumber.java src/jdk/nashorn/internal/objects/NativeObject.java src/jdk/nashorn/internal/objects/NativeRangeError.java src/jdk/nashorn/internal/objects/NativeReferenceError.java src/jdk/nashorn/internal/objects/NativeRegExp.java src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java src/jdk/nashorn/internal/objects/NativeStrictArguments.java src/jdk/nashorn/internal/objects/NativeString.java src/jdk/nashorn/internal/objects/NativeSyntaxError.java src/jdk/nashorn/internal/objects/NativeTypeError.java src/jdk/nashorn/internal/objects/NativeURIError.java src/jdk/nashorn/internal/objects/NativeUint16Array.java src/jdk/nashorn/internal/objects/NativeUint32Array.java src/jdk/nashorn/internal/objects/NativeUint8Array.java src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java src/jdk/nashorn/internal/objects/PrototypeObject.java src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java src/jdk/nashorn/internal/objects/annotations/Attribute.java src/jdk/nashorn/internal/objects/annotations/Constructor.java src/jdk/nashorn/internal/objects/annotations/Function.java src/jdk/nashorn/internal/objects/annotations/Getter.java src/jdk/nashorn/internal/objects/annotations/Property.java src/jdk/nashorn/internal/objects/annotations/ScriptClass.java src/jdk/nashorn/internal/objects/annotations/Setter.java src/jdk/nashorn/internal/objects/annotations/SpecializedConstructor.java src/jdk/nashorn/internal/objects/annotations/SpecializedFunction.java src/jdk/nashorn/internal/objects/annotations/Where.java src/jdk/nashorn/internal/objects/package-info.java src/jdk/nashorn/internal/parser/AbstractParser.java src/jdk/nashorn/internal/parser/JSONParser.java src/jdk/nashorn/internal/parser/Lexer.java src/jdk/nashorn/internal/parser/Parser.java src/jdk/nashorn/internal/parser/RegExp.java src/jdk/nashorn/internal/parser/RegExpScanner.java src/jdk/nashorn/internal/parser/Scanner.java src/jdk/nashorn/internal/parser/Token.java src/jdk/nashorn/internal/parser/TokenKind.java src/jdk/nashorn/internal/parser/TokenLookup.java src/jdk/nashorn/internal/parser/TokenStream.java src/jdk/nashorn/internal/parser/TokenType.java src/jdk/nashorn/internal/runtime/AccessorProperty.java src/jdk/nashorn/internal/runtime/BitVector.java src/jdk/nashorn/internal/runtime/CodeInstaller.java src/jdk/nashorn/internal/runtime/ConsString.java src/jdk/nashorn/internal/runtime/Context.java src/jdk/nashorn/internal/runtime/Debug.java src/jdk/nashorn/internal/runtime/DebugLogger.java src/jdk/nashorn/internal/runtime/DefaultPropertyAccess.java src/jdk/nashorn/internal/runtime/ECMAErrors.java src/jdk/nashorn/internal/runtime/ECMAException.java src/jdk/nashorn/internal/runtime/ErrorManager.java src/jdk/nashorn/internal/runtime/FindProperty.java src/jdk/nashorn/internal/runtime/FunctionScope.java src/jdk/nashorn/internal/runtime/GlobalFunctions.java src/jdk/nashorn/internal/runtime/GlobalObject.java src/jdk/nashorn/internal/runtime/JSErrorType.java src/jdk/nashorn/internal/runtime/JSType.java src/jdk/nashorn/internal/runtime/Logging.java src/jdk/nashorn/internal/runtime/NashornLoader.java src/jdk/nashorn/internal/runtime/NativeJavaPackage.java src/jdk/nashorn/internal/runtime/NumberToString.java src/jdk/nashorn/internal/runtime/ParserException.java src/jdk/nashorn/internal/runtime/Property.java src/jdk/nashorn/internal/runtime/PropertyAccess.java src/jdk/nashorn/internal/runtime/PropertyDescriptor.java src/jdk/nashorn/internal/runtime/PropertyHashMap.java src/jdk/nashorn/internal/runtime/PropertyListener.java src/jdk/nashorn/internal/runtime/PropertyListenerManager.java src/jdk/nashorn/internal/runtime/PropertyMap.java src/jdk/nashorn/internal/runtime/QuotedStringTokenizer.java src/jdk/nashorn/internal/runtime/RegExpMatch.java src/jdk/nashorn/internal/runtime/Scope.java src/jdk/nashorn/internal/runtime/ScriptFunction.java src/jdk/nashorn/internal/runtime/ScriptLoader.java src/jdk/nashorn/internal/runtime/ScriptObject.java src/jdk/nashorn/internal/runtime/ScriptRuntime.java src/jdk/nashorn/internal/runtime/ScriptingFunctions.java src/jdk/nashorn/internal/runtime/Source.java src/jdk/nashorn/internal/runtime/SpillProperty.java src/jdk/nashorn/internal/runtime/StructureLoader.java src/jdk/nashorn/internal/runtime/URIUtils.java src/jdk/nashorn/internal/runtime/Undefined.java src/jdk/nashorn/internal/runtime/UserAccessorProperty.java src/jdk/nashorn/internal/runtime/Version.java src/jdk/nashorn/internal/runtime/WithObject.java src/jdk/nashorn/internal/runtime/arrays/ArrayData.java src/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java src/jdk/nashorn/internal/runtime/arrays/ArrayIndex.java src/jdk/nashorn/internal/runtime/arrays/ArrayIterator.java src/jdk/nashorn/internal/runtime/arrays/ArrayLikeIterator.java src/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java src/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java src/jdk/nashorn/internal/runtime/arrays/EmptyArrayLikeIterator.java src/jdk/nashorn/internal/runtime/arrays/FrozenArrayFilter.java src/jdk/nashorn/internal/runtime/arrays/IntArrayData.java src/jdk/nashorn/internal/runtime/arrays/InvalidArrayIndexException.java src/jdk/nashorn/internal/runtime/arrays/IteratorAction.java src/jdk/nashorn/internal/runtime/arrays/LongArrayData.java src/jdk/nashorn/internal/runtime/arrays/MapIterator.java src/jdk/nashorn/internal/runtime/arrays/NoTypeArrayData.java src/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java src/jdk/nashorn/internal/runtime/arrays/ReverseArrayIterator.java src/jdk/nashorn/internal/runtime/arrays/ReverseMapIterator.java src/jdk/nashorn/internal/runtime/arrays/SealedArrayFilter.java src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java src/jdk/nashorn/internal/runtime/arrays/UndefinedArrayFilter.java src/jdk/nashorn/internal/runtime/linker/Bootstrap.java src/jdk/nashorn/internal/runtime/linker/InvokeByName.java src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java src/jdk/nashorn/internal/runtime/linker/JavaArgumentConverters.java src/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java src/jdk/nashorn/internal/runtime/linker/Lookup.java src/jdk/nashorn/internal/runtime/linker/Mangler.java src/jdk/nashorn/internal/runtime/linker/MethodHandleFactory.java src/jdk/nashorn/internal/runtime/linker/MethodHandleFunctionality.java src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java src/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java src/jdk/nashorn/internal/runtime/linker/NashornGuardedInvocation.java src/jdk/nashorn/internal/runtime/linker/NashornGuards.java src/jdk/nashorn/internal/runtime/linker/NashornLinker.java src/jdk/nashorn/internal/runtime/linker/NashornPrimitiveLinker.java src/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java src/jdk/nashorn/internal/runtime/options/KeyValueOption.java src/jdk/nashorn/internal/runtime/options/Option.java src/jdk/nashorn/internal/runtime/options/OptionTemplate.java src/jdk/nashorn/internal/runtime/options/Options.java src/jdk/nashorn/internal/runtime/options/ValueOption.java src/jdk/nashorn/internal/runtime/resources/Messages.properties src/jdk/nashorn/internal/runtime/resources/Options.properties src/jdk/nashorn/internal/runtime/resources/mozilla_compat.js src/jdk/nashorn/internal/runtime/resources/parser.js src/jdk/nashorn/internal/runtime/resources/version.properties-template src/jdk/nashorn/internal/scripts/JO$.java src/jdk/nashorn/internal/scripts/JS$.java src/jdk/nashorn/tools/Shell.java src/jdk/nashorn/tools/resources/Shell.properties src/jdk/nashorn/tools/resources/shell.js src/netscape/javascript/JSObject.java src/overview.html test/README test/examples/dual-fields-micro.js test/examples/innerbench.js test/examples/typechain.js test/lib/benchmark.js test/opt/add.js test/opt/add_constant.js test/opt/add_reuse_callsite.js test/opt/add_revert2.js test/opt/cascade_specialize.js test/script/assert.js test/script/basic/NASHORN-100.js test/script/basic/NASHORN-100.js.EXPECTED test/script/basic/NASHORN-101.js test/script/basic/NASHORN-101.js.EXPECTED test/script/basic/NASHORN-102.js test/script/basic/NASHORN-102.js.EXPECTED test/script/basic/NASHORN-103.js test/script/basic/NASHORN-104.js test/script/basic/NASHORN-104.js.EXPECTED test/script/basic/NASHORN-105.js test/script/basic/NASHORN-105.js.EXPECTED test/script/basic/NASHORN-106.js test/script/basic/NASHORN-106.js.EXPECTED test/script/basic/NASHORN-107.js test/script/basic/NASHORN-108.js test/script/basic/NASHORN-108.js.EXPECTED test/script/basic/NASHORN-109.js test/script/basic/NASHORN-109.js.EXPECTED test/script/basic/NASHORN-11.js test/script/basic/NASHORN-11.js.EXPECTED test/script/basic/NASHORN-111.js test/script/basic/NASHORN-111.js.EXPECTED test/script/basic/NASHORN-113.js test/script/basic/NASHORN-113.js.EXPECTED test/script/basic/NASHORN-114.js test/script/basic/NASHORN-115.js test/script/basic/NASHORN-115.js.EXPECTED test/script/basic/NASHORN-117.js test/script/basic/NASHORN-118.js test/script/basic/NASHORN-118.js.EXPECTED test/script/basic/NASHORN-119.js test/script/basic/NASHORN-119.js.EXPECTED test/script/basic/NASHORN-12.js test/script/basic/NASHORN-120.js test/script/basic/NASHORN-122.js test/script/basic/NASHORN-122.js.EXPECTED test/script/basic/NASHORN-126.js test/script/basic/NASHORN-126.js.EXPECTED test/script/basic/NASHORN-127.js test/script/basic/NASHORN-127.js.EXPECTED test/script/basic/NASHORN-130.js test/script/basic/NASHORN-132.js test/script/basic/NASHORN-132.js.EXPECTED test/script/basic/NASHORN-133.js test/script/basic/NASHORN-133.js.EXPECTED test/script/basic/NASHORN-135.js test/script/basic/NASHORN-136.js test/script/basic/NASHORN-136.js.EXPECTED test/script/basic/NASHORN-14.js test/script/basic/NASHORN-14.js.EXPECTED test/script/basic/NASHORN-148.js test/script/basic/NASHORN-148.js.EXPECTED test/script/basic/NASHORN-15.js test/script/basic/NASHORN-15.js.EXPECTED test/script/basic/NASHORN-153.js test/script/basic/NASHORN-156.js test/script/basic/NASHORN-157.js test/script/basic/NASHORN-163.js test/script/basic/NASHORN-163.js.EXPECTED test/script/basic/NASHORN-164.js test/script/basic/NASHORN-165.js test/script/basic/NASHORN-166.js test/script/basic/NASHORN-168.js test/script/basic/NASHORN-168.js.EXPECTED test/script/basic/NASHORN-169.js test/script/basic/NASHORN-172.js test/script/basic/NASHORN-173.js test/script/basic/NASHORN-173.js.EXPECTED test/script/basic/NASHORN-174.js test/script/basic/NASHORN-175.js test/script/basic/NASHORN-176.js test/script/basic/NASHORN-177.js test/script/basic/NASHORN-177.js.EXPECTED test/script/basic/NASHORN-178.js test/script/basic/NASHORN-178.js.EXPECTED test/script/basic/NASHORN-179.js test/script/basic/NASHORN-18.js test/script/basic/NASHORN-18.js.EXPECTED test/script/basic/NASHORN-181.js test/script/basic/NASHORN-182.js test/script/basic/NASHORN-183.js test/script/basic/NASHORN-184.js test/script/basic/NASHORN-184.js.EXPECTED test/script/basic/NASHORN-185.js test/script/basic/NASHORN-185.js.EXPECTED test/script/basic/NASHORN-187.js test/script/basic/NASHORN-188.js test/script/basic/NASHORN-188.js.EXPECTED test/script/basic/NASHORN-19.js test/script/basic/NASHORN-19.js.EXPECTED test/script/basic/NASHORN-190.js test/script/basic/NASHORN-192.js test/script/basic/NASHORN-194.js test/script/basic/NASHORN-196.js test/script/basic/NASHORN-198.js test/script/basic/NASHORN-20.js test/script/basic/NASHORN-20.js.EXPECTED test/script/basic/NASHORN-201.js test/script/basic/NASHORN-202.js test/script/basic/NASHORN-203.js test/script/basic/NASHORN-204.js test/script/basic/NASHORN-205.js test/script/basic/NASHORN-206.js test/script/basic/NASHORN-207.js test/script/basic/NASHORN-207_2.js test/script/basic/NASHORN-208.js test/script/basic/NASHORN-208.js.EXPECTED test/script/basic/NASHORN-209.js test/script/basic/NASHORN-209.js.EXPECTED test/script/basic/NASHORN-21.js test/script/basic/NASHORN-21.js.EXPECTED test/script/basic/NASHORN-211.js test/script/basic/NASHORN-212.js test/script/basic/NASHORN-213.js test/script/basic/NASHORN-215.js test/script/basic/NASHORN-215.js.EXPECTED test/script/basic/NASHORN-216.js test/script/basic/NASHORN-217.js test/script/basic/NASHORN-217.js.EXPECTED test/script/basic/NASHORN-219.js test/script/basic/NASHORN-219.js.EXPECTED test/script/basic/NASHORN-22.js test/script/basic/NASHORN-22.js.EXPECTED test/script/basic/NASHORN-221.js test/script/basic/NASHORN-222.js test/script/basic/NASHORN-223.js test/script/basic/NASHORN-225.js test/script/basic/NASHORN-226.js test/script/basic/NASHORN-227.js test/script/basic/NASHORN-228.js test/script/basic/NASHORN-229.js test/script/basic/NASHORN-229_subtest.js test/script/basic/NASHORN-23.js test/script/basic/NASHORN-23.js.EXPECTED test/script/basic/NASHORN-232.js test/script/basic/NASHORN-234.js test/script/basic/NASHORN-235.js test/script/basic/NASHORN-236.js test/script/basic/NASHORN-237.js test/script/basic/NASHORN-239.js test/script/basic/NASHORN-24.js test/script/basic/NASHORN-24.js.EXPECTED test/script/basic/NASHORN-241.js test/script/basic/NASHORN-242.js test/script/basic/NASHORN-245.js test/script/basic/NASHORN-247.js test/script/basic/NASHORN-25.js test/script/basic/NASHORN-25.js.EXPECTED test/script/basic/NASHORN-251.js test/script/basic/NASHORN-252.js test/script/basic/NASHORN-253.js test/script/basic/NASHORN-256.js test/script/basic/NASHORN-258.js test/script/basic/NASHORN-258.js.EXPECTED test/script/basic/NASHORN-26.js test/script/basic/NASHORN-26.js.EXPECTED test/script/basic/NASHORN-260.js test/script/basic/NASHORN-261.js test/script/basic/NASHORN-262.js test/script/basic/NASHORN-263.js test/script/basic/NASHORN-264.js test/script/basic/NASHORN-265.js test/script/basic/NASHORN-265.js.EXPECTED test/script/basic/NASHORN-266.js test/script/basic/NASHORN-269.js test/script/basic/NASHORN-27.js test/script/basic/NASHORN-27.js.EXPECTED test/script/basic/NASHORN-270.js test/script/basic/NASHORN-271.js test/script/basic/NASHORN-275.js test/script/basic/NASHORN-276.js test/script/basic/NASHORN-277.js test/script/basic/NASHORN-278.js test/script/basic/NASHORN-28.js test/script/basic/NASHORN-28.js.EXPECTED test/script/basic/NASHORN-281.js test/script/basic/NASHORN-284.js test/script/basic/NASHORN-284.js.EXPECTED test/script/basic/NASHORN-285.js test/script/basic/NASHORN-285.js.EXPECTED test/script/basic/NASHORN-288.js test/script/basic/NASHORN-29.js test/script/basic/NASHORN-29.js.EXPECTED test/script/basic/NASHORN-293.js test/script/basic/NASHORN-293.js.EXPECTED test/script/basic/NASHORN-294.js test/script/basic/NASHORN-296.js test/script/basic/NASHORN-297.js test/script/basic/NASHORN-30.js test/script/basic/NASHORN-30.js.EXPECTED test/script/basic/NASHORN-300.js test/script/basic/NASHORN-301.js test/script/basic/NASHORN-301.js.EXPECTED test/script/basic/NASHORN-304.js test/script/basic/NASHORN-310.js test/script/basic/NASHORN-310.js.EXPECTED test/script/basic/NASHORN-318.js test/script/basic/NASHORN-318.js.EXPECTED test/script/basic/NASHORN-32.js test/script/basic/NASHORN-32.js.EXPECTED test/script/basic/NASHORN-321.js test/script/basic/NASHORN-321.js.EXPECTED test/script/basic/NASHORN-323.js test/script/basic/NASHORN-323.js.EXPECTED test/script/basic/NASHORN-324.js test/script/basic/NASHORN-33.js test/script/basic/NASHORN-33.js.EXPECTED test/script/basic/NASHORN-331.js test/script/basic/NASHORN-331.js.EXPECTED test/script/basic/NASHORN-337.js test/script/basic/NASHORN-337.js.EXPECTED test/script/basic/NASHORN-34.js test/script/basic/NASHORN-34.js.EXPECTED test/script/basic/NASHORN-340.js test/script/basic/NASHORN-340.js.EXPECTED test/script/basic/NASHORN-349.js test/script/basic/NASHORN-354.js test/script/basic/NASHORN-354.js.EXPECTED test/script/basic/NASHORN-355.js test/script/basic/NASHORN-355.js.EXPECTED test/script/basic/NASHORN-36.js test/script/basic/NASHORN-36.js.EXPECTED test/script/basic/NASHORN-365.js test/script/basic/NASHORN-366.js test/script/basic/NASHORN-366.js.EXPECTED test/script/basic/NASHORN-368.js test/script/basic/NASHORN-368.js.EXPECTED test/script/basic/NASHORN-37.js test/script/basic/NASHORN-37.js.EXPECTED test/script/basic/NASHORN-375.js test/script/basic/NASHORN-376.js test/script/basic/NASHORN-377.js test/script/basic/NASHORN-377.js.EXPECTED test/script/basic/NASHORN-378.js test/script/basic/NASHORN-38.js test/script/basic/NASHORN-38.js.EXPECTED test/script/basic/NASHORN-380.js test/script/basic/NASHORN-380.js.EXPECTED test/script/basic/NASHORN-381.js test/script/basic/NASHORN-382.js test/script/basic/NASHORN-383.js test/script/basic/NASHORN-384.js test/script/basic/NASHORN-384.js.EXPECTED test/script/basic/NASHORN-385.js test/script/basic/NASHORN-385.js.EXPECTED test/script/basic/NASHORN-389.js test/script/basic/NASHORN-389.js.EXPECTED test/script/basic/NASHORN-393.js test/script/basic/NASHORN-393.js.EXPECTED test/script/basic/NASHORN-394.js test/script/basic/NASHORN-394.js.EXPECTED test/script/basic/NASHORN-396.js test/script/basic/NASHORN-397.js test/script/basic/NASHORN-398.js test/script/basic/NASHORN-40.js test/script/basic/NASHORN-40.js.EXPECTED test/script/basic/NASHORN-400.js test/script/basic/NASHORN-400.js.EXPECTED test/script/basic/NASHORN-401.js test/script/basic/NASHORN-401.js.EXPECTED test/script/basic/NASHORN-402.js test/script/basic/NASHORN-402.js.EXPECTED test/script/basic/NASHORN-404.js test/script/basic/NASHORN-405.js test/script/basic/NASHORN-405.js.EXPECTED test/script/basic/NASHORN-406.js test/script/basic/NASHORN-408.js test/script/basic/NASHORN-408.js.EXPECTED test/script/basic/NASHORN-415.js test/script/basic/NASHORN-415.js.EXPECTED test/script/basic/NASHORN-416.js test/script/basic/NASHORN-417.js test/script/basic/NASHORN-418.js test/script/basic/NASHORN-420.js test/script/basic/NASHORN-421.js test/script/basic/NASHORN-423.js test/script/basic/NASHORN-423.js.EXPECTED test/script/basic/NASHORN-423a.js test/script/basic/NASHORN-424.js test/script/basic/NASHORN-424.js.EXPECTED test/script/basic/NASHORN-425.js test/script/basic/NASHORN-425.js.EXPECTED test/script/basic/NASHORN-426.js test/script/basic/NASHORN-427.js test/script/basic/NASHORN-428.js test/script/basic/NASHORN-429.js test/script/basic/NASHORN-432.js test/script/basic/NASHORN-433.js test/script/basic/NASHORN-434.js test/script/basic/NASHORN-435.js test/script/basic/NASHORN-437.js test/script/basic/NASHORN-44.js test/script/basic/NASHORN-44.js.EXPECTED test/script/basic/NASHORN-441.js test/script/basic/NASHORN-441.js.EXPECTED test/script/basic/NASHORN-442.js test/script/basic/NASHORN-443.js test/script/basic/NASHORN-444.js test/script/basic/NASHORN-444.js.EXPECTED test/script/basic/NASHORN-445.js test/script/basic/NASHORN-446.js test/script/basic/NASHORN-447.js test/script/basic/NASHORN-448.js test/script/basic/NASHORN-449.js test/script/basic/NASHORN-449.js.EXPECTED test/script/basic/NASHORN-45.js test/script/basic/NASHORN-45.js.EXPECTED test/script/basic/NASHORN-450.js test/script/basic/NASHORN-452.js test/script/basic/NASHORN-459.js test/script/basic/NASHORN-46.js test/script/basic/NASHORN-46.js.EXPECTED test/script/basic/NASHORN-462.js test/script/basic/NASHORN-463.js test/script/basic/NASHORN-468.js test/script/basic/NASHORN-47.js test/script/basic/NASHORN-473.js test/script/basic/NASHORN-473.js.EXPECTED test/script/basic/NASHORN-474.js test/script/basic/NASHORN-474.js.EXPECTED test/script/basic/NASHORN-478.js test/script/basic/NASHORN-48.js test/script/basic/NASHORN-48.js.EXPECTED test/script/basic/NASHORN-481.js test/script/basic/NASHORN-481.js.EXPECTED test/script/basic/NASHORN-482.js test/script/basic/NASHORN-484.js test/script/basic/NASHORN-484.js.EXPECTED test/script/basic/NASHORN-486.js test/script/basic/NASHORN-487.js test/script/basic/NASHORN-488.js test/script/basic/NASHORN-49.js test/script/basic/NASHORN-49.js.EXPECTED test/script/basic/NASHORN-490.js test/script/basic/NASHORN-494.js test/script/basic/NASHORN-497.js test/script/basic/NASHORN-498.js test/script/basic/NASHORN-499.js test/script/basic/NASHORN-50.js test/script/basic/NASHORN-50.js.EXPECTED test/script/basic/NASHORN-500.js test/script/basic/NASHORN-503.js test/script/basic/NASHORN-503.js.EXPECTED test/script/basic/NASHORN-51.js test/script/basic/NASHORN-51.js.EXPECTED test/script/basic/NASHORN-511.js test/script/basic/NASHORN-515.js test/script/basic/NASHORN-515.js.EXPECTED test/script/basic/NASHORN-516.js test/script/basic/NASHORN-52.js test/script/basic/NASHORN-534.js test/script/basic/NASHORN-534.js.EXPECTED test/script/basic/NASHORN-535.js test/script/basic/NASHORN-535.js.EXPECTED test/script/basic/NASHORN-544.js test/script/basic/NASHORN-55.js test/script/basic/NASHORN-554.js test/script/basic/NASHORN-554.js.EXPECTED test/script/basic/NASHORN-556.js test/script/basic/NASHORN-556.js.EXPECTED test/script/basic/NASHORN-56.js test/script/basic/NASHORN-56.js.EXPECTED test/script/basic/NASHORN-562.js test/script/basic/NASHORN-565.js test/script/basic/NASHORN-565.js.EXPECTED test/script/basic/NASHORN-575.js test/script/basic/NASHORN-575.js.EXPECTED test/script/basic/NASHORN-58.js test/script/basic/NASHORN-58.js.EXPECTED test/script/basic/NASHORN-59.js test/script/basic/NASHORN-59.js.EXPECTED test/script/basic/NASHORN-592.js test/script/basic/NASHORN-592.js.EXPECTED test/script/basic/NASHORN-597.js test/script/basic/NASHORN-597.js.EXPECTED test/script/basic/NASHORN-60.js test/script/basic/NASHORN-60.js.EXPECTED test/script/basic/NASHORN-609.js test/script/basic/NASHORN-609.js.EXPECTED test/script/basic/NASHORN-61.js test/script/basic/NASHORN-61.js.EXPECTED test/script/basic/NASHORN-62.js test/script/basic/NASHORN-62.js.EXPECTED test/script/basic/NASHORN-620.js test/script/basic/NASHORN-620.js.EXPECTED test/script/basic/NASHORN-623.js test/script/basic/NASHORN-623.js.EXPECTED test/script/basic/NASHORN-627.js test/script/basic/NASHORN-627.js.EXPECTED test/script/basic/NASHORN-63.js test/script/basic/NASHORN-631.js.EXPECTED test/script/basic/NASHORN-637.js test/script/basic/NASHORN-637.js.EXPECTED test/script/basic/NASHORN-638.js test/script/basic/NASHORN-638.js.EXPECTED test/script/basic/NASHORN-639.js test/script/basic/NASHORN-64.js test/script/basic/NASHORN-642.js test/script/basic/NASHORN-642.js.EXPECTED test/script/basic/NASHORN-646.js test/script/basic/NASHORN-653.js test/script/basic/NASHORN-658.js test/script/basic/NASHORN-659.js test/script/basic/NASHORN-66.js test/script/basic/NASHORN-66.js.EXPECTED test/script/basic/NASHORN-664.js test/script/basic/NASHORN-665.js test/script/basic/NASHORN-67.js test/script/basic/NASHORN-67.js.EXPECTED test/script/basic/NASHORN-678.js test/script/basic/NASHORN-68.js test/script/basic/NASHORN-68.js.EXPECTED test/script/basic/NASHORN-689.js test/script/basic/NASHORN-689.js.EXPECTED test/script/basic/NASHORN-69.js test/script/basic/NASHORN-69.js.EXPECTED test/script/basic/NASHORN-691.js test/script/basic/NASHORN-691.js.EXPECTED test/script/basic/NASHORN-694.js test/script/basic/NASHORN-694.js.EXPECTED test/script/basic/NASHORN-697.js test/script/basic/NASHORN-703.js test/script/basic/NASHORN-703.js.EXPECTED test/script/basic/NASHORN-703a.js test/script/basic/NASHORN-703a.js.EXPECTED test/script/basic/NASHORN-705.js test/script/basic/NASHORN-71.js test/script/basic/NASHORN-71.js.EXPECTED test/script/basic/NASHORN-710.js test/script/basic/NASHORN-711.js test/script/basic/NASHORN-711.js.EXPECTED test/script/basic/NASHORN-72.js test/script/basic/NASHORN-72.js.EXPECTED test/script/basic/NASHORN-722.js test/script/basic/NASHORN-73.js test/script/basic/NASHORN-73.js.EXPECTED test/script/basic/NASHORN-737.js test/script/basic/NASHORN-737.js.EXPECTED test/script/basic/NASHORN-74.js test/script/basic/NASHORN-74.js.EXPECTED test/script/basic/NASHORN-740.js test/script/basic/NASHORN-740.js.EXPECTED test/script/basic/NASHORN-75.js test/script/basic/NASHORN-75.js.EXPECTED test/script/basic/NASHORN-758.js test/script/basic/NASHORN-759.js test/script/basic/NASHORN-759.js.EXPECTED test/script/basic/NASHORN-760.js test/script/basic/NASHORN-768.js test/script/basic/NASHORN-778.js test/script/basic/NASHORN-78.js test/script/basic/NASHORN-79.js test/script/basic/NASHORN-79.js.EXPECTED test/script/basic/NASHORN-792.js test/script/basic/NASHORN-792.js.EXPECTED test/script/basic/NASHORN-80.js test/script/basic/NASHORN-80.js.EXPECTED test/script/basic/NASHORN-81.js test/script/basic/NASHORN-833.js test/script/basic/NASHORN-833.js.EXPECTED test/script/basic/NASHORN-85.js test/script/basic/NASHORN-85.js.EXPECTED test/script/basic/NASHORN-86.js test/script/basic/NASHORN-87.js test/script/basic/NASHORN-89.js test/script/basic/NASHORN-90.js test/script/basic/NASHORN-90.js.EXPECTED test/script/basic/NASHORN-91.js test/script/basic/NASHORN-91.js.EXPECTED test/script/basic/NASHORN-92.js test/script/basic/NASHORN-92.js.EXPECTED test/script/basic/NASHORN-93.js test/script/basic/NASHORN-95.js test/script/basic/NASHORN-95.js.EXPECTED test/script/basic/NASHORN-96.js test/script/basic/NASHORN-96.js.EXPECTED test/script/basic/NASHORN-97.js test/script/basic/NASHORN-98.js test/script/basic/NASHORN-98.js.EXPECTED test/script/basic/NASHORN-99.js test/script/basic/addition.js test/script/basic/addition.js.EXPECTED test/script/basic/allgettersetters.js test/script/basic/andor.js test/script/basic/andor.js.EXPECTED test/script/basic/anonrecur.js test/script/basic/anonrecur.js.EXPECTED test/script/basic/applycall.js test/script/basic/applycall.js.EXPECTED test/script/basic/args.js test/script/basic/args.js.EXPECTED test/script/basic/arity.js test/script/basic/arity.js.EXPECTED test/script/basic/arrayprotoclass.js test/script/basic/arrayprotoclass.js.EXPECTED test/script/basic/arrays.js test/script/basic/arrays.js.EXPECTED test/script/basic/arrays2.js test/script/basic/arrays2.js.EXPECTED test/script/basic/arraysIntKey.js test/script/basic/arraysIntKey.js.EXPECTED test/script/basic/arrayset.js test/script/basic/arrayset.js.EXPECTED test/script/basic/arrayundefined.js test/script/basic/arrayundefined.js.EXPECTED test/script/basic/assign.js test/script/basic/assign.js.EXPECTED test/script/basic/bitwise_and.js test/script/basic/bitwise_and.js.EXPECTED test/script/basic/booleangetter.js test/script/basic/booleangetter.js.EXPECTED test/script/basic/builtin.js test/script/basic/builtin.js.EXPECTED test/script/basic/builtin_assign.js test/script/basic/builtin_assign.js.EXPECTED test/script/basic/builtinchain.js test/script/basic/builtinchain.js.EXPECTED test/script/basic/calllink.js test/script/basic/calllink.js.EXPECTED test/script/basic/closure.js test/script/basic/closure.js.EXPECTED test/script/basic/commandargs.js test/script/basic/commandargs.js.EXPECTED test/script/basic/compile-octane.js test/script/basic/compile-octane.js.EXPECTED test/script/basic/condassign.js test/script/basic/condassign.js.EXPECTED test/script/basic/construct.js test/script/basic/construct.js.EXPECTED test/script/basic/constructorname.js test/script/basic/constructorname.js.EXPECTED test/script/basic/date.js test/script/basic/date.js.EXPECTED test/script/basic/dateparse.js test/script/basic/dateparse.js.EXPECTED test/script/basic/decinc.js test/script/basic/decinc.js.EXPECTED test/script/basic/delete.js test/script/basic/delete.js.EXPECTED test/script/basic/delete2.js test/script/basic/delete2.js.EXPECTED test/script/basic/dotpropname.js test/script/basic/dotpropname.js.EXPECTED test/script/basic/doublecache.js test/script/basic/doublecache.js.EXPECTED test/script/basic/enumeration.js test/script/basic/enumeration.js.EXPECTED test/script/basic/errors.js test/script/basic/errors.js.EXPECTED test/script/basic/errorstack.js test/script/basic/errorstack.js.EXPECTED test/script/basic/eval.js test/script/basic/eval.js.EXPECTED test/script/basic/evalreturn.js test/script/basic/evalreturn.js.EXPECTED test/script/basic/exprclosure.js test/script/basic/exprclosure.js.EXPECTED test/script/basic/extensibility.js test/script/basic/extensibility.js.EXPECTED test/script/basic/fileline.js test/script/basic/fileline.js.EXPECTED test/script/basic/finally-catchalls.js test/script/basic/finally-catchalls.js.EXPECTED test/script/basic/finallyreturn.js test/script/basic/finallyreturn.js.EXPECTED test/script/basic/forin.js test/script/basic/forin.js.EXPECTED test/script/basic/forin2.js test/script/basic/forin2.js.EXPECTED test/script/basic/funcarray.js test/script/basic/funcarray.js.EXPECTED test/script/basic/funcbind.js test/script/basic/funcbind.js.EXPECTED test/script/basic/funcconstructor.js test/script/basic/funcconstructor.js.EXPECTED test/script/basic/getclassname.js test/script/basic/getenv.js test/script/basic/getenv.js.EXPECTED test/script/basic/getter_callsite.js test/script/basic/getter_callsite.js.EXPECTED test/script/basic/gettercalls.js test/script/basic/gettercalls.js.EXPECTED test/script/basic/getterfunc.js test/script/basic/getterfunc.js.EXPECTED test/script/basic/gettersetter.js test/script/basic/gettersetter.js.EXPECTED test/script/basic/globalaccess.js test/script/basic/globalaccess.js.EXPECTED test/script/basic/globals.js test/script/basic/globals.js.EXPECTED test/script/basic/globalscope.js test/script/basic/globalscope.js.EXPECTED test/script/basic/hello.js test/script/basic/hello.js.EXPECTED test/script/basic/herestr_operator.js test/script/basic/herestr_operator.js.EXPECTED test/script/basic/illegaljavaname.js test/script/basic/illegaljavaname.js.EXPECTED test/script/basic/incheck.js test/script/basic/incheck.js.EXPECTED test/script/basic/indexedcall.js test/script/basic/indexedcall.js.EXPECTED test/script/basic/info.js test/script/basic/info.js.EXPECTED test/script/basic/inherited_nonwritable.js test/script/basic/instanceof.js test/script/basic/instanceof.js.EXPECTED test/script/basic/instanceof2.js test/script/basic/instanceof2.js.EXPECTED test/script/basic/interfaces.js test/script/basic/interfaces.js.EXPECTED test/script/basic/iterator.js test/script/basic/iterator.js.EXPECTED test/script/basic/java.js test/script/basic/java.js.EXPECTED test/script/basic/javaarray.js test/script/basic/javaarray.js.EXPECTED test/script/basic/javaarrayconversion.js test/script/basic/javaarrayconversion.js.EXPECTED test/script/basic/javaexceptions.js test/script/basic/javaexceptions.js.EXPECTED test/script/basic/javaimporter.js test/script/basic/javaimporter.js.EXPECTED test/script/basic/javainnerclasses.js test/script/basic/javainnerclasses.js.EXPECTED test/script/basic/javasigcall.js test/script/basic/javasigcall.js.EXPECTED test/script/basic/jquery.js test/script/basic/jquery.js.EXPECTED test/script/basic/jsadapter.js test/script/basic/jsadapter.js.EXPECTED test/script/basic/jsadapterlink.js test/script/basic/jsadapterlink.js.EXPECTED test/script/basic/json.js test/script/basic/json.js.EXPECTED test/script/basic/list.js test/script/basic/list.js.EXPECTED test/script/basic/literal.js test/script/basic/literal.js.EXPECTED test/script/basic/load.js test/script/basic/load.js.EXPECTED test/script/basic/loadedfile.js test/script/basic/localundef.js test/script/basic/localundef.js.EXPECTED test/script/basic/map.js test/script/basic/map.js.EXPECTED test/script/basic/math.js test/script/basic/math.js.EXPECTED test/script/basic/minuszero.js test/script/basic/minuszero.js.EXPECTED test/script/basic/module.js test/script/basic/moduleload.js test/script/basic/moduleload.js.EXPECTED test/script/basic/nashorn2.js test/script/basic/nashorn2.js.EXPECTED test/script/basic/natives.js test/script/basic/natives.js.EXPECTED test/script/basic/new.js test/script/basic/new.js.EXPECTED test/script/basic/newexpr.js test/script/basic/newexpr.js.EXPECTED test/script/basic/newnew.js test/script/basic/newnew.js.EXPECTED test/script/basic/nonconstructors.js test/script/basic/nonconstructors.js.EXPECTED test/script/basic/nosuchmethod.js test/script/basic/nosuchmethod.js.EXPECTED test/script/basic/nosuchproperty.js test/script/basic/nosuchproperty.js.EXPECTED test/script/basic/number.js test/script/basic/number.js.EXPECTED test/script/basic/numberstring.js test/script/basic/numberstring.js.EXPECTED test/script/basic/objectprops.js test/script/basic/objectprops.js.EXPECTED test/script/basic/objects.js test/script/basic/objects.js.EXPECTED test/script/basic/options.js test/script/basic/options.js.EXPECTED test/script/basic/propchange.js test/script/basic/propchange.js.EXPECTED test/script/basic/propertycheck.js test/script/basic/propertycheck.js.EXPECTED test/script/basic/proto.js.EXPECTED test/script/basic/prototype.js test/script/basic/prototype.js.EXPECTED test/script/basic/pushpull.js test/script/basic/pushpull.js.EXPECTED test/script/basic/regex.js test/script/basic/regex.js.EXPECTED test/script/basic/regexp_flags.js test/script/basic/run-octane.js test/script/basic/runsunspider.js test/script/basic/runsunspider.js.EXPECTED test/script/basic/samfunc.js test/script/basic/samfunc.js.EXPECTED test/script/basic/scripting.js test/script/basic/scripting.js.EXPECTED test/script/basic/sealfreeze.js test/script/basic/sealfreeze.js.EXPECTED test/script/basic/setlength.js test/script/basic/setlength.js.EXPECTED test/script/basic/stdin.js test/script/basic/stdin.js.EXPECTED test/script/basic/strings.js test/script/basic/strings.js.EXPECTED test/script/basic/throws.js test/script/basic/throws.js.EXPECTED test/script/basic/tosource.js test/script/basic/tosource.js.EXPECTED test/script/basic/tostring.js test/script/basic/tostring.js.EXPECTED test/script/basic/try.js test/script/basic/try.js.EXPECTED test/script/basic/trybreakcont.js test/script/basic/trybreakcont.js.EXPECTED test/script/basic/trycatch.js test/script/basic/trycatch.js.EXPECTED test/script/basic/trycatchfor.js test/script/basic/trycatchfor.js.EXPECTED test/script/basic/tryfinallyreturn.js test/script/basic/tryfinallyreturn.js.EXPECTED test/script/basic/tryforbreak.js test/script/basic/tryforbreak.js.EXPECTED test/script/basic/typechange.js test/script/basic/typechange.js.EXPECTED test/script/basic/typeof.js test/script/basic/typeof.js.EXPECTED test/script/basic/typeof2.js test/script/basic/typeof2.js.EXPECTED test/script/basic/undefined.js test/script/basic/undefined.js.EXPECTED test/script/basic/underscore.js test/script/basic/underscore.js.EXPECTED test/script/basic/varargs.js test/script/basic/varargs.js.EXPECTED test/script/basic/void.js test/script/basic/void.js.EXPECTED test/script/basic/with.js test/script/basic/with.js.EXPECTED test/script/basic/withprimitive.js test/script/basic/withprimitive.js.EXPECTED test/script/basic/writable_relink.js test/script/basic/writable_relink.js.EXPECTED test/script/basic/xmlStrings.js.EXPECTED test/script/basic/xorassign.js test/script/basic/xorassign.js.EXPECTED test/script/basic/yui.js test/script/basic/yui.js.EXPECTED test/script/error/NASHORN-154/README test/script/error/NASHORN-154/function_mult_params_in_strict.js test/script/error/NASHORN-154/function_mult_params_in_strict.js.EXPECTED test/script/error/NASHORN-154/improper_return_break_continue.js test/script/error/NASHORN-154/improper_return_break_continue.js.EXPECTED test/script/error/NASHORN-154/invalid_lvalue.js test/script/error/NASHORN-154/invalid_lvalue.js.EXPECTED test/script/error/NASHORN-154/literal_data_and_accessor.js test/script/error/NASHORN-154/literal_data_and_accessor.js.EXPECTED test/script/error/NASHORN-154/literal_mult_getters.js test/script/error/NASHORN-154/literal_mult_getters.js.EXPECTED test/script/error/NASHORN-154/literal_mult_prop_in_strict.js test/script/error/NASHORN-154/literal_mult_prop_in_strict.js.EXPECTED test/script/error/NASHORN-154/with_in_strict.js test/script/error/NASHORN-154/with_in_strict.js.EXPECTED test/script/error/NASHORN-214.js test/script/error/NASHORN-214.js.EXPECTED test/script/error/NASHORN-35.js test/script/error/NASHORN-35.js.EXPECTED test/script/error/NASHORN-39.js test/script/error/NASHORN-39.js.EXPECTED test/script/error/NASHORN-568.js test/script/error/NASHORN-568.js.EXPECTED test/script/error/NASHORN-57.js test/script/error/NASHORN-57.js.EXPECTED test/script/error/NASHORN-668.js test/script/error/NASHORN-668.js.EXPECTED test/script/error/quotemissing.js test/script/error/quotemissing.js.EXPECTED test/script/error/strictmode.js test/script/error/strictmode.js.EXPECTED test/script/representations/NASHORN-592a.js test/script/sandbox/NASHORN-525.js test/script/sandbox/README test/script/sandbox/classloader.js test/script/sandbox/classloader.js.EXPECTED test/script/sandbox/doprivileged.js test/script/sandbox/doprivileged.js.EXPECTED test/script/sandbox/exit.js test/script/sandbox/exit.js.EXPECTED test/script/sandbox/file.js test/script/sandbox/file.js.EXPECTED test/script/sandbox/javaextend.js test/script/sandbox/javaextend.js.EXPECTED test/script/sandbox/loadLibrary.js test/script/sandbox/net.js test/script/sandbox/net.js.EXPECTED test/script/sandbox/property.js test/script/sandbox/property.js.EXPECTED test/script/sandbox/reflection.js test/script/sandbox/reflection.js.EXPECTED test/script/sandbox/runnable.js test/script/sandbox/runnable.js.EXPECTED test/script/sandbox/unsafe.js test/script/sandbox/unsafe.js.EXPECTED test/script/test262.js test/script/test262_single.js test/src/UnnamedPackageTestCallback.java test/src/jdk/nashorn/api/scripting/MultipleEngineTest.java test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java test/src/jdk/nashorn/api/scripting/Window.java test/src/jdk/nashorn/api/scripting/WindowEventHandler.java test/src/jdk/nashorn/internal/access/BooleanAccessTest.java test/src/jdk/nashorn/internal/access/MethodAccessTest.java test/src/jdk/nashorn/internal/access/NumberAccessTest.java test/src/jdk/nashorn/internal/access/NumberBoxingTest.java test/src/jdk/nashorn/internal/access/ObjectAccessTest.java test/src/jdk/nashorn/internal/access/Person.java test/src/jdk/nashorn/internal/access/SharedObject.java test/src/jdk/nashorn/internal/access/StringAccessTest.java test/src/jdk/nashorn/internal/codegen/CompilerTest.java test/src/jdk/nashorn/internal/parser/ParserTest.java test/src/jdk/nashorn/internal/performance/AuroraWrapper.java test/src/jdk/nashorn/internal/performance/OctaneTest.java test/src/jdk/nashorn/internal/performance/PerformanceWrapper.java test/src/jdk/nashorn/internal/performance/SplayTest.java test/src/jdk/nashorn/internal/runtime/ContextTest.java test/src/jdk/nashorn/internal/runtime/JSTypeTest.java test/src/jdk/nashorn/internal/runtime/Nashorn401TestSubject.java test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java test/src/jdk/nashorn/internal/test/framework/JSJUnitReportReporter.java test/src/jdk/nashorn/internal/test/framework/OrphanTestFinder.java test/src/jdk/nashorn/internal/test/framework/ParallelTestRunner.java test/src/jdk/nashorn/internal/test/framework/ScriptEvaluator.java test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java test/src/jdk/nashorn/internal/test/framework/ScriptTest.java test/src/jdk/nashorn/internal/test/framework/SeparateContextEvaluator.java test/src/jdk/nashorn/internal/test/framework/SharedContextEvaluator.java test/src/jdk/nashorn/internal/test/framework/TestConfig.java test/src/jdk/nashorn/internal/test/framework/TestFinder.java test/src/jdk/nashorn/internal/test/framework/TestHelper.java test/src/jdk/nashorn/internal/test/framework/TestReorderInterceptor.java test/src/jdk/nashorn/internal/test/models/ConstructorWithArgument.java test/src/jdk/nashorn/internal/test/models/FinalClass.java test/src/jdk/nashorn/internal/test/models/NoAccessibleConstructorClass.java test/src/jdk/nashorn/internal/test/models/NonPublicClass.java test/src/jdk/nashorn/internal/test/models/OuterClass.java test/src/jdk/nashorn/internal/test/models/OverloadedSam.java test/src/jdk/nashorn/internal/test/models/OverrideObject.java
diffstat 1175 files changed, 188153 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Thu Dec 20 14:16:21 2012 -0800
+++ b/.hgignore	Fri Dec 21 16:36:24 2012 -0400
@@ -1,4 +1,25 @@
+syntax: glob
+
 ^build/
 ^dist/
+^.hgtip
 /nbproject/private/
-^.hgtip
+^webrev/
+webrev.zip
+*.class
+*.log
+*.orig
+hotspot.log
+private.properties
+genfiles.properties
+private.xml
+.DS_Store*
+TEST-*.xml
+TESTS-*.xml
+report.xml
+CC/
+jcov2/
+buildtools/nasgen/nbproject/private/
+buildtools/nasgen/dist/
+buildtools/nasgen/build/
+.idea/*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ASSEMBLY_EXCEPTION	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,27 @@
+
+OPENJDK ASSEMBLY EXCEPTION
+
+The OpenJDK source code made available by Sun at openjdk.java.net and
+openjdk.dev.java.net ("OpenJDK Code") is distributed under the terms of the
+GNU General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+only ("GPL2"), with the following clarification and special exception.
+
+    Linking this OpenJDK Code statically or dynamically with other code
+    is making a combined work based on this library.  Thus, the terms
+    and conditions of GPL2 cover the whole combination.
+
+    As a special exception, Sun gives you permission to link this
+    OpenJDK Code with certain code licensed by Sun as indicated at
+    http://openjdk.java.net/legal/exception-modules-2007-05-08.html
+    ("Designated Exception Modules") to produce an executable,
+    regardless of the license terms of the Designated Exception Modules,
+    and to copy and distribute the resulting executable under GPL2,
+    provided that the Designated Exception Modules continue to be
+    governed by the licenses under which they were offered by Sun.
+
+As such, it allows licensees and sublicensees of Sun's GPL2 OpenJDK Code to
+build an executable that includes those portions of necessary code that Sun
+could not provide under GPL2 (or that Sun has provided under GPL2 with the
+Classpath exception).  If you modify or add to the OpenJDK code, that new
+GPL2 code may still be combined with Designated Exception Modules if the
+new code is made subject to this exception by its copyright holder.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LICENSE	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,347 @@
+The GNU General Public License (GPL)
+
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license
+document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share
+and change it.  By contrast, the GNU General Public License is intended to
+guarantee your freedom to share and change free software--to make sure the
+software is free for all its users.  This General Public License applies to
+most of the Free Software Foundation's software and to any other program whose
+authors commit to using it.  (Some other Free Software Foundation software is
+covered by the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price.  Our
+General Public Licenses are designed to make sure that you have the freedom to
+distribute copies of free software (and charge for this service if you wish),
+that you receive source code or can get it if you want it, that you can change
+the software or use pieces of it in new free programs; and that you know you
+can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny
+you these rights or to ask you to surrender the rights.  These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for
+a fee, you must give the recipients all the rights that you have.  You must
+make sure that they, too, receive or can get the source code.  And you must
+show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2)
+offer you this license which gives you legal permission to copy, distribute
+and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software.  If the
+software is modified by someone else and passed on, we want its recipients to
+know that what they have is not the original, so that any problems introduced
+by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents.  We
+wish to avoid the danger that redistributors of a free program will
+individually obtain patent licenses, in effect making the program proprietary.
+To prevent this, we have made it clear that any patent must be licensed for
+everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms of
+this General Public License.  The "Program", below, refers to any such program
+or work, and a "work based on the Program" means either the Program or any
+derivative work under copyright law: that is to say, a work containing the
+Program or a portion of it, either verbatim or with modifications and/or
+translated into another language.  (Hereinafter, translation is included
+without limitation in the term "modification".) Each licensee is addressed as
+"you".
+
+Activities other than copying, distribution and modification are not covered by
+this License; they are outside its scope.  The act of running the Program is
+not restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made by
+running the Program).  Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as
+you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this License
+and to the absence of any warranty; and give any other recipients of the
+Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may
+at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus
+forming a work based on the Program, and copy and distribute such modifications
+or work under the terms of Section 1 above, provided that you also meet all of
+these conditions:
+
+    a) You must cause the modified files to carry prominent notices stating
+    that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in whole or
+    in part contains or is derived from the Program or any part thereof, to be
+    licensed as a whole at no charge to all third parties under the terms of
+    this License.
+
+    c) If the modified program normally reads commands interactively when run,
+    you must cause it, when started running for such interactive use in the
+    most ordinary way, to print or display an announcement including an
+    appropriate copyright notice and a notice that there is no warranty (or
+    else, saying that you provide a warranty) and that users may redistribute
+    the program under these conditions, and telling the user how to view a copy
+    of this License.  (Exception: if the Program itself is interactive but does
+    not normally print such an announcement, your work based on the Program is
+    not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If identifiable
+sections of that work are not derived from the Program, and can be reasonably
+considered independent and separate works in themselves, then this License, and
+its terms, do not apply to those sections when you distribute them as separate
+works.  But when you distribute the same sections as part of a whole which is a
+work based on the Program, the distribution of the whole must be on the terms
+of this License, whose permissions for other licensees extend to the entire
+whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your
+rights to work written entirely by you; rather, the intent is to exercise the
+right to control the distribution of derivative or collective works based on
+the Program.
+
+In addition, mere aggregation of another work not based on the Program with the
+Program (or with a work based on the Program) on a volume of a storage or
+distribution medium does not bring the other work under the scope of this
+License.
+
+3. You may copy and distribute the Program (or a work based on it, under
+Section 2) in object code or executable form under the terms of Sections 1 and
+2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable source
+    code, which must be distributed under the terms of Sections 1 and 2 above
+    on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three years, to
+    give any third party, for a charge no more than your cost of physically
+    performing source distribution, a complete machine-readable copy of the
+    corresponding source code, to be distributed under the terms of Sections 1
+    and 2 above on a medium customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer to
+    distribute corresponding source code.  (This alternative is allowed only
+    for noncommercial distribution and only if you received the program in
+    object code or executable form with such an offer, in accord with
+    Subsection b above.)
+
+The source code for a work means the preferred form of the work for making
+modifications to it.  For an executable work, complete source code means all
+the source code for all modules it contains, plus any associated interface
+definition files, plus the scripts used to control compilation and installation
+of the executable.  However, as a special exception, the source code
+distributed need not include anything that is normally distributed (in either
+source or binary form) with the major components (compiler, kernel, and so on)
+of the operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the source
+code from the same place counts as distribution of the source code, even though
+third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License.  Any attempt otherwise to copy, modify,
+sublicense or distribute the Program is void, and will automatically terminate
+your rights under this License.  However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it.
+However, nothing else grants you permission to modify or distribute the Program
+or its derivative works.  These actions are prohibited by law if you do not
+accept this License.  Therefore, by modifying or distributing the Program (or
+any work based on the Program), you indicate your acceptance of this License to
+do so, and all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program),
+the recipient automatically receives a license from the original licensor to
+copy, distribute or modify the Program subject to these terms and conditions.
+You may not impose any further restrictions on the recipients' exercise of the
+rights granted herein.  You are not responsible for enforcing compliance by
+third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues), conditions
+are imposed on you (whether by court order, agreement or otherwise) that
+contradict the conditions of this License, they do not excuse you from the
+conditions of this License.  If you cannot distribute so as to satisfy
+simultaneously your obligations under this License and any other pertinent
+obligations, then as a consequence you may not distribute the Program at all.
+For example, if a patent license would not permit royalty-free redistribution
+of the Program by all those who receive copies directly or indirectly through
+you, then the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply and
+the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or
+other property right claims or to contest validity of any such claims; this
+section has the sole purpose of protecting the integrity of the free software
+distribution system, which is implemented by public license practices.  Many
+people have made generous contributions to the wide range of software
+distributed through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing to
+distribute software through any other system and a licensee cannot impose that
+choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain
+countries either by patents or by copyrighted interfaces, the original
+copyright holder who places the Program under this License may add an explicit
+geographical distribution limitation excluding those countries, so that
+distribution is permitted only in or among countries not thus excluded.  In
+such case, this License incorporates the limitation as if written in the body
+of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the
+General Public License from time to time.  Such new versions will be similar in
+spirit to the present version, but may differ in detail to address new problems
+or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any later
+version", you have the option of following the terms and conditions either of
+that version or of any later version published by the Free Software Foundation.
+If the Program does not specify a version number of this License, you may
+choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission.  For software which is copyrighted by the Free Software Foundation,
+write to the Free Software Foundation; we sometimes make exceptions for this.
+Our decision will be guided by the two goals of preserving the free status of
+all derivatives of our free software and of promoting the sharing and reuse of
+software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
+THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN OTHERWISE
+STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
+PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE,
+YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
+ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
+PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
+INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
+BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
+OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible
+use to the public, the best way to achieve this is to make it free software
+which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program.  It is safest to attach
+them to the start of each source file to most effectively convey the exclusion
+of warranty; and each file should have at least the "copyright" line and a
+pointer to where the full notice is found.
+
+    One line to give the program's name and a brief idea of what it does.
+
+    Copyright (C) <year> <name of author>
+
+    This program is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the Free
+    Software Foundation; either version 2 of the License, or (at your option)
+    any later version.
+
+    This program is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+    more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc., 59
+    Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it
+starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
+    with ABSOLUTELY NO WARRANTY; for details type 'show w'.  This is free
+    software, and you are welcome to redistribute it under certain conditions;
+    type 'show c' for details.
+
+The hypothetical commands 'show w' and 'show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may be
+called something other than 'show w' and 'show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.  Here
+is a sample; alter the names:
+
+    Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+    'Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+    signature of Ty Coon, 1 April 1989
+
+    Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General Public
+License instead of this License.
+
+
+"CLASSPATH" EXCEPTION TO THE GPL
+
+Certain source files distributed by Oracle America and/or its affiliates are
+subject to the following clarification and special exception to the GPL, but
+only where Oracle has expressly included in the particular source file's header
+the words "Oracle designates this particular file as subject to the "Classpath"
+exception as provided by Oracle in the LICENSE file that accompanied this code."
+
+    Linking this library statically or dynamically with other modules is making
+    a combined work based on this library.  Thus, the terms and conditions of
+    the GNU General Public License cover the whole combination.
+
+    As a special exception, the copyright holders of this library give you
+    permission to link this library with independent modules to produce an
+    executable, regardless of the license terms of these independent modules,
+    and to copy and distribute the resulting executable under terms of your
+    choice, provided that you also meet, for each linked independent module,
+    the terms and conditions of the license of that module.  An independent
+    module is a module which is not derived from or based on this library.  If
+    you modify this library, you may extend this exception to your version of
+    the library, but you are not obligated to do so.  If you do not wish to do
+    so, delete this exception statement from your version.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,147 @@
+- What is Nashorn?
+
+Nashorn is a runtime environment for programs written in ECMAScript 5.1
+that runs on top of JVM.
+
+- How to find out more about ECMAScript 5.1?
+
+The specification can be found at
+
+    http://www.ecma-international.org/publications/standards/Ecma-262.htm
+
+- How to checkout sources of Nashorn project?
+
+Nashorn project uses Mercurial source code control system. You can
+download Mercurial from http://mercurial.selenic.com/wiki/Download
+
+Information about the forest extension can be found at
+
+    http://mercurial.selenic.com/wiki/ForestExtension
+
+and downlaoded using
+
+    hg clone https://bitbucket.org/gxti/hgforest
+
+You can clone Nashorn Mercurial forest using this command:
+
+    hg fclone http://hg.openjdk.java.net/nashorn/jdk8 nashorn~jdk8
+    
+To update your copy of the forest (fwith the latest code:
+
+    (cd nashorn~jdk8 ; hg fpull)
+    
+Or just the nashorn subdirectory with
+
+    (cd nashorn~jdk8/nashorn ; hg pull -u)
+    
+To learn about Mercurial in detail, please visit http://hgbook.red-bean.com.
+
+- How to build?
+
+To build Nashorn, you need to install JDK 8. You may use the Nashorn
+forest build (recommended) or down load from java.net.  You will need to
+set JAVA_HOME environmental variable to point to your JDK installation
+directory.
+
+    cd nashorn~jdk8/nashorn/make
+    ant clean; ant
+
+- How to run?
+
+Use the jjs script (see RELESE_README):
+
+    cd nashorn~jdk8/nashorn
+    sh bin/jjs <your .js file>
+
+Nashorn supports javax.script API. It is possible to drop nashorn.jar in
+class path and request for "nashorn" script engine from
+javax.script.ScriptEngineManager. 
+
+Look for samples under the directory test/src/jdk/nashorn/api/scripting/.
+
+- Documentation
+
+Comprehensive development documentation is found in the Nashorn JavaDoc. You can
+build it using:
+
+    cd nashorn~jdk8/nashorn/make
+    ant javadoc
+    
+after which you can view the generated documentation at dist/javadoc/index.html.
+
+- Running tests
+
+Nashorn tests are TestNG based. Running tests requires downloading the
+TestNG library and placing its jar file into the lib subdirectory:
+
+    # download and install TestNG
+    wget http://testng.org/testng-x.y.z.zip
+    unzip testng-x.y.z.zip
+    cp testng-x.y.z/testng-x.y.z.jar test/lib/testng.jar
+    
+After that, you can run the tests using:
+    cd make
+    ant test
+    
+You can also run the ECMA-262 test suite with Nashorn. In order to do
+that, you will need to get a copy of it and put it in
+test/script/external/test262 directory. A convenient way to do it is:
+
+   hg clone http://hg.ecmascript.org/tests/test262/ test/script/external/test262
+    
+Alternatively, you can check it out elsewhere and make
+test/script/external/test262 a symbolic link to that directory. After
+you've done this, you can run the ECMA-262 tests using:
+
+    cd nashorn~jdk8/nashorn/make
+    ant test262
+    
+These tests take time, so we have a parallelized runner for them that
+takes advantage of all processor cores on the computer:
+
+    cd nashorn~jdk8/nashorn/make
+    ant test262parallel
+    
+- How to write your own test?
+
+Nashorn uses it's own simple test framework. Any .js file dropped under
+nashorn/test directory is considered as a test. A test file can
+optionally have .js.EXPECTED (foo.js.EXPECTED for foo.js) associated
+with it. The .EXPECTED file, if exists, should contain the output
+expected from compiling and/or running the test file.
+
+The test runner crawls these directories for .js files and looks for
+JTReg-style @foo comments to identify tests.
+
+    * @test - A test is tagged with @test.
+
+    * @test/fail - Tests that are supposed to fail (compiling, see @run/fail
+      for runtime) are tagged with @test/fail.
+
+    * @test/compile-error - Test expects compilation to fail, compares
+      output.
+
+    * @test/warning - Test expects compiler warnings, compares output.
+
+    * @test/nocompare - Test expects to compile [and/or run?]
+      successfully(may be warnings), does not compare output.
+
+    * @subtest - denotes necessary file for a main test file; itself is not
+      a test.
+
+    * @run - A test that should be run is also tagged with @run (otherwise
+      the test runner only compiles the test).
+
+    * @run/fail - A test that should compile but fail with a runtime error.
+
+    * @run/ignore-std-error - script may produce output on stderr, ignore
+      this output.
+
+    * @argument - pass an argument to script.
+
+    * @option \ - pass option to engine, sample.
+
+/**
+ * @option --dump-ir-graph
+ * @test
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RELEASE_README	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,20 @@
+The Nashorn repo is in the process of being migrated to OpenJDK and as such is
+incomplete in several areas.
+
+- The build system is not fully integrated.  When complete, Nashorn will be
+installed in its proper location in the JRE.
+
+- Once integrated, the correct version of the JDK will be wrapped around 
+Nashorn.  In the meantime, ensure you use JDK8 b68 or later.
+
+- The jjs tool has not been implemented in binary form yet.  Use "sh bin/jjs" 
+(or bin/jjs.bat on windows) in the interm.
+
+- The Dynalink component is not fully integrated into Nashorn as yet, but will
+be when details are finalized.
+
+- And, finally Nashorn is still in development.  To stay up to date, subscribe
+to nashorn-dev@openjdk.java.net at
+
+    http://mail.openjdk.java.net/mailman/listinfo/nashorn-dev.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/THIRD_PARTY_README	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,69 @@
+DO NOT TRANSLATE OR LOCALIZE.
+-----------------------------
+
+%% This notice is provided with respect to  ECMAScript Language
+Specification ECMA-262 Edition 5.1 which is included with the Nashorn
+technology.
+
+--- begin of LICENSE ---
+Copyright notice
+Copyright © 2011 Ecma International
+Ecma International
+Rue du Rhone 114
+CH-1204 Geneva
+Tel: +41 22 849 6000
+Fax: +41 22 849 6001
+Web: http://www.ecma-international.org
+
+This document and possible translations of it may be copied and furnished to
+others, and derivative works that comment on or otherwise explain it or assist
+in its implementation may be prepared, copied, published, and distributed, in
+whole or in part, without restriction of any kind, provided that the above
+copyright notice and this section are included on all such copies and derivative
+works. However, this document itself may not be modified in any way, including
+by removing the copyright notice or references to Ecma International, except as
+needed for the purpose of developing any document or deliverable produced by
+Ecma International (in which case the rules applied to copyrights must be
+followed) or as required to translate it into languages other than English. The
+limited permissions granted above are perpetual and will not be revoked by Ecma
+International or its successors or assigns. This document and the information
+contained herein is provided on an "AS IS" basis and ECMA INTERNATIONAL
+DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY
+WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP
+RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
+PURPOSE." Software License
+
+All Software contained in this document ("Software)" is protected by copyright
+and is being made available under the "BSD License", included below. This
+Software may be subject to third party rights (rights from parties other than
+Ecma International), including patent rights, and no licenses under such third
+party rights are granted under this license even if the third party concerned is
+a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS
+AVAILABLE AT http://www.ecma-international.org/memento/codeofconduct.htm FOR
+INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO
+IMPLEMENT ECMA INTERNATIONAL STANDARDS*. Redistribution and use in source and
+binary forms, with or without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+3. Neither the name of the authors nor Ecma International may be used to endorse
+or promote products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+OF SUCH DAMAGE.
+--- end of LICENSE ---
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/checkintest.sh	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,266 @@
+#!/bin/bash
+#
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+# 
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+# 
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+# 
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#best pass rate at test 262 known
+TEST262_PASS_AT_LEAST=435
+
+RUN_TEST="true"
+RUN_TEST262="true"
+RUN_NODE="true"
+KEEP_OUTPUT="true"
+CLEAN_AND_BUILD_NASHORN="true"
+
+#the stable node version to sync against
+NODE_LAST_STABLE=v0.6.18
+
+#parse args
+for arg in $*
+do
+    if [ $arg = "--no-test" ]; then
+	RUN_TEST="false"
+	echo "**** WARNING - you have disabled 'ant test', which is a minimum checkin requirement..."
+    elif [ $arg = "--no-262" ]; then
+	RUN_TEST262="false"
+    elif [ $arg = "--no-node" ]; then
+	RUN_NODE="false"
+    elif [ $arg = "--no-build" ]; then
+	CLEAN_AND_BUILD_NASHORN="false"
+    elif [ $arg = "--no-logs" ]; then
+	KEEP_OUTPUT="false"
+    fi
+done
+
+function lastpart() {        
+    arr=$(echo $1 | tr "/" "\n")
+    for x in $arr
+    do
+	_last=$x
+    done
+    echo $_last
+}
+
+function check_installed() {
+    which $1 >/dev/null
+    if [ $? -ne 0 ]; then
+	echo "Error $1 not installed: $?"
+	exit 2
+    fi
+}
+
+check_installed hg
+check_installed git
+check_installed mv
+check_installed git
+
+PWD=$(pwd);
+
+while [ -z $NASHORN_ROOT ]
+do
+    if [ -e $PWD/.hg ]; then
+	NASHORN_ROOT=${PWD}
+	break
+    fi
+    PWD=$(dirname ${PWD})
+done
+
+echo "Nashorn root detected at ${NASHORN_ROOT}"
+
+COMMON_ROOT=$(dirname $NASHORN_ROOT)
+echo "Common root is ${COMMON_ROOT}"
+
+echo "Running checkintest..."
+
+ABSOLUTE_NASHORN_HOME=$COMMON_ROOT/$(lastpart $NASHORN_ROOT)
+
+if [ $CLEAN_AND_BUILD_NASHORN != "false" ]; then
+    echo "Cleaning and building nashorn at $ABSOLUTE_NASHORN_HOME/nashorn..."
+    $(cd $ABSOLUTE_NASHORN_HOME/nashorn; ant clean >/dev/null 2>/dev/null)
+    $(cd $ABSOLUTE_NASHORN_HOME/nashorn; ant jar >/dev/null 2>/dev/null)
+    echo "Done."
+fi
+
+function failure_check() {
+    while read line
+    do
+	LINE=$(echo $line | grep "Tests run")    
+	if [ "${LINE}" != "" ]; then
+	    RESULT=$(echo $line | grep "Failures: 0" | grep "Errors: 0")
+	    if [ "${RESULT}" == "" ]; then
+		TESTNAME=$2
+		echo "There were errors in ${TESTNAME} : ${LINE}"
+		exit 1
+	    fi
+	fi
+    done < $1
+}
+
+function test() {
+    TEST_OUTPUT=$ABSOLUTE_NASHORN_HOME/$(mktemp tmp.XXXXX)
+    echo "Running 'ant test' on nashorn from ${ABSOLUTE_NASHORN_HOME}/nashorn..."
+    $(cd $ABSOLUTE_NASHORN_HOME/nashorn; ant test >$TEST_OUTPUT)
+    echo "Done."
+
+    failure_check $TEST_OUTPUT
+
+    echo "**** SUCCESS: 'ant test' successful"
+
+    if [ $KEEP_OUTPUT == "true" ]; then
+	cp $TEST_OUTPUT ./checkintest.test.log
+	rm -fr $TEST_OUTPUT
+    fi
+}
+
+if [ $RUN_TEST != "false" ]; then
+    test;
+fi
+
+function test262() {
+
+    echo "Running 'ant test262parallel' on nashorn from ${ABSOLUTE_NASHORN_HOME}/nashorn..."
+    TEST262_OUTPUT=$ABSOLUTE_NASHORN_HOME/$(mktemp tmp.XXXXX)
+
+    echo "Looking for ${ABSOLUTE_NASHORN_HOME}/test/test262..."
+
+    if [ ! -e $ABSOLUTE_NASHORN_HOME/nashorn/test/test262 ]; then
+	echo "test262 is missing... looking in $COMMON_ROOT..."
+	if [ ! -e $COMMON_ROOT/test262 ]; then
+	    echo "... not there either... cloning from repo..."
+	    hg clone http://hg.ecmascript.org/tests/test262 $COMMON_ROOT/test262 >/dev/null 2>/dev/null
+	    echo "Done."
+	fi
+	echo "Adding soft link ${COMMON_ROOT}/test262 -> ${ABSOLUTE_NASHORN_HOME}/test/test262..."
+	ln -s $COMMON_ROOT/test262 $ABSOLUTE_NASHORN_HOME/nashorn/test/test262
+	echo "Done."
+    fi
+
+    echo "Ensuring test262 is up to date..."
+    $(cd $ABSOLUTE_NASHORN_HOME/nashorn/test/test262; hg pull -u >/dev/null 2>/dev/null)
+    echo "Done."
+
+    echo "Running test262..."
+    $(cd $ABSOLUTE_NASHORN_HOME/nashorn; ant test262parallel > $TEST262_OUTPUT)
+    
+    FAILED=$(cat $TEST262_OUTPUT|grep "Tests run:"| cut -d ' ' -f 15 |tr -cd '"[[:digit:]]')
+    if [ $FAILED -gt $TEST262_PASS_AT_LEAST ]; then 
+	echo "FAILURE: There are ${FAILED} failures in test262 and can be no more than ${TEST262_PASS_AT_LEAST}"
+	cp $TEST262_OUTPUT ./checkintest.test262.log
+	echo "See ./checkintest.test262.log"
+	echo "Terminating due to error"
+	exit 1
+    elif [ $FAILED -lt $TEST262_PASS_AT_LEAST ]; then
+	echo "There seem to have been fixes to 262. ${FAILED} < ${TEST262_PASS_AT_LEAST}. Please update limit in bin/checkintest.sh"
+    fi
+    
+    echo "**** SUCCESS: Test262 passed with no more than ${TEST262_PASS_AT_LEAST} failures."
+
+    if [ $KEEP_OUTPUT == "true" ]; then
+	cp $TEST262_OUTPUT ./checkintest.test262.log
+	rm -fr $TEST262_OUTPUT
+    fi    
+}
+
+if [ $RUN_TEST262 != "false" ]; then
+    test262;    
+fi;
+
+function testnode() {
+    TESTNODEJAR_OUTPUT=$ABSOLUTE_NASHORN_HOME/$(mktemp tmp.XXXXX)
+   
+    echo "Running node tests..."
+#replace node jar properties nashorn with this nashorn
+    
+    NODEJAR_PROPERTIES=~/nodejar.properties
+    
+    NODE_HOME=$(cat $NODEJAR_PROPERTIES | grep ^node.home | cut -f2 -d=)    
+    NASHORN_HOME=$(cat $NODEJAR_PROPERTIES | grep ^nashorn.home | cut -f2 -d=)
+    
+    ABSOLUTE_NODE_HOME=$COMMON_ROOT/$(lastpart $NODE_HOME)    
+    
+    echo "Writing nodejar.properties..."
+
+    cat > $NODEJAR_PROPERTIES << EOF
+node.home=../node
+nashorn.home=../$(lastpart $NASHORN_ROOT)
+EOF
+    echo "Done."
+    echo "Checking node home ${ABSOLUTE_NODE_HOME}..."
+
+    if [ ! -e $ABSOLUTE_NODE_HOME ]; then
+	echo "Node base dir not found. Cloning node..."    
+	$(cd $COMMON_ROOT; git clone https://github.com/joyent/node.git $(lastpart $NODE_HOME) >/dev/null 2>/dev/null)
+	echo "Done."
+	echo "Updating to last stable version ${NODE_LAST_STABLE}..."
+	$(cd $ABSOLUTE_NODE_HOME; git checkout $NODE_LAST_STABLE >/dev/null 2>/dev/null)
+	echo "Done."
+	echo "Running configure..."
+	$(cd $ABSOLUTE_NODE_HOME; ./configure >/dev/null 2>/dev/null)
+	echo "Done."
+    fi
+    
+    echo "Ensuring node is built..."
+#make sure node is built
+    $(cd $ABSOLUTE_NODE_HOME; make >/dev/null 2>/dev/null)
+    echo "Done."
+
+    NODEJAR_HOME=$COMMON_ROOT/nodejar
+
+    if [ ! -e $NODEJAR_HOME ]; then
+	echo "No node jar home found. cloning from depot..."
+	$(cd $COMMON_ROOT; hg clone https://hg.kenai.com/hg/nodejs~source nodejar >/dev/null 2>/dev/null) 
+	$(cd $COMMON_ROOT/nodejar; ant >/dev/null)
+	echo "Done."
+	echo "Copying node files..."
+	$(cd $COMMON_ROOT/nodejar; ant copy-node-files >/dev/null 2>/dev/null)
+	echo "Patching node files..."
+	$(cd $COMMON_ROOT/nodejar; ant patch-node-files >/dev/null 2>/dev/null)
+	echo "Done."
+    fi
+    
+    echo "Ensuring node.jar is up to date from source depot..."
+    $(cd $COMMON_ROOT/nodejar; hg pull -u >/dev/null 2>/dev/null)
+    echo "Done."
+
+    echo "Installing nashorn..."
+    $(cd $COMMON_ROOT/nodejar; ant >/dev/null)
+    echo "Done."
+
+    echo "Running node.jar test..."
+    $(cd $COMMON_ROOT/nodejar; mvn clean verify >$TESTNODEJAR_OUTPUT)
+    echo "Done."
+
+    failure_check $TESTNODEJAR_OUTPUT
+    
+    echo "**** SUCCESS: Node test successful."
+
+    if [ $KEEP_OUTPUT == "true" ]; then
+	rm -fr $TESTNODEJAR_OUTPUT
+	cp $TESTNODEJAR_OUTPUT ./checkintest.nodejar.log
+    fi
+}
+
+if [ $RUN_NODE != "false" ]; then
+    testnode;
+fi;
+
+echo "Finished"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/fixorphantests.sh	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+# 
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+# 
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+# 
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#ensure that all tests tagged with @test are also tagged with @run
+
+for f in $(find test/script/basic/*.js); do 
+    grep @test $f >/dev/null
+    TEST=$?
+    grep @run $f >/dev/null
+    RUN=$?    
+
+    if [ $TEST -eq 0 ] && [ ! $RUN -eq 0 ]; then		
+	echo "repairing ${f}..."
+	TEMP=$(mktemp /tmp/scratch.XXXXXX)
+
+	#IFS='', -raw flag to preserve white space
+	while IFS='' read -r line; do 	    
+	    echo $line | grep @test >/dev/null
+	    TEST=$?
+	    printf "%s\n" "$line" 
+	    if [ $TEST -eq 0 ]; then
+		printf "%s\n" "$line" | sed s/@test/@run/g 
+	    fi	   
+	done < $f >$TEMP
+
+	cp $TEMP $f
+
+	rm -fr $TEMP
+    fi
+
+done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/fixwhitespace.sh	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+# 
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+# 
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+# 
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#convert tabs to spaces
+find . -name "*.java" -exec sed -i "" 's/	/    /g' {} \;
+
+#remove trailing whitespace
+find . -name "*.java" -exec sed -i "" 's/[ 	]*$//' \{} \;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/jjs	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,29 @@
+#!/bin/bash
+#
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+[ -z "$JAVA_HOME" ] && echo "Please set JAVA_HOME" && exit 1;
+
+$JAVA_HOME/bin/java -server -XX:-TieredCompilation -Xms2G -Xmx2G -esa -ea -Djava.ext.dirs=$JAVA_HOME/jre/lib/ext:`dirname $0`/../dist -XX:+HeapDumpOnOutOfMemoryError -Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -Dnashorn.debug=true jdk.nashorn.tools.Shell $*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/jjs.bat	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,27 @@
+rem
+rem Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+rem DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+rem
+rem This code is free software; you can redistribute it and/or modify it
+rem under the terms of the GNU General Public License version 2 only, as
+rem published by the Free Software Foundation.  Oracle designates this
+rem particular file as subject to the "Classpath" exception as provided
+rem by Oracle in the LICENSE file that accompanied this code.
+rem
+rem This code is distributed in the hope that it will be useful, but WITHOUT
+rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+rem FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+rem version 2 for more details (a copy is included in the LICENSE file that
+rem accompanied this code).
+rem
+rem You should have received a copy of the GNU General Public License version
+rem 2 along with this work; if not, write to the Free Software Foundation,
+rem Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+rem
+rem Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+rem or visit www.oracle.com if you need additional information or have any
+rem questions.
+rem
+@echo off
+
+java -Xms2G -Xmx2G -XX:-TieredCompilation -server -esa -ea -Djava.ext.dirs=%~dp0\..\dist -XX:+HeapDumpOnOutOfMemoryError -Dnashorn.debug=true -Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false jdk.nashorn.tools.Shell
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/jjssecure	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,29 @@
+#!/bin/bash
+#
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+[ -z "$JAVA_HOME" ] && echo "Please set JAVA_HOME" && exit 1;
+
+$JAVA_HOME/bin/java -Xms2G -Xmx2G -XX:-TieredCompilation -server -esa -ea -Djava.ext.dirs=$JAVA_HOME/jre/lib/ext:`dirname $0`/../dist -XX:+HeapDumpOnOutOfMemoryError -Dnashorn.debug=true -Djava.lang.invoke.MethodHandle.DEBUG_NAMES=true -Dnashorn.home=`dirname $0`/.. -Djava.security.manager jdk.nashorn.tools.Shell $*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/jjssecure.bat	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,27 @@
+rem
+rem Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+rem DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+rem
+rem This code is free software; you can redistribute it and/or modify it
+rem under the terms of the GNU General Public License version 2 only, as
+rem published by the Free Software Foundation.  Oracle designates this
+rem particular file as subject to the "Classpath" exception as provided
+rem by Oracle in the LICENSE file that accompanied this code.
+rem
+rem This code is distributed in the hope that it will be useful, but WITHOUT
+rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+rem FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+rem version 2 for more details (a copy is included in the LICENSE file that
+rem accompanied this code).
+rem
+rem You should have received a copy of the GNU General Public License version
+rem 2 along with this work; if not, write to the Free Software Foundation,
+rem Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+rem
+rem Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+rem or visit www.oracle.com if you need additional information or have any
+rem questions.
+rem
+@echo off
+
+java -Xms2G -Xmx2G -XX:-TieredCompilation -server -esa -ea -Djava.ext.dirs=%~dp0\..\dist -XX:+HeapDumpOnOutOfMemoryError -Dnashorn.debug=true -Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -Dnashorn.home=%~dp0\.. -Djava.security.manager jdk.nashorn.tools.Shell
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/nashorn	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,29 @@
+#!/bin/bash
+#
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+[ -z "$JAVA_HOME" ] && echo "Please set JAVA_HOME" && exit 1;
+
+$JAVA_HOME/bin/jrunscript -J-Xms2G -J-Xmx2G -J-XX:-TieredCompilation -J-server -J-esa -J-ea -J-Djava.ext.dirs=$JAVA_HOME/jre/lib/ext:`dirname $0`/../dist -J-XX:+HeapDumpOnOutOfMemoryError -J-Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -J-Dnashorn.debug=true -l nashorn $*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/nashorn.bat	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,27 @@
+rem
+rem Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+rem DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+rem
+rem This code is free software; you can redistribute it and/or modify it
+rem under the terms of the GNU General Public License version 2 only, as
+rem published by the Free Software Foundation.  Oracle designates this
+rem particular file as subject to the "Classpath" exception as provided
+rem by Oracle in the LICENSE file that accompanied this code.
+rem
+rem This code is distributed in the hope that it will be useful, but WITHOUT
+rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+rem FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+rem version 2 for more details (a copy is included in the LICENSE file that
+rem accompanied this code).
+rem
+rem You should have received a copy of the GNU General Public License version
+rem 2 along with this work; if not, write to the Free Software Foundation,
+rem Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+rem
+rem Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+rem or visit www.oracle.com if you need additional information or have any
+rem questions.
+rem
+@echo off
+
+jrunscript -J-Xms2G -J-Xmx2G -J-XX:-TieredCompilation -J-server -J-esa -J-ea -J-Djava.ext.dirs=%~dp0\..\dist -J-XX:+HeapDumpOnOutOfMemoryError -J-Dnashorn.debug=true -J-Djava.lang.invoke.MethodHandle.DEBUG_NAMES=false -l nashorn
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/rm-non-tracked.sh	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+# 
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+# 
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+# 
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+hg status|grep ^\?|awk '{print $2}'|xargs rm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/verbose_octane.bat	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,59 @@
+rem
+rem Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+rem DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+rem 
+rem This code is free software; you can redistribute it and/or modify it
+rem under the terms of the GNU General Public License version 2 only, as
+rem published by the Free Software Foundation.
+rem 
+rem This code is distributed in the hope that it will be useful, but WITHOUT
+rem ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+rem FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+rem version 2 for more details (a copy is included in the LICENSE file that
+rem accompanied this code).
+rem 
+rem You should have received a copy of the GNU General Public License version
+rem 2 along with this work; if not, write to the Free Software Foundation,
+rem Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+rem 
+rem Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+rem or visit www.oracle.com if you need additional information or have any
+rem questions.
+rem
+@echo off
+
+if "%JAVA_HOME%" neq "" (
+  call :run "%JAVA_HOME%/bin/java"
+) else (
+  call :run java
+)
+goto :EOF
+
+:run
+setlocal
+set NASHORN_JAR=dist/nashorn.jar
+set JVM_FLAGS=-Xms2G -Xmx2G -XX:-TieredCompilation -server -esa -ea -jar %NASHORN_JAR%
+set JVM_FLAGS7=-Xbootclasspath/p:%NASHORN_JAR% %JVM_FLAGS%
+set OCTANE_ARGS=--verbose --iterations 7
+
+%1 -fullversion 2>&1 | findstr /L /C:"version ""1.7"
+if %errorlevel% equ 0 (
+  set CMD=%1 %JVM_FLAGS7%
+) else (
+  %1 -fullversion
+  set CMD=%1 %JVM_FLAGS%
+)
+
+%CMD% test/script/basic/run-octane.js -- test/script/external/octane/benchmarks/box2d.js %OCTANE_ARGS%
+%CMD% test/script/basic/run-octane.js -- test/script/external/octane/benchmarks/code-load.js %OCTANE_ARGS%
+%CMD% test/script/basic/run-octane.js -- test/script/external/octane/benchmarks/crypto.js %OCTANE_ARGS%
+%CMD% test/script/basic/run-octane.js -- test/script/external/octane/benchmarks/deltablue.js %OCTANE_ARGS%
+%CMD% test/script/basic/run-octane.js -- test/script/external/octane/benchmarks/gbemu.js %OCTANE_ARGS%
+%CMD% test/script/basic/run-octane.js -- test/script/external/octane/benchmarks/navier-stokes.js %OCTANE_ARGS%
+%CMD% test/script/basic/run-octane.js -- test/script/external/octane/benchmarks/pdfjs.js %OCTANE_ARGS%
+%CMD% test/script/basic/run-octane.js -- test/script/external/octane/benchmarks/raytrace.js %OCTANE_ARGS%
+%CMD% test/script/basic/run-octane.js -- test/script/external/octane/benchmarks/regexp.js %OCTANE_ARGS%
+%CMD% test/script/basic/run-octane.js -- test/script/external/octane/benchmarks/richards.js %OCTANE_ARGS%
+%CMD% test/script/basic/run-octane.js -- test/script/external/octane/benchmarks/splay.js %OCTANE_ARGS%
+endlocal
+goto :EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/verbose_octane.sh	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,58 @@
+#!/bin/bash
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+# 
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+# 
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+# 
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+ITERS=$1
+if [ -z $ITERS ]; then 
+    ITERS=7
+fi
+NASHORN_JAR=dist/nashorn.jar
+JVM_FLAGS="-XX:+UnlockDiagnosticVMOptions -Dnashorn.unstable.relink.threshold=8 -Xms2G -Xmx2G -XX:-TieredCompilation -server -jar ${NASHORN_JAR}"
+JVM_FLAGS7="-Xbootclasspath/p:${NASHORN_JAR} ${JVM_FLAGS}"
+OCTANE_ARGS="--verbose --iterations ${ITERS}"
+
+BENCHMARKS=( "box2d.js" "code-load.js" "crypto.js" "deltablue.js" "earley-boyer.js" "gbemu.js" "navier-stokes.js" "raytrace.js" "regexp.js" "richards.js" "splay.js" )
+# TODO mandreel.js has metaspace issues
+
+if [ ! -z $JAVA7_HOME ]; then	
+    echo "running ${ITERS} iterations with java7 using JAVA_HOME=${JAVA7_HOME}..."
+    for BENCHMARK in "${BENCHMARKS[@]}"
+    do 
+	CMD="${JAVA8_HOME}/bin/java ${JVM_FLAGS} test/script/basic/run-octane.js -- test/script/external/octane/benchmarks/${BENCHMARK} ${OCTANE_ARGS}"
+	$CMD
+    done
+else
+    echo "no JAVA7_HOME set. skipping java7"
+fi
+
+if [ ! -z $JAVA8_HOME ]; then
+    echo "running ${ITERS} iterations with java8 using JAVA_HOME=${JAVA8_HOME}..."   
+    for BENCHMARK in "${BENCHMARKS[@]}"
+    do 
+	CMD="${JAVA8_HOME}/bin/java ${JVM_FLAGS} test/script/basic/run-octane.js -- test/script/external/octane/benchmarks/${BENCHMARK} ${OCTANE_ARGS}"
+	$CMD
+    done
+else 
+    echo "no JAVA8_HOME set"
+fi
+
+echo "Done"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildtools/nasgen/README	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,34 @@
+Nasgen is a tool for processing Java classes that implement native
+JavaScript objects. It does so by looking for the
+com.oracle.nashorn.objects.annotations.ScriptClass annotation and other
+annotations in that package.
+
+For each  class "C", nasgen instruments the original class and generates
+two additional classes: a "C$Prototype" class for the JavaScript
+prototype object, and a "C$Constructor" class for the JavaScript
+constructor function.
+
+Each class instrumented or generated by nasgen contains a private static
+"$nasgenmap$" field of type com.oracle.nashorn.runtime.PropertyMap and
+static initializer block to initialize the field to the object's
+JavaScript properties.
+
+Members annotated with @Function, @Property, @Getter, and @Setter are
+mapped to the $Constructor, $Prototype, or main class, depending on the
+value of the annotation's 'where' field. By default, @Property, @Getter,
+and @Setter belong to the main class while @Function methods without
+explicit 'where' field belong to the $Prototype class. The @Constructor
+annotation marks a method to be invoked as JavaScript constructor.
+
+Nasgen enforces all @Function/@Getter/@Setter/@Constructor annotated
+methods to be declared as static. Static final @Property fields remain
+in the main class while other @Property fields are moved to respective
+classes depending on the annotation's 'where' value. For functions
+mapped to the $Prototype or $Constructor class, nasgen also generates
+getters and setters prefixed by G$ and S$, respectively.
+
+Nasgen-generated classes are hidden from normal ClassLoaders by giving
+them a ".clazz" file name extension instead of the standard ".class"
+extension. This allows script classes to be loaded independently by each
+Nashorn context through the com.oracle.nashorn.runtime.StructureLoader
+class loader.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildtools/nasgen/build.xml	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ 
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+ 
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+ 
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ 
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+<project name="nasgen" default="all" basedir=".">
+  <target name="init">
+    <loadproperties srcFile="project.properties"/>
+  </target>
+
+  <target name="prepare" depends="init">
+    <mkdir dir="${build.classes.dir}"/>
+    <mkdir dir="${dist.dir}"/>
+    <mkdir dir="${dist.dir}/lib"/>
+  </target>
+
+  <target name="clean" depends="init">
+    <delete dir="${build.dir}"/>
+    <delete dir="${dist.dir}"/>
+  </target>
+
+  <target name="compile" depends="prepare" description="Compiles the nasgen sources">
+    <javac srcdir="${src.dir}"
+           destdir="${build.classes.dir}"
+           classpath="${javac.classpath}"
+           debug="${javac.debug}"
+           includeantruntime="false">
+      <compilerarg value="-Xlint:unchecked"/>
+      <compilerarg value="-Xlint:deprecation"/>
+      <compilerarg value="-XDignore.symbol.file"/>
+    </javac>
+  </target>
+
+  <target name="jar" depends="compile" description="Creates nasgen.jar">
+    <jar jarfile="${dist.jar}" basedir="${build.classes.dir}" manifest="${meta.inf.dir}/MANIFEST.MF"/>
+  </target>
+
+  <target name="dist" depends="jar"/>
+
+  <target name="all" depends="dist" 
+    description="Builds sources and generates nasgen.jar"/>
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildtools/nasgen/nasgen.iml	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ 
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+ 
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+ 
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ 
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="false">
+    <output url="file://$MODULE_DIR$/build/classes" />
+    <output-test url="file://$MODULE_DIR$/build/test/classes" />
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+      <excludeFolder url="file://$MODULE_DIR$/build" />
+      <excludeFolder url="file://$MODULE_DIR$/dist" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="asm" />
+  </component>
+</module>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildtools/nasgen/project.properties	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,52 @@
+#
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+# 
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+# 
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+# 
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+application.title=nasgen
+
+# source and target levels
+build.compiler=modern
+javac.source=1.7
+javac.target=1.7
+
+build.classes.dir=${build.dir}/classes
+
+# This directory is removed when the project is cleaned:
+build.dir=build
+
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/nasgen.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+
+nashorn.dir=../../
+
+javac.debug=true
+
+javac.classpath=\
+    ${nashorn.dir}/build/classes
+
+meta.inf.dir=${src.dir}/META-INF
+run.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}
+run.jvmargs=
+src.dir=src
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildtools/nasgen/src/META-INF/MANIFEST.MF	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Class-Path: lib/ant-1.7.1.jar
+Main-Class: jdk.nashorn.internal.tools.nasgen.Main
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,334 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.tools.nasgen;
+
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PRIVATE;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKEVIRTUAL;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.CLINIT;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.DEFAULT_INIT_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.GETTER_PREFIX;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.GET_CLASS_NAME;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.GET_CLASS_NAME_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.INIT;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.LOOKUP_NEWPROPERTY;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.LOOKUP_NEWPROPERTY_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.LOOKUP_TYPE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_FIELD_NAME;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_NEWMAP;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_NEWMAP_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_TYPE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTIONIMPL_MAKEFUNCTION;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTIONIMPL_MAKEFUNCTION_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTIONIMPL_MAKEFUNCTION_SPECS_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTIONIMPL_TYPE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETARITY;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETARITY_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_TYPE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SETTER_PREFIX;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.TYPE_OBJECT;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.List;
+import jdk.internal.org.objectweb.asm.ClassReader;
+import jdk.internal.org.objectweb.asm.ClassVisitor;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.FieldVisitor;
+import jdk.internal.org.objectweb.asm.Handle;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import jdk.internal.org.objectweb.asm.Type;
+import jdk.nashorn.internal.tools.nasgen.MemberInfo.Kind;
+
+/**
+ * Base class for class generator classes.
+ *
+ */
+public class ClassGenerator {
+    /** ASM class writer used to output bytecode for this class */
+    protected final ClassWriter cw;
+
+    /**
+     * Constructor
+     */
+    protected ClassGenerator() {
+        this.cw = makeClassWriter();
+    }
+
+    MethodGenerator makeStaticInitializer() {
+        return makeStaticInitializer(cw);
+    }
+
+    MethodGenerator makeConstructor() {
+        return makeConstructor(cw);
+    }
+
+    MethodGenerator makeMethod(final int access, final String name, final String desc) {
+        return makeMethod(cw, access, name, desc);
+    }
+
+    void addMapField() {
+        addMapField(cw);
+    }
+
+    void addField(final String name, final String desc) {
+        addField(cw, name, desc);
+    }
+
+    void addFunctionField(final String name) {
+        addFunctionField(cw, name);
+    }
+
+    void addGetter(final String owner, final MemberInfo memInfo) {
+        addGetter(cw, owner, memInfo);
+    }
+
+    void addSetter(final String owner, final MemberInfo memInfo) {
+        addSetter(cw, owner, memInfo);
+    }
+
+    void emitGetClassName(final String name) {
+        final MethodGenerator mi = makeMethod(ACC_PUBLIC, GET_CLASS_NAME, GET_CLASS_NAME_DESC);
+        mi.loadLiteral(name);
+        mi.returnValue();
+        mi.computeMaxs();
+        mi.visitEnd();
+    }
+
+    static ClassWriter makeClassWriter() {
+        return new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS) {
+            @Override
+            protected String getCommonSuperClass(final String type1, final String type2) {
+                try {
+                    return super.getCommonSuperClass(type1, type2);
+                } catch (final RuntimeException | LinkageError e) {
+                    return StringConstants.OBJECT_TYPE;
+                }
+            }
+        };
+    }
+
+    static MethodGenerator makeStaticInitializer(final ClassVisitor cv) {
+        return makeStaticInitializer(cv, CLINIT);
+    }
+
+    static MethodGenerator makeStaticInitializer(final ClassVisitor cv, final String name) {
+        final int access = ACC_PUBLIC | ACC_STATIC;
+        final String desc = DEFAULT_INIT_DESC;
+        final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null);
+        return new MethodGenerator(mv, access, name, desc);
+    }
+
+    static MethodGenerator makeConstructor(final ClassVisitor cv) {
+        final int access = ACC_PUBLIC;
+        final String name = INIT;
+        final String desc = DEFAULT_INIT_DESC;
+        final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null);
+        return new MethodGenerator(mv, access, name, desc);
+    }
+
+    static MethodGenerator makeMethod(final ClassVisitor cv, final int access, final String name, final String desc) {
+        final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null);
+        return new MethodGenerator(mv, access, name, desc);
+    }
+
+    static void emitStaticInitPrefix(final MethodGenerator mi, final String className) {
+        mi.visitCode();
+        mi.pushNull();
+        mi.putStatic(className, MAP_FIELD_NAME, MAP_DESC);
+        mi.loadClass(className);
+        mi.invokeStatic(MAP_TYPE, MAP_NEWMAP, MAP_NEWMAP_DESC);
+        mi.storeLocal(0);
+    }
+
+    static void emitStaticInitSuffix(final MethodGenerator mi, final String className) {
+        mi.loadLocal(0);
+        mi.putStatic(className, MAP_FIELD_NAME, MAP_DESC);
+        mi.returnVoid();
+        mi.computeMaxs();
+        mi.visitEnd();
+    }
+
+    @SuppressWarnings("fallthrough")
+    private static Type memInfoType(final MemberInfo memInfo) {
+        switch (memInfo.getJavaDesc().charAt(0)) {
+            case 'I': return Type.INT_TYPE;
+            case 'J': return Type.LONG_TYPE;
+            case 'D': return Type.DOUBLE_TYPE;
+            default:  assert false : memInfo.getJavaDesc();
+            case 'L': return TYPE_OBJECT;
+        }
+    }
+
+    private static String getterDesc(final MemberInfo memInfo) {
+        return Type.getMethodDescriptor(memInfoType(memInfo));
+    }
+
+    private static String setterDesc(final MemberInfo memInfo) {
+        return Type.getMethodDescriptor(Type.VOID_TYPE, memInfoType(memInfo));
+    }
+
+    static void addGetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) {
+        final int access = ACC_PUBLIC;
+        final String name = GETTER_PREFIX + memInfo.getJavaName();
+        final String desc = getterDesc(memInfo);
+        final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null);
+        final MethodGenerator mi = new MethodGenerator(mv, access, name, desc);
+        mi.visitCode();
+        if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) {
+            mi.getStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc());
+        } else {
+            mi.loadLocal(0);
+            mi.getField(owner, memInfo.getJavaName(), memInfo.getJavaDesc());
+        }
+        mi.returnValue();
+        mi.computeMaxs();
+        mi.visitEnd();
+    }
+
+    static void addSetter(final ClassVisitor cv, final String owner, final MemberInfo memInfo) {
+        final int access = ACC_PUBLIC;
+        final String name = SETTER_PREFIX + memInfo.getJavaName();
+        final String desc = setterDesc(memInfo);
+        final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null);
+        final MethodGenerator mi = new MethodGenerator(mv, access, name, desc);
+        mi.visitCode();
+        if (memInfo.isStatic() && memInfo.getKind() == Kind.PROPERTY) {
+            mi.loadLocal(1);
+            mi.putStatic(owner, memInfo.getJavaName(), memInfo.getJavaDesc());
+        } else {
+            mi.loadLocal(0);
+            mi.loadLocal(1);
+            mi.putField(owner, memInfo.getJavaName(), memInfo.getJavaDesc());
+        }
+        mi.returnVoid();
+        mi.computeMaxs();
+        mi.visitEnd();
+    }
+
+    static void addMapField(final ClassVisitor cv) {
+        // add a MAP static field
+        final FieldVisitor fv = cv.visitField(ACC_PRIVATE | ACC_STATIC,
+            MAP_FIELD_NAME, MAP_DESC, null, null);
+        if (fv != null) {
+            fv.visitEnd();
+        }
+    }
+
+    static void addField(final ClassVisitor cv, final String name, final String desc) {
+        final FieldVisitor fv = cv.visitField(ACC_PRIVATE, name, desc, null, null);
+        if (fv != null) {
+            fv.visitEnd();
+        }
+    }
+
+    static void addFunctionField(final ClassVisitor cv, final String name) {
+        addField(cv, name, OBJECT_DESC);
+    }
+
+    static void newFunction(final MethodGenerator mi, final String className, final MemberInfo memInfo, final List<MemberInfo> specs) {
+        final boolean arityFound = (memInfo.getArity() != MemberInfo.DEFAULT_ARITY);
+
+        mi.loadLiteral(memInfo.getName());
+        mi.visitLdcInsn(new Handle(H_INVOKESTATIC, className, memInfo.getJavaName(), memInfo.getJavaDesc()));
+
+        assert specs != null;
+        if (!specs.isEmpty()) {
+            mi.memberInfoArray(className, specs);
+            mi.invokeStatic(SCRIPTFUNCTIONIMPL_TYPE, SCRIPTFUNCTIONIMPL_MAKEFUNCTION, SCRIPTFUNCTIONIMPL_MAKEFUNCTION_SPECS_DESC);
+        } else {
+            mi.invokeStatic(SCRIPTFUNCTIONIMPL_TYPE, SCRIPTFUNCTIONIMPL_MAKEFUNCTION, SCRIPTFUNCTIONIMPL_MAKEFUNCTION_DESC);
+        }
+
+        if (arityFound) {
+            mi.dup();
+            mi.push(memInfo.getArity());
+            mi.invokeVirtual(SCRIPTFUNCTION_TYPE, SCRIPTFUNCTION_SETARITY, SCRIPTFUNCTION_SETARITY_DESC);
+        }
+
+    }
+
+    static void linkerAddGetterSetter(final MethodGenerator mi, final String className, final MemberInfo memInfo) {
+        final String propertyName = memInfo.getName();
+        mi.loadLocal(0);
+        mi.loadLiteral(propertyName);
+        // setup flags
+        mi.push(memInfo.getAttributes());
+        // setup getter method handle
+        String javaName = GETTER_PREFIX + memInfo.getJavaName();
+        mi.visitLdcInsn(new Handle(H_INVOKEVIRTUAL, className, javaName, getterDesc(memInfo)));
+        // setup setter method handle
+        if (memInfo.isFinal()) {
+            mi.pushNull();
+        } else {
+            javaName = SETTER_PREFIX + memInfo.getJavaName();
+            mi.visitLdcInsn(new Handle(H_INVOKEVIRTUAL, className, javaName, setterDesc(memInfo)));
+        }
+        mi.invokeStatic(LOOKUP_TYPE, LOOKUP_NEWPROPERTY, LOOKUP_NEWPROPERTY_DESC);
+        mi.storeLocal(0);
+    }
+
+    static void linkerAddGetterSetter(final MethodGenerator mi, final String className, final MemberInfo getter, final MemberInfo setter) {
+        final String propertyName = getter.getName();
+        mi.loadLocal(0);
+        mi.loadLiteral(propertyName);
+        // setup flags
+        mi.push(getter.getAttributes());
+        // setup getter method handle
+        mi.visitLdcInsn(new Handle(H_INVOKESTATIC, className,
+                getter.getJavaName(), getter.getJavaDesc()));
+        // setup setter method handle
+        if (setter == null) {
+            mi.pushNull();
+        } else {
+            mi.visitLdcInsn(new Handle(H_INVOKESTATIC, className,
+                    setter.getJavaName(), setter.getJavaDesc()));
+        }
+        mi.invokeStatic(LOOKUP_TYPE, LOOKUP_NEWPROPERTY, LOOKUP_NEWPROPERTY_DESC);
+        mi.storeLocal(0);
+    }
+
+    static ScriptClassInfo getScriptClassInfo(final String fileName) throws IOException {
+        try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(fileName))) {
+            return getScriptClassInfo(new ClassReader(bis));
+        }
+    }
+
+    static ScriptClassInfo getScriptClassInfo(final byte[] classBuf) {
+        return getScriptClassInfo(new ClassReader(classBuf));
+    }
+
+    private static ScriptClassInfo getScriptClassInfo(final ClassReader reader) {
+        final ScriptClassInfoCollector scic = new ScriptClassInfoCollector();
+        reader.accept(scic, 0);
+        return scic.getScriptClassInfo();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.tools.nasgen;
+
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER;
+import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.V1_7;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.CONSTRUCTOR_SUFFIX;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.DEFAULT_INIT_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.INIT;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_DUPLICATE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_DUPLICATE_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_FIELD_NAME;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_TYPE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_SETCONSTRUCTOR;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_SETCONSTRUCTOR_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_TYPE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTIONIMPL_INIT_DESC3;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTIONIMPL_INIT_DESC4;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTIONIMPL_TYPE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETARITY;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETARITY_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_TYPE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTOBJECT_INIT_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTOBJECT_TYPE;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.List;
+import jdk.internal.org.objectweb.asm.Handle;
+
+/**
+ * This class generates constructor class for a @ClassInfo annotated class.
+ *
+ */
+public class ConstructorGenerator extends ClassGenerator {
+    private final ScriptClassInfo scriptClassInfo;
+    private final String className;
+    private final MemberInfo constructor;
+    private final int memberCount;
+    private final List<MemberInfo> specs;
+
+    ConstructorGenerator(final ScriptClassInfo sci) {
+        this.scriptClassInfo = sci;
+
+        this.className = scriptClassInfo.getConstructorClassName();
+        this.constructor = scriptClassInfo.getConstructor();
+        this.memberCount = scriptClassInfo.getConstructorMemberCount();
+        this.specs = scriptClassInfo.getSpecializedConstructors();
+    }
+
+    byte[] getClassBytes() {
+        // new class extensing from ScriptObject
+        final String superClass = (constructor != null)? SCRIPTFUNCTIONIMPL_TYPE : SCRIPTOBJECT_TYPE;
+        cw.visit(V1_7, ACC_PUBLIC | ACC_SUPER, className, null, superClass, null);
+        if (memberCount > 0) {
+            // add fields
+            emitFields();
+            // add <clinit>
+            emitStaticInitializer();
+        }
+        // add <init>
+        emitConstructor();
+
+        if (constructor == null) {
+            emitGetClassName(scriptClassInfo.getName());
+        }
+
+        cw.visitEnd();
+        return cw.toByteArray();
+    }
+
+    // --Internals only below this point
+    private void emitFields() {
+        // Introduce "Function" type instance fields for each
+        // constructor @Function in script class and introduce instance
+        // fields for each constructor @Property in the script class.
+        for (MemberInfo memInfo : scriptClassInfo.getMembers()) {
+            if (memInfo.isConstructorFunction()) {
+                addFunctionField(memInfo.getJavaName());
+                memInfo = (MemberInfo)memInfo.clone();
+                memInfo.setJavaDesc(OBJECT_DESC);
+                memInfo.setJavaAccess(ACC_PUBLIC);
+                addGetter(className, memInfo);
+                addSetter(className, memInfo);
+            } else if (memInfo.isConstructorProperty()) {
+                if (memInfo.isStaticFinal()) {
+                    addGetter(scriptClassInfo.getJavaName(), memInfo);
+                } else {
+                    addField(memInfo.getJavaName(), memInfo.getJavaDesc());
+                    memInfo = (MemberInfo)memInfo.clone();
+                    memInfo.setJavaAccess(ACC_PUBLIC);
+                    addGetter(className, memInfo);
+                    addSetter(className, memInfo);
+                }
+            }
+        }
+
+        addMapField();
+    }
+
+    private void emitStaticInitializer() {
+        final MethodGenerator mi = makeStaticInitializer();
+        emitStaticInitPrefix(mi, className);
+
+        for (final MemberInfo memInfo : scriptClassInfo.getMembers()) {
+            if (memInfo.isConstructorFunction() || memInfo.isConstructorProperty()) {
+                linkerAddGetterSetter(mi, className, memInfo);
+            } else if (memInfo.isConstructorGetter()) {
+                final MemberInfo setter = scriptClassInfo.findSetter(memInfo);
+                linkerAddGetterSetter(mi, className, memInfo, setter);
+            }
+        }
+        emitStaticInitSuffix(mi, className);
+    }
+
+    private void emitConstructor() {
+        final MethodGenerator mi = makeConstructor();
+        mi.visitCode();
+        callSuper(mi);
+
+        if (memberCount > 0) {
+            // initialize Function type fields
+            initFunctionFields(mi);
+            // initialize data fields
+            initDataFields(mi);
+        }
+
+        if (constructor != null) {
+            final int arity = constructor.getArity();
+            if (arity != MemberInfo.DEFAULT_ARITY) {
+                mi.loadThis();
+                mi.push(arity);
+                mi.invokeVirtual(SCRIPTFUNCTION_TYPE, SCRIPTFUNCTION_SETARITY,
+                        SCRIPTFUNCTION_SETARITY_DESC);
+            }
+        }
+        mi.returnVoid();
+        mi.computeMaxs();
+        mi.visitEnd();
+    }
+
+    private void loadMap(final MethodGenerator mi) {
+        if (memberCount > 0) {
+            mi.getStatic(className, MAP_FIELD_NAME, MAP_DESC);
+            // make sure we use duplicated PropertyMap so that original map
+            // stays intact and so can be used for many globals in same context
+            mi.invokeVirtual(MAP_TYPE, MAP_DUPLICATE, MAP_DUPLICATE_DESC);
+        }
+    }
+
+    private void callSuper(final MethodGenerator mi) {
+        String superClass, superDesc;
+        mi.loadThis();
+        if (constructor == null) {
+            // call ScriptObject.<init>
+            superClass = SCRIPTOBJECT_TYPE;
+            superDesc = (memberCount > 0) ? SCRIPTOBJECT_INIT_DESC : DEFAULT_INIT_DESC;
+            loadMap(mi);
+        } else {
+            // call Function.<init>
+            superClass = SCRIPTFUNCTIONIMPL_TYPE;
+            superDesc = (memberCount > 0) ? SCRIPTFUNCTIONIMPL_INIT_DESC4 : SCRIPTFUNCTIONIMPL_INIT_DESC3;
+            mi.loadLiteral(constructor.getName());
+            mi.visitLdcInsn(new Handle(H_INVOKESTATIC, scriptClassInfo.getJavaName(), constructor.getJavaName(), constructor.getJavaDesc()));
+            loadMap(mi);
+            mi.memberInfoArray(scriptClassInfo.getJavaName(), specs); //pushes null if specs empty
+        }
+
+        mi.invokeSpecial(superClass, INIT, superDesc);
+    }
+
+    private void initFunctionFields(final MethodGenerator mi) {
+        for (final MemberInfo memInfo : scriptClassInfo.getMembers()) {
+            if (!memInfo.isConstructorFunction()) {
+                continue;
+            }
+            mi.loadThis();
+            newFunction(mi, scriptClassInfo.getJavaName(), memInfo, scriptClassInfo.findSpecializations(memInfo.getJavaName()));
+            mi.putField(className, memInfo.getJavaName(), OBJECT_DESC);
+        }
+    }
+
+    private void initDataFields(final MethodGenerator mi) {
+         for (final MemberInfo memInfo : scriptClassInfo.getMembers()) {
+            if (!memInfo.isConstructorProperty() || memInfo.isFinal()) {
+                continue;
+            }
+            final Object value = memInfo.getValue();
+            if (value != null) {
+                mi.loadThis();
+                mi.loadLiteral(value);
+                mi.putField(className, memInfo.getJavaName(), memInfo.getJavaDesc());
+            } else if (!memInfo.getInitClass().isEmpty()) {
+                final String clazz = memInfo.getInitClass();
+                mi.loadThis();
+                mi.newObject(clazz);
+                mi.dup();
+                mi.invokeSpecial(clazz, INIT, DEFAULT_INIT_DESC);
+                mi.putField(className, memInfo.getJavaName(), memInfo.getJavaDesc());
+            }
+        }
+
+        if (constructor != null) {
+            mi.loadThis();
+            final String protoName = scriptClassInfo.getPrototypeClassName();
+            mi.newObject(protoName);
+            mi.dup();
+            mi.invokeSpecial(protoName, INIT, DEFAULT_INIT_DESC);
+            mi.dup();
+            mi.loadThis();
+            mi.invokeStatic(PROTOTYPEOBJECT_TYPE, PROTOTYPEOBJECT_SETCONSTRUCTOR,
+                    PROTOTYPEOBJECT_SETCONSTRUCTOR_DESC);
+            mi.putField(SCRIPTFUNCTION_TYPE, PROTOTYPE, OBJECT_DESC);
+        }
+    }
+
+    /**
+     * Entry point for ConstructorGenerator run separately as an application. Will display
+     * usage. Takes one argument, a class name.
+     * @param args args vector
+     * @throws IOException if class can't be read
+     */
+    public static void main(final String[] args) throws IOException {
+        if (args.length != 1) {
+            System.err.println("Usage: " + ConstructorGenerator.class.getName() + " <class>");
+            System.exit(1);
+        }
+
+        final String className = args[0].replace('.', '/');
+        final ScriptClassInfo sci = getScriptClassInfo(className + ".class");
+        if (sci == null) {
+            System.err.println("No @ScriptClass in " + className);
+            System.exit(2);
+            throw new IOException(); // get rid of warning for sci.verify() below - may be null
+        }
+
+        try {
+            sci.verify();
+        } catch (final Exception e) {
+            System.err.println(e.getMessage());
+            System.exit(3);
+        }
+        final ConstructorGenerator gen = new ConstructorGenerator(sci);
+        try (FileOutputStream fos = new FileOutputStream(className + CONSTRUCTOR_SUFFIX + ".class")) {
+            fos.write(gen.getClassBytes());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/Main.java	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.tools.nasgen;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import jdk.internal.org.objectweb.asm.ClassReader;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.util.CheckClassAdapter;
+
+/**
+ * Main class for the "nasgen" tool.
+ *
+ */
+public class Main {
+    private static final boolean DEBUG = Boolean.getBoolean("nasgen.debug");
+
+    private interface ErrorReporter {
+        public void error(String msg);
+    }
+
+    /**
+     * Public entry point for Nasgen if invoked from command line. Nasgen takes three arguments
+     * in order: input directory, package list, output directory
+     *
+     * @param args argument vector
+     */
+    public static void main(final String[] args) {
+        final ErrorReporter reporter = new ErrorReporter() {
+            @Override
+            public void error(final String msg) {
+                Main.error(msg, 1);
+            }
+        };
+        if (args.length == 3) {
+            processAll(args[0], args[1], args[2], reporter);
+        } else {
+            error("Usage: nasgen <input-dir> <package-list> <output-dir>", 1);
+        }
+    }
+
+    private static void processAll(final String in, final String pkgList, final String out, final ErrorReporter reporter) {
+        final File inDir = new File(in);
+        if (!inDir.exists() || !inDir.isDirectory()) {
+            reporter.error(in + " does not exist or not a directory");
+            return;
+        }
+
+        final File outDir = new File(out);
+        if (!outDir.exists() || !outDir.isDirectory()) {
+            reporter.error(out + " does not exist or not a directory");
+            return;
+        }
+
+        final String[] packages = pkgList.split(":");
+        for (String pkg : packages) {
+            pkg = pkg.replace('.', File.separatorChar);
+            final File dir = new File(inDir, pkg);
+            final File[] classes = dir.listFiles();
+            for (final File clazz : classes) {
+                if (clazz.isFile() && clazz.getName().endsWith(".class")) {
+                    if (! process(clazz, new File(outDir, pkg), reporter)) {
+                        return;
+                    }
+                }
+            }
+        }
+    }
+
+    private static boolean process(final File inFile, final File outDir, final ErrorReporter reporter) {
+        try {
+            byte[] buf = new byte[(int)inFile.length()];
+
+            try (FileInputStream fin = new FileInputStream(inFile)) {
+                fin.read(buf);
+            }
+
+            final ScriptClassInfo sci = ClassGenerator.getScriptClassInfo(buf);
+
+            if (sci != null) {
+                try {
+                    sci.verify();
+                } catch (final Exception e) {
+                    reporter.error(e.getMessage());
+                    return false;
+                }
+
+                // create necessary output package dir
+                outDir.mkdirs();
+
+                // instrument @ScriptClass
+                final ClassWriter writer = ClassGenerator.makeClassWriter();
+                final ClassReader reader = new ClassReader(buf);
+                final ScriptClassInstrumentor inst = new ScriptClassInstrumentor(writer, sci);
+                reader.accept(inst, 0);
+                //noinspection UnusedAssignment
+
+                // write instrumented class
+                try (FileOutputStream fos = new FileOutputStream(new File(outDir, inFile.getName()))) {
+                    buf = writer.toByteArray();
+                    if (DEBUG) {
+                        verify(buf);
+                    }
+                    fos.write(buf);
+                }
+
+                // simple class name without package prefix
+                String simpleName = inFile.getName();
+                simpleName = simpleName.substring(0, simpleName.indexOf(".class"));
+
+                if (sci.getPrototypeMemberCount() > 0) {
+                    // generate prototype class
+                    final PrototypeGenerator protGen = new PrototypeGenerator(sci);
+                    buf = protGen.getClassBytes();
+                    if (DEBUG) {
+                        verify(buf);
+                    }
+                    try (FileOutputStream fos = new FileOutputStream(new File(outDir, simpleName + StringConstants.PROTOTYPE_SUFFIX + ".class"))) {
+                        fos.write(buf);
+                    }
+                }
+
+                if (sci.getConstructorMemberCount() > 0 || sci.getConstructor() != null) {
+                    // generate constructor class
+                    final ConstructorGenerator consGen = new ConstructorGenerator(sci);
+                    buf = consGen.getClassBytes();
+                    if (DEBUG) {
+                        verify(buf);
+                    }
+                    try (FileOutputStream fos = new FileOutputStream(new File(outDir, simpleName + StringConstants.CONSTRUCTOR_SUFFIX + ".class"))) {
+                        fos.write(buf);
+                    }
+                }
+            }
+            return true;
+        } catch (final IOException | RuntimeException e) {
+            if (DEBUG) {
+                e.printStackTrace(System.err);
+            }
+            reporter.error(e.getMessage());
+
+            return false;
+        }
+    }
+
+    private static void verify(final byte[] buf) {
+        final ClassReader cr = new ClassReader(buf);
+        CheckClassAdapter.verify(cr, false, new PrintWriter(System.err));
+    }
+
+    private static void error(final String msg, final int exitCode) {
+        System.err.println(msg);
+        System.exit(exitCode);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MemberInfo.java	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,377 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.tools.nasgen;
+
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_ARRAY_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_DESC;
+
+import jdk.internal.org.objectweb.asm.Opcodes;
+import jdk.internal.org.objectweb.asm.Type;
+import jdk.nashorn.internal.objects.annotations.Where;
+
+/**
+ * Details about a Java method or field annotated with any of the field/method
+ * annotations from the jdk.nashorn.internal.objects.annotations package.
+ */
+public final class MemberInfo implements Cloneable {
+    /**
+     * The different kinds of available class annotations
+     */
+    public static enum Kind {
+        /** This is a script class */
+        SCRIPT_CLASS,
+        /** This is a constructor */
+        CONSTRUCTOR,
+        /** This is a function */
+        FUNCTION,
+        /** This is a getter */
+        GETTER,
+        /** This is a setter */
+        SETTER,
+        /** This is a property */
+        PROPERTY,
+        /** This is a specialized version of a function */
+        SPECIALIZED_FUNCTION,
+        /** This is a specialized version of a constructor */
+        SPECIALIZED_CONSTRUCTOR
+    }
+
+    // keep in sync with jdk.nashorn.internal.objects.annotations.Attribute
+    static final int DEFAULT_ATTRIBUTES = 0x0;
+
+    static final int DEFAULT_ARITY = -2;
+
+    // the kind of the script annotation - one of the above constants
+    private MemberInfo.Kind kind;
+    // script property name
+    private String name;
+    // script property attributes
+    private int attributes;
+    // name of the java member
+    private String javaName;
+    // type descriptor of the java member
+    private String javaDesc;
+    // access bits of the Java field or method
+    private int javaAccess;
+    // initial value for static @Property fields
+    private Object value;
+    // class whose object is created to fill property value
+    private String initClass;
+    // arity of the Function or Constructor
+    private int arity;
+
+    private Where where;
+
+    /**
+     * @return the kind
+     */
+    public Kind getKind() {
+        return kind;
+    }
+
+    /**
+     * @param kind the kind to set
+     */
+    public void setKind(final Kind kind) {
+        this.kind = kind;
+    }
+
+    /**
+     * @return the name
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * @param name the name to set
+     */
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return the attributes
+     */
+    public int getAttributes() {
+        return attributes;
+    }
+
+    /**
+     * @param attributes the attributes to set
+     */
+    public void setAttributes(final int attributes) {
+        this.attributes = attributes;
+    }
+
+    /**
+     * @return the javaName
+     */
+    public String getJavaName() {
+        return javaName;
+    }
+
+    /**
+     * @param javaName the javaName to set
+     */
+    public void setJavaName(final String javaName) {
+        this.javaName = javaName;
+    }
+
+    /**
+     * @return the javaDesc
+     */
+    public String getJavaDesc() {
+        return javaDesc;
+    }
+
+    void setJavaDesc(final String javaDesc) {
+        this.javaDesc = javaDesc;
+    }
+
+    int getJavaAccess() {
+        return javaAccess;
+    }
+
+    void setJavaAccess(final int access) {
+        this.javaAccess = access;
+    }
+
+    Object getValue() {
+        return value;
+    }
+
+    void setValue(final Object value) {
+        this.value = value;
+    }
+
+    Where getWhere() {
+        return where;
+    }
+
+    void setWhere(final Where where) {
+        this.where = where;
+    }
+
+    boolean isFinal() {
+        return (javaAccess & Opcodes.ACC_FINAL) != 0;
+    }
+
+    boolean isStatic() {
+        return (javaAccess & Opcodes.ACC_STATIC) != 0;
+    }
+
+    boolean isStaticFinal() {
+        return isStatic() && isFinal();
+    }
+
+    boolean isInstanceGetter() {
+        return kind == Kind.GETTER && where == Where.INSTANCE;
+    }
+
+    /**
+     * Check whether this MemberInfo is a getter that resides in the instance
+     * @return true if instance setter
+     */
+    boolean isInstanceSetter() {
+        return kind == Kind.SETTER && where == Where.INSTANCE;
+    }
+
+    boolean isInstanceProperty() {
+        return kind == Kind.PROPERTY && where == Where.INSTANCE;
+    }
+
+    boolean isInstanceFunction() {
+        return kind == Kind.FUNCTION && where == Where.INSTANCE;
+    }
+
+    boolean isPrototypeGetter() {
+        return kind == Kind.GETTER && where == Where.PROTOTYPE;
+    }
+
+    boolean isPrototypeSetter() {
+        return kind == Kind.SETTER && where == Where.PROTOTYPE;
+    }
+
+    boolean isPrototypeProperty() {
+        return kind == Kind.PROPERTY && where == Where.PROTOTYPE;
+    }
+
+    boolean isPrototypeFunction() {
+        return kind == Kind.FUNCTION && where == Where.PROTOTYPE;
+    }
+
+    boolean isConstructorGetter() {
+        return kind == Kind.GETTER && where == Where.CONSTRUCTOR;
+    }
+
+    boolean isConstructorSetter() {
+        return kind == Kind.SETTER && where == Where.CONSTRUCTOR;
+    }
+
+    boolean isConstructorProperty() {
+        return kind == Kind.PROPERTY && where == Where.CONSTRUCTOR;
+    }
+
+    boolean isConstructorFunction() {
+        return kind == Kind.FUNCTION && where == Where.CONSTRUCTOR;
+    }
+
+    boolean isConstructor() {
+        return kind == Kind.CONSTRUCTOR;
+    }
+
+    void verify() {
+        if (kind == Kind.CONSTRUCTOR) {
+            final Type returnType = Type.getReturnType(javaDesc);
+            if (! returnType.toString().equals(OBJECT_DESC)) {
+                error("return value should be of Object type, found" + returnType);
+            }
+            final Type[] argTypes = Type.getArgumentTypes(javaDesc);
+            if (argTypes.length < 2) {
+                error("constructor methods should have at least 2 args");
+            }
+            if (! argTypes[0].equals(Type.BOOLEAN_TYPE)) {
+                error("first argument should be of boolean type, found" + argTypes[0]);
+            }
+            if (! argTypes[1].toString().equals(OBJECT_DESC)) {
+                error("second argument should be of Object type, found" + argTypes[0]);
+            }
+
+            if (argTypes.length > 2) {
+                for (int i = 2; i < argTypes.length - 1; i++) {
+                    if (! argTypes[i].toString().equals(OBJECT_DESC)) {
+                        error(i + "'th argument should be of Object type, found " + argTypes[i]);
+                    }
+                }
+
+                final String lastArgType = argTypes[argTypes.length - 1].toString();
+                final boolean isVarArg = lastArgType.equals(OBJECT_ARRAY_DESC);
+                if (!lastArgType.equals(OBJECT_DESC) && !isVarArg) {
+                    error("last argument is neither Object nor Object[] type: " + lastArgType);
+                }
+
+                if (isVarArg && argTypes.length > 3) {
+                    error("vararg constructor has more than 3 arguments");
+                }
+            }
+        } else if (kind == Kind.FUNCTION) {
+            final Type returnType = Type.getReturnType(javaDesc);
+            if (! returnType.toString().equals(OBJECT_DESC)) {
+                error("return value should be of Object type, found" + returnType);
+            }
+            final Type[] argTypes = Type.getArgumentTypes(javaDesc);
+            if (argTypes.length < 1) {
+                error("function methods should have at least 1 arg");
+            }
+            if (! argTypes[0].toString().equals(OBJECT_DESC)) {
+                error("first argument should be of Object type, found" + argTypes[0]);
+            }
+
+            if (argTypes.length > 1) {
+                for (int i = 1; i < argTypes.length - 1; i++) {
+                    if (! argTypes[i].toString().equals(OBJECT_DESC)) {
+                        error(i + "'th argument should be of Object type, found " + argTypes[i]);
+                    }
+                }
+
+                final String lastArgType = argTypes[argTypes.length - 1].toString();
+                final boolean isVarArg = lastArgType.equals(OBJECT_ARRAY_DESC);
+                if (!lastArgType.equals(OBJECT_DESC) && !isVarArg) {
+                    error("last argument is neither Object nor Object[] type: " + lastArgType);
+                }
+
+                if (isVarArg && argTypes.length > 2) {
+                    error("vararg function has more than 2 arguments");
+                }
+            }
+        } else if (kind == Kind.GETTER) {
+            final Type[] argTypes = Type.getArgumentTypes(javaDesc);
+            if (argTypes.length != 1) {
+                error("getter methods should have one argument");
+            }
+            if (! argTypes[0].toString().equals(OBJECT_DESC)) {
+                error("first argument of getter should be of Object type, found: " + argTypes[0]);
+            }
+            if (Type.getReturnType(javaDesc).equals(Type.VOID_TYPE)) {
+                error("return type of getter should not be void");
+            }
+        } else if (kind == Kind.SETTER) {
+            final Type[] argTypes = Type.getArgumentTypes(javaDesc);
+            if (argTypes.length != 2) {
+                error("setter methods should have two arguments");
+            }
+            if (! argTypes[0].toString().equals(OBJECT_DESC)) {
+                error("first argument of setter should be of Object type, found: " + argTypes[0]);
+            }
+            if (!Type.getReturnType(javaDesc).toString().equals("V")) {
+                error("return type of setter should be void, found: " + Type.getReturnType(javaDesc));
+            }
+        }
+    }
+
+    private void error(final String msg) {
+        throw new RuntimeException(javaName + javaDesc + " : " + msg);
+    }
+
+    /**
+     * @return the initClass
+     */
+    String getInitClass() {
+        return initClass;
+    }
+
+    /**
+     * @param initClass the initClass to set
+     */
+    void setInitClass(final String initClass) {
+        this.initClass = initClass;
+    }
+
+    @Override
+    protected Object clone() {
+        try {
+            return super.clone();
+        } catch (final CloneNotSupportedException e) {
+            assert false : "clone not supported " + e;
+            return null;
+        }
+    }
+
+    /**
+     * @return the arity
+     */
+    int getArity() {
+        return arity;
+    }
+
+    /**
+     * @param arity the arity to set
+     */
+    void setArity(final int arity) {
+        this.arity = arity;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,426 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.tools.nasgen;
+
+import static jdk.internal.org.objectweb.asm.Opcodes.AALOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.AASTORE;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACONST_NULL;
+import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.ANEWARRAY;
+import static jdk.internal.org.objectweb.asm.Opcodes.ARETURN;
+import static jdk.internal.org.objectweb.asm.Opcodes.ASM4;
+import static jdk.internal.org.objectweb.asm.Opcodes.ASTORE;
+import static jdk.internal.org.objectweb.asm.Opcodes.BALOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.BASTORE;
+import static jdk.internal.org.objectweb.asm.Opcodes.BIPUSH;
+import static jdk.internal.org.objectweb.asm.Opcodes.CALOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.CASTORE;
+import static jdk.internal.org.objectweb.asm.Opcodes.CHECKCAST;
+import static jdk.internal.org.objectweb.asm.Opcodes.DALOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.DASTORE;
+import static jdk.internal.org.objectweb.asm.Opcodes.DCONST_0;
+import static jdk.internal.org.objectweb.asm.Opcodes.DRETURN;
+import static jdk.internal.org.objectweb.asm.Opcodes.DUP;
+import static jdk.internal.org.objectweb.asm.Opcodes.DUP2;
+import static jdk.internal.org.objectweb.asm.Opcodes.FALOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.FASTORE;
+import static jdk.internal.org.objectweb.asm.Opcodes.FCONST_0;
+import static jdk.internal.org.objectweb.asm.Opcodes.FRETURN;
+import static jdk.internal.org.objectweb.asm.Opcodes.GETFIELD;
+import static jdk.internal.org.objectweb.asm.Opcodes.GETSTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.IALOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.IASTORE;
+import static jdk.internal.org.objectweb.asm.Opcodes.ICONST_0;
+import static jdk.internal.org.objectweb.asm.Opcodes.ILOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESPECIAL;
+import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
+import static jdk.internal.org.objectweb.asm.Opcodes.IRETURN;
+import static jdk.internal.org.objectweb.asm.Opcodes.ISTORE;
+import static jdk.internal.org.objectweb.asm.Opcodes.LALOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.LASTORE;
+import static jdk.internal.org.objectweb.asm.Opcodes.LCONST_0;
+import static jdk.internal.org.objectweb.asm.Opcodes.LRETURN;
+import static jdk.internal.org.objectweb.asm.Opcodes.NEW;
+import static jdk.internal.org.objectweb.asm.Opcodes.POP;
+import static jdk.internal.org.objectweb.asm.Opcodes.PUTFIELD;
+import static jdk.internal.org.objectweb.asm.Opcodes.PUTSTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.RETURN;
+import static jdk.internal.org.objectweb.asm.Opcodes.SALOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.SASTORE;
+import static jdk.internal.org.objectweb.asm.Opcodes.SIPUSH;
+import static jdk.internal.org.objectweb.asm.Opcodes.SWAP;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.METHODHANDLE_TYPE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.TYPE_METHODHANDLE;
+
+import java.util.List;
+import jdk.internal.org.objectweb.asm.Handle;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import jdk.internal.org.objectweb.asm.Type;
+
+/**
+ * Base class for all method generating classes.
+ *
+ */
+public class MethodGenerator extends MethodVisitor {
+    private final int access;
+    private final String name;
+    private final String descriptor;
+    private final Type returnType;
+    private final Type[] argumentTypes;
+
+    MethodGenerator(final MethodVisitor mv, final int access, final String name, final String descriptor) {
+        super(ASM4, mv);
+        this.access        = access;
+        this.name          = name;
+        this.descriptor    = descriptor;
+        this.returnType    = Type.getReturnType(descriptor);
+        this.argumentTypes = Type.getArgumentTypes(descriptor);
+    }
+
+    int getAccess() {
+        return access;
+    }
+
+    final String getName() {
+        return name;
+    }
+
+    final String getDescriptor() {
+        return descriptor;
+    }
+
+    final Type getReturnType() {
+        return returnType;
+    }
+
+    final Type[] getArgumentTypes() {
+        return argumentTypes;
+    }
+
+    /**
+     * Check whether access for this method is static
+     * @return true if static
+     */
+    protected final boolean isStatic() {
+        return (getAccess() & ACC_STATIC) != 0;
+    }
+
+    /**
+     * Check whether this method is a constructor
+     * @return true if constructor
+     */
+    protected final boolean isConstructor() {
+        return "<init>".equals(name);
+    }
+
+    void newObject(final String type) {
+        super.visitTypeInsn(NEW, type);
+    }
+
+    void newObjectArray(final String type) {
+        super.visitTypeInsn(ANEWARRAY, type);
+    }
+
+    void loadThis() {
+        if ((access & ACC_STATIC) != 0) {
+            throw new IllegalStateException("no 'this' inside static method");
+        }
+        super.visitVarInsn(ALOAD, 0);
+    }
+
+    void returnValue() {
+        super.visitInsn(returnType.getOpcode(IRETURN));
+    }
+
+    void returnVoid() {
+        super.visitInsn(RETURN);
+    }
+
+    // load, store
+    void arrayLoad(final Type type) {
+        super.visitInsn(type.getOpcode(IALOAD));
+    }
+
+    void arrayLoad() {
+        super.visitInsn(AALOAD);
+    }
+
+    void arrayStore(final Type type) {
+        super.visitInsn(type.getOpcode(IASTORE));
+    }
+
+    void arrayStore() {
+        super.visitInsn(AASTORE);
+    }
+
+    void loadLiteral(final Object value) {
+        super.visitLdcInsn(value);
+    }
+
+    void classLiteral(final String className) {
+        super.visitLdcInsn(className);
+    }
+
+    void loadLocal(final Type type, final int index) {
+        super.visitVarInsn(type.getOpcode(ILOAD), index);
+    }
+
+    void loadLocal(final int index) {
+        super.visitVarInsn(ALOAD, index);
+    }
+
+    void storeLocal(final Type type, final int index) {
+        super.visitVarInsn(type.getOpcode(ISTORE), index);
+    }
+
+    void storeLocal(final int index) {
+        super.visitVarInsn(ASTORE, index);
+    }
+
+    void checkcast(final String type) {
+        super.visitTypeInsn(CHECKCAST, type);
+    }
+
+    // push constants/literals
+    void pushNull() {
+        super.visitInsn(ACONST_NULL);
+    }
+
+    void push(final int value) {
+        if (value >= -1 && value <= 5) {
+            super.visitInsn(ICONST_0 + value);
+        } else if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE) {
+            super.visitIntInsn(BIPUSH, value);
+        } else if (value >= Short.MIN_VALUE && value <= Short.MAX_VALUE) {
+            super.visitIntInsn(SIPUSH, value);
+        } else {
+            super.visitLdcInsn(value);
+        }
+    }
+
+    void loadClass(final String className) {
+        super.visitLdcInsn(Type.getObjectType(className));
+    }
+
+    void pop() {
+        super.visitInsn(POP);
+    }
+
+    // various "dups"
+    void dup() {
+        super.visitInsn(DUP);
+    }
+
+    void dup2() {
+        super.visitInsn(DUP2);
+    }
+
+    void swap() {
+        super.visitInsn(SWAP);
+    }
+
+    void dupArrayValue(final int arrayOpcode) {
+        switch (arrayOpcode) {
+            case IALOAD: case FALOAD:
+            case AALOAD: case BALOAD:
+            case CALOAD: case SALOAD:
+            case IASTORE: case FASTORE:
+            case AASTORE: case BASTORE:
+            case CASTORE: case SASTORE:
+                dup();
+            break;
+
+            case LALOAD: case DALOAD:
+            case LASTORE: case DASTORE:
+                dup2();
+            break;
+            default:
+                throw new AssertionError("invalid dup");
+        }
+    }
+
+    void dupReturnValue(final int returnOpcode) {
+        switch (returnOpcode) {
+            case IRETURN:
+            case FRETURN:
+            case ARETURN:
+                super.visitInsn(DUP);
+                return;
+            case LRETURN:
+            case DRETURN:
+                super.visitInsn(DUP2);
+                return;
+            case RETURN:
+                return;
+            default:
+                throw new IllegalArgumentException("not return");
+        }
+    }
+
+    void dupValue(final Type type) {
+        switch (type.getSize()) {
+            case 1:
+                dup();
+            break;
+            case 2:
+                dup2();
+            break;
+            default:
+                throw new AssertionError("invalid dup");
+        }
+    }
+
+    void dupValue(final String desc) {
+        final int typeCode = desc.charAt(0);
+        switch (typeCode) {
+            case '[':
+            case 'L':
+            case 'Z':
+            case 'C':
+            case 'B':
+            case 'S':
+            case 'I':
+                super.visitInsn(DUP);
+                break;
+            case 'J':
+            case 'D':
+                super.visitInsn(DUP2);
+                break;
+            default:
+                throw new RuntimeException("invalid signature");
+        }
+    }
+
+    // push default value of given type desc
+    void defaultValue(final String desc) {
+        final int typeCode = desc.charAt(0);
+        switch (typeCode) {
+            case '[':
+            case 'L':
+                super.visitInsn(ACONST_NULL);
+                break;
+            case 'Z':
+            case 'C':
+            case 'B':
+            case 'S':
+            case 'I':
+                super.visitInsn(ICONST_0);
+                break;
+            case 'J':
+                super.visitInsn(LCONST_0);
+                break;
+            case 'F':
+                super.visitInsn(FCONST_0);
+                break;
+            case 'D':
+                super.visitInsn(DCONST_0);
+                break;
+            default:
+                throw new AssertionError("invalid desc " + desc);
+        }
+    }
+
+    // invokes, field get/sets
+    void invokeVirtual(final String owner, final String method, final String desc) {
+        super.visitMethodInsn(INVOKEVIRTUAL, owner, method, desc);
+    }
+
+    void invokeSpecial(final String owner, final String method, final String desc) {
+        super.visitMethodInsn(INVOKESPECIAL, owner, method, desc);
+    }
+
+    void invokeStatic(final String owner, final String method, final String desc) {
+        super.visitMethodInsn(INVOKESTATIC, owner, method, desc);
+    }
+
+    void putStatic(final String owner, final String field, final String desc) {
+        super.visitFieldInsn(PUTSTATIC, owner, field, desc);
+    }
+
+    void getStatic(final String owner, final String field, final String desc) {
+        super.visitFieldInsn(GETSTATIC, owner, field, desc);
+    }
+
+    void putField(final String owner, final String field, final String desc) {
+        super.visitFieldInsn(PUTFIELD, owner, field, desc);
+    }
+
+    void getField(final String owner, final String field, final String desc) {
+        super.visitFieldInsn(GETFIELD, owner, field, desc);
+    }
+
+    void memberInfoArray(final String className, final List<MemberInfo> mis) {
+        if (mis.isEmpty()) {
+            pushNull();
+            return;
+        }
+
+        int pos = 0;
+        push(mis.size());
+        newObjectArray(METHODHANDLE_TYPE);
+        for (final MemberInfo mi : mis) {
+            dup();
+            push(pos++);
+            visitLdcInsn(new Handle(H_INVOKESTATIC, className, mi.getJavaName(), mi.getJavaDesc()));
+            arrayStore(TYPE_METHODHANDLE);
+        }
+    }
+
+    void computeMaxs() {
+        // These values are ignored as we create class writer
+        // with ClassWriter.COMPUTE_MAXS flag.
+        super.visitMaxs(Short.MAX_VALUE, Short.MAX_VALUE);
+    }
+
+    // debugging support - print calls
+    void println(final String msg) {
+        super.visitFieldInsn(GETSTATIC,
+                    "java/lang/System",
+                    "out",
+                    "Ljava/io/PrintStream;");
+        super.visitLdcInsn(msg);
+        super.visitMethodInsn(INVOKEVIRTUAL,
+                    "java/io/PrintStream",
+                    "println",
+                    "(Ljava/lang/String;)V");
+    }
+
+    // print the object on the top of the stack
+    void printObject() {
+        super.visitFieldInsn(GETSTATIC,
+                    "java/lang/System",
+                    "out",
+                    "Ljava/io/PrintStream;");
+        super.visitInsn(SWAP);
+        super.visitMethodInsn(INVOKEVIRTUAL,
+                    "java/io/PrintStream",
+                    "println",
+                    "(Ljava/lang/Object;)V");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/NullVisitor.java	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.tools.nasgen;
+
+import jdk.internal.org.objectweb.asm.AnnotationVisitor;
+import jdk.internal.org.objectweb.asm.ClassVisitor;
+import jdk.internal.org.objectweb.asm.FieldVisitor;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import jdk.internal.org.objectweb.asm.Opcodes;
+
+/**
+ * A visitor that does nothing on visitXXX calls.
+ *
+ */
+public class NullVisitor extends ClassVisitor {
+    NullVisitor() {
+        super(Opcodes.ASM4);
+    }
+
+    @Override
+    public MethodVisitor visitMethod(
+        final int access,
+        final String name,
+        final String desc,
+        final String signature,
+        final String[] exceptions) {
+        return new MethodVisitor(Opcodes.ASM4) {
+            @Override
+            public AnnotationVisitor visitAnnotationDefault() {
+                return new NullAnnotationVisitor();
+            }
+
+            @Override
+            public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
+                return new NullAnnotationVisitor();
+            }
+        };
+    }
+
+    @Override
+    public FieldVisitor visitField(
+        final int access,
+        final String name,
+        final String desc,
+        final String signature,
+        final Object value) {
+        return new FieldVisitor(Opcodes.ASM4) {
+            @Override
+            public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
+                return new NullAnnotationVisitor();
+            }
+        };
+    }
+
+    @Override
+    public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
+        return new NullAnnotationVisitor();
+    }
+
+    private static class NullAnnotationVisitor extends AnnotationVisitor {
+        NullAnnotationVisitor() {
+            super(Opcodes.ASM4);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/PrototypeGenerator.java	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.tools.nasgen;
+
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER;
+import static jdk.internal.org.objectweb.asm.Opcodes.V1_7;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.DEFAULT_INIT_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.INIT;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_DUPLICATE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_DUPLICATE_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_FIELD_NAME;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_TYPE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_TYPE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPE_SUFFIX;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTOBJECT_INIT_DESC;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+/**
+ * This class generates prototype class for a @ClassInfo annotated class.
+ *
+ */
+public class PrototypeGenerator extends ClassGenerator {
+    private final ScriptClassInfo scriptClassInfo;
+    private final String className;
+    private final int memberCount;
+
+    PrototypeGenerator(final ScriptClassInfo sci) {
+        this.scriptClassInfo = sci;
+        this.className = scriptClassInfo.getPrototypeClassName();
+        this.memberCount = scriptClassInfo.getPrototypeMemberCount();
+    }
+
+    byte[] getClassBytes() {
+        // new class extensing from ScriptObject
+        cw.visit(V1_7, ACC_PUBLIC | ACC_SUPER, className, null, PROTOTYPEOBJECT_TYPE, null);
+        if (memberCount > 0) {
+            // add fields
+            emitFields();
+            // add <clinit>
+            emitStaticInitializer();
+        }
+        // add <init>
+        emitConstructor();
+
+        // add getClassName()
+        emitGetClassName(scriptClassInfo.getName());
+
+        cw.visitEnd();
+        return cw.toByteArray();
+    }
+
+    // --Internals only below this point
+    private void emitFields() {
+        // introduce "Function" type instance fields for each
+        // prototype @Function in script class info
+        for (MemberInfo memInfo : scriptClassInfo.getMembers()) {
+            if (memInfo.isPrototypeFunction()) {
+                addFunctionField(memInfo.getJavaName());
+                memInfo = (MemberInfo)memInfo.clone();
+                memInfo.setJavaDesc(OBJECT_DESC);
+                addGetter(className, memInfo);
+                addSetter(className, memInfo);
+            } else if (memInfo.isPrototypeProperty()) {
+                if (memInfo.isStaticFinal()) {
+                    addGetter(scriptClassInfo.getJavaName(), memInfo);
+                } else {
+                    addField(memInfo.getJavaName(), memInfo.getJavaDesc());
+                    memInfo = (MemberInfo)memInfo.clone();
+                    memInfo.setJavaAccess(ACC_PUBLIC);
+                    addGetter(className, memInfo);
+                    addSetter(className, memInfo);
+                }
+            }
+        }
+
+        addMapField();
+    }
+
+    private void emitStaticInitializer() {
+        final MethodGenerator mi = makeStaticInitializer();
+        emitStaticInitPrefix(mi, className);
+        for (final MemberInfo memInfo : scriptClassInfo.getMembers()) {
+            if (memInfo.isPrototypeFunction() || memInfo.isPrototypeProperty()) {
+                linkerAddGetterSetter(mi, className, memInfo);
+            } else if (memInfo.isPrototypeGetter()) {
+                final MemberInfo setter = scriptClassInfo.findSetter(memInfo);
+                linkerAddGetterSetter(mi, className, memInfo, setter);
+            }
+        }
+        emitStaticInitSuffix(mi, className);
+    }
+
+    private void emitConstructor() {
+        final MethodGenerator mi = makeConstructor();
+        mi.visitCode();
+        mi.loadThis();
+        if (memberCount > 0) {
+            // call "super(map$)"
+            mi.getStatic(className, MAP_FIELD_NAME, MAP_DESC);
+            // make sure we use duplicated PropertyMap so that original map
+            // stays intact and so can be used for many globals in same context
+            mi.invokeVirtual(MAP_TYPE, MAP_DUPLICATE, MAP_DUPLICATE_DESC);
+            mi.invokeSpecial(PROTOTYPEOBJECT_TYPE, INIT, SCRIPTOBJECT_INIT_DESC);
+            // initialize Function type fields
+            initFunctionFields(mi);
+        } else {
+            // call "super()"
+            mi.invokeSpecial(PROTOTYPEOBJECT_TYPE, INIT, DEFAULT_INIT_DESC);
+        }
+        mi.returnVoid();
+        mi.computeMaxs();
+        mi.visitEnd();
+    }
+
+    private void initFunctionFields(final MethodGenerator mi) {
+        for (final MemberInfo memInfo : scriptClassInfo.getMembers()) {
+            if (! memInfo.isPrototypeFunction()) {
+                continue;
+            }
+            mi.loadThis();
+            newFunction(mi, scriptClassInfo.getJavaName(), memInfo, scriptClassInfo.findSpecializations(memInfo.getJavaName()));
+            mi.putField(className, memInfo.getJavaName(), OBJECT_DESC);
+        }
+    }
+
+    /**
+     * External entry point for PrototypeGenerator if called from the command line
+     *
+     * @param args arguments, takes 1 argument which is the class to process
+     * @throws IOException if class cannot be read
+     */
+    public static void main(final String[] args) throws IOException {
+        if (args.length != 1) {
+            System.err.println("Usage: " + ConstructorGenerator.class.getName() + " <class>");
+            System.exit(1);
+        }
+
+        final String className = args[0].replace('.', '/');
+        final ScriptClassInfo sci = getScriptClassInfo(className + ".class");
+        if (sci == null) {
+            System.err.println("No @ScriptClass in " + className);
+            System.exit(2);
+            throw new AssertionError(); //guard against warning that sci is null below
+        }
+        try {
+            sci.verify();
+        } catch (final Exception e) {
+            System.err.println(e.getMessage());
+            System.exit(3);
+        }
+        final PrototypeGenerator gen = new PrototypeGenerator(sci);
+        try (FileOutputStream fos = new FileOutputStream(className + PROTOTYPE_SUFFIX + ".class")) {
+            fos.write(gen.getClassBytes());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfo.java	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.tools.nasgen;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import jdk.internal.org.objectweb.asm.Type;
+import jdk.nashorn.internal.objects.annotations.Constructor;
+import jdk.nashorn.internal.objects.annotations.Function;
+import jdk.nashorn.internal.objects.annotations.Getter;
+import jdk.nashorn.internal.objects.annotations.Property;
+import jdk.nashorn.internal.objects.annotations.ScriptClass;
+import jdk.nashorn.internal.objects.annotations.Setter;
+import jdk.nashorn.internal.objects.annotations.SpecializedConstructor;
+import jdk.nashorn.internal.objects.annotations.SpecializedFunction;
+import jdk.nashorn.internal.objects.annotations.Where;
+import jdk.nashorn.internal.tools.nasgen.MemberInfo.Kind;
+
+/**
+ * All annotation information from a class that is annotated with
+ * the annotation com.sun.oracle.objects.annotations.ScriptClass.
+ *
+ */
+public final class ScriptClassInfo {
+    // descriptots for various annotations
+    static final String SCRIPT_CLASS_ANNO_DESC  = Type.getDescriptor(ScriptClass.class);
+    static final String CONSTRUCTOR_ANNO_DESC   = Type.getDescriptor(Constructor.class);
+    static final String FUNCTION_ANNO_DESC      = Type.getDescriptor(Function.class);
+    static final String GETTER_ANNO_DESC        = Type.getDescriptor(Getter.class);
+    static final String SETTER_ANNO_DESC        = Type.getDescriptor(Setter.class);
+    static final String PROPERTY_ANNO_DESC      = Type.getDescriptor(Property.class);
+    static final String WHERE_ENUM_DESC         = Type.getDescriptor(Where.class);
+    static final String SPECIALIZED_FUNCTION    = Type.getDescriptor(SpecializedFunction.class);
+    static final String SPECIALIZED_CONSTRUCTOR = Type.getDescriptor(SpecializedConstructor.class);
+
+    static final Map<String, Kind> annotations = new HashMap<>();
+
+    static {
+        annotations.put(SCRIPT_CLASS_ANNO_DESC, Kind.SCRIPT_CLASS);
+        annotations.put(FUNCTION_ANNO_DESC, Kind.FUNCTION);
+        annotations.put(CONSTRUCTOR_ANNO_DESC, Kind.CONSTRUCTOR);
+        annotations.put(GETTER_ANNO_DESC, Kind.GETTER);
+        annotations.put(SETTER_ANNO_DESC, Kind.SETTER);
+        annotations.put(PROPERTY_ANNO_DESC, Kind.PROPERTY);
+        annotations.put(SPECIALIZED_FUNCTION, Kind.SPECIALIZED_FUNCTION);
+        annotations.put(SPECIALIZED_CONSTRUCTOR, Kind.SPECIALIZED_CONSTRUCTOR);
+    }
+
+    // name of the script class
+    private String name;
+    // member info for script properties
+    private List<MemberInfo> members = Collections.emptyList();
+    // java class name that is annotated with @ScriptClass
+    private String javaName;
+
+    /**
+     * @return the name
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * @param name the name to set
+     */
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return the members
+     */
+    public List<MemberInfo> getMembers() {
+        return Collections.unmodifiableList(members);
+    }
+
+    /**
+     * @param members the members to set
+     */
+    public void setMembers(final List<MemberInfo> members) {
+        this.members = members;
+    }
+
+    MemberInfo getConstructor() {
+        for (final MemberInfo memInfo : members) {
+            if (memInfo.getKind() == Kind.CONSTRUCTOR) {
+                return memInfo;
+            }
+        }
+        return null;
+    }
+
+    List<MemberInfo> getSpecializedConstructors() {
+        final List<MemberInfo> res = new LinkedList<>();
+        for (final MemberInfo memInfo : members) {
+            if (memInfo.getKind() == Kind.SPECIALIZED_CONSTRUCTOR) {
+                res.add(memInfo);
+            }
+        }
+        return res;
+    }
+
+    int getPrototypeMemberCount() {
+        int count = 0;
+        for (final MemberInfo memInfo : members) {
+            if (memInfo.getWhere() == Where.PROTOTYPE || memInfo.isConstructor()) {
+                count++;
+            }
+        }
+        return count;
+    }
+
+    int getConstructorMemberCount() {
+        int count = 0;
+        for (final MemberInfo memInfo : members) {
+            if (memInfo.getWhere() == Where.CONSTRUCTOR) {
+                count++;
+            }
+        }
+        return count;
+    }
+
+    int getInstancePropertyCount() {
+        int count = 0;
+        for (final MemberInfo memInfo : members) {
+            if (memInfo.getWhere() == Where.INSTANCE) {
+                count++;
+            }
+        }
+        return count;
+    }
+
+    MemberInfo find(final String findJavaName, final String findJavaDesc, final int findAccess) {
+        for (final MemberInfo memInfo : members) {
+            if (memInfo.getJavaName().equals(findJavaName) &&
+                memInfo.getJavaDesc().equals(findJavaDesc) &&
+                memInfo.getJavaAccess() == findAccess) {
+                return memInfo;
+            }
+        }
+        return null;
+    }
+
+    List<MemberInfo> findSpecializations(final String methodName) {
+        final List<MemberInfo> res = new LinkedList<>();
+        for (final MemberInfo memInfo : members) {
+            if (memInfo.getName().equals(methodName) &&
+                memInfo.getKind() == Kind.SPECIALIZED_FUNCTION) {
+                res.add(memInfo);
+            }
+        }
+        return res;
+    }
+
+    MemberInfo findSetter(final MemberInfo getter) {
+        assert getter.getKind() == Kind.GETTER : "getter expected";
+        final String getterName = getter.getName();
+        final Where getterWhere = getter.getWhere();
+        for (final MemberInfo memInfo : members) {
+            if (memInfo.getKind() == Kind.SETTER &&
+                getterName.equals(memInfo.getName()) &&
+                getterWhere == memInfo.getWhere()) {
+                return memInfo;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * @return the javaName
+     */
+    public String getJavaName() {
+        return javaName;
+    }
+
+    /**
+     * @param javaName the javaName to set
+     */
+    void setJavaName(final String javaName) {
+        this.javaName = javaName;
+    }
+
+    String getConstructorClassName() {
+        return getJavaName() + StringConstants.CONSTRUCTOR_SUFFIX;
+    }
+
+    String getPrototypeClassName() {
+        return getJavaName() + StringConstants.PROTOTYPE_SUFFIX;
+    }
+
+    void verify() {
+        boolean constructorSeen = false;
+        for (final MemberInfo memInfo : getMembers()) {
+            if (memInfo.isConstructor()) {
+                if (constructorSeen) {
+                    error("more than @Constructor method");
+                }
+                constructorSeen = true;
+            }
+            try {
+                memInfo.verify();
+            } catch (final Exception e) {
+                error(e.getMessage());
+            }
+        }
+    }
+
+    private void error(final String msg) throws RuntimeException {
+        throw new RuntimeException(javaName + " : " + msg);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInfoCollector.java	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,331 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.tools.nasgen;
+
+import static jdk.nashorn.internal.tools.nasgen.ScriptClassInfo.SCRIPT_CLASS_ANNO_DESC;
+import static jdk.nashorn.internal.tools.nasgen.ScriptClassInfo.WHERE_ENUM_DESC;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import jdk.internal.org.objectweb.asm.AnnotationVisitor;
+import jdk.internal.org.objectweb.asm.ClassReader;
+import jdk.internal.org.objectweb.asm.ClassVisitor;
+import jdk.internal.org.objectweb.asm.FieldVisitor;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import jdk.internal.org.objectweb.asm.Opcodes;
+import jdk.nashorn.internal.objects.annotations.Where;
+import jdk.nashorn.internal.tools.nasgen.MemberInfo.Kind;
+
+/**
+ * This class collects all @ScriptClass and other annotation information from a
+ * compiled .class file. Enforces that @Function/@Getter/@Setter/@Constructor
+ * methods are declared to be 'static'.
+ */
+public class ScriptClassInfoCollector extends ClassVisitor {
+    private String scriptClassName;
+    private List<MemberInfo> scriptMembers;
+    private String javaClassName;
+
+    ScriptClassInfoCollector(final ClassVisitor visitor) {
+        super(Opcodes.ASM4, visitor);
+    }
+
+    ScriptClassInfoCollector() {
+        this(new NullVisitor());
+    }
+
+    private void addScriptMember(final MemberInfo memInfo) {
+        if (scriptMembers == null) {
+            scriptMembers = new ArrayList<>();
+        }
+        scriptMembers.add(memInfo);
+    }
+
+    @Override
+    public void visit(final int version, final int access, final String name, final String signature,
+           final String superName, final String[] interfaces) {
+        super.visit(version, access, name, signature, superName, interfaces);
+        javaClassName = name;
+    }
+
+    @Override
+    public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
+        final AnnotationVisitor delegateAV = super.visitAnnotation(desc, visible);
+        if (SCRIPT_CLASS_ANNO_DESC.equals(desc)) {
+            return new AnnotationVisitor(Opcodes.ASM4, delegateAV) {
+                @Override
+                public void visit(final String name, final Object value) {
+                    if ("value".equals(name)) {
+                        scriptClassName = (String) value;
+                    }
+                    super.visit(name, value);
+                }
+            };
+        }
+
+        return delegateAV;
+    }
+
+    @Override
+    public FieldVisitor visitField(final int fieldAccess, final String fieldName, final String fieldDesc, final String signature, final Object value) {
+        final FieldVisitor delegateFV = super.visitField(fieldAccess, fieldName, fieldDesc, signature, value);
+
+        return new FieldVisitor(Opcodes.ASM4, delegateFV) {
+            @Override
+            public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
+                final AnnotationVisitor delegateAV = super.visitAnnotation(descriptor, visible);
+
+                if (ScriptClassInfo.PROPERTY_ANNO_DESC.equals(descriptor)) {
+                    final MemberInfo memInfo = new MemberInfo();
+
+                    memInfo.setKind(Kind.PROPERTY);
+                    memInfo.setJavaName(fieldName);
+                    memInfo.setJavaDesc(fieldDesc);
+                    memInfo.setJavaAccess(fieldAccess);
+
+                    if ((fieldAccess & Opcodes.ACC_STATIC) != 0) {
+                        memInfo.setValue(value);
+                    }
+
+                    addScriptMember(memInfo);
+
+                    return new AnnotationVisitor(Opcodes.ASM4, delegateAV) {
+                        // These could be "null" if values are not suppiled,
+                        // in which case we have to use the default values.
+                        private String  name;
+                        private Integer attributes;
+                        private String  clazz = "";
+                        private Where   where;
+
+                        @Override
+                        public void visit(final String annotationName, final Object annotationValue) {
+                            switch (annotationName) {
+                            case "name":
+                                this.name = (String) annotationValue;
+                                break;
+                            case "attributes":
+                                this.attributes = (Integer) annotationValue;
+                                break;
+                            case "clazz":
+                                this.clazz = (annotationValue == null) ? "" : annotationValue.toString();
+                                break;
+                            default:
+                                break;
+                            }
+                            super.visit(annotationName, annotationValue);
+                        }
+
+                        @Override
+                        public void visitEnum(final String enumName, final String desc, final String enumValue) {
+                            if ("where".equals(enumName) && WHERE_ENUM_DESC.equals(desc)) {
+                                this.where = Where.valueOf(enumValue);
+                            }
+                            super.visitEnum(enumName, desc, enumValue);
+                        }
+
+                        @Override
+                        public void visitEnd() {
+                            super.visitEnd();
+                            memInfo.setName(name == null ? fieldName : name);
+                            memInfo.setAttributes(attributes == null
+                                    ? MemberInfo.DEFAULT_ATTRIBUTES : attributes);
+                            clazz = clazz.replace('.', '/');
+                            memInfo.setInitClass(clazz);
+                            memInfo.setWhere(where == null? Where.INSTANCE : where);
+                        }
+                    };
+                }
+
+                return delegateAV;
+            }
+        };
+    }
+
+    private void error(final String javaName, final String javaDesc, final String msg) {
+        throw new RuntimeException(scriptClassName + "." + javaName + javaDesc + " : " + msg);
+    }
+
+    @Override
+    public MethodVisitor visitMethod(final int methodAccess, final String methodName,
+            final String methodDesc, final String signature, final String[] exceptions) {
+
+        final MethodVisitor delegateMV = super.visitMethod(methodAccess, methodName, methodDesc,
+                signature, exceptions);
+
+        return new MethodVisitor(Opcodes.ASM4, delegateMV) {
+
+            @Override
+            public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
+                final AnnotationVisitor delegateAV = super.visitAnnotation(descriptor, visible);
+                final Kind annoKind = ScriptClassInfo.annotations.get(descriptor);
+
+                if (annoKind != null) {
+                    if ((methodAccess & Opcodes.ACC_STATIC) == 0) {
+                        error(methodName, methodDesc, "nasgen method annotations cannot be on instance methods");
+                    }
+
+                    final MemberInfo memInfo = new MemberInfo();
+
+                    memInfo.setKind(annoKind);
+                    memInfo.setJavaName(methodName);
+                    memInfo.setJavaDesc(methodDesc);
+                    memInfo.setJavaAccess(methodAccess);
+
+                    addScriptMember(memInfo);
+
+                    return new AnnotationVisitor(Opcodes.ASM4, delegateAV) {
+                        // These could be "null" if values are not suppiled,
+                        // in which case we have to use the default values.
+                        private String  name;
+                        private Integer attributes;
+                        private Integer arity;
+                        private Where   where;
+
+                        @Override
+                        public void visit(final String annotationName, final Object annotationValue) {
+                            switch (annotationName) {
+                            case "name":
+                                this.name = (String)annotationValue;
+                                break;
+                            case "attributes":
+                                this.attributes = (Integer)annotationValue;
+                                break;
+                            case "arity":
+                                this.arity = (Integer)annotationValue;
+                                break;
+                            default:
+                                break;
+                            }
+
+                            super.visit(annotationName, annotationValue);
+                        }
+
+                        @Override
+                        public void visitEnum(final String enumName, final String desc, final String enumValue) {
+                            if ("where".equals(enumName) && WHERE_ENUM_DESC.equals(desc)) {
+                                this.where = Where.valueOf(enumValue);
+                            }
+                            super.visitEnum(enumName, desc, enumValue);
+                        }
+
+                        @Override
+                        public void visitEnd() {
+                            super.visitEnd();
+
+                            if (memInfo.getKind() == Kind.CONSTRUCTOR) {
+                                memInfo.setName(name == null ? scriptClassName : name);
+                            } else {
+                                memInfo.setName(name == null ? methodName : name);
+                            }
+                            memInfo.setAttributes(attributes == null ? MemberInfo.DEFAULT_ATTRIBUTES : attributes);
+
+                            memInfo.setArity((arity == null)? MemberInfo.DEFAULT_ARITY : arity);
+                            if (where == null) {
+                                // by default @Getter/@Setter belongs to INSTANCE
+                                // @Function belong to PROTOTYPE.
+                                switch (memInfo.getKind()) {
+                                    case GETTER:
+                                    case SETTER:
+                                        where = Where.INSTANCE;
+                                        break;
+                                    case SPECIALIZED_CONSTRUCTOR:
+                                    case CONSTRUCTOR:
+                                        where = Where.CONSTRUCTOR;
+                                        break;
+                                    case FUNCTION:
+                                        where = Where.PROTOTYPE;
+                                        break;
+                                    case SPECIALIZED_FUNCTION:
+                                        //TODO is this correct
+                                    default:
+                                        break;
+                                }
+                            }
+                            memInfo.setWhere(where);
+                        }
+                    };
+                }
+
+                return delegateAV;
+            }
+        };
+    }
+
+    ScriptClassInfo getScriptClassInfo() {
+        ScriptClassInfo sci = null;
+        if (scriptClassName != null) {
+            sci = new ScriptClassInfo();
+            sci.setName(scriptClassName);
+            if (scriptMembers == null) {
+                scriptMembers = Collections.emptyList();
+            }
+            sci.setMembers(scriptMembers);
+            sci.setJavaName(javaClassName);
+        }
+        return sci;
+    }
+
+    /**
+     * External entry point for ScriptClassInfoCollector if invoked from the command line
+     * @param args argument vector, args contains a class for which to collect info
+     * @throws IOException if there were problems parsing args or class
+     */
+    public static void main(final String[] args) throws IOException {
+        if (args.length != 1) {
+            System.err.println("Usage: " + ScriptClassInfoCollector.class.getName() + " <class>");
+            System.exit(1);
+        }
+
+        args[0] = args[0].replace('.', '/');
+        final ScriptClassInfoCollector scic = new ScriptClassInfoCollector();
+        try (final BufferedInputStream bis = new BufferedInputStream(new FileInputStream(args[0] + ".class"))) {
+            final ClassReader reader = new ClassReader(bis);
+            reader.accept(scic, 0);
+        }
+        final ScriptClassInfo sci = scic.getScriptClassInfo();
+        final PrintStream out = System.out;
+        if (sci != null) {
+            out.println("script class: " + sci.getName());
+            out.println("===================================");
+            for (final MemberInfo memInfo : sci.getMembers()) {
+                out.println("kind : " + memInfo.getKind());
+                out.println("name : " + memInfo.getName());
+                out.println("attributes: " + memInfo.getAttributes());
+                out.println("javaName: " + memInfo.getJavaName());
+                out.println("javaDesc: " + memInfo.getJavaDesc());
+                out.println("where: " + memInfo.getWhere());
+                out.println("=====================================");
+            }
+        } else {
+            out.println(args[0] + " is not a @ScriptClass");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,309 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.tools.nasgen;
+
+import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD;
+import static jdk.internal.org.objectweb.asm.Opcodes.DUP;
+import static jdk.internal.org.objectweb.asm.Opcodes.GETSTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESPECIAL;
+import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESTATIC;
+import static jdk.internal.org.objectweb.asm.Opcodes.NEW;
+import static jdk.internal.org.objectweb.asm.Opcodes.PUTFIELD;
+import static jdk.internal.org.objectweb.asm.Opcodes.RETURN;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.$CLINIT$;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.CLINIT;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.DEFAULT_INIT_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.INIT;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.MAP_FIELD_NAME;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.OBJECT_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTOBJECT_INIT_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTOBJECT_TYPE;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import jdk.internal.org.objectweb.asm.AnnotationVisitor;
+import jdk.internal.org.objectweb.asm.Attribute;
+import jdk.internal.org.objectweb.asm.ClassReader;
+import jdk.internal.org.objectweb.asm.ClassVisitor;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.FieldVisitor;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import jdk.internal.org.objectweb.asm.Opcodes;
+import jdk.internal.org.objectweb.asm.util.CheckClassAdapter;
+import jdk.nashorn.internal.objects.annotations.Where;
+import jdk.nashorn.internal.tools.nasgen.MemberInfo.Kind;
+
+/**
+ * This class instruments the java class annotated with @ScriptClass.
+ *
+ * Changes done are:
+ *
+ * 1) remove all jdk.nashorn.internal.objects.annotations.* annotations.
+ * 2) static final @Property fields stay here. Other @Property fields moved to
+ *    respective classes depending on 'where' value of annotation.
+ * 2) add "Map" type static field named "$map".
+ * 3) add static initializer block to initialize map.
+ */
+
+public class ScriptClassInstrumentor extends ClassVisitor {
+    private final ScriptClassInfo scriptClassInfo;
+    private final int memberCount;
+    private boolean staticInitFound;
+
+    ScriptClassInstrumentor(final ClassVisitor visitor, final ScriptClassInfo sci) {
+        super(Opcodes.ASM4, visitor);
+        if (sci == null) {
+            throw new IllegalArgumentException("Null ScriptClassInfo, is the class annotated?");
+        }
+        this.scriptClassInfo = sci;
+        this.memberCount = scriptClassInfo.getInstancePropertyCount();
+    }
+
+    @Override
+    public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
+        if (ScriptClassInfo.annotations.containsKey(desc)) {
+            // ignore @ScriptClass
+            return null;
+        }
+
+        return super.visitAnnotation(desc, visible);
+    }
+
+    @Override
+    public FieldVisitor visitField(final int fieldAccess, final String fieldName,
+            final String fieldDesc, final String signature, final Object value) {
+        final MemberInfo memInfo = scriptClassInfo.find(fieldName, fieldDesc, fieldAccess);
+        if (memInfo != null && memInfo.getKind() == Kind.PROPERTY &&
+                memInfo.getWhere() != Where.INSTANCE && !memInfo.isStaticFinal()) {
+            // non-instance @Property fields - these have to go elsewhere unless 'static final'
+            return null;
+        }
+
+        final FieldVisitor delegateFV = super.visitField(fieldAccess, fieldName, fieldDesc,
+                signature, value);
+        return new FieldVisitor(Opcodes.ASM4, delegateFV) {
+            @Override
+            public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
+                if (ScriptClassInfo.annotations.containsKey(desc)) {
+                    // ignore script field annotations
+                    return null;
+                }
+
+                return fv.visitAnnotation(desc, visible);
+            }
+
+            @Override
+            public void visitAttribute(final Attribute attr) {
+                fv.visitAttribute(attr);
+            }
+
+            @Override
+            public void visitEnd() {
+                fv.visitEnd();
+            }
+        };
+    }
+
+    @Override
+    public MethodVisitor visitMethod(final int methodAccess, final String methodName,
+            final String methodDesc, final String signature, final String[] exceptions) {
+
+        final boolean isConstructor = INIT.equals(methodName);
+        final boolean isStaticInit  = CLINIT.equals(methodName);
+
+        if (isStaticInit) {
+            staticInitFound = true;
+        }
+
+        final MethodGenerator delegateMV = new MethodGenerator(super.visitMethod(methodAccess, methodName, methodDesc,
+                signature, exceptions), methodAccess, methodName, methodDesc);
+
+        return new MethodVisitor(Opcodes.ASM4, delegateMV) {
+            @Override
+            public void visitInsn(final int opcode) {
+                // call $clinit$ just before return from <clinit>
+                if (isStaticInit && opcode == RETURN) {
+                    super.visitMethodInsn(INVOKESTATIC, scriptClassInfo.getJavaName(),
+                            $CLINIT$, DEFAULT_INIT_DESC);
+                }
+                super.visitInsn(opcode);
+            }
+
+            @Override
+            public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) {
+                if (isConstructor && opcode == INVOKESPECIAL &&
+                        INIT.equals(name) && SCRIPTOBJECT_TYPE.equals(owner)) {
+                    super.visitFieldInsn(GETSTATIC, scriptClassInfo.getJavaName(),
+                            MAP_FIELD_NAME, MAP_DESC);
+                    super.visitMethodInsn(INVOKESPECIAL, SCRIPTOBJECT_TYPE, INIT,
+                            SCRIPTOBJECT_INIT_DESC);
+
+                    if (memberCount > 0) {
+                        // initialize @Property fields if needed
+                        for (final MemberInfo memInfo : scriptClassInfo.getMembers()) {
+                            if (memInfo.isInstanceProperty() && !memInfo.getInitClass().isEmpty()) {
+                                final String clazz = memInfo.getInitClass();
+                                super.visitVarInsn(ALOAD, 0);
+                                super.visitTypeInsn(NEW, clazz);
+                                super.visitInsn(DUP);
+                                super.visitMethodInsn(INVOKESPECIAL, clazz,
+                                    INIT, DEFAULT_INIT_DESC);
+                                super.visitFieldInsn(PUTFIELD, scriptClassInfo.getJavaName(),
+                                    memInfo.getJavaName(), memInfo.getJavaDesc());
+                            }
+
+                            if (memInfo.isInstanceFunction()) {
+                                super.visitVarInsn(ALOAD, 0);
+                                ClassGenerator.newFunction(delegateMV, scriptClassInfo.getJavaName(), memInfo, scriptClassInfo.findSpecializations(memInfo.getJavaName()));
+                                super.visitFieldInsn(PUTFIELD, scriptClassInfo.getJavaName(),
+                                    memInfo.getJavaName(), OBJECT_DESC);
+                            }
+                        }
+                    }
+                } else {
+                    super.visitMethodInsn(opcode, owner, name, desc);
+                }
+            }
+
+            @Override
+            public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) {
+                if (ScriptClassInfo.annotations.containsKey(desc)) {
+                    // ignore script method annotations
+                    return null;
+                }
+                return super.visitAnnotation(desc, visible);
+            }
+        };
+    }
+
+    @Override
+    public void visitEnd() {
+        emitFields();
+        emitStaticInitializer();
+        emitGettersSetters();
+        super.visitEnd();
+    }
+
+    private void emitFields() {
+        // introduce "Function" type instance fields for each
+        // instance @Function in script class info
+        final String className = scriptClassInfo.getJavaName();
+        for (MemberInfo memInfo : scriptClassInfo.getMembers()) {
+            if (memInfo.isInstanceFunction()) {
+                ClassGenerator.addFunctionField(cv, memInfo.getJavaName());
+                memInfo = (MemberInfo)memInfo.clone();
+                memInfo.setJavaDesc(OBJECT_DESC);
+                ClassGenerator.addGetter(cv, className, memInfo);
+                ClassGenerator.addSetter(cv, className, memInfo);
+            }
+        }
+        ClassGenerator.addMapField(this);
+    }
+
+    void emitGettersSetters() {
+        if (memberCount > 0) {
+            for (final MemberInfo memInfo : scriptClassInfo.getMembers()) {
+                final String className = scriptClassInfo.getJavaName();
+                if (memInfo.isInstanceProperty()) {
+                    ClassGenerator.addGetter(cv, className, memInfo);
+                    if (! memInfo.isFinal()) {
+                        ClassGenerator.addSetter(cv, className, memInfo);
+                    }
+                }
+            }
+        }
+    }
+
+    private void emitStaticInitializer() {
+        final String className = scriptClassInfo.getJavaName();
+        if (! staticInitFound) {
+            // no user written <clinit> and so create one
+            final MethodVisitor mv = ClassGenerator.makeStaticInitializer(this);
+            mv.visitCode();
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(Short.MAX_VALUE, 0);
+            mv.visitEnd();
+        }
+        // Now generate $clinit$
+        final MethodGenerator mi = ClassGenerator.makeStaticInitializer(this, $CLINIT$);
+        ClassGenerator.emitStaticInitPrefix(mi, className);
+        if (memberCount > 0) {
+            for (final MemberInfo memInfo : scriptClassInfo.getMembers()) {
+                if (memInfo.isInstanceProperty() || memInfo.isInstanceFunction()) {
+                    ClassGenerator.linkerAddGetterSetter(mi, className, memInfo);
+                } else if (memInfo.isInstanceGetter()) {
+                    final MemberInfo setter = scriptClassInfo.findSetter(memInfo);
+                    ClassGenerator.linkerAddGetterSetter(mi, className, memInfo, setter);
+                }
+            }
+        }
+        ClassGenerator.emitStaticInitSuffix(mi, className);
+    }
+
+    /**
+     * External entry point for ScriptClassInfoCollector if run from the command line
+     *
+     * @param args arguments - one argument is needed, the name of the class to collect info from
+     *
+     * @throws IOException if there are problems reading class
+     */
+    public static void main(final String[] args) throws IOException {
+        if (args.length != 1) {
+            System.err.println("Usage: " + ScriptClassInfoCollector.class.getName() + " <class>");
+            System.exit(1);
+        }
+
+        final String fileName = args[0].replace('.', '/') + ".class";
+        final ScriptClassInfo sci = ClassGenerator.getScriptClassInfo(fileName);
+        if (sci == null) {
+            System.err.println("No @ScriptClass in " + fileName);
+            System.exit(2);
+            throw new AssertionError(); //guard against warning that sci is null below
+        }
+
+        try {
+            sci.verify();
+        } catch (final Exception e) {
+            System.err.println(e.getMessage());
+            System.exit(3);
+        }
+
+        final ClassWriter writer = ClassGenerator.makeClassWriter();
+        try (final BufferedInputStream bis = new BufferedInputStream(new FileInputStream(fileName))) {
+            final ClassReader reader = new ClassReader(bis);
+            final CheckClassAdapter checker = new CheckClassAdapter(writer);
+            final ScriptClassInstrumentor instr = new ScriptClassInstrumentor(checker, sci);
+            reader.accept(instr, 0);
+        }
+
+        try (FileOutputStream fos = new FileOutputStream(fileName)) {
+            fos.write(writer.toByteArray());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/StringConstants.java	Fri Dec 21 16:36:24 2012 -0400
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.