├── .circleci └── config.yml ├── .eslintignore ├── .eslintrc ├── .flowconfig ├── .gitignore ├── .gitmodules ├── .prettierrc ├── .watchmanconfig ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── PATENTS ├── README.md ├── assets ├── PrepackLogo.png ├── PrepackLogo.svg ├── PrepackLogoAlt.png ├── PrepackLogoAlt.svg ├── PrepackLogoWithText.png ├── PrepackLogoWithText.svg ├── PrepackLogoWithTextAlt.png ├── PrepackLogoWithTextAlt.svg ├── PrepackLogoWithTextOnDark.png └── PrepackLogoWithTextOnDark.svg ├── babel.config.js ├── bin ├── prepack-repl.js └── prepack.js ├── fb-www └── README.md ├── flow-libs ├── vscode-debugadapter.js.flow └── vscode-debugprotocol.js.flow ├── flow-typed └── npm │ ├── @babel │ ├── cli_vx.x.x.js │ ├── core_vx.x.x.js │ ├── generator_vx.x.x.js │ ├── node_vx.x.x.js │ ├── parser_vx.x.x.js │ ├── plugin-proposal-class-properties_vx.x.x.js │ ├── plugin-proposal-export-default-from_vx.x.x.js │ ├── plugin-proposal-object-rest-spread_vx.x.x.js │ ├── plugin-syntax-flow_vx.x.x.js │ ├── plugin-transform-flow-strip-types_vx.x.x.js │ ├── plugin-transform-modules-commonjs_vx.x.x.js │ ├── plugin-transform-react-jsx_vx.x.x.js │ ├── preset-env_vx.x.x.js │ ├── preset-flow_vx.x.x.js │ ├── preset-react_vx.x.x.js │ ├── register_vx.x.x.js │ ├── template_vx.x.x.js │ └── traverse_vx.x.x.js │ ├── babel-cli_vx.x.x.js │ ├── babel-core_vx.x.x.js │ ├── babel-eslint_vx.x.x.js │ ├── babel-generator_vx.x.x.js │ ├── babel-helper-function-name_vx.x.x.js │ ├── babel-helper-get-function-arity_vx.x.x.js │ ├── babel-jest_vx.x.x.js │ ├── babel-plugin-jest-hoist_vx.x.x.js │ ├── babel-plugin-transform-class-properties_vx.x.x.js │ ├── babel-plugin-transform-object-rest-spread_vx.x.x.js │ ├── babel-preset-es2015_vx.x.x.js │ ├── babel-preset-react_vx.x.x.js │ ├── babel-template_vx.x.x.js │ ├── babel-traverse_vx.x.x.js │ ├── babel-types_vx.x.x.js │ ├── babylon_vx.x.x.js │ ├── chalk_v1.x.x.js │ ├── eslint-config-kittens_vx.x.x.js │ ├── eslint-plugin-babel_vx.x.x.js │ ├── eslint-plugin-flow-header_vx.x.x.js │ ├── eslint-plugin-flowtype_vx.x.x.js │ ├── eslint-plugin-header_vx.x.x.js │ ├── eslint-plugin-prettier_vx.x.x.js │ ├── eslint_vx.x.x.js │ ├── flow-typed_vx.x.x.js │ ├── graceful-fs_v4.1.x.js │ ├── invariant_v2.x.x.js │ ├── istanbul_vx.x.x.js │ ├── jest_v23.x.x.js │ ├── js-beautify_v1.6.x.js │ ├── js-yaml_vx.x.x.js │ ├── jsdom_vx.x.x.js │ ├── madge_vx.x.x.js │ ├── minimist_v1.x.x.js │ ├── node-zip_vx.x.x.js │ ├── prettier_v1.x.x.js │ ├── prop-types_v15.x.x.js │ ├── queue-fifo_vx.x.x.js │ ├── react-native_vx.x.x.js │ ├── react-relay_v1.x.x.js │ ├── regenerator-runtime_vx.x.x.js │ ├── remap-istanbul_vx.x.x.js │ ├── repeating_vx.x.x.js │ ├── seedrandom_vx.x.x.js │ ├── source-map-support_vx.x.x.js │ ├── source-map_vx.x.x.js │ ├── uglify-js_vx.x.x.js │ ├── v8-profiler-node8_vx.x.x.js │ ├── vscode-debugadapter_vx.x.x.js │ ├── vscode-debugprotocol_vx.x.x.js │ ├── webpack-cli_vx.x.x.js │ └── webpack_vx.x.x.js ├── fuzzer ├── .eslintrc ├── .gitignore ├── package.json ├── src │ ├── execute.js │ ├── gen.js │ ├── overnight.js │ ├── property.js │ ├── report.js │ ├── sample.js │ └── test.js └── yarn.lock ├── package.json ├── scripts ├── .eslintrc ├── debug-fb-www.js ├── detect_bad_deps.js ├── generate-sourcemaps-test.js ├── instrumentor.js ├── lint-config.js ├── multi-runner.js ├── prettier.js ├── publish-gh-pages.sh ├── test-error-handler.js ├── test-internal-react.js ├── test-internal.js ├── test-runner.js ├── test-sourcemaps.sh ├── test-std-in.sh ├── test262-filters.yml ├── test262-runner.js └── test262.js ├── src ├── benchmarker.js ├── completions.js ├── construct_realm.js ├── debugger │ ├── adapter │ │ ├── DebugAdapter.js │ │ └── channel │ │ │ └── AdapterChannel.js │ ├── common │ │ ├── DebuggerConstants.js │ │ ├── DebuggerError.js │ │ ├── channel │ │ │ ├── DebugMessage.js │ │ │ ├── FileIOWrapper.js │ │ │ ├── MessageMarshaller.js │ │ │ └── MessagePackager.js │ │ ├── invariant.js │ │ └── types.js │ ├── mock-ui │ │ ├── DataHandler.js │ │ ├── UISession.js │ │ └── debugger-cli.js │ └── server │ │ ├── Breakpoint.js │ │ ├── BreakpointManager.js │ │ ├── Debugger.js │ │ ├── PerFileBreakpointMap.js │ │ ├── ReferenceMap.js │ │ ├── Stepper.js │ │ ├── SteppingManager.js │ │ ├── StopEventManager.js │ │ ├── VariableManager.js │ │ └── channel │ │ └── DebugChannel.js ├── descriptors.js ├── domains │ ├── TypesDomain.js │ ├── ValuesDomain.js │ └── index.js ├── environment.js ├── errors.js ├── evaluators │ ├── ArrayExpression.js │ ├── ArrowFunctionExpression.js │ ├── AssignmentExpression.js │ ├── AwaitExpression.js │ ├── BinaryExpression.js │ ├── BlockStatement.js │ ├── BooleanLiteral.js │ ├── BreakStatement.js │ ├── CallExpression.js │ ├── CatchClause.js │ ├── ClassDeclaration.js │ ├── ClassExpression.js │ ├── ConditionalExpression.js │ ├── ContinueStatement.js │ ├── Directive.js │ ├── DirectiveLiteral.js │ ├── DoExpression.js │ ├── DoWhileStatement.js │ ├── EmptyStatement.js │ ├── ExpressionStatement.js │ ├── File.js │ ├── ForInStatement.js │ ├── ForOfStatement.js │ ├── ForStatement.js │ ├── FunctionDeclaration.js │ ├── FunctionExpression.js │ ├── Identifier.js │ ├── IfStatement.js │ ├── JSXElement.js │ ├── LabeledStatement.js │ ├── LogicalExpression.js │ ├── MemberExpression.js │ ├── MetaProperty.js │ ├── NewExpression.js │ ├── NullLiteral.js │ ├── NumericLiteral.js │ ├── ObjectExpression.js │ ├── Program.js │ ├── RegExpLiteral.js │ ├── ReturnStatement.js │ ├── SequenceExpression.js │ ├── StringLiteral.js │ ├── SuperCall.js │ ├── SuperProperty.js │ ├── SwitchStatement.js │ ├── TaggedTemplateExpression.js │ ├── TemplateLiteral.js │ ├── ThisExpression.js │ ├── ThrowStatement.js │ ├── TryStatement.js │ ├── UnaryExpression.js │ ├── UpdateExpression.js │ ├── VariableDeclaration.js │ ├── WhileStatement.js │ ├── WithStatement.js │ ├── YieldExpression.js │ └── index.js ├── globals.js ├── initialize-singletons.js ├── intrinsics │ ├── common │ │ └── console.js │ ├── dom │ │ ├── document.js │ │ ├── global.js │ │ ├── setInterval.js │ │ └── setTimeout.js │ ├── ecma262 │ │ ├── Array.js │ │ ├── ArrayBuffer.js │ │ ├── ArrayBufferPrototype.js │ │ ├── ArrayIteratorPrototype.js │ │ ├── ArrayProto_toString.js │ │ ├── ArrayProto_values.js │ │ ├── ArrayPrototype.js │ │ ├── Boolean.js │ │ ├── BooleanPrototype.js │ │ ├── DataView.js │ │ ├── DataViewPrototype.js │ │ ├── Date.js │ │ ├── DatePrototype.js │ │ ├── Error.js │ │ ├── ErrorPrototype.js │ │ ├── EvalError.js │ │ ├── EvalErrorPrototype.js │ │ ├── Float32Array.js │ │ ├── Float32ArrayPrototype.js │ │ ├── Float64Array.js │ │ ├── Float64ArrayPrototype.js │ │ ├── Function.js │ │ ├── FunctionPrototype.js │ │ ├── Generator.js │ │ ├── GeneratorFunction.js │ │ ├── GeneratorPrototype.js │ │ ├── Int16Array.js │ │ ├── Int16ArrayPrototype.js │ │ ├── Int32Array.js │ │ ├── Int32ArrayPrototype.js │ │ ├── Int8Array.js │ │ ├── Int8ArrayPrototype.js │ │ ├── IteratorPrototype.js │ │ ├── JSON.js │ │ ├── Map.js │ │ ├── MapIteratorPrototype.js │ │ ├── MapPrototype.js │ │ ├── Math.js │ │ ├── Number.js │ │ ├── NumberPrototype.js │ │ ├── Object.js │ │ ├── ObjectProto_toString.js │ │ ├── ObjectPrototype.js │ │ ├── Promise.js │ │ ├── PromisePrototype.js │ │ ├── Proxy.js │ │ ├── RangeError.js │ │ ├── RangeErrorPrototype.js │ │ ├── ReferenceError.js │ │ ├── ReferenceErrorPrototype.js │ │ ├── Reflect.js │ │ ├── RegExp.js │ │ ├── RegExpPrototype.js │ │ ├── Set.js │ │ ├── SetIteratorPrototype.js │ │ ├── SetPrototype.js │ │ ├── String.js │ │ ├── StringIteratorPrototype.js │ │ ├── StringPrototype.js │ │ ├── Symbol.js │ │ ├── SymbolPrototype.js │ │ ├── SyntaxError.js │ │ ├── SyntaxErrorPrototype.js │ │ ├── ThrowTypeError.js │ │ ├── TypeError.js │ │ ├── TypeErrorPrototype.js │ │ ├── TypedArray.js │ │ ├── TypedArrayProto_values.js │ │ ├── TypedArrayPrototype.js │ │ ├── URIError.js │ │ ├── URIErrorPrototype.js │ │ ├── Uint16Array.js │ │ ├── Uint16ArrayPrototype.js │ │ ├── Uint32Array.js │ │ ├── Uint32ArrayPrototype.js │ │ ├── Uint8Array.js │ │ ├── Uint8ArrayPrototype.js │ │ ├── Uint8ClampedArray.js │ │ ├── Uint8ClampedArrayPrototype.js │ │ ├── WeakMap.js │ │ ├── WeakMapPrototype.js │ │ ├── WeakSet.js │ │ ├── WeakSetPrototype.js │ │ ├── decodeURI.js │ │ ├── decodeURIComponent.js │ │ ├── encodeURI.js │ │ ├── encodeURIComponent.js │ │ ├── eval.js │ │ ├── global.js │ │ ├── isFinite.js │ │ ├── isNaN.js │ │ ├── parseFloat.js │ │ └── parseInt.js │ ├── fb-www │ │ ├── fb-mocks.js │ │ ├── global.js │ │ ├── react-dom-mocks.js │ │ ├── react-mocks.js │ │ ├── react-native-mocks.js │ │ ├── relay-mocks.js │ │ └── utils.js │ ├── index.js │ ├── prepack │ │ ├── __IntrospectionError.js │ │ ├── __IntrospectionErrorPrototype.js │ │ ├── global.js │ │ └── utils.js │ └── react-native │ │ └── global.js ├── invariant.js ├── methods │ ├── abstract.js │ ├── arraybuffer.js │ ├── call.js │ ├── construct.js │ ├── create.js │ ├── date.js │ ├── destructuring.js │ ├── environment.js │ ├── function.js │ ├── generator.js │ ├── get.js │ ├── has.js │ ├── hash.js │ ├── index.js │ ├── integerindexed.js │ ├── integrity.js │ ├── is.js │ ├── iterator.js │ ├── join.js │ ├── json.js │ ├── own.js │ ├── promise.js │ ├── properties.js │ ├── proxy.js │ ├── regexp.js │ ├── to.js │ ├── typedarray.js │ └── widen.js ├── options.js ├── prepack-cli.js ├── prepack-node.js ├── prepack-options.js ├── prepack-standalone.js ├── react │ ├── ReactElementSet.js │ ├── ReactEquivalenceSet.js │ ├── ReactPropsSet.js │ ├── branching.js │ ├── components.js │ ├── elements.js │ ├── errors.js │ ├── experimental-server-rendering │ │ ├── dom-config.js │ │ ├── rendering.js │ │ └── utils.js │ ├── hoisting.js │ ├── jsx.js │ ├── optimizing.js │ ├── reconcilation.js │ └── utils.js ├── realm.js ├── repl-cli.js ├── serializer │ ├── Emitter.js │ ├── GeneratorTree.js │ ├── LazyObjectsSerializer.js │ ├── LoggingTracer.js │ ├── Referentializer.js │ ├── ResidualFunctionInitializers.js │ ├── ResidualFunctionInstantiator.js │ ├── ResidualFunctions.js │ ├── ResidualHeapGraphGenerator.js │ ├── ResidualHeapRefCounter.js │ ├── ResidualHeapSerializer.js │ ├── ResidualHeapValueIdentifiers.js │ ├── ResidualHeapVisitor.js │ ├── ResidualOperationSerializer.js │ ├── ResidualOptimizedFunctions.js │ ├── ResidualReactElementSerializer.js │ ├── ResidualReactElementVisitor.js │ ├── factorify.js │ ├── functions.js │ ├── index.js │ ├── serializer.js │ ├── statistics.js │ ├── types.js │ ├── utils.js │ └── visitors.js ├── singletons.js ├── statistics.js ├── types.js ├── utils.js ├── utils │ ├── ConcreteModelConverter.js │ ├── DebugReproManager.js │ ├── DebugReproPackager.js │ ├── HeapInspector.js │ ├── JSONTokenizer.js │ ├── NameGenerator.js │ ├── PreludeGenerator.js │ ├── ShapeInformation.js │ ├── SourceMapManager.js │ ├── TextPrinter.js │ ├── babelhelpers.js │ ├── errors.js │ ├── flow.js │ ├── generator.js │ ├── internalizer.js │ ├── json.js │ ├── leak.js │ ├── logger.js │ ├── modules.js │ ├── native-to-interp.js │ ├── parse.js │ ├── paths.js │ ├── reachability.js │ ├── simplifier.js │ ├── strict.js │ └── traverse-fast.js └── values │ ├── AbstractObjectValue.js │ ├── AbstractValue.js │ ├── ArgumentsExotic.js │ ├── ArrayValue.js │ ├── BooleanValue.js │ ├── BoundFunctionValue.js │ ├── ConcreteValue.js │ ├── ECMAScriptFunctionValue.js │ ├── ECMAScriptSourceFunctionValue.js │ ├── EmptyValue.js │ ├── FunctionValue.js │ ├── IntegerIndexedExotic.js │ ├── NativeFunctionValue.js │ ├── NullValue.js │ ├── NumberValue.js │ ├── ObjectValue.js │ ├── PrimitiveValue.js │ ├── ProxyValue.js │ ├── StringExotic.js │ ├── StringValue.js │ ├── SymbolValue.js │ ├── UndefinedValue.js │ ├── Value.js │ └── index.js ├── test ├── error-handler │ ├── .write-write-conflict.js.swp │ ├── EmptyBuiltInArrayCycle.js │ ├── EmptyBuiltInPropsCycle.js │ ├── FinalObjectCannotBeMutated.js │ ├── InstantRenderArrayOps3.js │ ├── ModifiedObjectPropertyLimitation.js │ ├── PropertyAttributeConflict.js │ ├── Set.js │ ├── abstract-value-check-dup-name-string.js │ ├── bad-functions.js │ ├── binaryExpression.js │ ├── call.js │ ├── call2.js │ ├── class.js │ ├── conditional-return.js │ ├── forInStatement.js │ ├── forOfStatement.js │ ├── in1.js │ ├── in2.js │ ├── instanceof.js │ ├── member.js │ ├── member2.js │ ├── object-assign.js │ ├── objectExpression.js │ ├── objectExpression2.js │ ├── objectpattern.js │ ├── stackOverflow.js │ ├── syntaxError.js │ ├── testErrorHandlerCalled.js │ ├── try-and-access-abstract-property.js │ ├── try-and-call-abstract-function.js │ ├── unaryExpression.js │ ├── updateExpression.js │ ├── with.js │ ├── with2.js │ ├── write-forin-conflict.js │ ├── write-in-conflict.js │ ├── write-reflect-conflict.js │ ├── write-write-conflict.js │ ├── write-write-conflict2.js │ ├── write-write-conflict3.js │ ├── write-write-conflict4.js │ └── write-write-unknown-prop-conflict.js ├── react │ ├── AssignSpread-test.js │ ├── AssignSpread │ │ ├── simple-assign.js │ │ ├── simple-assign2.js │ │ ├── simple-assign3.js │ │ ├── simple-assign4.js │ │ ├── simple-assign5.js │ │ ├── simple-with-jsx-spread.js │ │ ├── simple-with-jsx-spread10.js │ │ ├── simple-with-jsx-spread11.js │ │ ├── simple-with-jsx-spread12.js │ │ ├── simple-with-jsx-spread13.js │ │ ├── simple-with-jsx-spread2.js │ │ ├── simple-with-jsx-spread3.js │ │ ├── simple-with-jsx-spread4.js │ │ ├── simple-with-jsx-spread5.js │ │ ├── simple-with-jsx-spread6.js │ │ ├── simple-with-jsx-spread7.js │ │ ├── simple-with-jsx-spread8.js │ │ ├── simple-with-jsx-spread9.js │ │ └── unsafe-spread.js │ ├── ClassComponents-test.js │ ├── ClassComponents │ │ ├── array-from.js │ │ ├── array-from2.js │ │ ├── classes-with-state.js │ │ ├── complex-class-into-functional-root.js │ │ ├── complex-class-into-functional-root2.js │ │ ├── complex-class-into-functional-root3.js │ │ ├── complex-class-into-functional-root4.js │ │ ├── complex-class-into-functional-root5.js │ │ ├── complex-class-proper-hoisting.js │ │ ├── complex-class-with-equivalent-node.js │ │ ├── inheritance-chain.js │ │ ├── simple-classes-2.js │ │ ├── simple-classes-3.js │ │ ├── simple-classes.js │ │ └── simple.js │ ├── FBMocks-test.js │ ├── FBMocks │ │ ├── fb1.js │ │ ├── fb10.js │ │ ├── fb11.js │ │ ├── fb12.js │ │ ├── fb13.js │ │ ├── fb14.js │ │ ├── fb15.js │ │ ├── fb16.js │ │ ├── fb17.js │ │ ├── fb18.js │ │ ├── fb19.js │ │ ├── fb2.js │ │ ├── fb20.js │ │ ├── fb21.js │ │ ├── fb22.js │ │ ├── fb23.js │ │ ├── fb24.js │ │ ├── fb25.js │ │ ├── fb3.js │ │ ├── fb4.js │ │ ├── fb5.js │ │ ├── fb6.js │ │ ├── fb7.js │ │ ├── fb8.js │ │ ├── fb9.js │ │ ├── function-bind.js │ │ ├── hacker-news.js │ │ ├── hacker-news.json │ │ ├── pe-functional-benchmark.js │ │ └── repl-example.js │ ├── FactoryComponents-test.js │ ├── FactoryComponents │ │ ├── simple.js │ │ └── simple2.js │ ├── FirstRenderOnly-test.js │ ├── FirstRenderOnly │ │ ├── equivalence.js │ │ ├── equivalence2.js │ │ ├── equivalence3.js │ │ ├── equivalence4.js │ │ ├── equivalence5.js │ │ ├── get-derived-state-from-props.js │ │ ├── get-derived-state-from-props2.js │ │ ├── get-derived-state-from-props3.js │ │ ├── get-derived-state-from-props4.js │ │ ├── get-derived-state-from-props5.js │ │ ├── react-context.js │ │ ├── react-context2.js │ │ ├── react-context3.js │ │ ├── react-context4.js │ │ ├── react-context5.js │ │ ├── react-context6.js │ │ ├── replace-this-in-callbacks.js │ │ ├── replace-this-in-callbacks2.js │ │ ├── replace-this-in-callbacks3.js │ │ ├── simple-2.js │ │ ├── simple-3.js │ │ ├── simple-4.js │ │ ├── simple.js │ │ └── will-mount.js │ ├── FunctionalComponents-test.js │ ├── FunctionalComponents │ │ ├── additional-function-regression.js │ │ ├── array-from.js │ │ ├── array-map.js │ │ ├── array-map2.js │ │ ├── array-map3.js │ │ ├── array-twice.js │ │ ├── bound-type.js │ │ ├── bound-type2.js │ │ ├── circular-reference.js │ │ ├── class-root-with-instance-vars-2.js │ │ ├── class-root-with-instance-vars.js │ │ ├── class-root-with-props.js │ │ ├── class-root-with-refs.js │ │ ├── class-root-with-render-methods.js │ │ ├── class-root-with-state.js │ │ ├── class-root.js │ │ ├── clone-element.js │ │ ├── clone-element2.js │ │ ├── conditional.js │ │ ├── default-props.js │ │ ├── default-props2.js │ │ ├── delete-element-prop-key.js │ │ ├── do-not-optimize.js │ │ ├── dynamic-context.js │ │ ├── dynamic-props.js │ │ ├── dynamic-type.js │ │ ├── dynamic-type2.js │ │ ├── dynamic-type3.js │ │ ├── dynamic-type4.js │ │ ├── equivalence.js │ │ ├── event-handlers.js │ │ ├── hoist-fragment.js │ │ ├── keyed-non-element.js │ │ ├── keyed-unnecessarily.js │ │ ├── keyed.js │ │ ├── model-props.js │ │ ├── nested-array-children.js │ │ ├── not-safe.js │ │ ├── not-safe2.js │ │ ├── null-or-undefined-props.js │ │ ├── pathological-case.js │ │ ├── react-children-map.js │ │ ├── react-element-havoc.js │ │ ├── refs-typeof.js │ │ ├── refs.js │ │ ├── refs2.js │ │ ├── refs3.js │ │ ├── return-text.js │ │ ├── return-undefined.js │ │ ├── runtime-error.js │ │ ├── safe.js │ │ ├── safe2.js │ │ ├── safe3.js │ │ ├── simple-10.js │ │ ├── simple-11.js │ │ ├── simple-12.js │ │ ├── simple-13.js │ │ ├── simple-14.js │ │ ├── simple-15.js │ │ ├── simple-16.js │ │ ├── simple-17.js │ │ ├── simple-18.js │ │ ├── simple-19.js │ │ ├── simple-2.js │ │ ├── simple-20.js │ │ ├── simple-21.js │ │ ├── simple-22.js │ │ ├── simple-23.js │ │ ├── simple-24.js │ │ ├── simple-25.js │ │ ├── simple-26.js │ │ ├── simple-27.js │ │ ├── simple-28.js │ │ ├── simple-29.js │ │ ├── simple-3.js │ │ ├── simple-4.js │ │ ├── simple-5.js │ │ ├── simple-6.js │ │ ├── simple-7.js │ │ ├── simple-8.js │ │ ├── simple-9.js │ │ ├── simple-children.js │ │ ├── simple-fragments.js │ │ ├── simple-refs.js │ │ ├── simple-with-abstract-props.js │ │ ├── simple-with-new-expression.js │ │ ├── simple-with-unary.js │ │ ├── simple.js │ │ └── two-roots.js │ ├── ReactDOM-test.js │ ├── ReactDOM │ │ └── create-portal.js │ ├── ReactNative-test.js │ ├── ReactNative │ │ ├── simple.js │ │ └── simple2.js │ ├── Reconciliation-test.js │ ├── Reconciliation │ │ ├── key-change-fragments.js │ │ ├── key-change.js │ │ ├── key-nesting-2.js │ │ ├── key-nesting-3.js │ │ ├── key-nesting-4.js │ │ ├── key-nesting-5.js │ │ ├── key-nesting-6.js │ │ ├── key-nesting-7.js │ │ ├── key-nesting-8.js │ │ ├── key-nesting-9.js │ │ ├── key-nesting.js │ │ ├── key-not-change-fragments.js │ │ ├── lazy-branched-elements.js │ │ ├── lazy-branched-elements2.js │ │ ├── type-change.js │ │ ├── type-change10.js │ │ ├── type-change11.js │ │ ├── type-change2.js │ │ ├── type-change3.js │ │ ├── type-change4.js │ │ ├── type-change5.js │ │ ├── type-change6.js │ │ ├── type-change7.js │ │ ├── type-change8.js │ │ ├── type-change9.js │ │ └── type-same.js │ ├── RenderProps-test.js │ ├── RenderProps │ │ ├── react-context.js │ │ ├── react-context2.js │ │ ├── react-context3.js │ │ ├── react-context4.js │ │ ├── react-context5.js │ │ ├── react-context6.js │ │ ├── react-context7.js │ │ ├── react-root-context.js │ │ ├── react-root-context2.js │ │ ├── react-root-context3.js │ │ ├── react-root-context4.js │ │ ├── relay-query-renderer.js │ │ ├── relay-query-renderer2.js │ │ └── relay-query-renderer3.js │ ├── ServerRendering-test.js │ ├── ServerRendering │ │ ├── hacker-news.js │ │ ├── hacker-news.json │ │ └── pe-functional-benchmark.js │ ├── Throw-test.js │ ├── Throw │ │ ├── throw-conditional.js │ │ └── throw.js │ ├── __snapshots__ │ │ ├── AssignSpread-test.js.snap │ │ ├── ClassComponents-test.js.snap │ │ ├── FBMocks-test.js.snap │ │ ├── FactoryComponents-test.js.snap │ │ ├── FirstRenderOnly-test.js.snap │ │ ├── FunctionalComponents-test.js.snap │ │ ├── ReactDOM-test.js.snap │ │ ├── ReactNative-test.js.snap │ │ ├── Reconciliation-test.js.snap │ │ ├── RenderProps-test.js.snap │ │ ├── ServerRendering-test.js.snap │ │ └── Throw-test.js.snap │ └── setupReactTests.js ├── serializer │ ├── abstract │ │ ├── AbstractFunctionWithResultType.js │ │ ├── AbstractNumericProperty.js │ │ ├── AbstractOrNullOrUndefined.js │ │ ├── AbstractPropertyDelete.js │ │ ├── AbstractPropertyDelete2.js │ │ ├── AbstractPropertyDelete3.js │ │ ├── AbstractPrototype.js │ │ ├── Array.js │ │ ├── ArrayConcat.js │ │ ├── ArrayInitializer.js │ │ ├── ArrayLength.js │ │ ├── ArrayLength2.js │ │ ├── ArrayLength3.js │ │ ├── ArrayMap.js │ │ ├── ArrayMap1.js │ │ ├── ArrayMap2.js │ │ ├── BinaryExpression.js │ │ ├── BinaryExpression2.js │ │ ├── BinaryExpression3.js │ │ ├── Branching.js │ │ ├── BranchingConsoleLog.js │ │ ├── Break.js │ │ ├── Break2.js │ │ ├── Break3.js │ │ ├── Call.js │ │ ├── Call2.js │ │ ├── Call3.js │ │ ├── Call4.js │ │ ├── CantCatchIntrospectionError.js │ │ ├── CantCatchIntrospectionError1.js │ │ ├── CompareObjects.js │ │ ├── Compose.js │ │ ├── ComposedCompletions.js │ │ ├── ConcreteModel1.js │ │ ├── ConcreteModel2.js │ │ ├── Conditional.js │ │ ├── ConditionalAbstractObjectValueDefineProperty.js │ │ ├── ConditionalAbstractObjectValueDefineProperty2.js │ │ ├── ConditionalAbstractObjectValueDelete.js │ │ ├── ConditionalAbstractObjectValueGet.js │ │ ├── ConditionalAbstractObjectValueGetOwnProperty.js │ │ ├── ConditionalAbstractObjectValueGetPartial.js │ │ ├── ConditionalAbstractObjectValueGetWithPrototype.js │ │ ├── ConditionalAbstractObjectValueSet.js │ │ ├── ConditionalAbstractObjectValueSetNewProperty.js │ │ ├── ConditionalAbstractObjectValueSetPartial.js │ │ ├── ConditionalEmptyProperty.js │ │ ├── ConditionalImpliedPropertyAssignment.js │ │ ├── ConstructFunctionReturnsAbstract.js │ │ ├── Continue.js │ │ ├── Continue2.js │ │ ├── DebugValue.js │ │ ├── DefineDeletedProperty.js │ │ ├── Delete.js │ │ ├── Delete1.js │ │ ├── Delete2.js │ │ ├── Delete3.js │ │ ├── Delete4.js │ │ ├── Delete5.js │ │ ├── Delete6.js │ │ ├── Delete7.js │ │ ├── Delete8.js │ │ ├── DeleteArrayProperty.js │ │ ├── DeleteArrayProperty2.js │ │ ├── DeleteFunctionProperty.js │ │ ├── DeleteObjectProperty.js │ │ ├── DeleteOnConditionalObject.js │ │ ├── Distribute.js │ │ ├── DoWhile.js │ │ ├── DoWhile1.js │ │ ├── DoWhile10.js │ │ ├── DoWhile11.js │ │ ├── DoWhile12.js │ │ ├── DoWhile13.js │ │ ├── DoWhile2.js │ │ ├── DoWhile2a.js │ │ ├── DoWhile3.js │ │ ├── DoWhile4.js │ │ ├── DoWhile5.js │ │ ├── DoWhile6.js │ │ ├── DoWhile6a.js │ │ ├── DoWhile6b.js │ │ ├── DoWhile6c.js │ │ ├── DoWhile6d.js │ │ ├── DoWhile7.js │ │ ├── DoWhile8.js │ │ ├── DoWhile8a.js │ │ ├── DoWhile9.js │ │ ├── Error.js │ │ ├── ErrorMessageStringCoercion.js │ │ ├── Fibonacci.js │ │ ├── ForInStatement.js │ │ ├── ForInStatement1.js │ │ ├── ForInStatement10.js │ │ ├── ForInStatement11.js │ │ ├── ForInStatement11a.js │ │ ├── ForInStatement11b.js │ │ ├── ForInStatement12.js │ │ ├── ForInStatement2.js │ │ ├── ForInStatement2a.js │ │ ├── ForInStatement3.js │ │ ├── ForInStatement3a.js │ │ ├── ForInStatement4.js │ │ ├── ForInStatement5.js │ │ ├── ForInStatement6.js │ │ ├── ForInStatement7.js │ │ ├── ForInStatement8.js │ │ ├── ForInStatement9.js │ │ ├── ForLoop.js │ │ ├── ForLoop1.js │ │ ├── ForLoop2.js │ │ ├── ForOfStatement.js │ │ ├── ForOfStatement2.js │ │ ├── Function.js │ │ ├── GeneratorScoping1.js │ │ ├── GeneratorScoping2.js │ │ ├── GeneratorScoping3.js │ │ ├── GeneratorScoping4.js │ │ ├── GetPrototypeOf.js │ │ ├── GetPrototypeOf2.js │ │ ├── GetValue.js │ │ ├── GetValue10.js │ │ ├── GetValue2.js │ │ ├── GetValue3.js │ │ ├── GetValue4.js │ │ ├── GetValue5.js │ │ ├── GetValue6.js │ │ ├── GetValue7.js │ │ ├── GetValue8.js │ │ ├── GetValue9.js │ │ ├── GlobalAbstractName.js │ │ ├── If.js │ │ ├── ImplicitAbstractConversion.js │ │ ├── ImplicitAbstractConversion10.js │ │ ├── ImplicitAbstractConversion11.js │ │ ├── ImplicitAbstractConversion12.js │ │ ├── ImplicitAbstractConversion13.js │ │ ├── ImplicitAbstractConversion14.js │ │ ├── ImplicitAbstractConversion15.js │ │ ├── ImplicitAbstractConversion16.js │ │ ├── ImplicitAbstractConversion17.js │ │ ├── ImplicitAbstractConversion18.js │ │ ├── ImplicitAbstractConversion19.js │ │ ├── ImplicitAbstractConversion2.js │ │ ├── ImplicitAbstractConversion20.js │ │ ├── ImplicitAbstractConversion21.js │ │ ├── ImplicitAbstractConversion22.js │ │ ├── ImplicitAbstractConversion23.js │ │ ├── ImplicitAbstractConversion24.js │ │ ├── ImplicitAbstractConversion25.js │ │ ├── ImplicitAbstractConversion26.js │ │ ├── ImplicitAbstractConversion27.js │ │ ├── ImplicitAbstractConversion28.js │ │ ├── ImplicitAbstractConversion29.js │ │ ├── ImplicitAbstractConversion3.js │ │ ├── ImplicitAbstractConversion30.js │ │ ├── ImplicitAbstractConversion31.js │ │ ├── ImplicitAbstractConversion32.js │ │ ├── ImplicitAbstractConversion33.js │ │ ├── ImplicitAbstractConversion36.js │ │ ├── ImplicitAbstractConversion4.js │ │ ├── ImplicitAbstractConversion5.js │ │ ├── ImplicitAbstractConversion6.js │ │ ├── ImplicitAbstractConversion7.js │ │ ├── ImplicitAbstractConversion8.js │ │ ├── ImplicitAbstractConversion9.js │ │ ├── Implies.js │ │ ├── In.js │ │ ├── In2.js │ │ ├── In3.js │ │ ├── Instanceof1.js │ │ ├── Instanceof2.js │ │ ├── Instanceof3.js │ │ ├── InternalProps.js │ │ ├── IntrinsicObjectCSE.js │ │ ├── IntrinsicUnion.js │ │ ├── IntrinsicUnion2.js │ │ ├── InvariantsForNonAbstractProperties.js │ │ ├── IsPrototypeOf.js │ │ ├── Issue2327InBinop.js │ │ ├── Issue2327InBinopUnconditional.js │ │ ├── Issue2327InstanceOfBinop.js │ │ ├── Issue2327InstanceOfBinopUnconditional.js │ │ ├── Issue2327StringLength.js │ │ ├── Issue2327StringLengthUnconditional.js │ │ ├── Issue2327StringSlice.js │ │ ├── Issue2327StringSliceUnconditional.js │ │ ├── Issue2327StringSplit.js │ │ ├── JSONStringifyOnAbstract2411.js │ │ ├── JSONparse.js │ │ ├── JSONparse2.js │ │ ├── ListOperationsCommentBubble.js │ │ ├── ListOperationsSimple.js │ │ ├── LogicalExpression.js │ │ ├── LogicalExpression2.js │ │ ├── MakeFinal.js │ │ ├── Map.js │ │ ├── MathRound.js │ │ ├── MightBeEmptyAssignment.js │ │ ├── ModelFunction.js │ │ ├── ModifiedBindingsCSE.js │ │ ├── MutatingObjectsFromOuterScope.js │ │ ├── NegateObject.js │ │ ├── NestedAbstractProperties.js │ │ ├── NullPrototypePartialKey.js │ │ ├── Number.js │ │ ├── ObjectAssign.js │ │ ├── ObjectAssign10.js │ │ ├── ObjectAssign11.js │ │ ├── ObjectAssign12.js │ │ ├── ObjectAssign13.js │ │ ├── ObjectAssign14.js │ │ ├── ObjectAssign15.js │ │ ├── ObjectAssign16.js │ │ ├── ObjectAssign17.js │ │ ├── ObjectAssign18.js │ │ ├── ObjectAssign19.js │ │ ├── ObjectAssign2.js │ │ ├── ObjectAssign20.js │ │ ├── ObjectAssign3.js │ │ ├── ObjectAssign4.js │ │ ├── ObjectAssign5.js │ │ ├── ObjectAssign6.js │ │ ├── ObjectAssign7.js │ │ ├── ObjectAssign8.js │ │ ├── ObjectAssign9.js │ │ ├── ObjectCreate.js │ │ ├── ObjectExpression.js │ │ ├── Optional.js │ │ ├── Optional2.js │ │ ├── Optional3.js │ │ ├── Optional4.js │ │ ├── Optional5.js │ │ ├── OrdinaryToPrimitive.js │ │ ├── OwnKeys.js │ │ ├── PathConditions.js │ │ ├── PathConditions2.js │ │ ├── PathConditions3.js │ │ ├── PossibleThrow.js │ │ ├── PropagateFunctionResultType.js │ │ ├── Property.js │ │ ├── Property2.js │ │ ├── Property3.js │ │ ├── Property4.js │ │ ├── Property5.js │ │ ├── PropertyAttributeConflict.js │ │ ├── PutValue.js │ │ ├── PutValue10.js │ │ ├── PutValue11.js │ │ ├── PutValue12.js │ │ ├── PutValue13.js │ │ ├── PutValue2.js │ │ ├── PutValue3.js │ │ ├── PutValue4.js │ │ ├── PutValue5.js │ │ ├── PutValue6.js │ │ ├── PutValue7.js │ │ ├── PutValue8.js │ │ ├── PutValue9.js │ │ ├── QualifiedCall.js │ │ ├── QualifiedCall2.js │ │ ├── QualifiedCall3.js │ │ ├── Refine.js │ │ ├── Refine2.js │ │ ├── Refine3.js │ │ ├── Refine4.js │ │ ├── Refine5.js │ │ ├── Refine6.js │ │ ├── Refine7.js │ │ ├── RegressionTestForNestedGenerators.js │ │ ├── ReplaceFunctionBody.js │ │ ├── Residual.js │ │ ├── ResidualExplicitParameters.js │ │ ├── ResidualExplicitParameters2.js │ │ ├── ResidualInvariant1.js │ │ ├── ResidualInvariant2.js │ │ ├── ResidualInvariant3.js │ │ ├── ResidualInvariant4.js │ │ ├── ResidualInvariantPathCondition.js │ │ ├── ResidualTemplate.js │ │ ├── ResidualVoid.js │ │ ├── Return.js │ │ ├── Return1.js │ │ ├── Return10.js │ │ ├── Return1a.js │ │ ├── Return2.js │ │ ├── Return2a.js │ │ ├── Return3.js │ │ ├── Return3a.js │ │ ├── Return4.js │ │ ├── Return4a.js │ │ ├── Return5.js │ │ ├── Return5a.js │ │ ├── Return6.js │ │ ├── Return6a.js │ │ ├── Return7.js │ │ ├── Return8.js │ │ ├── Return9.js │ │ ├── Set.js │ │ ├── SimpleObject.js │ │ ├── SimpleObject2.js │ │ ├── SimpleObject3.js │ │ ├── SimpleObject4.js │ │ ├── String.js │ │ ├── StringLength.js │ │ ├── Switch.js │ │ ├── Switch2.js │ │ ├── Switch3.js │ │ ├── Switch4.js │ │ ├── SymbolAbstractValueDescription.js │ │ ├── SymbolEqualityRegressionTest.js │ │ ├── Symbols.js │ │ ├── Symbols2.js │ │ ├── Symbols3.js │ │ ├── Symbols4.js │ │ ├── Symbols5.js │ │ ├── Symbols6.js │ │ ├── Symbols7.js │ │ ├── TemporalCSE.js │ │ ├── Throw.js │ │ ├── Throw10.js │ │ ├── Throw2.js │ │ ├── Throw3.js │ │ ├── Throw4.js │ │ ├── Throw5.js │ │ ├── Throw5a.js │ │ ├── Throw5b.js │ │ ├── Throw5c.js │ │ ├── Throw5d.js │ │ ├── Throw6.js │ │ ├── Throw6a.js │ │ ├── Throw6b.js │ │ ├── Throw8.js │ │ ├── Throw9a.js │ │ ├── Throw9b.js │ │ ├── ThrowInConstructor.js │ │ ├── ThrowInConstructor2.js │ │ ├── ThrowInConstructor3.js │ │ ├── ThrowInDoubleCatch.js │ │ ├── ToString.js │ │ ├── ToString2.js │ │ ├── ToString3.js │ │ ├── ToString4.js │ │ ├── TypeDomain4.js │ │ ├── TypeDomain5.js │ │ ├── TypeOf.js │ │ ├── TypesDomain.js │ │ ├── TypesDomain2.js │ │ ├── TypesDomain3.js │ │ ├── UnaryExpression.js │ │ ├── UnaryExpression2.js │ │ ├── UnknownNumericKey.js │ │ ├── UnknownNumericKeyAssignment.js │ │ ├── UnknownObjectKey.js │ │ ├── UnknownObjectKeyAssignment.js │ │ ├── UnknownPropertyOnPrimitive.js │ │ ├── UpdateExpression.js │ │ ├── UpdateExpression2.js │ │ ├── UpdateExpression3.js │ │ ├── UpdateExpression4.js │ │ ├── UseAbstractObjectValueTemplateInIsCall.js │ │ ├── WaitGenerator0.js │ │ ├── WaitGenerator0a.js │ │ ├── WaitGenerator0b.js │ │ ├── WaitGenerator1.js │ │ ├── WaitGenerator2.js │ │ ├── WaitGenerator3.js │ │ ├── WaitGenerator4.js │ │ ├── WaitGenerator5.js │ │ ├── WeakMap.js │ │ ├── WeakSet.js │ │ ├── WhileLoop.js │ │ ├── With.js │ │ ├── defineProperty.js │ │ ├── defineProperty2.js │ │ ├── getOwnPropertyDescriptor.js │ │ ├── getOwnPropertyDescriptor2.js │ │ ├── getOwnPropertyDescriptor3.js │ │ ├── getOwnPropertyDescriptor4.js │ │ ├── getOwnPropertyDescriptor5.js │ │ ├── getOwnPropertyDescriptor6.js │ │ ├── getOwnPropertyDescriptor7.js │ │ ├── getOwnPropertyDescriptor8.js │ │ ├── getOwnPropertyDescriptor9.js │ │ ├── object-assign10.js │ │ ├── object-assign11.js │ │ ├── object-assign12.js │ │ ├── object-assign2.js │ │ ├── object-assign3.js │ │ ├── object-assign4.js │ │ ├── object-assign5.js │ │ ├── object-assign5a.js │ │ ├── object-assign5b.js │ │ ├── object-assign6.js │ │ ├── object-assign7.js │ │ ├── object-assign8.js │ │ ├── object-assign9.js │ │ ├── reflectHas.js │ │ ├── reflectHas1.js │ │ ├── reflectHas2.js │ │ ├── require_tracking.js │ │ ├── require_tracking2.js │ │ └── toLocaleString.js │ ├── additional-functions │ │ ├── AdditionalFunCapturedScope.js │ │ ├── ArrayConcat.js │ │ ├── Class.js │ │ ├── DeadCodeCheck.js │ │ ├── DeadOuterObject.js │ │ ├── DelayInitializations1.js │ │ ├── DelayInitializations2.js │ │ ├── DelayInitializations3.js │ │ ├── EmitPropertyRegressionTest.js │ │ ├── Example1.js │ │ ├── FunctionApply.js │ │ ├── GlobalLetBinding.js │ │ ├── Issue1821RegressionTest.js │ │ ├── ModifiedBindingWithoutInitialValue.js │ │ ├── ModifiedBindingsCapturedScopesCalls.js │ │ ├── ModifiedObjectProperty.js │ │ ├── ModifiedObjectPropertyWithAbstractKey.js │ │ ├── MutatedObject.js │ │ ├── NestedOptimizedFunction1.js │ │ ├── NestedOptimizedFunction10.js │ │ ├── NestedOptimizedFunction11.js │ │ ├── NestedOptimizedFunction12.js │ │ ├── NestedOptimizedFunction13.js │ │ ├── NestedOptimizedFunction14.js │ │ ├── NestedOptimizedFunction15.js │ │ ├── NestedOptimizedFunction16.js │ │ ├── NestedOptimizedFunction17.js │ │ ├── NestedOptimizedFunction18.js │ │ ├── NestedOptimizedFunction19.js │ │ ├── NestedOptimizedFunction2.js │ │ ├── NestedOptimizedFunction20.js │ │ ├── NestedOptimizedFunction21.js │ │ ├── NestedOptimizedFunction22.js │ │ ├── NestedOptimizedFunction3.js │ │ ├── NestedOptimizedFunction4.js │ │ ├── NestedOptimizedFunction6.js │ │ ├── NestedOptimizedFunction7.js │ │ ├── NestedOptimizedFunction8.js │ │ ├── NestedThrowEffects.js │ │ ├── ObjectCreationGeneratorRegressionTest.js │ │ ├── ObjectLifetime1.js │ │ ├── ObjectLifetime2.js │ │ ├── OptimizedArrayFilterOpAliasing.js │ │ ├── OptimizedArrayFilterOpAliasing2.js │ │ ├── OptimizedArrayFilterOpSpecialization.js │ │ ├── OptimizedArrayOpAliasing.js │ │ ├── OptimizedArrayOpAliasing2.js │ │ ├── OptimizedArrayOpAliasing3.js │ │ ├── OptimizedArrayOpNoDefaultMaterialization.js │ │ ├── OptimizedArrayOpSpecialization.js │ │ ├── OptimizedArrayOpSpecializationBailout.js │ │ ├── OptimizedArrayOpSpecializationBailout2.js │ │ ├── OptimizedResidualOptimized.js │ │ ├── OuterScopeCacheRegressionTest.js │ │ ├── ReadThenDelete.js │ │ ├── ReferentializationRegressionTest.js │ │ ├── RegressionTestForIssue1881.js │ │ ├── RegressionTestForIssue1957.js │ │ ├── RegressionTestForIssue2090.js │ │ ├── ResidualFunctionBindingsMutatedByOptimizedFunctionRegressionTest.js │ │ ├── TargetsWithGenerators.js │ │ ├── ThisArgument.js │ │ ├── ToObject.js │ │ ├── UnknownArray.js │ │ ├── UpdateExpression.js │ │ ├── UpdateExpression2.js │ │ ├── abstract-property-modification.js │ │ ├── arguments.js │ │ ├── arguments2.js │ │ ├── arguments3.js │ │ ├── arguments4.js │ │ ├── bad-functions2.js │ │ ├── capture-local.js │ │ ├── conditions.js │ │ ├── conditions2.js │ │ ├── conditions3.js │ │ ├── create-local.js │ │ ├── createdobject-modifications.js │ │ ├── createdobject.js │ │ ├── dead-functions.js │ │ ├── func-nesting.js │ │ ├── modified-global-let-simple.js │ │ ├── modifiedobjects.js │ │ ├── named-function.js │ │ ├── nested_function.js │ │ ├── nested_function2.js │ │ ├── nested_function3.js │ │ ├── nested_function4.js │ │ ├── nested_modifybinding.js │ │ ├── noconflict-captures.js │ │ ├── noconflict-captures2.js │ │ ├── noconflict-existantobject.js │ │ ├── noopfunc.js │ │ ├── possible_throw_object_assign.js │ │ ├── precise_captures.js │ │ ├── prelude-ordering.js │ │ ├── property-deletion.js │ │ ├── property-modification.js │ │ ├── referentialization.js │ │ ├── referentialization2.js │ │ ├── register_conditionally.js │ │ ├── register_test.js │ │ ├── require_opt.js │ │ ├── return-or-many-throw.js │ │ ├── return-or-multiple-throw.js │ │ ├── return-or-throw-modifybindings.js │ │ ├── return-or-throw-modifybindings2.js │ │ ├── return-or-throw-modifybindings3.js │ │ ├── return-or-throw-modifyproperties.js │ │ ├── return-or-throw-modifyproperties2.js │ │ ├── return-or-throw-simple.js │ │ ├── return-or-throw-simple1.js │ │ ├── return-value-simple.js │ │ ├── self_referential.js │ │ ├── self_referential_simple.js │ │ ├── write-in-conflict.js │ │ └── write-write-noconflict.js │ ├── basic │ │ ├── Arguments.js │ │ ├── Arguments2.js │ │ ├── ArrayBuffer.js │ │ ├── ArrayIndexedProperty.js │ │ ├── ArrayInitializer2.js │ │ ├── ArrayInitializer3.js │ │ ├── ArrayPrototype.js │ │ ├── ArrayWithProperties.js │ │ ├── AssumeDataProperty.js │ │ ├── AssumeDataProperty2.js │ │ ├── AssumeDataProperty3.js │ │ ├── AssumeDataProperty4.js │ │ ├── AvoidIdLeaks.js │ │ ├── AvoidUnnecessaryWrappedFunctions.js │ │ ├── Bind.js │ │ ├── BoundFunction.js │ │ ├── BoundFunctionCreationOrder.js │ │ ├── BoundFunctionProperties.js │ │ ├── BoundFunctionProperties2.js │ │ ├── CapturedScope.js │ │ ├── CapturedScope10.js │ │ ├── CapturedScope11.js │ │ ├── CapturedScope2.js │ │ ├── CapturedScope3.js │ │ ├── CapturedScope4.js │ │ ├── CapturedScope5.js │ │ ├── CapturedScope6.js │ │ ├── CapturedScope7.js │ │ ├── CapturedScope8.js │ │ ├── CapturedScope9.js │ │ ├── CapturedScopeArrayAccess1.js │ │ ├── CapturedScopeArrayAccess2.js │ │ ├── CapturedScopeParameterOrdering.js │ │ ├── CapturedScopesAndIndexedVars.js │ │ ├── CircularFuncs.js │ │ ├── CircularFunctions.js │ │ ├── ClassExpression.js │ │ ├── ClassExpression2.js │ │ ├── ClassExpression3.js │ │ ├── ClassExpression4.js │ │ ├── ClassExpression5.js │ │ ├── ClassExpression6.js │ │ ├── ClassExpression7.js │ │ ├── Closure.js │ │ ├── Closure2.js │ │ ├── Closure3.js │ │ ├── Closure4.js │ │ ├── ClosureRefReplacement.js │ │ ├── ClosureRefVisitor.js │ │ ├── ClosureRefVisitor2.js │ │ ├── ClosureRefVisitor3.js │ │ ├── ClosureRefVisitor4.js │ │ ├── ConditionalReturn.js │ │ ├── ConditionalReturn2.js │ │ ├── ConditionalReturn3.js │ │ ├── CyclicArray.js │ │ ├── CyclicDependencies.js │ │ ├── Date.js │ │ ├── DefineProperty.js │ │ ├── DefinePropertySameNameDiffDesc.js │ │ ├── DelayInitWithDifferentValues.js │ │ ├── DelayInitializations.js │ │ ├── DelayInitializations2.js │ │ ├── DelayedValuePropertyOrdering.js │ │ ├── DelayedValuePropertyOrdering2.js │ │ ├── DontInlineFunctionsWithCapturedScopes.js │ │ ├── DuplicateFactoryFunctions.js │ │ ├── EfficientPrototypeSetting.js │ │ ├── EmitFunctionExpression.js │ │ ├── EmptyBlocks.js │ │ ├── ErrorPrototypeToString.js │ │ ├── ExceedStackDepth.js │ │ ├── Factories1.js │ │ ├── Factories2.js │ │ ├── FactorifyMixNodeTypes.js │ │ ├── FactorifyVoid0.js │ │ ├── ForInStatement1.js │ │ ├── ForOfStatement1.js │ │ ├── FrozenLazyObject.js │ │ ├── Function.js │ │ ├── FunctionBodyClone1.js │ │ ├── FunctionBodyClone2.js │ │ ├── FunctionOrdering.js │ │ ├── FunctionPrototype.js │ │ ├── FunctionPrototype2.js │ │ ├── FunctionPrototypeAssignmentIsSimple.js │ │ ├── FunctionUndelayOrdering.js │ │ ├── GenerateInvariants.js │ │ ├── GlobalMustBePassedInWhenUsed.js │ │ ├── GlobalProperty.js │ │ ├── GlobalProperty2.js │ │ ├── GlobalProperty3.js │ │ ├── GlobalPropertyGetter.js │ │ ├── GlobalPropertyNotValidIdentifier.js │ │ ├── GlobalPropertyStrict.js │ │ ├── GlobalPropertyStrict2.js │ │ ├── GlobalThing.js │ │ ├── GlobalVar.js │ │ ├── HelloWorld.js │ │ ├── HoistFunctionDeclarations.js │ │ ├── IncrementalMemoization.js │ │ ├── Integral.js │ │ ├── IntrinsicPutValue.js │ │ ├── IntrinsicSerialization.js │ │ ├── Issue2555RegressionTest.js │ │ ├── Issue2555RegressionTest2.js │ │ ├── IteratorPrototype.js │ │ ├── JSCCollections.js │ │ ├── KeysAsNumbers.js │ │ ├── LargeDelayedValue.js │ │ ├── LetGlobal.js │ │ ├── ManyFunctionInstantiations.js │ │ ├── Map.js │ │ ├── Map2.js │ │ ├── MapIteratorPrototype.js │ │ ├── MapNotDeadMember.js │ │ ├── MemoizeGlobalPropertiesRegExp.js │ │ ├── MissingInitialElement.js │ │ ├── NestedFunctions1.js │ │ ├── NestedFunctions2.js │ │ ├── NestedFunctions3.js │ │ ├── NestedFunctions4.js │ │ ├── NestedFunctions5.js │ │ ├── NonObjectPrototypes.js │ │ ├── NonOrdinarySetPrototypeOf.js │ │ ├── NonStrictComplex.js │ │ ├── NullPrototype.js │ │ ├── ObjectFreeze1.js │ │ ├── ObjectFreeze2.js │ │ ├── ObjectFreeze3.js │ │ ├── ObjectFreeze4.js │ │ ├── ObjectFreeze5.js │ │ ├── ObjectPreventExtensions1.js │ │ ├── ObjectSeal1.js │ │ ├── ObjectSeal2.js │ │ ├── OmitInvariants.js │ │ ├── OmitUnknownScopeSelectorError.js │ │ ├── OverridingFunctionPrototype.js │ │ ├── PathConditionDeadCode.js │ │ ├── PathConditionThrow.js │ │ ├── Promise.js │ │ ├── PropertyAssignment.js │ │ ├── PropertyGetter.js │ │ ├── PropertySetter.js │ │ ├── Prototypes.js │ │ ├── Prototypes2.js │ │ ├── Proxy.js │ │ ├── Recursion.js │ │ ├── Recursion2.js │ │ ├── RecursiveMutatedFunctionIdentifier.js │ │ ├── ReferentializeBug.js │ │ ├── ReferentializeInitializer.js │ │ ├── RegExp.js │ │ ├── ResidualIdentityObservation.js │ │ ├── ResidualIdentityObservation2.js │ │ ├── Set.js │ │ ├── SetNotDeadMember.js │ │ ├── SetTimeout.js │ │ ├── SimpleCircularFunctions.js │ │ ├── SimpleInheritanceChains.js │ │ ├── StrictComplex.js │ │ ├── StrictGlobals.js │ │ ├── StrictSimple.js │ │ ├── StringPrototype.js │ │ ├── Symbols.js │ │ ├── Symbols2.js │ │ ├── Uint8Array.js │ │ ├── Undefined.js │ │ ├── UndefinedAsLocalVariableName.js │ │ ├── UniqueNames.js │ │ ├── UnknownScopeSelectorError.js │ │ ├── Values.js │ │ ├── WeakMap.js │ │ ├── WeakMapDeadMember.js │ │ ├── WeakMapInternalReference.js │ │ ├── WeakSet.js │ │ ├── WeakSetDeadMember.js │ │ ├── __output.js │ │ └── setTimeoutAndInterval.js │ ├── instant-render │ │ ├── EmptyBuiltInArray.js │ │ ├── EmptyBuiltInArrayLength.js │ │ ├── EmptyBuiltInProps.js │ │ ├── FunctionArgumentModeling.js │ │ └── NotNull.js │ ├── optimizations │ │ ├── CommonSubExpr.js │ │ ├── CommonSubExpr2.js │ │ ├── CommonSubExpr3.js │ │ ├── DedupeGenerator.js │ │ ├── DelayInitCaptures.js │ │ ├── DelayInitMult.js │ │ ├── collapse_cases.js │ │ ├── eagerlyRequireModuleDependencies.js │ │ ├── getOwnPropertySymbols.js │ │ ├── non_numeric_arg_require.js │ │ ├── proto.js │ │ ├── require_accelerate.js │ │ ├── require_delay.js │ │ ├── require_hoist.js │ │ ├── require_mightHaveBeenDeleted.js │ │ ├── require_opt.js │ │ ├── require_opt_with_dependencies.js │ │ ├── require_removefactoryfunctions.js │ │ ├── require_spec_accelerate_delay.js │ │ ├── require_speculatively.js │ │ ├── require_speculatively_specific.js │ │ ├── require_throws.js │ │ ├── require_throws1.js │ │ ├── require_unsupported.js │ │ ├── residualDeadCode.js │ │ ├── simplify.js │ │ ├── simplify10.js │ │ ├── simplify11.js │ │ ├── simplify12.js │ │ ├── simplify2.js │ │ ├── simplify3.js │ │ ├── simplify4.js │ │ ├── simplify5.js │ │ ├── simplify6.js │ │ ├── simplify7.js │ │ ├── simplify8.js │ │ ├── simplify8a.js │ │ ├── simplify8b.js │ │ ├── simplify8c.js │ │ ├── simplify9.js │ │ ├── simplifyCompNullOrUndefined.js │ │ ├── simplifyCompNullOrUndefined2.js │ │ ├── simplifyCompNullOrUndefined3.js │ │ ├── simplifyEqNull.js │ │ ├── simplifyEqUndefined.js │ │ ├── simplifyMultipleIfs1.js │ │ ├── simplifyMultipleIfs2.js │ │ └── simplifyStrictEq.js │ ├── optimized-functions │ │ ├── 2248-repro.js │ │ ├── AbstractDate.js │ │ ├── ArgumentProperty.js │ │ ├── ArrayAccess.js │ │ ├── ArrayFrom.js │ │ ├── ArrayFrom10.js │ │ ├── ArrayFrom11.js │ │ ├── ArrayFrom2.js │ │ ├── ArrayFrom3.js │ │ ├── ArrayFrom4.js │ │ ├── ArrayFrom5.js │ │ ├── ArrayFrom6.js │ │ ├── ArrayFrom7.js │ │ ├── ArrayFrom8.js │ │ ├── ArrayFrom9.js │ │ ├── ArrayIndexOf.js │ │ ├── ArrayReverse.js │ │ ├── ArrowFunction.js │ │ ├── ArrowFunction2.js │ │ ├── CallWithThrow.js │ │ ├── CommonParentScopeCapture.js │ │ ├── ComposeJoins.js │ │ ├── ConditionalArray.js │ │ ├── ConditionalArray2.js │ │ ├── ConditionalArray3.js │ │ ├── ConditionalArray4.js │ │ ├── ConditionalArray5.js │ │ ├── ConditionalGet.js │ │ ├── ConditionalGet2.js │ │ ├── ConditionalGet3.js │ │ ├── ConditionalObjectAssign.js │ │ ├── ConditionalObjectAssign2.js │ │ ├── ConditionalObjectAssign3.js │ │ ├── ConditionalObjectAssign4.js │ │ ├── ConditionalObjectAssign5.js │ │ ├── ConditionalReturn.js │ │ ├── ConditionalReturn2.js │ │ ├── ConditionallyLeakedBinding.js │ │ ├── ConditionallyLeakedObject1.js │ │ ├── ConditionallyLeakedObject2.js │ │ ├── ConditionallyOptimizedFunction.js │ │ ├── ConditionallyReachable.js │ │ ├── DeadModifiedBindings.js │ │ ├── DeadObjectAssign.js │ │ ├── DeadObjectAssign10.js │ │ ├── DeadObjectAssign11.js │ │ ├── DeadObjectAssign12.js │ │ ├── DeadObjectAssign13.js │ │ ├── DeadObjectAssign14.js │ │ ├── DeadObjectAssign15.js │ │ ├── DeadObjectAssign16.js │ │ ├── DeadObjectAssign17.js │ │ ├── DeadObjectAssign18.js │ │ ├── DeadObjectAssign19.js │ │ ├── DeadObjectAssign2.js │ │ ├── DeadObjectAssign20.js │ │ ├── DeadObjectAssign21.js │ │ ├── DeadObjectAssign22.js │ │ ├── DeadObjectAssign23.js │ │ ├── DeadObjectAssign24.js │ │ ├── DeadObjectAssign3.js │ │ ├── DeadObjectAssign4.js │ │ ├── DeadObjectAssign5.js │ │ ├── DeadObjectAssign6.js │ │ ├── DeadObjectAssign7.js │ │ ├── DeadObjectAssign8.js │ │ ├── DeadObjectAssign9.js │ │ ├── DefineOptFuncInsideFuncInsideOptFunc.js │ │ ├── Empty.js │ │ ├── ForLoop.js │ │ ├── ForLoop2.js │ │ ├── ForLoop3.js │ │ ├── HavocBindings1.js │ │ ├── HavocBindings10.js │ │ ├── HavocBindings11.js │ │ ├── HavocBindings2.js │ │ ├── HavocBindings3.js │ │ ├── HavocBindings4.js │ │ ├── HavocBindings5.js │ │ ├── HavocBindings7.js │ │ ├── HavocBindings8.js │ │ ├── HavocBindings9.js │ │ ├── HavocBindingsRegression.js │ │ ├── HavocNestedBindings1.js │ │ ├── HavocNestedBindings2.js │ │ ├── HavocObjects1.js │ │ ├── HavocObjects2.js │ │ ├── HavocObjects3.js │ │ ├── HavocObjects4.js │ │ ├── HavocObjects5.js │ │ ├── InstantRenderArrayOps1.js │ │ ├── InstantRenderArrayOps2.js │ │ ├── InstantRenderArrayOpsBenignMutation.js │ │ ├── Issue1640ImplicitThis.js │ │ ├── Issue1856.js │ │ ├── Issue2151.js │ │ ├── Issue2262Regression.js │ │ ├── Issue2266Regression.js │ │ ├── Issue2358-2.js │ │ ├── Issue2358.js │ │ ├── Issue2359-1.js │ │ ├── Issue2359-2.js │ │ ├── Issue2388.js │ │ ├── Issue2392-1.js │ │ ├── Issue2392-2.js │ │ ├── Issue2398.js │ │ ├── Issue2399.js │ │ ├── Issue2422.js │ │ ├── Issue2423.js │ │ ├── LeakObjectWithSetter.js │ │ ├── LeakedCustomObjectInMultipleScopes.js │ │ ├── LeakedObjectCodeDuplication.js │ │ ├── LoopBailout.js │ │ ├── LoopBailout10.js │ │ ├── LoopBailout11.js │ │ ├── LoopBailout12.js │ │ ├── LoopBailout13.js │ │ ├── LoopBailout14.js │ │ ├── LoopBailout15.js │ │ ├── LoopBailout16.js │ │ ├── LoopBailout17.js │ │ ├── LoopBailout18.js │ │ ├── LoopBailout19.js │ │ ├── LoopBailout2.js │ │ ├── LoopBailout3.js │ │ ├── LoopBailout4.js │ │ ├── LoopBailout5.js │ │ ├── LoopBailout6.js │ │ ├── LoopBailout7.js │ │ ├── LoopBailout8.js │ │ ├── LoopBailout9.js │ │ ├── MissingModifiedBinding.js │ │ ├── ModifiedResidualBindings.js │ │ ├── ModifiedResidualBindings2.js │ │ ├── ModifiedResidualBindings3.js │ │ ├── NestedConditions.js │ │ ├── NestedConditionsRedeclare.js │ │ ├── NestedConditionsRightPath.js │ │ ├── NestedOptimizeSameFunction.js │ │ ├── NestedTemporalJoinConditions.js │ │ ├── NullCheck.js │ │ ├── NullThrows.js │ │ ├── ObjectAssign.js │ │ ├── ObjectAssign2.js │ │ ├── ObjectAssign3.js │ │ ├── ObjectAssign4.js │ │ ├── ObjectAssign5.js │ │ ├── ObjectAssign6.js │ │ ├── ObjectAssign7.js │ │ ├── ObjectAssign8.js │ │ ├── ObjectAssign9.js │ │ ├── ObjectAssignProps.js │ │ ├── OptimizeInSpeculativeContext.js │ │ ├── OptimizedConditionalFunction.js │ │ ├── OptimizedResidualOptimized.js │ │ ├── ParentInitializesLocal.js │ │ ├── ParentInitializesLocal2.js │ │ ├── PropertyDeref.js │ │ ├── RegressionTestForIssue1837.js │ │ ├── RegressionTestForIssue1840.js │ │ ├── RegressionTestForIssue1848.js │ │ ├── RegressionTestForIssue1883.js │ │ ├── RegressionTestForIssue2015.js │ │ ├── RegressionTestForIssue2056.js │ │ ├── Switch.js │ │ ├── Switch2.js │ │ ├── Switch3.js │ │ ├── Switch4.js │ │ ├── Switch5.js │ │ ├── Switch6.js │ │ ├── SymbolGet.js │ │ ├── ThrowOrReturn.js │ │ ├── ThrowOrReturn2.js │ │ ├── ThrowOrReturn3.js │ │ ├── ToString.js │ │ ├── ToString2.js │ │ ├── ToString3.js │ │ ├── ToString4.js │ │ ├── TransitiveMaterializationDirect.js │ │ ├── TransitiveMaterializationViaAbstractValue.js │ │ ├── TransitiveMaterializationViaFunctionCall.js │ │ ├── TransitiveMaterializationViaFunctionProperty.js │ │ ├── TransitiveMaterializationViaLeakedBinding.js │ │ ├── TransitiveMaterializationViaObjectProp.js │ │ ├── TransitiveMaterializationViaThisBinding.js │ │ ├── UnknownProperty.js │ │ ├── UnknownProperty2.js │ │ ├── WrongReferentializationScope.js │ │ ├── WrongScopeTripleNested.js │ │ ├── double-call.js │ │ ├── instanceof.js │ │ ├── issue-2252-3.js │ │ └── simple-nesting.js │ ├── pure-functions │ │ ├── AbstractCall.js │ │ ├── AbstractCallUnknownType.js │ │ ├── AbstractCallUnknownType2.js │ │ ├── AbstractComputedProperty.js │ │ ├── AbstractComputedPropertyAssignment.js │ │ ├── AbstractObject.js │ │ ├── AbstractObject2.js │ │ ├── AbstractObjectOptimizable.js │ │ ├── AbstractPropertyObjectKey.js │ │ ├── AbstractPropertyObjectKeyAssignment.js │ │ ├── AbstractPropertyRead.js │ │ ├── AbstractPropertyRead2.js │ │ ├── AbstractPropertyRead3.js │ │ ├── AbstractPropertyRead4.js │ │ ├── AbstractPropertyRead5.js │ │ ├── AbstractPropertyRead6.js │ │ ├── BinaryExpressions.js │ │ ├── BinaryExpressions2.js │ │ ├── BinaryExpressions3.js │ │ ├── CastStringOnUnknown.js │ │ ├── ConditionalHavocedGet.js │ │ ├── ConditionalHavocedGetPartial.js │ │ ├── ConditionalHavocedSet.js │ │ ├── ConditionalHavocedSetPartial.js │ │ ├── ConditionalObjectPartialKey.js │ │ ├── FatalErrorAfterJoins.js │ │ ├── FatalErrorAfterModifiedBinding.js │ │ ├── ForInBailout.js │ │ ├── GetterOnAbstractPrototype.js │ │ ├── GetterOnAbstractPrototype2.js │ │ ├── HavocBinding.js │ │ ├── HavocBindingImmutable.js │ │ ├── Invariants.js │ │ ├── Invariants2.js │ │ ├── Invariants3.js │ │ ├── Issue2418.js │ │ ├── NewExpression.js │ │ ├── ObjectAssign.js │ │ ├── ObjectAssign2.js │ │ ├── PutValueOnAbstract.js │ │ ├── PutValueOnAbstract2.js │ │ ├── SetterOnHavocedPrototype.js │ │ ├── StackOverflow.js │ │ ├── ToObject.js │ │ ├── UnaryExpressions.js │ │ ├── UnknownGetter.js │ │ ├── UnknownSetter.js │ │ ├── hasOwnProperty.js │ │ └── hasOwnProperty2.js │ ├── react │ │ └── jsx │ │ │ ├── default-props.js │ │ │ ├── element-simple.js │ │ │ ├── jsx-simple.js │ │ │ ├── jsx-spread.js │ │ │ └── key-children.js │ └── trivial │ │ ├── Console.js │ │ ├── Empty.js │ │ ├── FunctionExpressionApplication.js │ │ ├── GlobalVariable.js │ │ ├── GlobalVariable2.js │ │ ├── If.js │ │ ├── LocalVariable.js │ │ └── ObjectCreation.js ├── source-maps │ └── Stacktrace.js └── std-in │ └── StdIn.js ├── webpack.config.js ├── website ├── .gitignore ├── CNAME ├── README.md ├── circle.yml ├── css │ ├── prism.css │ └── style.css ├── favicon.ico ├── frequently-asked-questions.html ├── getting-started.html ├── index.html ├── js │ ├── prism.js │ ├── repl-worker.js │ ├── repl.js │ └── toggle_menu.js ├── package.json ├── repl.html ├── scripts │ └── prettier │ │ └── index.js ├── static │ └── images │ │ ├── blue_box.png │ │ ├── green_diamond.png │ │ ├── grey_ellipse.png │ │ ├── orange_triangle.png │ │ ├── oss_logo.png │ │ ├── prepack_logo.png │ │ ├── red_circle.png │ │ └── yellow_star.png └── yarn.lock └── yarn.lock /.eslintignore: -------------------------------------------------------------------------------- 1 | test262 2 | lib 3 | /fb-www 4 | underscore-with-tests.js 5 | flow-typed 6 | test/**/*.js 7 | babel.config.js 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .*.haste_cache.* 2 | *~ 3 | **/node_modules/ 4 | /lib 5 | npm-debug.log 6 | yarn-error.log 7 | .DS_Store 8 | build/ 9 | .idea/ 10 | tmp_website_build/ 11 | coverage*/ 12 | .vscode 13 | /fb-www 14 | facebook/test 15 | facebook/test-react 16 | facebook/tutorial 17 | prepack.min.js 18 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "test/test262"] 2 | path = test/test262 3 | url = https://github.com/tc39/test262 4 | ignore = all -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "parser": "babylon", 4 | "printWidth": 120 5 | } -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/.watchmanconfig -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](https://code.fb.com/codeofconduct/) so that you can understand what actions will and will not be tolerated. 4 | -------------------------------------------------------------------------------- /assets/PrepackLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/assets/PrepackLogo.png -------------------------------------------------------------------------------- /assets/PrepackLogoAlt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/assets/PrepackLogoAlt.png -------------------------------------------------------------------------------- /assets/PrepackLogoWithText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/assets/PrepackLogoWithText.png -------------------------------------------------------------------------------- /assets/PrepackLogoWithTextAlt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/assets/PrepackLogoWithTextAlt.png -------------------------------------------------------------------------------- /assets/PrepackLogoWithTextOnDark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/assets/PrepackLogoWithTextOnDark.png -------------------------------------------------------------------------------- /bin/prepack-repl.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require("../lib/repl-cli"); 4 | -------------------------------------------------------------------------------- /bin/prepack.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require("../lib/prepack-cli"); 4 | -------------------------------------------------------------------------------- /flow-typed/npm/invariant_v2.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 60de437d85342dea19dcd82c5a50f88a 2 | // flow-typed version: da30fe6876/invariant_v2.x.x/flow_>=v0.33.x 3 | 4 | declare module invariant { 5 | declare module.exports: (condition: boolean, message: string) => void; 6 | } 7 | -------------------------------------------------------------------------------- /fuzzer/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "node": true 4 | }, 5 | "rules": { 6 | "flow-header/flow-header": "off" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /fuzzer/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | yarn-error.log 4 | overnight.sqlite 5 | -------------------------------------------------------------------------------- /scripts/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-restricted-imports": "off" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /scripts/test-sourcemaps.sh: -------------------------------------------------------------------------------- 1 | node Stacktrace.js.new2.js 2>&1 >/dev/null | grep "Stacktrace.js:2" > /dev/null 2 | X=$? 3 | rm Stacktrace.js.new1.js 4 | rm Stacktrace.js.new1.js.map 5 | rm Stacktrace.js.new2.js 6 | rm Stacktrace.js.new2.js.map 7 | exit $X 8 | -------------------------------------------------------------------------------- /src/intrinsics/dom/setInterval.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/src/intrinsics/dom/setInterval.js -------------------------------------------------------------------------------- /src/intrinsics/dom/setTimeout.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/src/intrinsics/dom/setTimeout.js -------------------------------------------------------------------------------- /src/methods/integerindexed.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/src/methods/integerindexed.js -------------------------------------------------------------------------------- /src/utils/internalizer.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/src/utils/internalizer.js -------------------------------------------------------------------------------- /test/error-handler/.write-write-conflict.js.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/test/error-handler/.write-write-conflict.js.swp -------------------------------------------------------------------------------- /test/error-handler/Set.js: -------------------------------------------------------------------------------- 1 | // jsc 2 | // recover-from-errors 3 | // expected errors: [{"location":{"start":{"line":5,"column":22},"end":{"line":5,"column":25},"source":"test/error-handler/Set.js"},"severity":"RecoverableError","errorCode":"PP0001"}] 4 | 5 | let s = new Set(["a", "a"]); 6 | 7 | inspect = function() { 8 | return s.size === 1; 9 | }; 10 | -------------------------------------------------------------------------------- /test/error-handler/abstract-value-check-dup-name-string.js: -------------------------------------------------------------------------------- 1 | // expected errors: [{"location": {"start":{"line":4,"column":0},"end":{"line":4,"column":27},"source":"test/error-handler/abstract-value-check-dup-name-string.js"},"severity":"FatalError","errorCode":"PP0019","message":"An abstract value with the same name exists"}] 2 | 3 | __abstract("number", "foo"); 4 | __abstract("number", "foo"); 5 | -------------------------------------------------------------------------------- /test/error-handler/forInStatement.js: -------------------------------------------------------------------------------- 1 | // expected errors: [{"location":{"start":{"line":6,"column":14},"end":{"line":6,"column":16},"identifierName":"ob","source":"test/error-handler/forInStatement.js"},"severity":"FatalError","errorCode":"PP0013"}] 2 | 3 | let ob = global.__abstract ? __abstract("object", "({ x: 1 })") : { x: 1 }; 4 | 5 | let tgt = {}; 6 | for (var p in ob) { 7 | } 8 | -------------------------------------------------------------------------------- /test/error-handler/forOfStatement.js: -------------------------------------------------------------------------------- 1 | // expected errors: [{"location":{"start":{"line":5,"column":14},"end":{"line":5,"column":16},"identifierName":"ob","source":"test/error-handler/forOfStatement.js"},"severity":"FatalError","errorCode":"PP0014"}] 2 | 3 | let ob = global.__abstract ? __abstract("object", "([1, 2, 3])") : [1, 2, 3]; 4 | 5 | for (let p of ob) { 6 | } 7 | -------------------------------------------------------------------------------- /test/error-handler/objectExpression2.js: -------------------------------------------------------------------------------- 1 | // expected errors: [{"location":{"start":{"line":6,"column":11},"end":{"line":6,"column":29},"source":"test/error-handler/objectExpression2.js"},"severity":"FatalError","errorCode":"PP0011"}] 2 | 3 | let x = __abstract("number"); 4 | let y = __abstract("number"); 5 | 6 | let ob = { [x]: function() {}, [y]: 2 }; 7 | -------------------------------------------------------------------------------- /test/error-handler/objectpattern.js: -------------------------------------------------------------------------------- 1 | // recover-from-errors 2 | // expected errors: [{"location":{"start":{"line":7,"column":3},"end":{"line":7,"column":10},"source":"test/error-handler/objectpattern.js"},"severity":"FatalError","errorCode":"PP0014"}] 3 | 4 | let p = __abstract("string", "foo"); 5 | let foo = "foo"; 6 | ({ [foo]: q1 } = { foo: "bar" }); 7 | ({ [p]: q2 } = { foo: "bar" }); 8 | -------------------------------------------------------------------------------- /test/error-handler/stackOverflow.js: -------------------------------------------------------------------------------- 1 | // expected errors: [{"location":{"start":{"line":3,"column":2},"end":{"line":3,"column":3},"identifierName":"f","source":"test/error-handler/stackOverflow.js"},"severity":"FatalError","errorCode":"PP0045"}] 2 | function f() { 3 | f(); 4 | } 5 | f(); 6 | -------------------------------------------------------------------------------- /test/error-handler/syntaxError.js: -------------------------------------------------------------------------------- 1 | // recover-from-errors 2 | // expected errors: [{"location":{"line":4,"column":3,"source":"test/error-handler/syntaxError.js","start":{"line":4,"column":3},"end":{"line":4,"column":3}},"severity":"FatalError","errorCode":"PP1004","callStack":"Error\n "}] 3 | 4 | if x then y 5 | -------------------------------------------------------------------------------- /test/error-handler/testErrorHandlerCalled.js: -------------------------------------------------------------------------------- 1 | // expected errors: [{errorCode: "PP0001", severity: "FatalError"}] 2 | let l = __abstract("number"); 3 | let a = new Array(l); 4 | -------------------------------------------------------------------------------- /test/react/FBMocks/fb3.js: -------------------------------------------------------------------------------- 1 | if (!window.__evaluatePureFunction) { 2 | window.__evaluatePureFunction = function(f) { 3 | return f(); 4 | }; 5 | } 6 | 7 | (function() { 8 | function App() {} 9 | require("React"); 10 | 11 | var ReactRelay = require("RelayModern"); 12 | 13 | window.__evaluatePureFunction(() => { 14 | ReactRelay.createFragmentContainer(App); 15 | }); 16 | })(); 17 | -------------------------------------------------------------------------------- /test/react/FunctionalComponents/not-safe.js: -------------------------------------------------------------------------------- 1 | var x = 0; 2 | 3 | function foo() { 4 | x++; // not safe 5 | } 6 | function Bar() { 7 | foo(); 8 | return null; 9 | } 10 | 11 | if (this.__optimizeReactComponentTree) { 12 | __optimizeReactComponentTree(Bar); 13 | } 14 | -------------------------------------------------------------------------------- /test/react/FunctionalComponents/not-safe2.js: -------------------------------------------------------------------------------- 1 | var x = 0; 2 | 3 | function foo() { 4 | function foo2() { 5 | x++; // not safe 6 | } 7 | foo2(); 8 | } 9 | function Bar() { 10 | foo(); 11 | return null; 12 | } 13 | 14 | if (this.__optimizeReactComponentTree) { 15 | __optimizeReactComponentTree(Bar); 16 | } 17 | -------------------------------------------------------------------------------- /test/react/FunctionalComponents/safe.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var x = 0; 3 | function foo2() { 4 | x++; // safe 5 | } 6 | foo2(); 7 | } 8 | function Bar() { 9 | foo(); 10 | return null; 11 | } 12 | 13 | if (this.__optimizeReactComponentTree) { 14 | __optimizeReactComponentTree(Bar); 15 | } 16 | -------------------------------------------------------------------------------- /test/react/FunctionalComponents/safe2.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var x = 0; 3 | function foo2() { 4 | function foo3() { 5 | x++; // safe 6 | } 7 | foo3(); 8 | } 9 | foo2(); 10 | } 11 | function Bar() { 12 | foo(); 13 | } 14 | 15 | if (this.__optimizeReactComponentTree) { 16 | __optimizeReactComponentTree(Bar); 17 | } 18 | -------------------------------------------------------------------------------- /test/react/FunctionalComponents/safe3.js: -------------------------------------------------------------------------------- 1 | function Bar(props) { 2 | if (props.arg) return undefined; 3 | let f = 42; 4 | return f; 5 | } 6 | 7 | if (this.__optimizeReactComponentTree) { 8 | __optimizeReactComponentTree(Bar); 9 | } 10 | -------------------------------------------------------------------------------- /test/react/FunctionalComponents/two-roots.js: -------------------------------------------------------------------------------- 1 | function A(props) { 2 | return props.toString(); 3 | } 4 | 5 | function B(props) { 6 | return props.toString(); 7 | } 8 | 9 | if (this.__optimizeReactComponentTree) { 10 | __optimizeReactComponentTree(A); 11 | __optimizeReactComponentTree(B); 12 | } 13 | 14 | this.A = A; 15 | this.B = B; 16 | -------------------------------------------------------------------------------- /test/serializer/abstract/AbstractFunctionWithResultType.js: -------------------------------------------------------------------------------- 1 | // add at runtime:function __nextComponentID() { return 42; } 2 | (function() { 3 | let f = global.__abstract ? __abstract(":number", "__nextComponentID") : __nextComponentID; 4 | let t = typeof f(); 5 | inspect = function() { 6 | return t; 7 | }; 8 | })(); 9 | -------------------------------------------------------------------------------- /test/serializer/abstract/AbstractNumericProperty.js: -------------------------------------------------------------------------------- 1 | // add at runtime: global.z = { 0: "test string" }; 2 | if (global.__assumeDataProperty) 3 | __assumeDataProperty( 4 | this, 5 | "z", 6 | __abstract({ 7 | 0: __abstract("string"), 8 | }) 9 | ); 10 | let check = z && typeof z[0] === "string" && z[0]; 11 | inspect = function() { 12 | return check; 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/AbstractPrototype.js: -------------------------------------------------------------------------------- 1 | let obj = global.__abstract ? __abstract("object", "({})") : {}; 2 | 3 | function Constructor() {} 4 | Constructor.prototype = obj; 5 | 6 | let obj2 = new Constructor(); 7 | 8 | inspect = function() { 9 | return Object.getPrototypeOf(obj2) === obj; 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/abstract/Array.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | var l = __abstract("number"); 4 | var a = new Array(l); 5 | if (a.length) { 6 | } 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ArrayConcat.js: -------------------------------------------------------------------------------- 1 | // add at runtime:function __nextComponentID() { return 42; } 2 | (function() { 3 | let f = global.__abstract ? __abstract(":number", "__nextComponentID") : __nextComponentID; 4 | let n = f(); 5 | let a = [].concat([n]); 6 | 7 | inspect = function() { 8 | return a[0]; 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/abstract/ArrayInitializer.js: -------------------------------------------------------------------------------- 1 | // does contain:[11, 22 2 | (function() { 3 | let x = global.__abstract ? __abstract("boolean", "true") : true; 4 | let o = []; 5 | o.push(11); 6 | o.push(22); 7 | if (x) { 8 | o.push(3); 9 | } else { 10 | } 11 | inspect = function() { 12 | return o; 13 | }; 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/abstract/ArrayLength.js: -------------------------------------------------------------------------------- 1 | var x = global.__abstract ? __abstract("boolean", "true") : true; 2 | var a = []; 3 | if (x) a.push(42); 4 | inspect = function() { 5 | return a.length; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ArrayLength2.js: -------------------------------------------------------------------------------- 1 | var x = global.__abstract ? __abstract("boolean", "true") : true; 2 | var a = []; 3 | var b = x ? a : []; 4 | if (b === a) { 5 | a.push(42); 6 | } 7 | inspect = function() { 8 | return a.length; 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/ArrayLength3.js: -------------------------------------------------------------------------------- 1 | // does contain:[1,, 3,, 5, 6] 2 | (function() { 3 | let x = global.__abstract ? __abstract("boolean", "true") : true; 4 | let a = [1, , 3, , 5, 6, , , ,]; // Hole in the middle and end. 5 | if (x) { 6 | a.length = 100; 7 | } 8 | inspect = function() { 9 | return a.length; 10 | }; 11 | })(); 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/ArrayMap.js: -------------------------------------------------------------------------------- 1 | let c = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let a = [1]; 4 | if (c) a.push(2); 5 | let x = a.map(x => x + 42); 6 | 7 | global.inspect = function() { 8 | JSON.stringify(x); 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/ArrayMap1.js: -------------------------------------------------------------------------------- 1 | let c = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let a = [1]; 4 | let sum = 0; 5 | if (c) a.push(2); 6 | let x = a.map(x => { 7 | sum += x; 8 | return x + 42; 9 | }); 10 | 11 | global.inspect = function() { 12 | sum + JSON.stringify(x); 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/ArrayMap2.js: -------------------------------------------------------------------------------- 1 | let c = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let a = [1]; 4 | if (c) a.push(2); 5 | let x; 6 | try { 7 | x = a.map(x => { 8 | if (x === 2) throw x; 9 | else return x + 42; 10 | }); 11 | } catch (e) { 12 | x = e; 13 | } 14 | 15 | global.inspect = function() { 16 | JSON.stringify(x); 17 | }; 18 | -------------------------------------------------------------------------------- /test/serializer/abstract/BinaryExpression.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | var x = __abstract("number"); 4 | var y = {} + x; 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/Branching.js: -------------------------------------------------------------------------------- 1 | if (Date.now() > 0) x = Date.now(); 2 | inspect = function() { 3 | return ""; 4 | }; 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/Break.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let arr = []; 4 | 5 | xyz: while (true) { 6 | arr[0] = 123; 7 | if (x) break xyz; 8 | else break xyz; 9 | } 10 | 11 | var z = arr; 12 | 13 | inspect = function() { 14 | return "" + z; 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/abstract/Break2.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | let arr = []; 3 | 4 | function foo() { 5 | xyz: while (true) { 6 | arr[0] = 123; 7 | if (x) break; 8 | else break xyz; 9 | } 10 | } 11 | 12 | var z = foo(); 13 | 14 | inspect = function() { 15 | return z; 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/abstract/Break3.js: -------------------------------------------------------------------------------- 1 | let foo = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | var y = eval(` 4 | do { 5 | if (foo) { 6 | x = 1; 7 | break; 8 | } else { 9 | x = 2; 10 | break; 11 | } 12 | } while (true);`); 13 | 14 | inspect = function() { 15 | return y; 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/abstract/Call.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | var g = __abstract("object", "String"); 4 | g(); 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/Call2.js: -------------------------------------------------------------------------------- 1 | function f() { 2 | return 123; 3 | } 4 | var g = global.__abstract ? global.__abstract("function", "f") : f; 5 | var z = g(); 6 | 7 | inspect = function() { 8 | return "" + z; 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/Call4.js: -------------------------------------------------------------------------------- 1 | function f(v) { 2 | return v * 2; 3 | } 4 | var g = global.__abstract ? global.__abstract("function", "f") : f; 5 | let v = Object.freeze([1]).map(g); 6 | 7 | inspect = function() { 8 | return v; 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/CantCatchIntrospectionError.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let x = __abstract("boolean", "true"); 3 | 4 | try { 5 | var obj = __abstract("object"); 6 | if (x) delete obj.someProperty; 7 | } catch (err) { 8 | throw new Error("Cannot catch"); 9 | } finally { 10 | throw new Error("Cannot finally"); 11 | } 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/CantCatchIntrospectionError1.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let x = __abstract("boolean", "true"); 3 | 4 | try { 5 | var obj = __abstract("object"); 6 | if (x) { 7 | } else delete obj.someProperty; 8 | } catch (err) { 9 | throw new Error("Cannot catch"); 10 | } finally { 11 | throw new Error("Cannot finally"); 12 | } 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/CompareObjects.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var x = global.__abstract ? __abstract("object", "({})") : {}; 3 | var c = x === global; 4 | inspect = function() { 5 | return c; 6 | }; 7 | })(); 8 | -------------------------------------------------------------------------------- /test/serializer/abstract/Compose.js: -------------------------------------------------------------------------------- 1 | function bar(y) { 2 | if (y) { 3 | throw Error("Foo"); 4 | } 5 | return null; 6 | } 7 | 8 | function fn(x, y) { 9 | if (x) { 10 | bar(y); 11 | } 12 | return 123; 13 | } 14 | 15 | if (global.__optimize) __optimize(fn); 16 | 17 | inspect = function() { 18 | return fn(true, false); 19 | }; 20 | -------------------------------------------------------------------------------- /test/serializer/abstract/ComposedCompletions.js: -------------------------------------------------------------------------------- 1 | let n1 = global.__abstract ? __abstract("number", "4") : 4; 2 | 3 | function f1() { 4 | if (n1 === 1) return 10; 5 | if (n1 === 2) throw 20; 6 | if (n1 === 3) return 30; 7 | if (n1 === 4) return 40; 8 | throw 50; 9 | } 10 | 11 | var x = f1(); 12 | 13 | inspect = function() { 14 | return x; 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/abstract/Conditional.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | let y = x ? 1 : 2; 3 | var z = y; 4 | var z1 = x ? { a: 123 } : { y: 456 }; 5 | inspect = function() { 6 | return z + JSON.stringify(z1); 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/abstract/ConditionalAbstractObjectValueGet.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let c = global.__abstract ? __abstract("boolean", "(true)") : true; 3 | let o = c ? {} : {}; 4 | global.foo = o.bar; 5 | inspect = function() { 6 | return global.foo; 7 | }; 8 | })(); 9 | -------------------------------------------------------------------------------- /test/serializer/abstract/ConditionalAbstractObjectValueGetWithPrototype.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let c = global.__abstract ? __abstract("boolean", "(true)") : true; 3 | let o1 = {}; 4 | o1.__proto__ = { bar: 42 }; 5 | let o2 = {}; 6 | let o = c ? o1 : o2; 7 | global.foo = o.bar; 8 | inspect = function() { 9 | return global.foo; 10 | }; 11 | })(); 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/ConditionalImpliedPropertyAssignment.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let b = global.__abstract ? __abstract("boolean", "(true)") : true; 3 | let obj = {}; 4 | if (b) { 5 | global.obj = obj; 6 | } else { 7 | obj.x = 42; 8 | } 9 | })(); 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/ConstructFunctionReturnsAbstract.js: -------------------------------------------------------------------------------- 1 | function F() { 2 | this.a = 1; 3 | this.b = 2; 4 | if (global.__abstract) return global.__abstract(undefined, "undefined"); 5 | } 6 | 7 | const result = new F(); 8 | 9 | global.inspect = () => JSON.stringify(result); 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/Continue.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let arr = []; 4 | 5 | for (let i of [1, 2, 3]) { 6 | arr[i] = i * 10; 7 | if (x) continue; 8 | else continue; 9 | } 10 | 11 | z = arr; 12 | 13 | inspect = function() { 14 | return "" + global.z; 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/abstract/Continue2.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let arr = []; 4 | 5 | for (let i of [1, 2, 3]) { 6 | arr[i] = i * 10; 7 | if (x) continue; 8 | else break; 9 | } 10 | 11 | inspect = function() { 12 | return JSON.stringify(arr); 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/DebugValue.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | let ob = x ? { a: 1 } : { b: 2 }; 3 | 4 | global.__abstract ? __debugValue(ob) : {}; 5 | global.__abstract ? __debugValue([ob, x]) : {}; 6 | 7 | inspect = function() { 8 | return true; 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/Delete.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | var obj = __makePartial({}); 4 | delete obj.someProperty; 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/Delete1.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | var obj = global.__abstract ? __abstract("object", "({ p: 41} )") : { p: 41 }; 3 | delete obj.p; 4 | z = obj.p; 5 | 6 | inspect = function() { 7 | return global.z; 8 | }; 9 | -------------------------------------------------------------------------------- /test/serializer/abstract/Delete2.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let ob1 = { x: 123 }; 4 | let ob2 = { x: 456 }; 5 | let o = x ? ob1 : ob2; 6 | 7 | delete o.x; 8 | 9 | z = o.x; 10 | z1 = ob1.x; 11 | z2 = ob2.x; 12 | 13 | inspect = function() { 14 | return "" + global.z + global.z1 + global.z2; 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/abstract/Delete3.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let ob1 = { x: 123 }; 4 | let ob2 = { y: 456 }; 5 | let o = x ? ob1 : ob2; 6 | 7 | delete o.x; 8 | 9 | z = o.x; 10 | z1 = ob1.x; 11 | z2 = ob2.x; 12 | 13 | inspect = function() { 14 | return "" + global.z + global.z1 + global.z2; 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/abstract/Delete4.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let x = __abstract("boolean", "true"); 3 | 4 | let ob1 = { x: 123 }; 5 | let ob2 = { 6 | get x() { 7 | return 456; 8 | }, 9 | }; 10 | let o = x ? ob1 : ob2; 11 | 12 | delete o.x; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/Delete5.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let x = __abstract("boolean", "true"); 3 | 4 | let ob1 = { x: 123 }; 5 | let ob2 = {}; 6 | Object.defineProperty(ob2, "x", { writable: false, value: 456 }); 7 | let o = x ? ob1 : ob2; 8 | 9 | delete o.x; 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/Delete6.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let ob1 = { x: 123 }; 4 | let ob2 = { y: 456 }; 5 | let ob3 = {}; 6 | let o = x ? ob1 : ob2; 7 | 8 | delete o.x; 9 | ob1.x = ob3.x; 10 | 11 | z = ob1.x; 12 | 13 | inspect = function() { 14 | return "" + global.z; 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/abstract/Delete7.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let x = global.__abstract ? __abstract("boolean", "true") : true; 3 | 4 | let proto = {}; 5 | Object.defineProperty(proto, "x", { writable: false, value: 111 }); 6 | let ob1 = { x: 123 }; 7 | Object.setPrototypeOf(ob1, proto); 8 | let ob2 = { y: 456 }; 9 | let o = x ? ob1 : ob2; 10 | 11 | delete o.x; 12 | ob1.x = 789; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/DeleteArrayProperty.js: -------------------------------------------------------------------------------- 1 | var x = global.__abstract ? __abstract("boolean", "true") : true; 2 | var o = [42]; 3 | if (x) delete o[0]; 4 | inspect = function() { 5 | return o[0]; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/DeleteArrayProperty2.js: -------------------------------------------------------------------------------- 1 | var x = global.__abstract ? __abstract("boolean", "true") : true; 2 | var a = [42]; 3 | var o = global.__makePartial ? __makePartial(a) : a; 4 | if (x) delete o[0]; 5 | inspect = function() { 6 | return o[0]; 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/abstract/DeleteFunctionProperty.js: -------------------------------------------------------------------------------- 1 | var x = global.__abstract ? __abstract("boolean", "true") : true; 2 | var o = function f() {}; 3 | o.x = 42; 4 | if (x) delete o.x; 5 | inspect = function() { 6 | return o.x; 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/abstract/DeleteObjectProperty.js: -------------------------------------------------------------------------------- 1 | var x = global.__abstract ? __abstract("boolean", "true") : true; 2 | var o = { x: 42 }; 3 | if (x) delete o.x; 4 | inspect = function() { 5 | return o.x; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/Distribute.js: -------------------------------------------------------------------------------- 1 | // does not contain:infeasible 2 | (function() { 3 | let c = global.__abstract ? __abstract("boolean", "(true)") : true; 4 | let left = c ? 0 : 10; 5 | let right = c ? 5 : 15; 6 | let infeasible = left > right; 7 | if (infeasible) throw new Error("infeasible!"); 8 | inspect = function() { 9 | return infeasible; 10 | }; 11 | })(); 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile.js: -------------------------------------------------------------------------------- 1 | let n = global.__abstract ? __abstract("number", "10") : 10; 2 | let i = 0; 3 | let j; 4 | do { 5 | i++; 6 | j = 0; 7 | } while (i < n); 8 | 9 | inspect = function() { 10 | return i + " " + j; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile1.js: -------------------------------------------------------------------------------- 1 | let n = global.__abstract ? __abstract("number", "10") : 10; 2 | let i = 0; 3 | let j; 4 | let k = 10; 5 | do { 6 | i++; 7 | if (i > 1) { 8 | j = 2; 9 | k = i + 3; 10 | } 11 | } while (i < n); 12 | 13 | inspect = function() { 14 | return i + " " + j + " " + k; 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile10.js: -------------------------------------------------------------------------------- 1 | let n = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let i = 0; 3 | let o = { x: 0 }; 4 | do { 5 | o.x = i; 6 | i++; 7 | } while (i < n); 8 | 9 | inspect = function() { 10 | return JSON.stringify(o); 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile11.js: -------------------------------------------------------------------------------- 1 | let n = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let i = 0; 3 | let o = []; 4 | do { 5 | o[i] = i; 6 | i++; 7 | } while (i < n); 8 | 9 | inspect = function() { 10 | return JSON.stringify(o); 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile12.js: -------------------------------------------------------------------------------- 1 | var n = global.__abstract ? __abstract("number", "(2)") : 2; 2 | let i = 0; 3 | do { 4 | console.log(i++); 5 | } while (i++ < n); 6 | 7 | inspect = function() { 8 | return i; 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile2.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let n = global.__abstract ? __abstract("number", "10") : 10; 3 | let o = {}; 4 | let i = 0; 5 | do { 6 | i++; 7 | if (i > 5) throw "oopsie"; 8 | } while (i < n); 9 | 10 | inspect = function() { 11 | return i; 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile2a.js: -------------------------------------------------------------------------------- 1 | // does not contain:inspect 2 | let n = global.__abstract ? __abstract("number", "10") : 10; 3 | let o = {}; 4 | let i = 0; 5 | do { 6 | i++; 7 | throw "oopsie"; 8 | } while (i < n); 9 | 10 | inspect = function() { 11 | return i; 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile4.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let n = global.__abstract ? __abstract("number", "10") : 10; 3 | let i = 0; 4 | do { 5 | i++; 6 | if (i > 5) break; 7 | } while (i < n); 8 | 9 | inspect = function() { 10 | return i; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile5.js: -------------------------------------------------------------------------------- 1 | let n = global.__abstract ? __abstract("number", "10") : 10; 2 | let i = 0; 3 | let j; 4 | let k; 5 | do { 6 | j = i; 7 | i++; 8 | k = i + 2; 9 | } while (i < n); 10 | 11 | inspect = function() { 12 | return i + " " + j + " " + k; 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile6.js: -------------------------------------------------------------------------------- 1 | let n = global.__abstract ? __abstract("number", "10") : 10; 2 | let i = 0; 3 | let ob = { j: 0 }; 4 | do { 5 | i++; 6 | ob.j = i; 7 | } while (ob.j < n); 8 | 9 | inspect = function() { 10 | return i + " " + ob.j; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile6a.js: -------------------------------------------------------------------------------- 1 | let n = global.__abstract ? __abstract("number", "1") : 1; 2 | let i = 0; 3 | let ob = { j: 0 }; 4 | do { 5 | i++; 6 | if (i > 1) ob.j = i; 7 | } while (i < n); 8 | 9 | inspect = function() { 10 | return i + " " + ob.j; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile6b.js: -------------------------------------------------------------------------------- 1 | let n = global.__abstract ? __abstract("number", "1") : 1; 2 | let i = 0; 3 | let ob = {}; 4 | do { 5 | i++; 6 | if (i > 1) ob.j = i; 7 | } while (i < n); 8 | let k = ob.j; 9 | 10 | inspect = function() { 11 | return k + " " + JSON.stringify(Reflect.ownKeys(ob)); 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile6c.js: -------------------------------------------------------------------------------- 1 | let n = global.__abstract ? __abstract("number", "2") : 2; 2 | let i = 0; 3 | let ob = { j: 1 }; 4 | do { 5 | i++; 6 | if (i == 1) delete ob.j; 7 | else ob.j = undefined; 8 | } while (i < n); 9 | let k = ob.j; 10 | 11 | inspect = function() { 12 | return k + " " + JSON.stringify(Reflect.ownKeys(ob)); 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile6d.js: -------------------------------------------------------------------------------- 1 | let n = global.__abstract ? __abstract("number", "1") : 1; 2 | let i = 0; 3 | let ob = { j: 1 }; 4 | do { 5 | i++; 6 | if (i == 1) delete ob.j; 7 | else ob.j = undefined; 8 | } while (i < n); 9 | let k = ob.j; 10 | 11 | inspect = function() { 12 | return k + " " + JSON.stringify(Reflect.ownKeys(ob)); 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile7.js: -------------------------------------------------------------------------------- 1 | let n = global.__abstract ? __abstract("number", "10") : 10; 2 | let i = 0; 3 | let ob = {}; 4 | do { 5 | i++; 6 | ob[i] = 1; 7 | } while (i < n); 8 | let x = ob[5]; 9 | 10 | inspect = function() { 11 | return i + " " + x + " " + JSON.stringify(ob); 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile8.js: -------------------------------------------------------------------------------- 1 | let a = global.__abstract ? __abstract([], "[1, 2, 3]") : [1, 2, 3]; 2 | let n = global.__abstract ? __abstract("number", "(3)") : 3; 3 | let i = 0; 4 | let b = []; 5 | do { 6 | b[i] = a[i++]; 7 | } while (i < n); 8 | let x = b[1]; 9 | let j = b.length; 10 | 11 | inspect = function() { 12 | return i + " " + j + " " + x + " " + JSON.stringify(b); 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile8a.js: -------------------------------------------------------------------------------- 1 | let a = global.__abstract ? __makeSimple(__abstract("array", "[1, 2, 3]")) : [1, 2, 3]; 2 | let i = 0; 3 | let b = []; 4 | do { 5 | b[i] = a[i++]; 6 | } while (i < a.length); 7 | let x = b[1]; 8 | let j = b.length; 9 | 10 | inspect = function() { 11 | return i + " " + j + " " + x + " " + JSON.stringify(b); 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/DoWhile9.js: -------------------------------------------------------------------------------- 1 | // skip lazy objects 2 | 3 | let n = global.__abstract ? __abstract("number", "(3)") : 3; 4 | let i = 0; 5 | let o = null; 6 | do { 7 | o = { i }; 8 | i++; 9 | } while (i < n); 10 | 11 | inspect = function() { 12 | return JSON.stringify(o); 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/Error.js: -------------------------------------------------------------------------------- 1 | // does not contain:setPrototypeOf 2 | // throws introspection error 3 | let x = global.__abstract ? __abstract("string", "('abc')") : "abc"; 4 | let err1 = new Error(x); 5 | err1.name = x; 6 | let err2 = new Error(err1); 7 | 8 | inspect = function() { 9 | return "" + err2; 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/abstract/ErrorMessageStringCoercion.js: -------------------------------------------------------------------------------- 1 | let num = global.__abstract ? __abstract("number", "42") : 42; 2 | let err = new Error(num); 3 | 4 | inspect = function() { 5 | return "" + err; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/Fibonacci.js: -------------------------------------------------------------------------------- 1 | // skip this test for now 2 | // throws introspection error 3 | let n = global.__abstract ? global.__abstract("number", "4") : 4; 4 | 5 | function fibonacci(x) { 6 | return x <= 1 ? x : fibonacci(x - 1) + fibonacci(x - 2); 7 | } 8 | 9 | let x = fibonacci(n); 10 | let y = typeof x; 11 | 12 | inspect = function() { 13 | return x + " " + y; 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForInStatement.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let x = __abstract("boolean", "true"); 3 | let ob = { a: 1 }; 4 | if (x) { 5 | delete ob.a; 6 | } 7 | for (var p in ob) { 8 | console.log(p); 9 | } 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForInStatement1.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let x = __abstract("boolean", "true"); 3 | let ob = x ? { a: 1 } : { b: 2 }; 4 | let tgt = {}; 5 | for (var p in ob) { 6 | tgt[p] = p + p; 7 | } 8 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForInStatement10.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | let ob = global.__abstract ? __abstract({ x: 1 }, "({ x: 1 })") : { x: 1 }; 4 | if (global.__makeSimple) __makeSimple(ob); 5 | 6 | let tgt = {}; 7 | for (var p in ob) { 8 | break; 9 | } 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForInStatement11.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | let ob = global.__abstract ? __abstract({ x: 1 }, "({ x: 1 })") : { x: 1 }; 4 | if (global.__makeSimple) __makeSimple(ob); 5 | 6 | let tgt = {}; 7 | for (var p in ob) { 8 | console.log(p); 9 | } 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForInStatement11b.js: -------------------------------------------------------------------------------- 1 | let ob = global.__makePartial ? __makePartial({ x: 1 }) : { x: 1 }; 2 | if (global.__makeSimple) __makeSimple(ob); 3 | 4 | let ob2 = {}; 5 | for (var p in ob) { 6 | ob2[p] = ob[p]; 7 | } 8 | 9 | let tgt = {}; 10 | for (var p in ob) { 11 | tgt[p] = ob2[p]; 12 | } 13 | 14 | inspect = function() { 15 | return tgt.x; 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForInStatement2.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let x = __abstract("boolean", "true"); 3 | let ob = x ? { a: 1 } : { b: 2 }; 4 | let src = {}; 5 | let tgt = {}; 6 | for (var p in ob) { 7 | tgt[p] = src[p]; 8 | } 9 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForInStatement2a.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | let ob = x ? { a: 1 } : { b: 2 }; 3 | let src = global.__makePartial ? __makePartial({}) : {}; 4 | if (global.__makeSimple) __makeSimple(src); 5 | let tgt = {}; 6 | for (var p in ob) { 7 | tgt[p] = src[p]; 8 | } 9 | 10 | inspect = function() { 11 | return tgt.a; 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForInStatement3.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let ob = __abstract({}, "({})"); 3 | if (global.__makeSimple) __makeSimple(ob); 4 | let x = __abstract("string"); 5 | 6 | ob[x] = 123; 7 | let tgt = {}; 8 | for (var p in ob) { 9 | tgt[p] = ob[p]; 10 | } 11 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForInStatement3a.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let ob = __abstract({}, "({})"); 3 | if (global.__makeSimple) __makeSimple(ob); 4 | let x = __abstract("string"); 5 | 6 | ob[x] = 123; 7 | let tgt = {}; 8 | tgt[x] = 456; 9 | for (var p in ob) { 10 | tgt[p] = ob[p]; 11 | } 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForInStatement4.js: -------------------------------------------------------------------------------- 1 | let ob = global.__abstract ? __abstract({ x: 1 }, "({ x: 1 })") : { x: 1 }; 2 | if (global.__makeSimple) __makeSimple(ob); 3 | 4 | let tgt = {}; 5 | for (var p in ob) { 6 | tgt[p] = ob[p]; 7 | } 8 | 9 | inspect = function() { 10 | return ""; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForInStatement5.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | let ob = global.__abstract ? __abstract({ x: 1 }, "({ x: 1 })") : { x: 1 }; 4 | if (global.__makeSimple) __makeSimple(ob); 5 | 6 | let tgt = {}; 7 | for (var p in ob) { 8 | tgt[p] = ob[p + p]; 9 | } 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForInStatement6.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | let ob = global.__abstract ? __abstract({ x: 1 }, "({ x: 1 })") : { x: 1 }; 4 | if (global.__makeSimple) __makeSimple(ob); 5 | 6 | let tgt = {}; 7 | for (var p in ob) { 8 | tgt[p] = ob.x; 9 | } 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForInStatement7.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | let ob = global.__abstract ? __abstract({ x: 1 }, "({ x: 1 })") : { x: 1 }; 4 | if (global.__makeSimple) __makeSimple(ob); 5 | 6 | let tgt = {}; 7 | for (var p in ob) { 8 | tgt.x = 1; 9 | } 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForInStatement8.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | let ob = global.__abstract ? __abstract({ x: 1 }, "({ x: 1 })") : { x: 1 }; 4 | if (global.__makeSimple) __makeSimple(ob); 5 | 6 | let tgt = {}; 7 | for (var p in ob) { 8 | tgt = ob.x; 9 | } 10 | 11 | z = tgt; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForInStatement9.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | let ob = global.__abstract ? __abstract({ x: 1 }, "({ x: 1 })") : { x: 1 }; 4 | if (global.__makeSimple) __makeSimple(ob); 5 | function f() {} 6 | 7 | let tgt = {}; 8 | for (var p in ob) { 9 | new f(); 10 | } 11 | 12 | z = tgt; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForLoop.js: -------------------------------------------------------------------------------- 1 | var x = global.__abstract ? (x = __abstract("number", "(1)")) : 1; 2 | let i; 3 | 4 | for (i = 0; i < 2; i++) { 5 | if (i === x) break; 6 | } 7 | 8 | inspect = function() { 9 | return i; 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForLoop1.js: -------------------------------------------------------------------------------- 1 | var x = global.__abstract ? (x = __abstract("number", "(2)")) : 2; 2 | let i; 3 | let j = 100; 4 | 5 | label: for (i = 0; i < 3; i++) { 6 | if (i == x - 1) continue label; 7 | if (i === x) continue; 8 | j += 100; 9 | } 10 | 11 | inspect = function() { 12 | return j; 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForLoop2.js: -------------------------------------------------------------------------------- 1 | for (; true; ) { 2 | break; 3 | } 4 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForOfStatement.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | var x = __abstract("object"); 4 | for (var y of x) { 5 | } 6 | -------------------------------------------------------------------------------- /test/serializer/abstract/ForOfStatement2.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | var x = __abstract("object"); 4 | function foo() { 5 | for (var e of x) return e; 6 | } 7 | let p; 8 | for ([p = foo()] of [[undefined]]) { 9 | } 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/Function.js: -------------------------------------------------------------------------------- 1 | var __abstract = global.__abstract 2 | ? global.__abstract 3 | : function() { 4 | return console.log; 5 | }; 6 | 7 | var obj = __abstract("function", "console.log"); 8 | var ident = 10; 9 | obj("literal ", 5, ident); 10 | 11 | inspect = function() { 12 | return 0; 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/GeneratorScoping2.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let a = global.__abstract ? __abstract("boolean", "(false)") : false; 3 | let x = global.__abstract ? __abstract("number", "(42)") : 42; 4 | let y = x * 2; 5 | var z; 6 | if (a) { 7 | z = y; 8 | } else { 9 | z = y; 10 | } 11 | inspect = function() { 12 | return z.toString(); 13 | }; 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/abstract/GetPrototypeOf.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let p1 = { p: 1 }; 4 | let p2 = { p: 2 }; 5 | let o1 = Object.create(p1); 6 | let o2 = Object.create(p2); 7 | let o = x ? o1 : o2; 8 | 9 | var z = Object.getPrototypeOf(o); 10 | 11 | inspect = function() { 12 | return z.p; 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/GetPrototypeOf2.js: -------------------------------------------------------------------------------- 1 | let o = global.__abstract ? __abstract({}, "{}") : {}; 2 | 3 | var p = Object.getPrototypeOf(o); 4 | 5 | inspect = function() { 6 | return p === Object.prototype; 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/abstract/GetValue.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | var obj = __makePartial({}); 4 | var x = obj.someProperty; 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/GetValue2.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | var obj = __abstract("object"); 4 | var x = obj["someProperty"]; 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/GetValue3.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let ob = x ? { a: 1 } : { b: 2 }; 4 | 5 | var z = ob.a; 6 | 7 | inspect = function() { 8 | return z; 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/GetValue4.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | let calledGetter = false; 3 | let ob = x 4 | ? { a: 1 } 5 | : { 6 | get a() { 7 | calledGetter = true; 8 | return 2; 9 | }, 10 | }; 11 | let y = ob.a; 12 | inspect = function() { 13 | return JSON.stringify({ y, calledGetter }); 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/abstract/GetValue5.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let proto = { a: 1 }; 4 | let o = { a: 2 }; 5 | Object.setPrototypeOf(o, proto); 6 | 7 | let ob = x ? o : { a: 3 }; 8 | 9 | delete ob.a; 10 | var z = o.a; 11 | 12 | inspect = function() { 13 | return z; 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/abstract/GetValue6.js: -------------------------------------------------------------------------------- 1 | let ob = global.__makePartial ? __makeSimple(__makePartial({})) : { a: 123 }; 2 | if (global.__residual) 3 | __residual( 4 | "void", 5 | o => { 6 | o.a = 123; 7 | }, 8 | ob 9 | ); 10 | 11 | var z = ob.a; 12 | 13 | inspect = function() { 14 | return z; 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/abstract/GetValue8.js: -------------------------------------------------------------------------------- 1 | // cannot serialize 2 | 3 | let ob = global.__makePartial ? __makeSimple(__makePartial({})) : {}; 4 | var n = global.__abstract ? __abstract("string", '("a")') : "a"; 5 | 6 | z = ob[n]; 7 | 8 | inspect = function() { 9 | return global.z; 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/abstract/GetValue9.js: -------------------------------------------------------------------------------- 1 | let obj = global.__makePartial ? __makeSimple(__makePartial({})) : {}; 2 | x = obj[5]; 3 | 4 | inspect = function() { 5 | return global.x === undefined; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/GlobalAbstractName.js: -------------------------------------------------------------------------------- 1 | // does not contain:global 2 | (function() { 3 | global.x = 42; 4 | var y = global.__abstract ? __abstract("number", "global.x") : 42; 5 | inspect = function() { 6 | return y; 7 | }; 8 | })(); 9 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = 123 * ob; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion10.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = 2 < x; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion11.js: -------------------------------------------------------------------------------- 1 | let y = 2 < "abc"; 2 | inspect = function() { 3 | return y; 4 | }; 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion12.js: -------------------------------------------------------------------------------- 1 | let y = "abc" > 2; 2 | inspect = function() { 3 | return y; 4 | }; 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion13.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = 2 <= x; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion14.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = 2 >= x; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion15.js: -------------------------------------------------------------------------------- 1 | let y = 2 ** 3; 2 | inspect = function() { 3 | return y; 4 | }; 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion16.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = 123 >= ob; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion17.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = ob >= 123; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion18.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = ob >= 2; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion19.js: -------------------------------------------------------------------------------- 1 | let y = 2 >= "abc"; 2 | inspect = function() { 3 | return y; 4 | }; 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion2.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "3") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = 123 / ob; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion20.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = ob >= 3; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion21.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = ob % 4; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion22.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = ob / 4; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion23.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = ob * 4; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion24.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = ob - 4; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion25.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = ob <= 123; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion26.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = ob <= "123"; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion27.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = ob <= "abc"; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion28.js: -------------------------------------------------------------------------------- 1 | let y = 3 <= "abc"; 2 | inspect = function() { 3 | return y; 4 | }; 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion29.js: -------------------------------------------------------------------------------- 1 | let y = 3 <= 5; 2 | inspect = function() { 3 | return y; 4 | }; 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion3.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "3") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = 123 - ob; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion30.js: -------------------------------------------------------------------------------- 1 | let y = 1 >= 3; 2 | inspect = function() { 3 | return y; 4 | }; 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion31.js: -------------------------------------------------------------------------------- 1 | let y = 14 >= 3; 2 | inspect = function() { 3 | return y; 4 | }; 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion32.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = 2 ** x; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion33.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = ob ** 2; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion36.js: -------------------------------------------------------------------------------- 1 | let y = 123 * 4; 2 | inspect = function() { 3 | return y; 4 | }; 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion4.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = 123 > ob; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion5.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = 2 ** ob; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion6.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = 2 == ob; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion7.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = ob == 2; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion8.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = x ** 2; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ImplicitAbstractConversion9.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(3)") : 3; 2 | let ob = { valueOf: () => x }; 3 | let y = x < 2; 4 | inspect = function() { 5 | return y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/In.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let x = __abstract("boolean", "true"); 3 | let ob = { a: 1 }; 4 | if (x) { 5 | delete ob.a; 6 | } 7 | z = "a" in ob; 8 | -------------------------------------------------------------------------------- /test/serializer/abstract/Instanceof2.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | var b = global.__abstract ? __abstract("boolean", "true") : true; 4 | var o = global.__abstract ? __abstract("object", "({})") : {}; 5 | 6 | try { 7 | x1 = o instanceof b; 8 | } catch (err) { 9 | x1 = err; 10 | } 11 | 12 | inspect = function() { 13 | return "" + x1; 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/abstract/InternalProps.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let ob = {}; 4 | if (!x) { 5 | Object.setPrototypeOf(ob, { a: 1 }); 6 | } else { 7 | Object.setPrototypeOf(ob, { a: 2 }); 8 | } 9 | 10 | var z = ob.a; 11 | 12 | inspect = function() { 13 | return z; 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/abstract/IsPrototypeOf.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | let x = global.__abstract ? __abstract("boolean", "true") : true; 4 | let ob = global.__makePartial ? __makeSimple(__makePartial({})) : {}; 5 | 6 | let p = x ? {} : ob.p; 7 | 8 | y = Object.prototype.isPrototypeOf(p); 9 | 10 | inspect = function() { 11 | return "" + y; 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/Issue2327InBinop.js: -------------------------------------------------------------------------------- 1 | // expected RecoverableError: PP0004 2 | 3 | let o = global.__abstractOrNull ? __abstractOrNull("object", "undefined") : undefined; 4 | let s = true; 5 | 6 | if (o != undefined) s = "foobar" in o; 7 | if (o != undefined) s = "foobar" in o; 8 | 9 | global.s = s; 10 | 11 | inspect = () => s; // Should be true 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/Issue2327InBinopUnconditional.js: -------------------------------------------------------------------------------- 1 | // Copies of "foobar" in:1 2 | // expected RecoverableError: PP0004 3 | 4 | let o = global.__abstract ? __abstract("object", "('foobar42')") : "foobar42"; 5 | let s = true; 6 | 7 | if (o != undefined) s = "foobar" in o; 8 | if (o != undefined) s = "foobar" in o; 9 | 10 | global.s = s; 11 | 12 | inspect = () => s; // Should be true 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/Issue2327InstanceOfBinop.js: -------------------------------------------------------------------------------- 1 | // expected RecoverableError: PP0004 2 | 3 | let o = global.__abstractOrNull ? __abstractOrNull("object", "undefined") : undefined; 4 | let s = true; 5 | 6 | if (o != undefined) s = "foobar" instanceof o; 7 | if (o != undefined) s = "foobar" instanceof o; 8 | 9 | global.s = s; 10 | 11 | inspect = () => s; // Should be true 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/Issue2327StringLength.js: -------------------------------------------------------------------------------- 1 | let o = global.__abstractOrNull ? __abstractOrNull("string", "undefined") : undefined; 2 | let s; 3 | 4 | if (o != undefined) s = 5 + o.length; 5 | if (o != undefined) s = 7 + o.length; 6 | 7 | global.s = s; 8 | 9 | inspect = () => s; 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/Issue2327StringLengthUnconditional.js: -------------------------------------------------------------------------------- 1 | // Copies of length:1 2 | 3 | let o = global.__abstract ? __abstract("string", "('xyz')") : "xyz"; 4 | let s; 5 | 6 | if (o != undefined) s = 5 + o.length; 7 | if (o != undefined) s = 7 + o.length; 8 | 9 | global.s = s; 10 | 11 | inspect = () => s; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/Issue2327StringSlice.js: -------------------------------------------------------------------------------- 1 | let o = global.__abstractOrNull ? __abstractOrNull("string", "undefined") : undefined; 2 | let s = "ok"; 3 | 4 | if (o != undefined) s = "X" + o.slice(3); 5 | if (o != undefined) s = "Y" + o.slice(3); 6 | 7 | global.s = s; 8 | 9 | inspect = () => s; 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/Issue2327StringSplit.js: -------------------------------------------------------------------------------- 1 | let o = global.__abstractOrNull ? __abstractOrNull("string", "undefined") : undefined; 2 | let s = "ok"; 3 | 4 | if (o != undefined) s = o.split(); 5 | if (o != undefined) s = o.split(); 6 | 7 | global.s = s; 8 | 9 | inspect = () => s; 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/JSONStringifyOnAbstract2411.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | // 3 | (function() { 4 | let o = __abstract("object", "(o)"); 5 | let s; 6 | s = "A" + JSON.stringify(o); 7 | 8 | global.s = s; 9 | })(); 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/JSONparse2.js: -------------------------------------------------------------------------------- 1 | let ob = global.__makePartial ? __makePartial({ x: 1 }) : { x: 1 }; 2 | var str = JSON.stringify(ob); 3 | ob.x = 3; 4 | let ob2 = JSON.parse(str); 5 | let ob2x = ob2.x; 6 | ob2.x++; 7 | x = ob2.x; 8 | let ob3 = JSON.parse(str); 9 | y = ob3.x; 10 | var z = ob2x; 11 | 12 | inspect = function() { 13 | return "" + str + ob.x + ob2.x + ob3.x + z; 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/abstract/ListOperationsSimple.js: -------------------------------------------------------------------------------- 1 | function foo(y) { 2 | let inc = x => x + 1; 3 | return y.map(inc); 4 | } 5 | 6 | global.__optimize && __optimize(foo); 7 | 8 | inspect = () => { 9 | return foo([7, 8, 9, 10]); 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/abstract/MathRound.js: -------------------------------------------------------------------------------- 1 | var x = 42.42; 2 | y = global.__abstract ? __abstract("number", x.toString()) : x; 3 | var s = Math.round(y); 4 | inspect = function() { 5 | return s; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/MightBeEmptyAssignment.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var a = {}; 3 | var c = global.__abstract ? __abstract("boolean", "true") : "c"; 4 | if (c) { 5 | a.foo = 42; 6 | global.a = a; 7 | } 8 | inspect = function() { 9 | return global.a.foo; 10 | }; 11 | })(); 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/MutatingObjectsFromOuterScope.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let outer = {}; 3 | function f(x) { 4 | outer.x = x; 5 | return outer; 6 | } 7 | if (global.__optimize) __optimize(f); 8 | global.f = f; 9 | inspect = function() { 10 | return f(42).x; 11 | }; 12 | })(); 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/NegateObject.js: -------------------------------------------------------------------------------- 1 | y = global.__abstract ? __abstract("object", "({})") : {}; 2 | let z = !y; 3 | if (global.__isAbstract && __isAbstract(z)) throw new Error("bug!"); 4 | var x = z; 5 | inspect = function() { 6 | return x; 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/abstract/NestedAbstractProperties.js: -------------------------------------------------------------------------------- 1 | let o = global.__abstract 2 | ? __abstract( 3 | { 4 | x: __abstract("number"), 5 | }, 6 | "({x: 42})" 7 | ) 8 | : { x: 42 }; 9 | var a = o.x; 10 | inspect = function() { 11 | return "" + a; 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/NullPrototypePartialKey.js: -------------------------------------------------------------------------------- 1 | let s = global.__abstract ? __abstract("string", "('foo')") : "foo"; 2 | 3 | let x = Object.create(null); 4 | x.a = 1; 5 | x.b = 2; 6 | 7 | let y = x[s]; 8 | 9 | inspect = function() { 10 | return y; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/Number.js: -------------------------------------------------------------------------------- 1 | var n = new Number(123); 2 | 3 | inspect = function() { 4 | return "" + n.valueOf() + " " + n.toExponential(5); 5 | }; 6 | -------------------------------------------------------------------------------- /test/serializer/abstract/ObjectAssign4.js: -------------------------------------------------------------------------------- 1 | var obj = 2 | global.__abstract && global.__makePartial && global.__makeSimple 3 | ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) 4 | : { foo: 1 }; 5 | var copyOfObj = Object.assign({}, obj); 6 | 7 | inspect = function() { 8 | return JSON.stringify(copyOfObj); 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/ObjectAssign5.js: -------------------------------------------------------------------------------- 1 | var obj = 2 | global.__abstract && global.__makePartial && global.__makeSimple 3 | ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) 4 | : { foo: 1 }; 5 | var copyOfObj = Object.assign({}, obj); 6 | var copyOfCopyOfObj = Object.assign({}, copyOfObj); 7 | 8 | inspect = function() { 9 | return JSON.stringify(copyOfCopyOfObj); 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/abstract/ObjectExpression.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | let p = x ? "x" : "y"; 3 | let q = x ? "y" : "z"; 4 | let r = x ? "f" : "g"; 5 | 6 | var ob = { [p]: 1, [q]: 2 }; 7 | var ob2 = { [r]: function() {} }; 8 | 9 | inspect = function() { 10 | return ob.x + " " + ob.y + " " + ob2.f.name; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/Optional.js: -------------------------------------------------------------------------------- 1 | function f() { 2 | return 123; 3 | } 4 | var g = global.__abstractOrNull ? __abstractOrNull("function", "null") : null; 5 | var z = undefined; 6 | if (g !== null) z = g(); 7 | 8 | inspect = function() { 9 | return "" + z; 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/abstract/Optional2.js: -------------------------------------------------------------------------------- 1 | function f() { 2 | return 123; 3 | } 4 | var g = global.__abstractOrUndefined ? __abstractOrUndefined("function", "f") : f; 5 | if (g != null) { 6 | var z = g(); 7 | } 8 | 9 | inspect = function() { 10 | return "" + z; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/Optional3.js: -------------------------------------------------------------------------------- 1 | // Copies of f;:2 2 | function f() { 3 | return 123; 4 | } 5 | var g = global.__abstractOrNullOrUndefined ? __abstractOrNullOrUndefined("function", "f") : f; 6 | var z = g && g(); 7 | 8 | inspect = function() { 9 | return "" + z; 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/abstract/Optional4.js: -------------------------------------------------------------------------------- 1 | var g = global.__abstractOrNull ? __abstractOrNull("function", "null") : null; 2 | var z = g && g(); 3 | 4 | inspect = function() { 5 | return "" + z; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/OrdinaryToPrimitive.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let x = { 3 | toString() { 4 | return Math.random() ? "a" : "b"; 5 | }, 6 | }; 7 | new Date(x); 8 | -------------------------------------------------------------------------------- /test/serializer/abstract/OwnKeys.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let x = __abstract("boolean", "true"); 3 | let ob = { a: 1 }; 4 | if (x) { 5 | delete ob.a; 6 | } 7 | let keys = Reflect.ownKeys(ob); 8 | console.log(keys[0]); 9 | -------------------------------------------------------------------------------- /test/serializer/abstract/PossibleThrow.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | let y; 3 | try { 4 | if (x) { 5 | y = 1; 6 | throw Error(); 7 | } else { 8 | y = 0; 9 | } 10 | } catch (e) {} 11 | 12 | inspect = function() { 13 | return y; 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/abstract/PropagateFunctionResultType.js: -------------------------------------------------------------------------------- 1 | // add at runtime: let __obj = {f: function() { return 19; }}; 2 | let obj = global.__abstract 3 | ? __abstract({ f: __abstract(":number") }, "__obj") 4 | : { 5 | f: function() { 6 | return 19; 7 | }, 8 | }; 9 | let result = obj.f() + 23; 10 | global.inspect = function() { 11 | return 42; 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/Property3.js: -------------------------------------------------------------------------------- 1 | // does not contain:456 2 | let x = global.__abstract ? __abstract("boolean", "true") : true; 3 | 4 | let ob = {}; 5 | if (x) { 6 | ob.x = 123; 7 | } else { 8 | ob.x = 456; 9 | } 10 | if (x) { 11 | var y = ob; 12 | } 13 | 14 | inspect = function() { 15 | return y; 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/abstract/Property4.js: -------------------------------------------------------------------------------- 1 | // does not contain:Date 2 | // omit invariants 3 | let x = global.__abstract ? __abstract("boolean", "true") : true; 4 | 5 | let ob = {}; 6 | if (x) { 7 | ob.x = 123; 8 | } else { 9 | ob.x = Date.now(); 10 | } 11 | if (x) { 12 | var y = ob; 13 | } 14 | 15 | inspect = function() { 16 | return y; 17 | }; 18 | -------------------------------------------------------------------------------- /test/serializer/abstract/Property5.js: -------------------------------------------------------------------------------- 1 | // does not contain:dead 2 | let x = global.__abstract ? __abstract("boolean", "true") : true; 3 | 4 | let ob = {}; 5 | if (x) { 6 | ob.x = 123; 7 | } else { 8 | let nested = { p: "dead" }; 9 | ob.x = { left: nested, right: nested }; 10 | } 11 | if (x) { 12 | var y = ob; 13 | } 14 | 15 | inspect = function() { 16 | return y; 17 | }; 18 | -------------------------------------------------------------------------------- /test/serializer/abstract/PropertyAttributeConflict.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | var c = global.__abstract ? __abstract("boolean", "(true)") : true; 4 | var obj = { x: 1 }; 5 | if (c) delete obj.x; 6 | Object.defineProperty(obj, "x", { value: 2 }); 7 | inspect = function() { 8 | return Object.getOwnPropertyDescriptor(obj, "x").enumerable; 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/PutValue.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | var i = 42; 3 | i.someProperty = 43; 4 | 5 | var obj = __makePartial({}); 6 | obj.someProperty = 42; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/PutValue11.js: -------------------------------------------------------------------------------- 1 | var c = global.__abstract ? __abstract("boolean", "false") : false; 2 | var a = {}; 3 | if (c) a.f = a; 4 | 5 | inspect = function() { 6 | return "f" in a; 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/abstract/PutValue13.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let a = global.__abstract ? __abstract("boolean", "(false)") : false; 3 | let obj = {}; 4 | if (a) { 5 | obj.notAnObject = Date.now(); 6 | } 7 | inspect = function() { 8 | return obj.notAnObject instanceof Object; 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/abstract/PutValue2.js: -------------------------------------------------------------------------------- 1 | var obj = global.__makePartial ? __makePartial({ someProperty: 41 }) : {}; 2 | obj.someProperty = 42; 3 | var z = obj.someProperty; 4 | 5 | inspect = function() { 6 | return "" + z; 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/abstract/PutValue3.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let obj = { x: 123 }; 4 | 5 | var o = x ? obj : { x: 456 }; 6 | 7 | o.x = 42; 8 | 9 | inspect = function() { 10 | return JSON.stringify(o); 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/PutValue4.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | var o1 = { x: 23 }; 4 | var o2 = { x: 12 }; 5 | let a = x ? o1 : o2; 6 | a.x = 42; 7 | var y = o1.x; 8 | o1.x = 99; 9 | 10 | inspect = function() { 11 | return "" + y + "-" + o1.x + "-" + o2.x; 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/PutValue5.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let obj = { x: 123 }; 4 | 5 | var o = x ? obj : { y: 456 }; 6 | 7 | o.y = 42; 8 | 9 | inspect = function() { 10 | return JSON.stringify(o); 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/PutValue6.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let x = __abstract("boolean", "true"); 3 | 4 | let obj = { set x(v) {} }; 5 | 6 | o = x ? obj : { x: 456 }; 7 | 8 | o.x = 42; 9 | -------------------------------------------------------------------------------- /test/serializer/abstract/Refine.js: -------------------------------------------------------------------------------- 1 | // does not contain: ? 10 : 2 | 3 | let x = global.__abstract ? __abstract("boolean", "true") : true; 4 | let y; 5 | let z; 6 | if (x) y = 10; 7 | if (x) z = y; 8 | else z = 10; 9 | 10 | inspect = function() { 11 | return z; 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/Refine2.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "false") : false; 2 | let f = function() { 3 | return 42; 4 | }; 5 | let initialized = false; 6 | if (x) { 7 | f = undefined; 8 | initialized = true; 9 | } 10 | let result; 11 | if (!initialized) { 12 | result = f(); 13 | } 14 | 15 | inspect = function() { 16 | return result; 17 | }; 18 | -------------------------------------------------------------------------------- /test/serializer/abstract/Refine4.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | let ob = x ? { y: "z" } : null; 3 | var z = ob != null && ob; 4 | var z1 = ob != null || x || ob; 5 | 6 | inspect = function() { 7 | return z.y + z1; 8 | }; 9 | -------------------------------------------------------------------------------- /test/serializer/abstract/Refine5.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | let ob = x ? { y: "z" } : undefined; 3 | var z = ob != undefined && ob; 4 | var z1 = ob != undefined || x || ob; 5 | 6 | inspect = function() { 7 | return z.y + z1; 8 | }; 9 | -------------------------------------------------------------------------------- /test/serializer/abstract/RegressionTestForNestedGenerators.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var x = global.__abstract ? __abstract("boolean", "(true)") : true; 3 | if (x) { 4 | var obj = {}; 5 | global.obj = obj; 6 | obj.time = Date.now(); 7 | } 8 | inspect = function() { 9 | return global.obj.time > 0; 10 | }; 11 | })(); 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/ReplaceFunctionBody.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f() { 3 | return 23; 4 | } 5 | function g() { 6 | return 42; 7 | } 8 | if (global.__abstract) { 9 | global.__replaceFunctionImplementation_unsafe(f, g); 10 | global.inspect = f; 11 | } else { 12 | global.inspect = g; 13 | } 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/abstract/ResidualExplicitParameters.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let x = 42; 3 | let y = global.__residual_unsafe 4 | ? __residual_unsafe("number", function() { 5 | return x; 6 | }) 7 | : 42; // this variant takes no further arguments 8 | inspect = function() { 9 | return y; 10 | }; 11 | })(); 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/ResidualExplicitParameters2.js: -------------------------------------------------------------------------------- 1 | // cannot serialize 2 | (function() { 3 | let x = 42; 4 | let y = global.__residual 5 | ? __residual("number", function() { 6 | return x; 7 | }) 8 | : 42; // this variant takes no further arguments 9 | inspect = function() { 10 | return y; 11 | }; 12 | })(); 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/ResidualInvariant1.js: -------------------------------------------------------------------------------- 1 | function checker() { 2 | let x = global.__abstract ? global.__abstract("number", "5") : 5; 3 | global.__assume && global.__assume(x !== 5, "x should not be 5"); 4 | } 5 | 6 | inspect = () => { 7 | try { 8 | checker(); 9 | return "x should not be 5"; 10 | } catch (err) { 11 | return err; 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/ResidualInvariant2.js: -------------------------------------------------------------------------------- 1 | function checker() { 2 | let x = global.__abstract ? global.__abstract("number", "5") : 5; 3 | global.__assume && global.__assume(x === 5, "x should not be 5"); 4 | } 5 | 6 | inspect = () => { 7 | try { 8 | checker(); 9 | return "ok"; 10 | } catch (err) { 11 | throw Error("Safe assumption violated"); 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/ResidualInvariant3.js: -------------------------------------------------------------------------------- 1 | function checker() { 2 | let x = global.__abstract ? global.__abstract("number", "5") : 5; 3 | global.__assume && global.__assume(x !== 5); 4 | } 5 | 6 | inspect = () => { 7 | try { 8 | checker(); 9 | return "Error: Assumption violated"; 10 | } catch (err) { 11 | return err.message; 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/ResidualInvariantPathCondition.js: -------------------------------------------------------------------------------- 1 | // does not contain:42 2 | 3 | function checker() { 4 | let x = global.__abstract ? global.__abstract("boolean", "true") : true; 5 | global.__assume && global.__assume(x); 6 | if (!x) { 7 | global.foo = 42; 8 | } 9 | } 10 | 11 | global.__optimize && __optimize(checker); 12 | 13 | inspect = () => {}; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/ResidualVoid.js: -------------------------------------------------------------------------------- 1 | var y = global.__residual 2 | ? __residual("void", function() { 3 | // A void residual function that has some side-effect that doesn't affect the heap 4 | let res = 0; 5 | }) 6 | : undefined; 7 | inspect = function() { 8 | return y; 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/Return.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let y = 1; 4 | 5 | function f(b) { 6 | if (b) { 7 | y = 2; 8 | return 1; 9 | } else { 10 | y = 3; 11 | return 2; 12 | } 13 | } 14 | 15 | var z = f(x); 16 | var z1 = y; 17 | 18 | inspect = function() { 19 | return "" + z + z1; 20 | }; 21 | -------------------------------------------------------------------------------- /test/serializer/abstract/Return1.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | var y = 1; 4 | 5 | function f(b) { 6 | if (b) return 1; 7 | y = 2; 8 | } 9 | 10 | var z = f(x); 11 | var z1 = y; 12 | var z2 = f(!x); 13 | var z3 = y; 14 | 15 | inspect = function() { 16 | return "" + z + z1 + z2 + z3; 17 | }; 18 | -------------------------------------------------------------------------------- /test/serializer/abstract/Return10.js: -------------------------------------------------------------------------------- 1 | // Copies of 42:1 2 | 3 | (function() { 4 | x = global.__abstract ? __abstract("number", "5") : 5; 5 | if (x == 5) { 6 | console.log("42"); 7 | } else { 8 | return; 9 | } 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/abstract/Return1a.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | var y = 1; 4 | 5 | function f(b) { 6 | if (b) { 7 | } else return 1; 8 | y = 2; 9 | } 10 | 11 | var z = f(x); 12 | var z1 = y; 13 | var z2 = f(!x); 14 | var z3 = y; 15 | 16 | inspect = function() { 17 | return "" + z + z1 + z2 + z3; 18 | }; 19 | -------------------------------------------------------------------------------- /test/serializer/abstract/Return2.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | var y = 1; 4 | 5 | function f(b) { 6 | if (b) return 1; 7 | y = 2; 8 | return 2; 9 | } 10 | 11 | var z = f(x); 12 | 13 | inspect = function() { 14 | return "" + y + z; 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/abstract/Return2a.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | var y = 1; 4 | 5 | function f(b) { 6 | if (b) { 7 | } else return 1; 8 | y = 2; 9 | return 2; 10 | } 11 | 12 | var z = f(!x); 13 | 14 | inspect = function() { 15 | return "" + y + z; 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/abstract/Return3.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | var y = 1; 4 | var y1 = 2; 5 | 6 | function f(b) { 7 | y = 2; 8 | if (b) return 0; 9 | y1 = 3; 10 | if (x) { 11 | return 1; 12 | } else { 13 | throw 2; 14 | } 15 | } 16 | 17 | var z = f(!x); 18 | 19 | inspect = function() { 20 | return z; 21 | }; 22 | -------------------------------------------------------------------------------- /test/serializer/abstract/Return3a.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | var y = 1; 4 | var y1 = 2; 5 | 6 | function f(b) { 7 | y = 2; 8 | if (b) { 9 | } else return 0; 10 | y1 = 3; 11 | if (x) { 12 | return 1; 13 | } else { 14 | throw 2; 15 | } 16 | } 17 | 18 | var z = f(!x); 19 | 20 | inspect = function() { 21 | return z; 22 | }; 23 | -------------------------------------------------------------------------------- /test/serializer/abstract/Return4.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | var y = 1; 4 | 5 | function f(b) { 6 | if (b) return 1; 7 | y = 2; 8 | if (b) return 2; 9 | y = 3; 10 | if (b) return 3; 11 | } 12 | 13 | var z = f(!x); 14 | 15 | inspect = function() { 16 | return "" + y + z; 17 | }; 18 | -------------------------------------------------------------------------------- /test/serializer/abstract/Return4a.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | var y = 1; 4 | 5 | function f(b) { 6 | if (b) { 7 | } else return 1; 8 | y = 2; 9 | if (b) { 10 | } else return 2; 11 | y = 3; 12 | if (b) { 13 | } else return 3; 14 | } 15 | 16 | var z = f(x); 17 | 18 | inspect = function() { 19 | return "" + y + z; 20 | }; 21 | -------------------------------------------------------------------------------- /test/serializer/abstract/Return5.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | var y = 1; 4 | 5 | function f(b) { 6 | if (b) return 1; 7 | y = 2; 8 | if (b) return 2; 9 | y = 3; 10 | return 3; 11 | } 12 | 13 | var z = f(!x); 14 | 15 | inspect = function() { 16 | return "" + y + z; 17 | }; 18 | -------------------------------------------------------------------------------- /test/serializer/abstract/Return5a.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | var y = 1; 4 | 5 | function f(b) { 6 | if (b) { 7 | } else return 1; 8 | y = 2; 9 | if (b) { 10 | } else return 2; 11 | y = 3; 12 | return 3; 13 | } 14 | 15 | var z = f(x); 16 | 17 | inspect = function() { 18 | return "" + y + z; 19 | }; 20 | -------------------------------------------------------------------------------- /test/serializer/abstract/Return6.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | var y = 1; 4 | 5 | function f(b) { 6 | if (b) throw 1; 7 | y = 2; 8 | } 9 | 10 | var z = f(!x); 11 | 12 | inspect = function() { 13 | return z; 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/abstract/Return6a.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "(1)") : 1; 2 | 3 | let i = 0; 4 | 5 | function f() { 6 | if (i === x) return 10; 7 | i++; 8 | if (i === x) return 11; 9 | i++; 10 | } 11 | 12 | f(); 13 | 14 | inspect = function() { 15 | return i; 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/abstract/Return8.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | var y = 1; 4 | 5 | function f(b) { 6 | if (b) throw 1; 7 | y = 2; 8 | } 9 | 10 | function g(b) { 11 | f(b); 12 | } 13 | 14 | var z = g(x); 15 | 16 | inspect = function() { 17 | return z; 18 | }; 19 | -------------------------------------------------------------------------------- /test/serializer/abstract/Return9.js: -------------------------------------------------------------------------------- 1 | let b = global.__abstract ? __abstract("boolean", "true") : true; 2 | function f() {} 3 | 4 | let y = 1; 5 | function g() { 6 | if (b) return "foo"; 7 | y = 2; 8 | f(); 9 | return "bar"; 10 | } 11 | 12 | var x = g(); 13 | 14 | inspect = function() { 15 | return [x, y].join(" "); 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/abstract/SimpleObject.js: -------------------------------------------------------------------------------- 1 | let o = global.__abstract ? __makeSimple(__abstract("object", "({})")) : {}; 2 | let p = global.__abstract ? __makeSimple(__abstract("object", "({ toString: () => 'x' })")) : { toString: () => "x" }; 3 | o[p] = p; 4 | var x = Array.isArray(o); 5 | var y = typeof o[p]; 6 | 7 | inspect = function() { 8 | return x + " " + y; 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/String.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("string", "('a,b,c,d,e')") : "a,b,c,d,e"; 2 | let sliced = x.slice(2, 3); 3 | let split = x.split(",", 2); 4 | 5 | inspect = function() { 6 | return sliced + split.join(":"); 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/abstract/StringLength.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("string", "('a,b,c,d,e')") : "a,b,c,d,e"; 2 | let length = x.length; 3 | 4 | inspect = function() { 5 | return length; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/Switch4.js: -------------------------------------------------------------------------------- 1 | let input = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let selector = input ? "A" : "B"; 4 | let value = 1; 5 | switch (selector) { 6 | case "A": 7 | value = 2; 8 | throw 123; 9 | case "B": 10 | value = 3; 11 | break; 12 | } 13 | 14 | inspect = function() { 15 | return value; 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/abstract/Symbols.js: -------------------------------------------------------------------------------- 1 | // es6 2 | (function() { 3 | var myObj = {}; 4 | var fooSym = Symbol("foo"); 5 | var otherSym = Symbol("bar"); 6 | myObj["foo"] = "bar"; 7 | myObj[fooSym] = "baz"; 8 | myObj[otherSym] = "bing"; 9 | inspect = function() { 10 | return myObj[otherSym]; 11 | }; 12 | })(); 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/Symbols2.js: -------------------------------------------------------------------------------- 1 | // es6 2 | (function() { 3 | var myObj = {}; 4 | var otherSym = Symbol("bar"); 5 | myObj["foo"] = "bar"; 6 | myObj[otherSym] = myObj; 7 | inspect = function() { 8 | return myObj[otherSym]; 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/abstract/Symbols3.js: -------------------------------------------------------------------------------- 1 | // es6 2 | (function() { 3 | let x = global.__abstract ? __abstract("boolean", "(true)") : true; 4 | let obj = {}; 5 | let symbol = Symbol(); 6 | if (x) { 7 | obj[symbol] = 42; 8 | } 9 | inspect = function() { 10 | return obj[symbol]; 11 | }; 12 | })(); 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/Symbols4.js: -------------------------------------------------------------------------------- 1 | // es6 2 | (function() { 3 | //let x = global.__abstract ? __abstract("boolean", "(true)") : true; 4 | let obj = {}; 5 | let symbol = Symbol(); 6 | obj[symbol] = 42; 7 | delete obj[symbol]; 8 | inspect = function() { 9 | return symbol in obj; 10 | }; 11 | })(); 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/Symbols5.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let x = global.__abstract ? __abstract("symbol", "(Symbol())") : Symbol(); 3 | let y; 4 | try { 5 | y = +x; 6 | } catch (e) { 7 | y = e instanceof TypeError; 8 | } 9 | inspect = function() { 10 | return y; 11 | }; 12 | })(); 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/Symbols6.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let x = global.__abstract ? __abstract("symbol", "(Symbol())") : Symbol(); 3 | let y; 4 | try { 5 | y = x - 10; 6 | } catch (e) { 7 | y = e instanceof TypeError; 8 | } 9 | inspect = function() { 10 | return y; 11 | }; 12 | })(); 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/Symbols7.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let x = global.__abstract ? __abstract("symbol", "(Symbol())") : Symbol(); 3 | let y; 4 | try { 5 | y = x + 10; 6 | } catch (e) { 7 | y = e instanceof TypeError; 8 | } 9 | inspect = function() { 10 | return y; 11 | }; 12 | })(); 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/TemporalCSE.js: -------------------------------------------------------------------------------- 1 | this.glob = 123; 2 | let b = global.__abstract ? __abstract("boolean", "true") : true; 3 | let y; 4 | if (b) { 5 | y = glob; 6 | } 7 | let z; 8 | if (b) { 9 | z = glob; 10 | } 11 | 12 | inspect = function() { 13 | return y + " " + z; 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/abstract/Throw.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | try { 4 | if (x) throw "is true"; 5 | else throw "is false"; 6 | } catch (e) { 7 | var z = e; 8 | } 9 | 10 | inspect = function() { 11 | return "" + z; 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/Throw10.js: -------------------------------------------------------------------------------- 1 | let c1 = global.__abstract ? __abstract("boolean", "true") : true; 2 | let c2 = global.__abstract ? __abstract("boolean", "false") : false; 3 | 4 | function foo(cond) { 5 | if (cond) throw "I am an error too!"; 6 | } 7 | 8 | if (c2) { 9 | foo(c1); 10 | } 11 | 12 | inspect = function() { 13 | return "success"; 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/abstract/Throw2.js: -------------------------------------------------------------------------------- 1 | // does not contain:setPrototypeOf 2 | let x = global.__abstract ? __abstract("boolean", "true") : true; 3 | 4 | var z; 5 | try { 6 | if (x) throw new Error("is true"); 7 | z = "is false"; 8 | } catch (e) { 9 | z = e; 10 | } 11 | 12 | inspect = function() { 13 | return z; 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/abstract/Throw3.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | var z; 4 | try { 5 | if (x) z = "is true"; 6 | else throw "is false"; 7 | } catch (e) { 8 | z = e; 9 | } 10 | 11 | inspect = function() { 12 | return z; 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/Throw4.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | var z; 4 | try { 5 | if (x) z = "is true"; 6 | else throw "is false"; 7 | } finally { 8 | z = "is finally"; 9 | } 10 | 11 | inspect = function() { 12 | return z; 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/Throw5.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | function foo(b) { 4 | if (b) throw new Error("is true"); 5 | return "is false"; 6 | } 7 | var z; 8 | try { 9 | z = foo(x); 10 | } catch (e) { 11 | z = e; 12 | } 13 | 14 | inspect = function() { 15 | return z; 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/abstract/Throw5a.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | let y = global.__abstract ? __abstract("boolean", "false") : false; 3 | 4 | var z; 5 | if (x) { 6 | if (y) throw new Error("x is true"); 7 | z = 1; 8 | } else { 9 | if (y) throw new Error("x is false"); 10 | z = 2; 11 | } 12 | 13 | inspect = function() { 14 | return z; 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/abstract/Throw6.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | function foo(b) { 4 | if (b) throw new Error("is true"); 5 | return "is false"; 6 | } 7 | 8 | var z = foo(!x); 9 | 10 | inspect = function() { 11 | return z; 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/Throw6a.js: -------------------------------------------------------------------------------- 1 | let a = global.__abstract ? __abstract("boolean", "false") : false; 2 | let b = global.__abstract ? __abstract("boolean", "(false)") : false; 3 | 4 | function foo() { 5 | if (a) throw new Error("one"); 6 | if (b) throw new Error("true"); 7 | return "!a && !b"; 8 | } 9 | 10 | var z = foo(); 11 | 12 | inspect = function() { 13 | return z; 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/abstract/Throw6b.js: -------------------------------------------------------------------------------- 1 | // Copies of _\$0 = _\$1.Date.now():1 2 | let x = global.__abstract ? __abstract("boolean", "true") : true; 3 | 4 | function foo(b) { 5 | if (b) throw new Error("" + Date.now()); 6 | return "is false"; 7 | } 8 | let z = foo(!x); 9 | 10 | inspect = function() { 11 | return z; 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/ThrowInConstructor.js: -------------------------------------------------------------------------------- 1 | function F() { 2 | const b = global.__abstract ? global.__abstract("boolean", "false") : false; 3 | if (b) throw new Error("abrupt"); 4 | return { p: 42 }; 5 | } 6 | 7 | const result = new F(); 8 | 9 | global.inspect = () => JSON.stringify(result); 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/ThrowInConstructor2.js: -------------------------------------------------------------------------------- 1 | function F() { 2 | const b = global.__abstract ? global.__abstract("boolean", "true") : true; 3 | return b ? { p: 42 } : 42; 4 | } 5 | 6 | const result = new F(); 7 | 8 | global.inspect = () => JSON.stringify(result); 9 | -------------------------------------------------------------------------------- /test/serializer/abstract/ThrowInConstructor3.js: -------------------------------------------------------------------------------- 1 | function F() { 2 | const b1 = global.__abstract ? global.__abstract("boolean", "false") : false; 3 | const b2 = global.__abstract ? global.__abstract("boolean", "true") : true; 4 | if (b1) throw new Error("abrupt"); 5 | return b2 ? { p: 42 } : 42; 6 | } 7 | 8 | const result = new F(); 9 | 10 | global.inspect = () => JSON.stringify(result); 11 | -------------------------------------------------------------------------------- /test/serializer/abstract/ThrowInDoubleCatch.js: -------------------------------------------------------------------------------- 1 | try { 2 | try { 3 | const b = __abstract("boolean", "false"); 4 | if (b) throw new Error("throw"); 5 | } catch (error) {} 6 | } catch (error) { 7 | console.log(error.message); 8 | } 9 | -------------------------------------------------------------------------------- /test/serializer/abstract/ToString.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "42") : 42; 2 | let s = x.toString(); 3 | let t = s.toString(); 4 | inspect = function() { 5 | return t; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/ToString2.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? global.__abstract("string", "('xxxx')") : "xxxx"; 2 | let y = global.__abstract ? global.__abstract("number", "(3)") : 3; 3 | let ob = { toString: () => x }; 4 | let ob2 = { toString: () => x, valueOf: () => y }; 5 | var str = "aaa" + ob; 6 | var num = 123 + ob2; 7 | 8 | inspect = function() { 9 | return str + num; 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/abstract/ToString3.js: -------------------------------------------------------------------------------- 1 | var a = String(global.__abstract ? __abstract("string", '"foo"') : "foo"); 2 | var b = String(global.__abstract ? __abstract("number", "42") : 42); 3 | var c = String(global.__abstract ? __abstract("boolean", "true") : true); 4 | 5 | inspect = function() { 6 | return JSON.stringify({ a, b, c }); 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/abstract/TypeDomain4.js: -------------------------------------------------------------------------------- 1 | // does not contain:typeof 2 | (function() { 3 | let a = global.__makeSimple ? global.__makeSimple(__abstract({}, "{}")) : {}; 4 | let b = global.__abstract ? global.__abstract("number", "100") : 100; 5 | let x = a.x === b; 6 | let y = typeof x; 7 | 8 | inspect = function() { 9 | return y; 10 | }; 11 | })(); 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/TypeDomain5.js: -------------------------------------------------------------------------------- 1 | // does not contain:=== 2 | (function() { 3 | let x = global.__abstract ? global.__abstract("boolean", "true") : true; 4 | let a = {}; 5 | if (x) { 6 | a = 100; 7 | } 8 | let y = a === 200; 9 | 10 | inspect = function() { 11 | return y; 12 | }; 13 | })(); 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/TypeOf.js: -------------------------------------------------------------------------------- 1 | var x = 42; 2 | var y = global.__abstract ? global.__abstract("number", x.toString()) : x; 3 | var s = typeof y; 4 | 5 | let f = y ? () => 1 : () => 2; 6 | var t = typeof f; 7 | 8 | let yy = y * y; 9 | var u = typeof yy; 10 | 11 | let b = y > 3; 12 | var v = typeof b; 13 | 14 | inspect = function() { 15 | return s + t + u + v; 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/abstract/TypesDomain.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? global.__abstract("boolean", "true") : true; 2 | 3 | let o = x ? {} : () => 1; 4 | 5 | var z = o || "no no no"; 6 | 7 | var z1 = Number.isFinite(o); 8 | 9 | inspect = function() { 10 | return "" + z + z1; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/TypesDomain2.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | let x = global.__abstract ? global.__abstract("boolean", "true") : true; 4 | 5 | let p = x ? 1 : {}; 6 | 7 | var z = isFinite(p); 8 | 9 | inspect = function() { 10 | return "" + z; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/UnaryExpression.js: -------------------------------------------------------------------------------- 1 | var x = global.__abstract ? global.__abstract("number", "42") : 42; 2 | var y1 = -x; 3 | var y2 = ~x; 4 | var y3 = !x; 5 | var y4 = typeof x; 6 | inspect = function() { 7 | return "" + y1 + y2 + y3 + y4; 8 | }; 9 | -------------------------------------------------------------------------------- /test/serializer/abstract/UnknownNumericKey.js: -------------------------------------------------------------------------------- 1 | var n = global.__abstract ? global.__abstract("number", "(0)") : 0; 2 | var result = { 0: "a" }[n]; 3 | inspect = function() { 4 | return result; 5 | }; 6 | -------------------------------------------------------------------------------- /test/serializer/abstract/UnknownNumericKeyAssignment.js: -------------------------------------------------------------------------------- 1 | var n = global.__abstract ? global.__abstract("number", "(0)") : 0; 2 | var obj = { 0: "a", 1: "b" }; 3 | obj[n] = "c"; 4 | inspect = function() { 5 | return JSON.stringify(obj); 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/UnknownPropertyOnPrimitive.js: -------------------------------------------------------------------------------- 1 | var b = global.__abstract ? global.__abstract("boolean", "(true)") : true; 2 | var n = global.__abstract ? global.__abstract("number", "(0)") : 0; 3 | b[n] = "noop"; 4 | inspect = function() { 5 | return b["0"]; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/UpdateExpression.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? global.__abstract("number", "42") : 42; 2 | let y = x++; 3 | ++x; 4 | let z = --y; 5 | y--; 6 | inspect = function() { 7 | return "" + x + y + z; 8 | }; 9 | -------------------------------------------------------------------------------- /test/serializer/abstract/UpdateExpression3.js: -------------------------------------------------------------------------------- 1 | var foo = { x: 42 }; 2 | let obj = global.__makePartial ? global.__makePartial({ x: __abstract("number", "foo.x") }) : foo; 3 | let y = obj.x++; 4 | inspect = function() { 5 | return "" + obj.x + y; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/UseAbstractObjectValueTemplateInIsCall.js: -------------------------------------------------------------------------------- 1 | let obj = global.__abstract ? __abstract({}, "obj") : {}; 2 | let func = global.__abstract ? __abstract(function() {}, "func") : function() {}; 3 | global.result = typeof obj + "/" + typeof func; 4 | global.inspect = function() { 5 | return global.result; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/WaitGenerator2.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let x = global.__abstract ? __abstract("boolean", "(true)") : true; 3 | global.obj = {}; 4 | if (x) { 5 | var scope = Date.now(); 6 | global.obj.time = scope; 7 | } else { 8 | global.obj.time = 33; 9 | } 10 | inspect = function() { 11 | return global.obj.time > 0; 12 | }; 13 | })(); 14 | -------------------------------------------------------------------------------- /test/serializer/abstract/WhileLoop.js: -------------------------------------------------------------------------------- 1 | while (true) { 2 | break; 3 | } 4 | -------------------------------------------------------------------------------- /test/serializer/abstract/With.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | let obj = global.__abstract ? __abstract("object", "({x:1,y:3})") : { x: 1, y: 3 }; 4 | if (global.__makeSimple) global.__makeSimple(obj); 5 | let y = 2; 6 | with (obj) { 7 | z = x + y; 8 | } 9 | inspect = function() { 10 | return z; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/abstract/defineProperty.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let x = global.__abstract ? __abstract("object", "({p: 1})") : { p: 1 }; 3 | Object.defineProperty(x, "q", { enumerable: false, value: 2 }); 4 | -------------------------------------------------------------------------------- /test/serializer/abstract/defineProperty2.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let x = __abstract("boolean", "true"); 3 | let ob1 = []; 4 | Object.defineProperty(ob1, "length", { writable: false, value: 0 }); 5 | let ob2 = []; 6 | let ob = x ? ob1 : ob2; 7 | Object.defineProperty(ob, "0", { value: 1 }); 8 | -------------------------------------------------------------------------------- /test/serializer/abstract/getOwnPropertyDescriptor.js: -------------------------------------------------------------------------------- 1 | let x = global.__makePartial ? __makePartial({ p: 1 }, "({p: 1})") : { p: 1 }; 2 | Object.defineProperty(x, "p", { enumerable: false, value: 2 }); 3 | var z = Object.getOwnPropertyDescriptor(x, "p"); 4 | inspect = function() { 5 | return JSON.stringify(z); 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/getOwnPropertyDescriptor2.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let x = __makePartial({ p: 1 }, "({p: 1})"); 3 | z = Object.getOwnPropertyDescriptor(x, "q"); 4 | console.log(z); 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/getOwnPropertyDescriptor3.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | let x = __abstract("boolean", "true"); 3 | let ob = { a: 1 }; 4 | if (x) { 5 | delete ob.a; 6 | } 7 | let desc = Object.getOwnPropertyDescriptor(ob, "a"); 8 | console.log(JSON.stringify(desc)); 9 | -------------------------------------------------------------------------------- /test/serializer/abstract/getOwnPropertyDescriptor4.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | let ob = x ? { a: 1 } : { b: 2 }; 3 | let desc = Object.getOwnPropertyDescriptor(ob, "a"); 4 | inspect = function() { 5 | return desc; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/abstract/getOwnPropertyDescriptor5.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | let ob = x ? { a: 1 } : { a: 2 }; 3 | var desc = Object.getOwnPropertyDescriptor(ob, "a"); 4 | Object.defineProperty(ob, "b", desc); 5 | var b = ob.b; 6 | inspect = function() { 7 | return JSON.stringify(desc) + b; 8 | }; 9 | -------------------------------------------------------------------------------- /test/serializer/abstract/getOwnPropertyDescriptor8.js: -------------------------------------------------------------------------------- 1 | let desc = Object.getOwnPropertyDescriptor(Map.prototype, "size"); 2 | inspect = function() { 3 | return JSON.stringify(desc); 4 | }; 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/getOwnPropertyDescriptor9.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("boolean", "true") : true; 2 | let nonEnumerableA = { a: 1 }; 3 | Object.defineProperty(nonEnumerableA, "a", { enumerable: false }); 4 | let ob = x ? nonEnumerableA : { a: 2 }; 5 | let desc = Object.getOwnPropertyDescriptor(ob, "a"); 6 | inspect = function() { 7 | return desc; 8 | }; 9 | -------------------------------------------------------------------------------- /test/serializer/abstract/object-assign2.js: -------------------------------------------------------------------------------- 1 | var obj = 2 | global.__abstract && global.__makePartial && global.__makeSimple 3 | ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) 4 | : { foo: 1 }; 5 | var copyOfObj = Object.assign({}, { foo: 2 }, obj); 6 | 7 | inspect = function() { 8 | return JSON.stringify(copyOfObj); 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/abstract/object-assign6.js: -------------------------------------------------------------------------------- 1 | var obj = 2 | global.__abstract && global.__makePartial && global.__makeSimple 3 | ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) 4 | : { foo: 1 }; 5 | 6 | var copyOfObj = {}; 7 | Object.assign(copyOfObj, obj); 8 | copyOfObj.x = 10; 9 | 10 | inspect = function() { 11 | return JSON.stringify(copyOfObj); 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/abstract/reflectHas.js: -------------------------------------------------------------------------------- 1 | let ob = global.__makePartial ? __makePartial({ p: 1 }) : { p: 1 }; 2 | var z = Reflect.has(ob, "p"); 3 | 4 | let b = global.__abstract ? __abstract("boolean", "true") : true; 5 | ob = b ? { p: 1 } : { p: 2 }; 6 | var z1 = Reflect.has(ob, "p"); 7 | 8 | inspect = function() { 9 | return "" + z + z1; 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/abstract/reflectHas1.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | let ob = __makePartial({ p: 1 }, "({p: 1})"); 4 | z = Reflect.has(ob, "q"); 5 | -------------------------------------------------------------------------------- /test/serializer/abstract/reflectHas2.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | let b = __abstract("boolean", "true"); 4 | ob = b ? { p: 1 } : { q: 2 }; 5 | z1 = Reflect.has(ob, "p"); 6 | -------------------------------------------------------------------------------- /test/serializer/abstract/toLocaleString.js: -------------------------------------------------------------------------------- 1 | // throws introspection error 2 | 3 | var x = __abstract("number"); 4 | var y = x.toLocaleString(); 5 | if (y) { 6 | } 7 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/ArrayConcat.js: -------------------------------------------------------------------------------- 1 | function fn(arg) { 2 | var x = Array.from(arg).map(x => x); 3 | return ["start"].concat(x).concat(["end"]); 4 | } 5 | 6 | if (global.__optimize) __optimize(fn); 7 | 8 | inspect = function() { 9 | return JSON.stringify([fn([1, 2, 3]), fn([4, 5, 6])]); 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/Class.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f() { 3 | class foo { 4 | doSomething() { 5 | return 42; 6 | } 7 | } 8 | return foo; 9 | } 10 | if (global.__optimize) __optimize(f); 11 | inspect = function() { 12 | return new (f())().doSomething(); 13 | }; 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/DeadCodeCheck.js: -------------------------------------------------------------------------------- 1 | // does not contain:x.thisShouldNotAppear 2 | 3 | function fn(x) { 4 | var a = x.thisShouldNotAppear; 5 | 6 | return 10; 7 | } 8 | 9 | global.__optimize && __optimize(fn); 10 | 11 | inspect = function() { 12 | return fn({}); 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/DeadOuterObject.js: -------------------------------------------------------------------------------- 1 | // expected Warning: PP1007 2 | 3 | (function() { 4 | let outer = {}; 5 | function f(x) { 6 | outer.x = x; 7 | } 8 | if (global.__optimize) __optimize(f); 9 | global.f = f; 10 | inspect = function() { 11 | return true; 12 | }; 13 | })(); 14 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/DelayInitializations1.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f() { 3 | let obj = {}; 4 | return function() { 5 | return obj; 6 | }; 7 | } 8 | global.__optimize && __optimize(f); 9 | inspect = function() { 10 | return f()() === f()(); 11 | }; 12 | })(); 13 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/DelayInitializations2.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f(c) { 3 | let obj = c ? {} : undefined; 4 | return function() { 5 | return obj; 6 | }; 7 | } 8 | global.__optimize && __optimize(f); 9 | inspect = function() { 10 | return f(true)() === f(true)(); 11 | }; 12 | })(); 13 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/DelayInitializations3.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f() { 3 | let a = global.__abstract ? __abstract(undefined, "(42)") : 42; 4 | function nested() { 5 | return a; 6 | } 7 | return nested; 8 | } 9 | global.__optimize && __optimize(f); 10 | inspect = function() { 11 | return "" + f()() + "/" + f()(); 12 | }; 13 | })(); 14 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/GlobalLetBinding.js: -------------------------------------------------------------------------------- 1 | // expected Warning: PP1007 2 | let x = undefined; 3 | let y = undefined; 4 | global.f = function() { 5 | x = {}; 6 | }; 7 | 8 | global.f1 = function() { 9 | y = {}; 10 | }; 11 | 12 | if (global.__optimize) __optimize(f); 13 | global.inspect = function() { 14 | global.f(); 15 | global.f1(); 16 | return x !== y; 17 | }; 18 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/ModifiedBindingWithoutInitialValue.js: -------------------------------------------------------------------------------- 1 | // expected Warning: PP1007 2 | // does not contain:dead 3 | (function() { 4 | let b = { p: "dead" }; 5 | global.f = function() { 6 | b = 42; 7 | return 23; 8 | }; 9 | if (global.__optimize) __optimize(f); 10 | inspect = function() { 11 | return global.f(); 12 | }; 13 | })(); 14 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/MutatedObject.js: -------------------------------------------------------------------------------- 1 | function additional1(x, y) { 2 | var cache = {}; 3 | 4 | if (!cache[x]) { 5 | cache[x] = y; 6 | } 7 | return cache[x]; 8 | } 9 | 10 | if (global.__optimize) __optimize(additional1); 11 | 12 | inspect = function inspect() { 13 | return additional1("a", 5); 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/NestedOptimizedFunction1.js: -------------------------------------------------------------------------------- 1 | // does not contain:1 + 2 2 | (function() { 3 | function g() { 4 | return 1 + 2; 5 | } 6 | function f() { 7 | if (global.__optimize) __optimize(g); 8 | return g; 9 | } 10 | if (global.__optimize) __optimize(f); 11 | global.inspect = function() { 12 | return f()(); 13 | }; 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/NestedOptimizedFunction2.js: -------------------------------------------------------------------------------- 1 | // does not contain:1 + 2 2 | (function() { 3 | function f() { 4 | function g() { 5 | return 1 + 2; 6 | } 7 | if (global.__optimize) __optimize(g); 8 | return g; 9 | } 10 | if (global.__optimize) __optimize(f); 11 | global.inspect = function() { 12 | return f()(); 13 | }; 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/ObjectLifetime1.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let a = [1, 2, 3]; 3 | let f = function() { 4 | return a; 5 | }; 6 | if (global.__optimize) __optimize(f); 7 | inspect = function() { 8 | return f() === f(); 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/OuterScopeCacheRegressionTest.js: -------------------------------------------------------------------------------- 1 | // expected Warning: PP1007 2 | var cache = {}; 3 | 4 | function additional1(x, y) { 5 | if (!cache[x]) { 6 | cache[x] = y; 7 | } 8 | return cache[x]; 9 | } 10 | 11 | if (global.__optimize) __optimize(additional1); 12 | 13 | inspect = function inspect() { 14 | return additional1("a", 5); 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/ThisArgument.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f(z) { 3 | var x = this.x; 4 | var self = this; 5 | return function(y) { 6 | return self.x + y + z; 7 | }; 8 | } 9 | 10 | if (global.__optimize) __optimize(f); 11 | 12 | global.inspect = function() { 13 | var g = f.apply({ x: 11 }); 14 | return g(7); 15 | }; 16 | })(); 17 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/UnknownArray.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/test/serializer/additional-functions/UnknownArray.js -------------------------------------------------------------------------------- /test/serializer/additional-functions/arguments3.js: -------------------------------------------------------------------------------- 1 | // does not contain:x = 5; 2 | 3 | function additional1(argument, argument) { 4 | var z = { foo: argument }; 5 | var x = 5; 6 | return z; 7 | } 8 | if (global.__optimize) __optimize(additional1); 9 | 10 | inspect = function inspect() { 11 | let z = additional1(7, 10); 12 | 13 | return "" + JSON.stringify(z); 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/dead-functions.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function g() { 3 | return 42; 4 | } 5 | function f() { 6 | return g(); 7 | } 8 | if (global.__optimize) { 9 | __optimize(f); 10 | __optimize(g); 11 | } 12 | inspect = f; 13 | })(); 14 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/named-function.js: -------------------------------------------------------------------------------- 1 | function additional1() { 2 | return { 3 | foo: function foo() { 4 | return 123; 5 | }, 6 | }; 7 | } 8 | 9 | if (this.__optimize) { 10 | __optimize(additional1); 11 | } 12 | 13 | inspect = function() { 14 | let x = additional1(); 15 | 16 | return x.foo(); 17 | }; 18 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/precise_captures.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function Bar() { 3 | return 123; 4 | } 5 | 6 | function Foo() { 7 | return Bar(); 8 | } 9 | 10 | if (global.__optimize) __optimize(Foo); 11 | 12 | global.Foo = Foo; 13 | 14 | inspect = function() { 15 | return Foo(); 16 | }; 17 | })(); 18 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/self_referential.js: -------------------------------------------------------------------------------- 1 | // does not contain:x = 5; 2 | 3 | function func1() { 4 | let x = 5; 5 | let z = [func1]; 6 | return z; 7 | } 8 | 9 | if (global.__optimize) { 10 | __optimize(func1); 11 | } 12 | 13 | inspect = function() { 14 | return func1()[0] === func1()[0]; 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/additional-functions/self_referential_simple.js: -------------------------------------------------------------------------------- 1 | // does not contain:x = 5; 2 | 3 | function func1() { 4 | let x = 5; 5 | let z = func1; 6 | return z; 7 | } 8 | 9 | if (global.__optimize) { 10 | __optimize(func1); 11 | } 12 | 13 | inspect = function() { 14 | return func1()[0] === func1()[0]; 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/basic/Arguments.js: -------------------------------------------------------------------------------- 1 | function g(i) { 2 | function f() { 3 | /* This function is too big to be inlined! */ 4 | return i + arguments[0]; 5 | } 6 | return f; 7 | } 8 | var h0 = g(0); 9 | var h1 = g(1); 10 | 11 | inspect = function() { 12 | return h1(42) - h0(42); 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/basic/Arguments2.js: -------------------------------------------------------------------------------- 1 | function f() { 2 | return arguments; 3 | } 4 | 5 | var x = f(42, "b", true); 6 | 7 | inspect = function() { 8 | return "" + x[0] + x[1] + x[2] + x.length + (x.callee === f) + (x.caller !== undefined); 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/basic/ArrayBuffer.js: -------------------------------------------------------------------------------- 1 | var x = new ArrayBuffer(16); 2 | // Two typed arrays over the same buffer should share the same buffer 3 | var y = new Int8Array(x); 4 | y[0] = 1; 5 | var z = new Int16Array(x); 6 | z[0] = 2; 7 | var a = new DataView(x); 8 | a.setInt8(2, 3); 9 | inspect = function() { 10 | return x.byteLength + y[0] + z[0] + y[2]; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/basic/ArrayIndexedProperty.js: -------------------------------------------------------------------------------- 1 | var a = [1, 2, 3]; 2 | Object.defineProperty(a, 2, { 3 | configurable: true, 4 | enumerable: true, 5 | get: function() { 6 | throw new Error(); 7 | }, 8 | }); 9 | inspect = function() { 10 | return a.length + typeof Object.getOwnPropertyDescriptor(a, 2).get; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/basic/ArrayInitializer2.js: -------------------------------------------------------------------------------- 1 | // does contain:[11,, 333, 44] 2 | (function() { 3 | let o = [11, 22, 33, 44]; 4 | o["2"] = 333; // Index property. 5 | delete o[1]; 6 | o["010"] = 42; // None-index property. 7 | inspect = function() { 8 | return o; 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/basic/ArrayInitializer3.js: -------------------------------------------------------------------------------- 1 | // does contain:[11, 22,, 44] 2 | (function() { 3 | let o = [11, 22, 33, 44]; 4 | Object.defineProperty(o, "2", { 5 | get: function() { 6 | return "changed"; 7 | }, 8 | }); 9 | inspect = function() { 10 | return o[2]; 11 | }; 12 | })(); 13 | -------------------------------------------------------------------------------- /test/serializer/basic/ArrayPrototype.js: -------------------------------------------------------------------------------- 1 | var na = Object.create(Array.prototype); 2 | var a = []; 3 | 4 | inspect = function() { 5 | a.push(123); 6 | na.push(123); 7 | return a[0] + na[0]; 8 | }; 9 | -------------------------------------------------------------------------------- /test/serializer/basic/ArrayWithProperties.js: -------------------------------------------------------------------------------- 1 | var a = [1, 2, 3]; 2 | a.foo = 42; 3 | 4 | // Array.toString() only shows indexed values 5 | inspect = function() { 6 | return a + " " + a.foo; 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/basic/AssumeDataProperty.js: -------------------------------------------------------------------------------- 1 | if (global.__assumeDataProperty) __assumeDataProperty(global, "o", undefined); 2 | if (global.__assumeDataProperty) __assumeDataProperty(global, "inspect", undefined); 3 | if (global.__makePartial) __makePartial(global); 4 | var o = 42; 5 | inspect = function() { 6 | return o; 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/basic/AssumeDataProperty2.js: -------------------------------------------------------------------------------- 1 | if (global.__assumeDataProperty) __assumeDataProperty(global, "special-identifier", undefined); 2 | if (global.__assumeDataProperty) __assumeDataProperty(global, "inspect", undefined); 3 | if (global.__makePartial) __makePartial(global); 4 | global["special-identifier"] = 42; 5 | inspect = function() { 6 | return global["special-identifier"]; 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/basic/AvoidIdLeaks.js: -------------------------------------------------------------------------------- 1 | // Making sure we don't leak ids in global scope 2 | 3 | inspect = function() { 4 | return global._0 !== undefined; 5 | }; 6 | -------------------------------------------------------------------------------- /test/serializer/basic/AvoidUnnecessaryWrappedFunctions.js: -------------------------------------------------------------------------------- 1 | // does not contain: function 2 | inspect = String.prototype.substring.bind(" testing", 1); 3 | -------------------------------------------------------------------------------- /test/serializer/basic/Bind.js: -------------------------------------------------------------------------------- 1 | // does not contain: bind 2 | (function() { 3 | function f() { 4 | return function() { 5 | /* This comment makes this function too big to be inlined */ return 42; 6 | }; 7 | } 8 | 9 | var f1 = f(); 10 | var f2 = f(); 11 | inspect = function() { 12 | return f1() + f2(); 13 | }; 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/basic/BoundFunction.js: -------------------------------------------------------------------------------- 1 | var o = { x: 42 }; 2 | o.f = function() { 3 | return this.x; 4 | }.bind(o); 5 | 6 | inspect = function() { 7 | return o.f(); 8 | }; 9 | -------------------------------------------------------------------------------- /test/serializer/basic/BoundFunctionProperties.js: -------------------------------------------------------------------------------- 1 | global.func = function(a, b, c) {}; 2 | global.bound = global.func.bind(null); 3 | global.bound.foo = 123; 4 | inspect = function() { 5 | return global.func.length + "-" + global.bound.length + "-" + global.bound.foo; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/basic/CapturedScope2.js: -------------------------------------------------------------------------------- 1 | // serialized function clone count: 0 2 | var f = function(x) { 3 | var i = x > 5 ? 0 : 1; 4 | return function() { 5 | i += 1; 6 | return i; 7 | }; 8 | }; 9 | 10 | var g = [f(2), f(6), f(4), f(9)]; 11 | 12 | inspect = function() { 13 | return g[0]() + " " + g[1]() + " " + g[2]() + " " + g[3](); 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/basic/CapturedScope8.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let f = function(x) { 3 | return function() { 4 | for (let i = 0; i < 100; i++) x++; 5 | return x; 6 | }; 7 | }; 8 | global.g = [f(2), f(6)]; 9 | inspect = function() { 10 | global.g[0](); 11 | return global.g[1](); 12 | }; 13 | })(); 14 | -------------------------------------------------------------------------------- /test/serializer/basic/ClassExpression.js: -------------------------------------------------------------------------------- 1 | const Foo = class { 2 | constructor() { 3 | this.x = 10; 4 | } 5 | method(y) { 6 | return this.x + y; 7 | } 8 | }; 9 | 10 | inspect = function() { 11 | var foo = new Foo(); 12 | return [foo, foo.method(10)]; 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/basic/ClassExpression5.js: -------------------------------------------------------------------------------- 1 | global.x = 0; 2 | 3 | class Bar { 4 | constructor(y) { 5 | global.x = y + 10; 6 | } 7 | } 8 | 9 | class Foo extends Bar { 10 | constructor(y) { 11 | super(y); 12 | } 13 | } 14 | 15 | new Foo(1); 16 | 17 | inspect = function() { 18 | return global.x; 19 | }; 20 | -------------------------------------------------------------------------------- /test/serializer/basic/ClassExpression6.js: -------------------------------------------------------------------------------- 1 | global.x = 0; 2 | 3 | var A = class { 4 | constructor(y) { 5 | global.x = y + 10; 6 | } 7 | render() {} 8 | }; 9 | 10 | var b = new A(); 11 | 12 | var C = class extends b.constructor { 13 | constructor(y) { 14 | super(y); 15 | } 16 | }; 17 | 18 | new C(1); 19 | 20 | inspect = function() { 21 | return global.x; 22 | }; 23 | -------------------------------------------------------------------------------- /test/serializer/basic/ClassExpression7.js: -------------------------------------------------------------------------------- 1 | global.C = class {}; 2 | global.C.prototype.foo = 42; 3 | 4 | inspect = function() { 5 | return JSON.stringify(global.C); 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/basic/Closure.js: -------------------------------------------------------------------------------- 1 | var f = function() { 2 | var i = 0; 3 | return function() { 4 | i += 1; 5 | return i; 6 | }; 7 | }; 8 | 9 | var g = f(); 10 | 11 | inspect = function() { 12 | return g() + " " + g(); 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/basic/Closure2.js: -------------------------------------------------------------------------------- 1 | var f = function() { 2 | for (var i = 0; ; ) { 3 | var j = 0; 4 | return function() { 5 | j += 1; 6 | return j; 7 | }; 8 | } 9 | }; 10 | 11 | var g = f(); 12 | 13 | inspect = function() { 14 | return g() + " " + g(); 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/basic/Closure3.js: -------------------------------------------------------------------------------- 1 | var f = function() { 2 | var i = 42; 3 | return function() { 4 | return i; 5 | }; 6 | }; 7 | 8 | var g = f(); 9 | 10 | inspect = function() { 11 | return g() + " " + g(); 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/basic/Closure4.js: -------------------------------------------------------------------------------- 1 | var g, h; 2 | var f = function() { 3 | var i = 42; 4 | g = function() { 5 | return i; 6 | }; 7 | h = function() { 8 | i += 1; 9 | return i; 10 | }; 11 | }; 12 | 13 | f(); 14 | 15 | inspect = function() { 16 | return g() + " " + h() + " " + g(); 17 | }; 18 | -------------------------------------------------------------------------------- /test/serializer/basic/ClosureRefVisitor.js: -------------------------------------------------------------------------------- 1 | // jsc 2 | (function() { 3 | let o = { 4 | encode: function encode(s) { 5 | return unescape(encodeURI(s)); 6 | }, 7 | }; 8 | inspect = function() { 9 | return o; 10 | }; 11 | if (global.__makePartial) { 12 | __makePartial(global); 13 | } 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/basic/ClosureRefVisitor2.js: -------------------------------------------------------------------------------- 1 | // omit invariants 2 | (function() { 3 | var f = function() { 4 | return function() { 5 | return function() { 6 | return this.x; 7 | }.bind({ x: 42 }); 8 | }; 9 | }; 10 | var g1 = f(); 11 | var g2 = f(); 12 | var g3 = f(); 13 | inspect = function() { 14 | return g1() + g2() + g3(); 15 | }; 16 | })(); 17 | -------------------------------------------------------------------------------- /test/serializer/basic/ConditionalReturn.js: -------------------------------------------------------------------------------- 1 | let b = global.__abstract ? __abstract("boolean", "true") : true; 2 | 3 | let n1; 4 | if (b) n1 = 5; 5 | let n2 = global.__abstract ? __abstract("number", "7") : 7; 6 | 7 | function f() { 8 | if (!b) return; 9 | return n2 - n1; 10 | } 11 | 12 | inspect = function() { 13 | return f(); 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/basic/CyclicArray.js: -------------------------------------------------------------------------------- 1 | var a = [0, 1, 2, 3, 4]; 2 | a[2] = a; 3 | 4 | inspect = function() { 5 | return a[2][2][2][2][2][4]; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/basic/CyclicDependencies.js: -------------------------------------------------------------------------------- 1 | var a = { v: 42 }; 2 | var b = { a: a }; 3 | a.b = b; 4 | 5 | inspect = function() { 6 | return a.b.a.b.a.b.a.b.a.b.a.b.a.b.a.v; 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/basic/Date.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var x = new Date(42); 3 | inspect = function() { 4 | return x.getTime(); 5 | }; 6 | })(); 7 | -------------------------------------------------------------------------------- /test/serializer/basic/DelayInitWithDifferentValues.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f(y) { 3 | let x = 0; 4 | return function() { 5 | return [x++, y.value]; 6 | }; 7 | } 8 | let f1 = f({ value: 1 }); 9 | let f2 = f({ value: 2 }); 10 | let f3 = f({ value: 3 }); 11 | inspect = function() { 12 | f1()[1] + f2()[1] + f3()[1]; 13 | }; 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/basic/DelayInitializations2.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let a = global.__abstract ? __abstract(undefined, "(42)") : 42; 3 | function f() { 4 | return a++; 5 | } 6 | global.inspect = function() { 7 | f() + f(); 8 | }; 9 | })(); 10 | -------------------------------------------------------------------------------- /test/serializer/basic/DelayedValuePropertyOrdering.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let o = { a: undefined, b: {} }; 3 | o.a = o; 4 | 5 | global.inspect = function() { 6 | for (let name in o) { 7 | return name; 8 | } 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/basic/DelayedValuePropertyOrdering2.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let x = global.__abstract ? __abstract("boolean", "false") : false; 3 | let o = { a: undefined, b: {} }; 4 | o.a = o; // delay 5 | if (x) delete o.a; // might have been deleted 6 | 7 | global.inspect = function() { 8 | for (let name in o) { 9 | return name; 10 | } 11 | }; 12 | })(); 13 | -------------------------------------------------------------------------------- /test/serializer/basic/EfficientPrototypeSetting.js: -------------------------------------------------------------------------------- 1 | // does not contain:__proto__ = 2 | (function() { 3 | var x = { x: 1 }; 4 | var proto = { p: 2 }; 5 | x.__proto__ = proto; 6 | inspect = function() { 7 | let p = Object.getPrototypeOf(x); 8 | return p === proto; 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/basic/EmitFunctionExpression.js: -------------------------------------------------------------------------------- 1 | // does contain: function ( 2 | // does not contain: function _ 3 | function f() { 4 | return 42; 5 | } 6 | inspect = function() { 7 | return f(); 8 | }; 9 | -------------------------------------------------------------------------------- /test/serializer/basic/EmptyBlocks.js: -------------------------------------------------------------------------------- 1 | // does not contain: {} 2 | (function() { 3 | function fib(x) { 4 | let y = Date.now(); 5 | return x <= 1 ? x : fib(x - 1) + fib(x - 2); 6 | } 7 | 8 | let x = Date.now(); 9 | if (x * 2 > 42) x = fib(10); 10 | global.result = x; 11 | inspect = function() { 12 | return global.result; 13 | }; 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/basic/ExceedStackDepth.js: -------------------------------------------------------------------------------- 1 | // exceeds stack limit 2 | // throws introspection error 3 | let immediate = function(future) { 4 | if (Date.now() > future) { 5 | return "exit value"; 6 | } 7 | 8 | return immediate(future); 9 | }; 10 | 11 | let n = immediate(Date.now() - 1); 12 | 13 | inspect = function() { 14 | return n; 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/basic/FrozenLazyObject.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let o = { foo: 42 }; 3 | Object.freeze(o); 4 | global.o = o; 5 | inspect = function() { 6 | return o.foo; 7 | }; 8 | })(); 9 | -------------------------------------------------------------------------------- /test/serializer/basic/Function.js: -------------------------------------------------------------------------------- 1 | var i = 0; 2 | var f = function() { 3 | i += 1; 4 | return i.toString(); 5 | }; 6 | 7 | inspect = function() { 8 | return f() + " " + f(); 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/basic/FunctionOrdering.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | global.first = function() { 3 | // Function ordering: 1 4 | second(); 5 | return 10; 6 | }; 7 | var second = function() { 8 | // Function ordering: 2 9 | return 20; 10 | }; 11 | inspect = function() { 12 | return global.first() + second(); 13 | }; 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/basic/FunctionPrototype.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f() {} 3 | let p = f.prototype; 4 | inspect = function() { 5 | return p === f.prototype; 6 | }; 7 | })(); 8 | -------------------------------------------------------------------------------- /test/serializer/basic/FunctionPrototype2.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f() {} 3 | f.prototype.foo = 42; 4 | inspect = function() { 5 | return f.prototype.foo; 6 | }; 7 | })(); 8 | -------------------------------------------------------------------------------- /test/serializer/basic/FunctionPrototypeAssignmentIsSimple.js: -------------------------------------------------------------------------------- 1 | // does not contain:defineProperty 2 | (function() { 3 | function f() {} 4 | f.prototype = 42; 5 | inspect = function() { 6 | return f.prototype; 7 | }; 8 | })(); 9 | -------------------------------------------------------------------------------- /test/serializer/basic/GenerateInvariants.js: -------------------------------------------------------------------------------- 1 | // does contain:Prepack model invariant violation 2 | (function() { 3 | let foo = global.__abstract ? __abstract({ x: __abstract("number") }, "({x : 1})") : { x: 1 }; 4 | global.foox = foo.x; 5 | global.inspect = function() {}; 6 | })(); 7 | -------------------------------------------------------------------------------- /test/serializer/basic/GlobalMustBePassedInWhenUsed.js: -------------------------------------------------------------------------------- 1 | // does contain:.call(this) 2 | (function() { 3 | var _$0 = this; 4 | 5 | x = 42; 6 | 7 | function _0() { 8 | return _$0.x; 9 | } 10 | 11 | inspect = _0; 12 | }.call(this)); 13 | -------------------------------------------------------------------------------- /test/serializer/basic/GlobalProperty.js: -------------------------------------------------------------------------------- 1 | global.foo = 42; 2 | 3 | inspect = function() { 4 | return global.foo; 5 | }; 6 | -------------------------------------------------------------------------------- /test/serializer/basic/GlobalProperty2.js: -------------------------------------------------------------------------------- 1 | global.foo = 42; 2 | 3 | inspect = function() { 4 | global.foo += 1; 5 | return global.foo; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/basic/GlobalProperty3.js: -------------------------------------------------------------------------------- 1 | Object.defineProperty(global, "foo", { configurable: true, enumerable: false, value: 41 }); 2 | Object.defineProperty(global, "bar", { 3 | configurable: true, 4 | enumerable: false, 5 | get: function() { 6 | return 43; 7 | }, 8 | }); 9 | 10 | inspect = function() { 11 | global.foo += 1; 12 | return global.foo === global.bar; 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/basic/GlobalPropertyNotValidIdentifier.js: -------------------------------------------------------------------------------- 1 | global["foo-bar"] = 42; 2 | inspect = function() { 3 | return global["foo-bar"]; 4 | }; 5 | -------------------------------------------------------------------------------- /test/serializer/basic/GlobalPropertyStrict.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | global.foo = 42; 3 | 4 | global.inspect = function() { 5 | return global.foo; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/basic/GlobalPropertyStrict2.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | "use strict"; 3 | function a(x) { 4 | return x; 5 | } 6 | global.a = a; 7 | })(); 8 | inspect = function() { 9 | return global.a(22); 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/basic/GlobalThing.js: -------------------------------------------------------------------------------- 1 | // does contain: globalThing 2 | var globalThing; 3 | inspect = function() { 4 | return globalThing; 5 | }; 6 | -------------------------------------------------------------------------------- /test/serializer/basic/GlobalVar.js: -------------------------------------------------------------------------------- 1 | // does contain:var x 2 | var x = 1; 3 | -------------------------------------------------------------------------------- /test/serializer/basic/HelloWorld.js: -------------------------------------------------------------------------------- 1 | function hello() { 2 | return "hello"; 3 | } 4 | function world() { 5 | return "world"; 6 | } 7 | var s = hello() + " " + world(); 8 | 9 | inspect = function() { 10 | return s; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/basic/HoistFunctionDeclarations.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f() { 3 | return obj.f; 4 | } 5 | let obj = { f: f.prototype }; 6 | obj.obj = obj; 7 | inspect = function() { 8 | return f() === obj.f; 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/basic/IncrementalMemoization.js: -------------------------------------------------------------------------------- 1 | // Copies of String: 1 2 | // omit invariants 3 | (function() { 4 | let indexOf = String.prototype.indexOf; 5 | let substr = String.prototype.substr; 6 | inspect = function() { 7 | return indexOf.name + substr.name; 8 | }; 9 | })(); 10 | -------------------------------------------------------------------------------- /test/serializer/basic/IntrinsicPutValue.js: -------------------------------------------------------------------------------- 1 | Object["0"] = 1; 2 | inspect = function() { 3 | return Object["0"]; 4 | }; 5 | -------------------------------------------------------------------------------- /test/serializer/basic/IntrinsicSerialization.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let old = Array.prototype.forEach; 3 | Array.prototype.forEach = function() {}; 4 | Array.prototype.forEach = old; 5 | inspect = function() { 6 | return Array.prototype.forEach.name; 7 | }; 8 | })(); 9 | -------------------------------------------------------------------------------- /test/serializer/basic/Issue2555RegressionTest.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function A() { 3 | B; 4 | } 5 | function B() {} 6 | 7 | let p = Object.create(A.prototype); 8 | B.prototype = Object.create(p); 9 | 10 | global.inspect = function() { 11 | return p.prototype === A; 12 | }; 13 | })(); 14 | -------------------------------------------------------------------------------- /test/serializer/basic/IteratorPrototype.js: -------------------------------------------------------------------------------- 1 | // es6 2 | let IteratorPrototype = [][Symbol.iterator]().__proto__.__proto__; 3 | 4 | inspect = function() { 5 | return IteratorPrototype; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/basic/JSCCollections.js: -------------------------------------------------------------------------------- 1 | // jsc 2 | (function() { 3 | let o = new Object(); 4 | let m = new Map(); 5 | m.set(o, o); 6 | let s = new Set(); 7 | s.add(o); 8 | inspect = function() { 9 | return m.size + s.size; 10 | }; 11 | })(); 12 | -------------------------------------------------------------------------------- /test/serializer/basic/LargeDelayedValue.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let obj = { a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9, j: 10, k: 11, l: 12 }; 3 | global.a = [ 4 | function() { 5 | return obj; 6 | }, 7 | function() { 8 | return obj; 9 | }, 10 | ]; 11 | inspect = function() { 12 | global.a[0]().length + global.a[1]().length; 13 | }; 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/basic/LetGlobal.js: -------------------------------------------------------------------------------- 1 | let x = 0; 2 | var y = 1; 3 | 4 | function f() { 5 | let w = { x: 5 }; 6 | var z = { z: 6 }; 7 | x += 1; 8 | y += 1; 9 | let foo = function() { 10 | w.x += z.z + 1; 11 | }; 12 | foo(); 13 | return x + w.x + y; 14 | } 15 | inspect = f; 16 | -------------------------------------------------------------------------------- /test/serializer/basic/Map.js: -------------------------------------------------------------------------------- 1 | function Map() { 2 | return Map; 3 | } 4 | var f = Map; 5 | 6 | inspect = function() { 7 | return f == f(); 8 | }; 9 | -------------------------------------------------------------------------------- /test/serializer/basic/Map2.js: -------------------------------------------------------------------------------- 1 | var m = new Map([["a", 1], ["b", 2]]); 2 | m.foo = 123; 3 | 4 | var z = m; 5 | 6 | inspect = function() { 7 | return m.size === 2 && m instanceof Map && m.foo === 123 && m.get("a") === 1 && m.get("b") === 2; 8 | }; 9 | -------------------------------------------------------------------------------- /test/serializer/basic/MapIteratorPrototype.js: -------------------------------------------------------------------------------- 1 | // es6 2 | let MapIteratorPrototype = new Map()[Symbol.iterator]().__proto__; 3 | 4 | inspect = function() { 5 | return MapIteratorPrototype; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/basic/MapNotDeadMember.js: -------------------------------------------------------------------------------- 1 | // es6 2 | // does contain:__dead_object_signature__ 3 | 4 | let alive = new Object(); 5 | let dead = new String("__dead_object_signature__"); 6 | 7 | var s = new Map(); 8 | 9 | s.set(alive, 1); 10 | s.set(dead, 1); 11 | 12 | inspect = function() { 13 | return "containsAlive: " + s.has(alive); 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/basic/MemoizeGlobalPropertiesRegExp.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let re = RegExp; 3 | RegExp = function() { 4 | throw new Error(); 5 | }; 6 | RegExp = new re("ab+c"); 7 | })(); 8 | 9 | inspect = function() { 10 | return RegExp; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/basic/MissingInitialElement.js: -------------------------------------------------------------------------------- 1 | var a = [, 0]; 2 | inspect = function() { 3 | return a[0]; 4 | }; 5 | -------------------------------------------------------------------------------- /test/serializer/basic/NestedFunctions3.js: -------------------------------------------------------------------------------- 1 | // Copies of x0: 3 2 | var f = function() { 3 | return function() { 4 | var x0 = 1; 5 | var x1 = x0 + x0; 6 | var x2 = x1 + x1; 7 | var x3 = x2 + x2; 8 | var x4 = x3 + x3; 9 | return x4; 10 | }; 11 | }; 12 | var g = f(); 13 | -------------------------------------------------------------------------------- /test/serializer/basic/NestedFunctions5.js: -------------------------------------------------------------------------------- 1 | var f = function() { 2 | return nested; // note that declaration comes later --- this is okay! 3 | function nested() { 4 | var x0 = 1; 5 | var x1 = x0 + x0; 6 | var x2 = x1 + x1; 7 | var x3 = x2 + x2; 8 | var x4 = x3 + x3; 9 | return x4; 10 | } 11 | }; 12 | var g = f(); 13 | inspect = function() { 14 | return f()(); 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/basic/NonObjectPrototypes.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var x = {}; 3 | x.__proto__ = 42; 4 | inspect = function() { 5 | return x.__proto__; 6 | }; 7 | })(); 8 | -------------------------------------------------------------------------------- /test/serializer/basic/NullPrototype.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var x = {}; 3 | x.__proto__ = null; 4 | inspect = function() { 5 | x.__proto__ === null; 6 | }; 7 | })(); 8 | -------------------------------------------------------------------------------- /test/serializer/basic/ObjectFreeze1.js: -------------------------------------------------------------------------------- 1 | // does contain:freeze 2 | // does not contain:defineProperty 3 | (function() { 4 | var o = { x: 23, y: 42 }; 5 | Object.freeze(o); 6 | global.inspect = function() { 7 | o.z = "bug"; 8 | return o.z; 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/basic/ObjectFreeze2.js: -------------------------------------------------------------------------------- 1 | // does contain:freeze 2 | // does not contain:defineProperty 3 | (function() { 4 | var f = function() {}; 5 | Object.freeze(f); 6 | global.inspect = function() { 7 | f.z = "bug"; 8 | return f.z; 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/basic/ObjectFreeze3.js: -------------------------------------------------------------------------------- 1 | // does contain:freeze 2 | // does not contain:defineProperty 3 | (function() { 4 | var a = [1, 2, 3]; 5 | Object.freeze(a); 6 | global.inspect = function() { 7 | a.z = "bug"; 8 | return a.z; 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/basic/ObjectFreeze4.js: -------------------------------------------------------------------------------- 1 | // does contain:freeze 2 | // does not contain:defineProperty 3 | (function() { 4 | var re = RegExp(); 5 | Object.freeze(re); 6 | global.inspect = function() { 7 | re.z = "bug"; 8 | return re.z; 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/basic/ObjectFreeze5.js: -------------------------------------------------------------------------------- 1 | // does contain:freeze 2 | (function() { 3 | var o = { x: 23, y: 42 }; 4 | Object.defineProperty(o, "foo", { enumerable: false, writable: false, configurable: false, value: 42 }); 5 | Object.freeze(o); 6 | global.inspect = function() { 7 | o.z = "bug"; 8 | return o.z + Object.getOwnPropertyDescriptor(o, "foo").enumerable; 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/basic/ObjectPreventExtensions1.js: -------------------------------------------------------------------------------- 1 | // does contain:preventExtensions 2 | // does not contain:defineProperty 3 | (function() { 4 | var o = { x: 23, y: 42 }; 5 | Object.preventExtensions(o); 6 | global.inspect = function() { 7 | o.z = "bug"; 8 | return o.z; 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/basic/ObjectSeal1.js: -------------------------------------------------------------------------------- 1 | // does contain:seal 2 | // does not contain:defineProperty 3 | (function() { 4 | var o = { x: 23, y: 42 }; 5 | Object.seal(o); 6 | global.inspect = function() { 7 | o.z = "bug"; 8 | return o.z; 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/basic/ObjectSeal2.js: -------------------------------------------------------------------------------- 1 | // does contain:seal 2 | (function() { 3 | var o = { x: 23, y: 42 }; 4 | Object.defineProperty(o, "foo", { enumerable: false, writable: false, configurable: false, value: 42 }); 5 | Object.seal(o); 6 | global.inspect = function() { 7 | o.z = "bug"; 8 | return o.z + Object.getOwnPropertyDescriptor(o, "foo").writable; 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/basic/OmitInvariants.js: -------------------------------------------------------------------------------- 1 | // omit invariants 2 | // does not contain:Prepack model invariant violation 3 | (function() { 4 | let foo = global.__abstract ? __abstract({ x: __abstract("number") }, "({x : 1})") : { x: 1 }; 5 | global.foox = foo.x; 6 | global.inspect = function() {}; 7 | })(); 8 | -------------------------------------------------------------------------------- /test/serializer/basic/OmitUnknownScopeSelectorError.js: -------------------------------------------------------------------------------- 1 | // omit invariants 2 | // does not contain:Unknown scope selector 3 | (function() { 4 | var x = 2; 5 | var y = 2; 6 | function getAnswer() { 7 | return x + y; 8 | } 9 | function setX(newX) { 10 | x = newX; 11 | } 12 | global.getAnswer = getAnswer; 13 | global.setX = setX; 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/basic/OverridingFunctionPrototype.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f() {} 3 | let p = f.prototype; 4 | f.prototype = {}; 5 | Object.defineProperty(f.prototype, "constructor", { 6 | configurable: true, 7 | enumerable: false, 8 | writable: true, 9 | value: f, 10 | }); 11 | inspect = function() { 12 | return f.prototype === p; 13 | }; 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/basic/PathConditionDeadCode.js: -------------------------------------------------------------------------------- 1 | let b = global.__abstract ? __abstract("boolean", "true") : true; 2 | let n1; 3 | if (b) n1 = 5; 4 | let n2 = global.__abstract ? __abstract("number", "7") : 7; 5 | var x = 0; 6 | function f() { 7 | if (!b) return; 8 | if (b) throw "foo"; 9 | //dead 10 | x = 42; 11 | } 12 | 13 | inspect = function() { 14 | return f(); 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/basic/Promise.js: -------------------------------------------------------------------------------- 1 | function fn(resolve) { 2 | setTimeout(function() { 3 | resolve(); 4 | }, 100); 5 | } 6 | 7 | inspect = function() { 8 | return new Promise(fn); 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/basic/PropertyAssignment.js: -------------------------------------------------------------------------------- 1 | // add at runtime:var foo = {}; 2 | // Copies of .bar:2 3 | // omit invariants 4 | var ob = global.__makeSimple ? __makeSimple(__abstract({}, "foo")) : {}; 5 | ob.bar = { a: 1 }; 6 | 7 | inspect = function() { 8 | return JSON.stringify(ob.bar); 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/basic/PropertyGetter.js: -------------------------------------------------------------------------------- 1 | var s = {}; 2 | Object.defineProperty(s, "p", { 3 | configurable: true, 4 | enumerable: true, 5 | get: function() { 6 | throw new Error("42"); 7 | }, 8 | }); 9 | 10 | inspect = function() { 11 | try { 12 | return s.p; 13 | } catch (e) { 14 | return e.message; 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/basic/Proxy.js: -------------------------------------------------------------------------------- 1 | let p = new Proxy( 2 | {}, 3 | { 4 | get: function() { 5 | return 42; 6 | }, 7 | } 8 | ); 9 | inspect = function() { 10 | return p.x; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/basic/Recursion.js: -------------------------------------------------------------------------------- 1 | var f = function(i) { 2 | return i > 0 ? f(i - 1) + 1 : 0; 3 | }; 4 | 5 | inspect = function() { 6 | return f(42); 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/basic/Recursion2.js: -------------------------------------------------------------------------------- 1 | var f = (function() { 2 | var Map2 = function() { 3 | return Map2; 4 | }; 5 | return Map2; 6 | })(); 7 | 8 | inspect = function() { 9 | return f() == f()() ? true : false; 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/basic/RecursiveMutatedFunctionIdentifier.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let v; 3 | function init() { 4 | init = function() {}; 5 | v = {}; 6 | } 7 | function work() { 8 | let a = (init(), v); 9 | let b = (init(), v); 10 | return a == b; 11 | } 12 | global.inspect = work; 13 | })(); 14 | -------------------------------------------------------------------------------- /test/serializer/basic/ReferentializeInitializer.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f() { 3 | let obj = { count: 0 }; 4 | return function(reset) { 5 | if (reset) obj = { count: 0 }; 6 | return obj.count++; 7 | }; 8 | } 9 | var g = f(); 10 | inspect = function() { 11 | return "" + g(false) + g(true) + g(false); 12 | }; 13 | })(); 14 | -------------------------------------------------------------------------------- /test/serializer/basic/ResidualIdentityObservation.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var a = { x: 4 }; 3 | function f() { 4 | return a; 5 | } 6 | function g() { 7 | return a; 8 | } 9 | inspect = function() { 10 | return f() === g(); 11 | }; 12 | })(); 13 | -------------------------------------------------------------------------------- /test/serializer/basic/ResidualIdentityObservation2.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var a = { x: 4 }; 3 | function f() { 4 | return a; 5 | } 6 | inspect = function() { 7 | return f() === f(); 8 | }; 9 | })(); 10 | -------------------------------------------------------------------------------- /test/serializer/basic/Set.js: -------------------------------------------------------------------------------- 1 | var m = new Set(["a", "b"]); 2 | m.foo = 123; 3 | m.add(m); 4 | 5 | z = m; 6 | 7 | inspect = function() { 8 | return m instanceof Set && m.foo === 123 && m.has("a") && m.has("b") && m.has(m) && m.size === 3; 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/basic/SetNotDeadMember.js: -------------------------------------------------------------------------------- 1 | // es6 2 | // does contain:__dead_object_signature__ 3 | 4 | let alive = new Object(); 5 | let dead = new String("__dead_object_signature__"); 6 | 7 | var s = new Set([alive, dead]); 8 | 9 | inspect = function() { 10 | return "containsAlive: " + s.has(alive); 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/basic/SetTimeout.js: -------------------------------------------------------------------------------- 1 | // es6 2 | var st = global.setTimeout; 3 | var y; 4 | global.setTimeout = function(x) { 5 | return st(x, y); 6 | }; 7 | 8 | inspect = function() { 9 | return (global.setTimeout ? "global.setTimeout" : "") + (st ? "st" : ""); 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/basic/SimpleCircularFunctions.js: -------------------------------------------------------------------------------- 1 | let cond = 0; 2 | 3 | function a() { 4 | cond += 1; 5 | b(); 6 | } 7 | function b() { 8 | if (cond < 2) a(); 9 | } 10 | 11 | inspect = function() { 12 | a(); 13 | return cond; 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/basic/SimpleInheritanceChains.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function A() {} 3 | function B() {} 4 | B.prototype = Object.create(A.prototype); 5 | inspect = function() { 6 | return A.prototype === B.prototype.__proto__; 7 | }; 8 | })(); 9 | -------------------------------------------------------------------------------- /test/serializer/basic/StrictGlobals.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | "use strict"; 3 | let moduleTable = {}; 4 | function require(id) { 5 | return {}; 6 | } 7 | global.require = require; 8 | })(); 9 | 10 | three = require("three"); 11 | -------------------------------------------------------------------------------- /test/serializer/basic/StrictSimple.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2004-present Facebook. All Rights Reserved. 3 | */ 4 | (function() { 5 | var isStrict = function() { 6 | "use strict"; 7 | return !!this; 8 | }; 9 | inspect = function() { 10 | return isStrict(); 11 | }; 12 | })(); 13 | -------------------------------------------------------------------------------- /test/serializer/basic/StringPrototype.js: -------------------------------------------------------------------------------- 1 | String.prototype.x = 42; 2 | 3 | inspect = function() { 4 | return String.prototype.x; 5 | }; 6 | -------------------------------------------------------------------------------- /test/serializer/basic/Symbols.js: -------------------------------------------------------------------------------- 1 | // es6 2 | var it = Symbol.iterator; 3 | 4 | inspect = function() { 5 | return it === Symbol.iterator; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/basic/Symbols2.js: -------------------------------------------------------------------------------- 1 | // es6 2 | (function() { 3 | let a = Symbol.for("test"); 4 | let b = Symbol.for("test"); 5 | inspect = function() { 6 | return "" + (a === Symbol.for("test")); 7 | }; 8 | })(); 9 | -------------------------------------------------------------------------------- /test/serializer/basic/Uint8Array.js: -------------------------------------------------------------------------------- 1 | var x = new Uint8Array([1, 2, 3]); 2 | x.foo = "bar"; 3 | 4 | inspect = function() { 5 | return x.length + " " + x[0] + x[1] + x[2] + x[3] + x.foo; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/basic/Undefined.js: -------------------------------------------------------------------------------- 1 | // does not contain:undefined 2 | // omit invariants 3 | (function() { 4 | var x = undefined; 5 | inspect = function() { 6 | return x; 7 | }; 8 | })(); 9 | -------------------------------------------------------------------------------- /test/serializer/basic/UndefinedAsLocalVariableName.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | let x = undefined; 3 | inspect = function() { 4 | let undefined = 42; 5 | return undefined === x; 6 | }; 7 | })(); 8 | -------------------------------------------------------------------------------- /test/serializer/basic/UniqueNames.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function bar() { 3 | try { 4 | return global._0.name; 5 | } catch (e) { 6 | return "exception"; 7 | } 8 | } 9 | inspect = function() { 10 | return bar(); 11 | }; 12 | })(); 13 | -------------------------------------------------------------------------------- /test/serializer/basic/UnknownScopeSelectorError.js: -------------------------------------------------------------------------------- 1 | // does contain:Unknown scope selector 2 | (function() { 3 | var x = 2; 4 | var y = 2; 5 | function getAnswer() { 6 | return x + y; 7 | } 8 | function setX(newX) { 9 | x = newX; 10 | } 11 | global.getAnswer = getAnswer; 12 | global.setX = setX; 13 | })(); 14 | -------------------------------------------------------------------------------- /test/serializer/basic/Values.js: -------------------------------------------------------------------------------- 1 | function g(i) { 2 | function f() { 3 | /* This comment is here so that the function gets too big to be considered for inlining by our serialiser. */ 4 | return i + arguments[0]; 5 | } 6 | return f; 7 | } 8 | var h0 = g(0); 9 | var h1 = g(1); 10 | 11 | inspect = function() { 12 | return h1(42) - h0(42); 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/basic/WeakMapDeadMember.js: -------------------------------------------------------------------------------- 1 | // es6 2 | // does not contain:__dead_object_signature__ 3 | 4 | let alive = new Object(); 5 | let dead = new String("__dead_object_signature__"); 6 | 7 | var s = new WeakMap(); 8 | 9 | s.set(alive, 1); 10 | s.set(dead, 1); 11 | 12 | inspect = function() { 13 | return "containsAlive: " + s.has(alive); 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/basic/WeakSet.js: -------------------------------------------------------------------------------- 1 | // es6 2 | let a = { a: 1 }; 3 | let b = { b: 2 }; 4 | var m = new WeakSet([a, b]); 5 | m.foo = 123; 6 | 7 | var z = m; 8 | 9 | inspect = function() { 10 | return m instanceof WeakSet && m.foo === 123 && m.has(a) === 1 && m.has(b) === 2 && m.size === 2; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/basic/WeakSetDeadMember.js: -------------------------------------------------------------------------------- 1 | // es6 2 | // does not contain:__dead_object_signature__ 3 | 4 | let alive = new Object(); 5 | let dead = new String("__dead_object_signature__"); 6 | 7 | var s = new WeakSet([alive, dead]); 8 | 9 | inspect = function() { 10 | return "containsAlive: " + s.has(alive); 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/basic/__output.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f() { 3 | return "__output" in global; 4 | } 5 | if (global.__abstract) { 6 | // we are running under Prepack 7 | global.__output = { inspect: f }; 8 | } else { 9 | // we are not running under Prepack 10 | global.inspect = f; 11 | } 12 | })(); 13 | -------------------------------------------------------------------------------- /test/serializer/basic/setTimeoutAndInterval.js: -------------------------------------------------------------------------------- 1 | // es6 2 | // does contain:keep me 3 | (function() { 4 | let f = function() { 5 | /* keep me */ 6 | }; 7 | let id1 = global.setTimeout(f, 1000); 8 | let id2 = global.setInterval(f, 1000); 9 | global.clearTimeout(id1); 10 | global.clearInterval(id2); 11 | inspect = function() { 12 | return true; 13 | }; 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/optimizations/CommonSubExpr.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "10") : 10; 2 | global.a = x + 1; 3 | global.b = x + 1; 4 | 5 | inspect = function() { 6 | return global.a + global.b; 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/optimizations/DedupeGenerator.js: -------------------------------------------------------------------------------- 1 | // Copies of Date.now():1 2 | (function() { 3 | function fib(x) { 4 | let y = Date.now(); 5 | return x <= 1 ? x : fib(x - 1) + fib(x - 2); 6 | } 7 | 8 | let x = Date.now(); 9 | if (x * 2 > 42) x = fib(10); 10 | global.result = x; 11 | })(); 12 | -------------------------------------------------------------------------------- /test/serializer/optimizations/proto.js: -------------------------------------------------------------------------------- 1 | let proto = { a: 123 }; 2 | let o = {}; 3 | Object.setPrototypeOf(o, proto); 4 | global.x = o; 5 | inspect = function() { 6 | return Object.getPrototypeOf(global.x).a; 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/optimizations/simplify10.js: -------------------------------------------------------------------------------- 1 | // add at runtime:var c=true; 2 | let c = global.__abstract ? __abstract("boolean", "c") : true; 3 | let s = NaN; 4 | let u = c ? s : 42; 5 | let v = c ? 43 : s; 6 | 7 | inspect = function() { 8 | return u + " " + v; 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/optimizations/simplify11.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function fn(arg) { 3 | return arg == null ? "a" : arg && "b"; 4 | } 5 | 6 | if (global.__optimize) __optimize(fn); 7 | 8 | global.inspect = function() { 9 | return JSON.stringify([fn(null), fn(undefined), fn({})]); 10 | }; 11 | })(); 12 | -------------------------------------------------------------------------------- /test/serializer/optimizations/simplify2.js: -------------------------------------------------------------------------------- 1 | let b = global.__abstract ? __abstract("boolean", "false") : false; 2 | let ob1 = b ? undefined : { foo: 42 }; 3 | let ob2 = b ? null : { foo: 24 }; 4 | 5 | var x, y; 6 | if (undefined === ob1 || ob2 === null) x = "no can do"; 7 | else { 8 | x = ob1.foo; 9 | y = ob2.foo; 10 | } 11 | 12 | inspect = function() { 13 | return x + " " + y; 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/optimizations/simplify5.js: -------------------------------------------------------------------------------- 1 | let n = global.__abstract ? __abstract("number", "1") : 1; 2 | let o = global.__abstract ? __abstract("object", "({})") : {}; 3 | let opt = n ? o : undefined; 4 | 5 | var x, y, z; 6 | x = !!n; 7 | y = opt !== undefined; 8 | 9 | if (!!n) { 10 | z = n ? 10 : 20; 11 | } 12 | 13 | inspect = function() { 14 | return "" + x + " " + y + " " + z; 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/optimizations/simplify6.js: -------------------------------------------------------------------------------- 1 | // does not contain: {} 2 | let x = global.abstract ? __abstract(undefined, "5") : 5; 3 | let xIsNull = x == null; 4 | let y = xIsNull ? null : {}; 5 | if (y) global.result = true; 6 | 7 | inspect = function() { 8 | return global.result; 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/optimizations/simplify7.js: -------------------------------------------------------------------------------- 1 | // does not contain: "no" 2 | let s = global.__abstract ? __abstract("string", "('s')") : "s"; 3 | 4 | var y, z; 5 | if (s ? "t" : "") { 6 | y = s ? "yes" : "no"; 7 | } 8 | 9 | inspect = function() { 10 | return y + " " + z; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/optimizations/simplify8.js: -------------------------------------------------------------------------------- 1 | // does not contain: bar 2 | let a = global.__abstractOrNull ? __abstractOrNull("object", "({ foo: 0 })") : {}; 3 | let b = a == null; 4 | let c = !b; 5 | let ob = b ? null : { bar: 1 }; 6 | let obstr = c ? "str" : ob; 7 | 8 | inspect = function() { 9 | return obstr; 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/optimizations/simplify8a.js: -------------------------------------------------------------------------------- 1 | // does not contain: bar 2 | let a = global.__abstractOrNull ? __abstractOrNull("object", "({ foo: 0 })") : {}; 3 | let b = a == null; 4 | let c = !b; 5 | let ob = b ? null : { bar: 1 }; 6 | let obstr = ob ? "ob" : "str"; 7 | 8 | inspect = function() { 9 | return obstr; 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/optimizations/simplify8b.js: -------------------------------------------------------------------------------- 1 | // does not contain: bar 2 | let a = global.__abstract ? __abstract("boolean", "(true)") : true; 3 | let ob = a ? null : { bar: 1 }; 4 | let nob = !ob && "not an object"; 5 | 6 | inspect = function() { 7 | return nob; 8 | }; 9 | -------------------------------------------------------------------------------- /test/serializer/optimizations/simplify9.js: -------------------------------------------------------------------------------- 1 | let ob = global.__abstract ? __makeSimple(__abstract("object", "({a: 1})")) : { a: 1 }; 2 | let a = ob.a; 3 | 4 | let _1aw_ = !a; 5 | 6 | let _1bx_ = _1aw_ ? null : ob; 7 | 8 | let _1bw_ = !_1bx_; 9 | 10 | if (!_1bw_) { 11 | var y = _1bw_ ? 123 : 456; 12 | } 13 | 14 | inspect = function() { 15 | return y; 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/optimizations/simplifyCompNullOrUndefined.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract(undefined, "undefined") : undefined; 2 | 3 | if (x == null) global.result = x === null; 4 | 5 | inspect = () => global.result; 6 | -------------------------------------------------------------------------------- /test/serializer/optimizations/simplifyCompNullOrUndefined2.js: -------------------------------------------------------------------------------- 1 | // does contain result = false 2 | 3 | let x = global.__abstract ? __abstract(undefined, "undefined") : undefined; 4 | 5 | if (x != null) global.result = x === undefined; 6 | 7 | inspect = () => global.result; 8 | -------------------------------------------------------------------------------- /test/serializer/optimizations/simplifyCompNullOrUndefined3.js: -------------------------------------------------------------------------------- 1 | function f(obj) { 2 | let y = obj.foo; 3 | if (y == null) { 4 | return y === undefined; 5 | } 6 | } 7 | global.__optimize && __optimize(f); 8 | inspect = () => f({ foo: null }); 9 | -------------------------------------------------------------------------------- /test/serializer/optimizations/simplifyMultipleIfs1.js: -------------------------------------------------------------------------------- 1 | // omit invariants 2 | // Copies of if \(:2 3 | var x = global.__abstract ? __abstract("boolean", "x") : "x"; 4 | 5 | if (x) { 6 | console.log("Hello"); 7 | } 8 | 9 | if (x) { 10 | console.log(" World"); 11 | } 12 | 13 | if (x) { 14 | console.log("!"); 15 | } 16 | 17 | if (!x) { 18 | console.log("Hello World!"); 19 | } 20 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/AbstractDate.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f(x) { 3 | return new Date(x).getUTCDay(); 4 | } 5 | 6 | global.__optimize && __optimize(f); 7 | 8 | global.inspect = function() { 9 | return f(1529579851072000); 10 | }; 11 | })(); 12 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ArgumentProperty.js: -------------------------------------------------------------------------------- 1 | function fn(arg) { 2 | if (arg !== null) { 3 | if (arg.foo) { 4 | return 42; 5 | } 6 | } 7 | } 8 | 9 | if (global.__optimize) { 10 | __optimize(fn); 11 | } 12 | 13 | inspect = function() { 14 | return JSON.stringify([fn(null), fn({}), fn({ foo: true })]); 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ArrayAccess.js: -------------------------------------------------------------------------------- 1 | // does not contain:"0" 2 | // omit invariants 3 | (function() { 4 | function f(x) { 5 | return x[0]; 6 | } 7 | global.__optimize && __optimize(f); 8 | global.inspect = function() { 9 | return f([42]); 10 | }; 11 | })(); 12 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ArrayFrom10.js: -------------------------------------------------------------------------------- 1 | // arrayNestedOptimizedFunctionsEnabled 2 | 3 | function f(c) { 4 | var arr = Array.from(c); 5 | arr[0] = 42; 6 | return arr; 7 | } 8 | 9 | global.__optimize && __optimize(f); 10 | 11 | inspect = () => { 12 | return f([{ foo: 0 }]); 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ArrayFrom11.js: -------------------------------------------------------------------------------- 1 | function fn(x, y) { 2 | var a = Array.from(x); 3 | var b = Array.from(x); 4 | var c = y ? a : b; 5 | return c.length && c[0]; 6 | } 7 | 8 | this.__optimize && __optimize(fn); 9 | 10 | inspect = function() { 11 | return fn(["foo", 1, 2], true); 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ArrayFrom5.js: -------------------------------------------------------------------------------- 1 | function fn(x, y) { 2 | var foo = Array.from(x); 3 | 4 | return foo[y] + 5; 5 | } 6 | 7 | if (global.__optimize) __optimize(fn); 8 | 9 | inspect = function() { 10 | return JSON.stringify([10], 0); 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ArrowFunction.js: -------------------------------------------------------------------------------- 1 | // does contain:=> { 2 | 3 | const foo = x => { 4 | return x + 1; 5 | }; 6 | 7 | if (global.__optimize) __optimize(foo); 8 | 9 | inspect = function() { 10 | return foo(5); 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ArrowFunction2.js: -------------------------------------------------------------------------------- 1 | // does contain:=> { 2 | 3 | function foo(x) { 4 | this.x = x; 5 | const bar = () => { 6 | return this.x; 7 | }; 8 | if (global.__optimize) __optimize(bar); 9 | this.bar = bar; 10 | } 11 | 12 | if (global.__optimize) __optimize(foo); 13 | 14 | inspect = function() { 15 | return foo(5).bar(); 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ConditionalArray.js: -------------------------------------------------------------------------------- 1 | // does contain:1-2-3 2 | 3 | function fn(a) { 4 | var array = a === null ? [1, 2, 3] : [4, 5, 6]; 5 | 6 | return array.join("-"); 7 | } 8 | 9 | global.__optimize && __optimize(fn); 10 | 11 | inspect = function() { 12 | return JSON.stringify({ 13 | a: fn(null), 14 | b: fn(true), 15 | }); 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ConditionalArray2.js: -------------------------------------------------------------------------------- 1 | function fn(a, b) { 2 | var array = a === null ? b : [4, 5, 6]; 3 | 4 | return array.join("-"); 5 | } 6 | 7 | global.__optimize && __optimize(fn); 8 | 9 | inspect = function() { 10 | return JSON.stringify({ 11 | a: fn(null, [1, 2, 3]), 12 | b: fn(true, [1, 2, 3]), 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ConditionalArray3.js: -------------------------------------------------------------------------------- 1 | function fn(a, b) { 2 | var array = a === null ? b : [4, 5, 6]; 3 | 4 | return array.reverse().join("-"); 5 | } 6 | 7 | global.__optimize && __optimize(fn); 8 | 9 | inspect = function() { 10 | return JSON.stringify({ 11 | a: fn(null, [1, 2, 3]), 12 | b: fn(true, [1, 2, 3]), 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ConditionalArray4.js: -------------------------------------------------------------------------------- 1 | function fn(a, b) { 2 | var array = a === null ? Array.from(b) : [4, 5, 6]; 3 | 4 | return array.reverse().join("-"); 5 | } 6 | 7 | global.__optimize && __optimize(fn); 8 | 9 | inspect = function() { 10 | return JSON.stringify({ 11 | a: fn(null, [1, 2, 3]), 12 | b: fn(true, [1, 2, 3]), 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ConditionalGet.js: -------------------------------------------------------------------------------- 1 | // inline expressions 2 | // Copies of \{\}:0 3 | // Copies of = 2:0 4 | 5 | function fn(x, b) { 6 | var a = x ? b : { a: 2 }; 7 | return a.a; 8 | } 9 | 10 | this.__optimize && __optimize(fn); 11 | 12 | inspect = function() { 13 | return fn(false, { a: 1 }); 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ConditionalGet2.js: -------------------------------------------------------------------------------- 1 | // inline expressions 2 | // Copies of \{\}:0 3 | // Copies of = 2:0 4 | 5 | function fn(x) { 6 | var a = x || { a: 2 }; 7 | return a.a; 8 | } 9 | 10 | this.__optimize && __optimize(fn); 11 | 12 | inspect = function() { 13 | return fn({ a: 1 }); 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ConditionalGet3.js: -------------------------------------------------------------------------------- 1 | // inline expressions 2 | // Copies of \{\}:0 3 | // Copies of = 2:0 4 | 5 | function fn(x) { 6 | var a = x && { a: 2 }; 7 | return a.a; 8 | } 9 | 10 | this.__optimize && __optimize(fn); 11 | 12 | inspect = function() { 13 | return fn({ a: 1 }); 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ConditionalObjectAssign.js: -------------------------------------------------------------------------------- 1 | function fn(x) { 2 | var a = x ? { a: 1 } : { a: 2 }; 3 | 4 | return Object.assign({}, a, { b: 1 }); 5 | } 6 | 7 | global.__optimize && __optimize(fn); 8 | 9 | inspect = function() { 10 | return JSON.stringify({ x: fn(false), y: fn(true) }); 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ConditionalObjectAssign3.js: -------------------------------------------------------------------------------- 1 | function fn(x, y, z) { 2 | var a = x ? y : z || { a: 2 }; 3 | 4 | return Object.assign({}, a, { b: 1 }); 5 | } 6 | 7 | global.__optimize && __optimize(fn); 8 | 9 | inspect = function() { 10 | return JSON.stringify({ x: fn(false, { a: 1 }, true), y: fn(true, { a: 1 }, false) }); 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ConditionalObjectAssign4.js: -------------------------------------------------------------------------------- 1 | function fn(x) { 2 | var a = x || { b: 5 }; 3 | 4 | return Object.assign({}, a, { b: 1 }); 5 | } 6 | 7 | global.__optimize && __optimize(fn); 8 | 9 | inspect = function() { 10 | return JSON.stringify({ x: fn(false), y: fn({ b: 10 }) }); 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ConditionalObjectAssign5.js: -------------------------------------------------------------------------------- 1 | function fn(x) { 2 | var a = x && { b: 5 }; 3 | 4 | return Object.assign({}, a, { b: 1 }); 5 | } 6 | 7 | global.__optimize && __optimize(fn); 8 | 9 | inspect = function() { 10 | return JSON.stringify({ x: fn(null), y: fn({ b: 10 }) }); 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ConditionalReturn.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function foo(x) { 3 | if (!x) { 4 | return null; 5 | } 6 | return x != null ? x : null; 7 | } 8 | 9 | global.__optimize && __optimize(foo); 10 | 11 | global.inspect = function() { 12 | return JSON.stringify([foo(null), foo(undefined), foo(0), foo(1), foo({})]); 13 | }; 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ConditionalReturn2.js: -------------------------------------------------------------------------------- 1 | function bar() { 2 | return 123; 3 | } 4 | 5 | function fn(x) { 6 | if (!x) { 7 | return bar(); 8 | } 9 | 10 | var foo = x.foo; 11 | if (!foo) { 12 | return 456; 13 | } 14 | } 15 | 16 | this.__optimize && __optimize(fn); 17 | 18 | inspect = function() { 19 | return JSON.stringify(fn()); 20 | }; 21 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ConditionallyLeakedObject1.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f(g, c) { 3 | let o = { foo: 42 }; 4 | if (c) { 5 | g(o); 6 | } else { 7 | o.foo = 2; 8 | } 9 | 10 | return o; 11 | } 12 | 13 | global.__optimize && __optimize(f); 14 | inspect = function() { 15 | return JSON.stringify(f(o => o, false)); 16 | }; 17 | })(); 18 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ConditionallyOptimizedFunction.js: -------------------------------------------------------------------------------- 1 | // does not contain:1 + 2 2 | (function() { 3 | function g() { 4 | return 1 + 2; 5 | } 6 | if (global.__optimize && __abstract("boolean", "true")) __optimize(g); 7 | global.inspect = function() { 8 | return g(); 9 | }; 10 | })(); 11 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/DeadModifiedBindings.js: -------------------------------------------------------------------------------- 1 | // does not contain:reachMe 2 | (function() { 3 | var x; 4 | function g() { 5 | x = { canYou: "reachMe?" }; 6 | } 7 | function f() { 8 | g(); 9 | return 42; 10 | } 11 | if (global.__optimize) __optimize(f); 12 | global.inspect = f; 13 | })(); 14 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/Empty.js: -------------------------------------------------------------------------------- 1 | var x = global.__abstract ? (x = __abstract("boolean", "true")) : true; 2 | 3 | function foo() { 4 | let ob = {}; 5 | if (!x) ob.bar = 123; 6 | return ob.bar; 7 | } 8 | 9 | if (global.__optimize) __optimize(foo); 10 | 11 | inspect = function() { 12 | return foo(); 13 | }; 14 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ForLoop2.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function fn() { 3 | var arr = [0]; 4 | for (var i = 0; i < arr.length; i++) { 5 | break; 6 | } 7 | return 10; 8 | } 9 | 10 | if (global.__optimize) { 11 | __optimize(fn); 12 | } 13 | 14 | global.inspect = function() { 15 | return fn(); 16 | }; 17 | })(); 18 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/HavocBindings1.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f(g) { 3 | let x = 23; 4 | function f() { 5 | x = x + 42; 6 | } 7 | g(f); 8 | return x; 9 | } 10 | global.__optimize && __optimize(f); 11 | global.inspect = function() { 12 | return f(g => g()); 13 | }; 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/HavocBindings2.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f(g) { 3 | var x = 23; 4 | function f() { 5 | x = x + 42; 6 | } 7 | g(f); 8 | return x; 9 | } 10 | global.__optimize && __optimize(f); 11 | global.inspect = function() { 12 | return f(g => g()); 13 | }; 14 | })(); 15 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/HavocBindings7.js: -------------------------------------------------------------------------------- 1 | // does contain:42 2 | (function() { 3 | function f(g) { 4 | const x = 23; 5 | function f() { 6 | return x; 7 | } 8 | g(f); 9 | return x + 19; 10 | } 11 | global.__optimize && __optimize(f); 12 | global.inspect = function() { 13 | return f(g => g()); 14 | }; 15 | })(); 16 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/HavocBindings8.js: -------------------------------------------------------------------------------- 1 | function fn(x, y, abstractVal) { 2 | var value = x.toString(); 3 | 4 | if (y) { 5 | abstractVal(function() { 6 | value += "-next"; 7 | }); 8 | } 9 | return value; 10 | } 11 | 12 | global.__optimize && __optimize(fn); 13 | 14 | inspect = function() { 15 | return fn(10, false, function() {}); 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/HavocBindingsRegression.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f(g) { 3 | var x = {}; 4 | global.__makeFinal && __makeFinal(x); 5 | function f() { 6 | x = 42; 7 | } 8 | g(f); 9 | return x; 10 | } 11 | global.__optimize && __optimize(f); 12 | global.inspect = function() { 13 | return f(g => g()); 14 | }; 15 | })(); 16 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/InstantRenderArrayOps2.js: -------------------------------------------------------------------------------- 1 | // instant render 2 | // does contain:42 3 | 4 | function f(c) { 5 | var arr = Array.from(c); 6 | let foo = 1; 7 | 8 | function op(x) { 9 | return foo + 41; 10 | } 11 | 12 | let mapped = arr.map(op); 13 | 14 | return mapped; 15 | } 16 | global.__optimize && __optimize(f); 17 | 18 | inspect = () => f([0]); 19 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/Issue1856.js: -------------------------------------------------------------------------------- 1 | let p = {}; 2 | function f(c) { 3 | let o = {}; 4 | if (c) { 5 | o.__proto__ = p; 6 | throw o; 7 | } 8 | } 9 | if (global.__optimize) __optimize(f); 10 | inspect = function() { 11 | try { 12 | f(true); 13 | } catch (e) { 14 | return e.$Prototype === p; 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/Issue2151.js: -------------------------------------------------------------------------------- 1 | function bad(v) { 2 | if (v == null) { 3 | return null; 4 | } 5 | var a = v.a, 6 | b = v.b; 7 | if (a == null || b == null) { 8 | return a && b; 9 | } 10 | return v; 11 | } 12 | 13 | if (global.__optimize) __optimize(bad); 14 | 15 | inspect = function() { 16 | return bad(null); 17 | }; 18 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/Issue2266Regression.js: -------------------------------------------------------------------------------- 1 | // expected Warning: 2 | function outer() { 3 | function inner() { 4 | return 42; 5 | } 6 | if (global.__optimize) __optimize(inner); 7 | return inner; 8 | } 9 | if (global.__optimize) __optimize(outer); 10 | global.inspect = function() { 11 | return outer()(); 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/LeakObjectWithSetter.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | function f(g) { 3 | let o = { 4 | foo: 1, 5 | set x(v) { 6 | this.foo += 1; 7 | }, 8 | }; 9 | g(o); 10 | return o; 11 | } 12 | 13 | global.__optimize && __optimize(f); 14 | inspect = () => { 15 | JSON.stringify(f(o => o)); 16 | }; 17 | })(); 18 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/LeakedCustomObjectInMultipleScopes.js: -------------------------------------------------------------------------------- 1 | function f(g, c) { 2 | let o = { foo: {} }; 3 | o.__proto__ = {}; 4 | 5 | if (c) { 6 | g(o); 7 | } else { 8 | o.foo = { bar: 5 }; 9 | g(o); 10 | } 11 | return o; 12 | } 13 | 14 | global.__optimize && __optimize(f); 15 | inspect = function() { 16 | return f(o => o); 17 | }; 18 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/LeakedObjectCodeDuplication.js: -------------------------------------------------------------------------------- 1 | // Copies of 42:1 2 | function f(g) { 3 | var o = {}; 4 | o.foo = 42; 5 | g(o); 6 | return o; 7 | } 8 | 9 | global.__optimize && __optimize(f); 10 | inspect = function() { 11 | return f(o => o); 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/LoopBailout10.js: -------------------------------------------------------------------------------- 1 | function fn(x, counter) { 2 | var i = 0; 3 | for (; i !== x; ) { 4 | counter.x++; 5 | i++; 6 | var val1 = counter.x, 7 | val2 = val1 + 1; 8 | } 9 | return val2; 10 | } 11 | 12 | global.__optimize && __optimize(fn); 13 | 14 | inspect = function() { 15 | return fn(100, { x: 2 }); 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/LoopBailout11.js: -------------------------------------------------------------------------------- 1 | function fn(x, counter) { 2 | var i = 0; 3 | var val2 = undefined; 4 | for (; i !== x; ) { 5 | counter.x++; 6 | i++; 7 | val2 = i; 8 | } 9 | return val2; 10 | } 11 | 12 | global.__optimize && __optimize(fn); 13 | 14 | inspect = function() { 15 | return fn(100, { x: 2 }); 16 | }; 17 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/LoopBailout12.js: -------------------------------------------------------------------------------- 1 | function fn(x, counter) { 2 | var i = 0; 3 | var val2 = undefined; 4 | for (; i !== x; ) { 5 | var foo = {}; 6 | counter.x++; 7 | i++; 8 | foo.x = x; 9 | } 10 | return foo; 11 | } 12 | 13 | global.__optimize && __optimize(fn); 14 | 15 | inspect = function() { 16 | return fn(100, { x: 2 }).x; 17 | }; 18 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/LoopBailout19.js: -------------------------------------------------------------------------------- 1 | function fn(x, oldItems) { 2 | var items = []; 3 | for (var i; i < x; ) { 4 | i++; 5 | var oldItem = oldItems[i]; 6 | items.push(oldItem + 2); 7 | } 8 | return items; 9 | } 10 | 11 | global.__optimize && __optimize(fn); 12 | 13 | inspect = function() { 14 | return JSON.stringify(fn(5, [1, 2, 3, 4, 5])); 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/LoopBailout2.js: -------------------------------------------------------------------------------- 1 | function fn(x, oldItems) { 2 | var items = []; 3 | for (let i = 0; i < x; i++) { 4 | var oldItem = oldItems[i]; 5 | items.push(oldItem + 2); 6 | } 7 | return items; 8 | } 9 | 10 | global.__optimize && __optimize(fn); 11 | 12 | inspect = function() { 13 | return JSON.stringify(fn(5, [1, 2, 3, 4, 5])); 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/LoopBailout8.js: -------------------------------------------------------------------------------- 1 | function fn(x, counter) { 2 | var i = 0; 3 | for (; i !== x; ) { 4 | counter.x++; 5 | i++; 6 | } 7 | return counter.x; 8 | } 9 | 10 | global.__optimize && __optimize(fn); 11 | 12 | inspect = function() { 13 | return fn(100, { x: 2 }); 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/LoopBailout9.js: -------------------------------------------------------------------------------- 1 | function fn(x, counter) { 2 | var i = 0; 3 | for (; i !== x; ) { 4 | counter.x++; 5 | i++; 6 | var val = counter.x; 7 | } 8 | return val; 9 | } 10 | 11 | global.__optimize && __optimize(fn); 12 | 13 | inspect = function() { 14 | return fn(100, { x: 2 }); 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/NestedTemporalJoinConditions.js: -------------------------------------------------------------------------------- 1 | function fn(str, start, length) { 2 | var size = str.length; 3 | var posA = 0; 4 | if (start > 0) { 5 | if (posA >= size) { 6 | return posA; 7 | } 8 | } 9 | } 10 | 11 | if (global.__optimize) __optimize(fn); 12 | 13 | global.inspect = function() { 14 | return true; 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/NullCheck.js: -------------------------------------------------------------------------------- 1 | function func1(v) { 2 | if (v == null) return null; 3 | var a = v.a; 4 | if (a == null) return null; 5 | return a; 6 | } 7 | 8 | if (global.__optimize) __optimize(func1); 9 | 10 | inspect = function() { 11 | return func1(); 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ObjectAssign.js: -------------------------------------------------------------------------------- 1 | // Copies of .assign;:1 2 | global.f = function(x, y) { 3 | if (y) return Object.assign({}, x); 4 | else throw new Error(); 5 | }; 6 | 7 | if (global.__optimize) __optimize(f); 8 | 9 | global.inspect = function() { 10 | return global.f({ p: 42 }, true).p; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ObjectAssign6.js: -------------------------------------------------------------------------------- 1 | function fn(abstract) { 2 | var a = Object.assign({}, { x: 1 }, abstract); 3 | return a.x; 4 | } 5 | 6 | global.__optimize && __optimize(fn); 7 | 8 | inspect = function() { 9 | return fn({ x: 2 }); 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ObjectAssign7.js: -------------------------------------------------------------------------------- 1 | // does not contain:Object.assign 2 | 3 | function fn(abstract) { 4 | var a = Object.assign({}, { x: 1 }, abstract, { x: 25 }); 5 | return a.x; 6 | } 7 | 8 | global.__optimize && __optimize(fn); 9 | 10 | inspect = function() { 11 | return fn({ x: 2 }); 12 | }; 13 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/PropertyDeref.js: -------------------------------------------------------------------------------- 1 | function fn(arg) { 2 | return arg != null && arg.x && arg.y; 3 | } 4 | 5 | if (global.__optimize) __optimize(fn); 6 | 7 | inspect = function() { 8 | return JSON.stringify([fn(null), fn(undefined), fn({ x: false, y: 5 }), fn({ x: 5, y: 10 })]); 9 | }; 10 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/Switch2.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "1") : 1; 2 | 3 | function f(x) { 4 | switch (x) { 5 | default: 6 | return 42; 7 | } 8 | } 9 | 10 | global.__optimize && __optimize(f); 11 | 12 | inspect = function() { 13 | return f(x); 14 | }; 15 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/Switch3.js: -------------------------------------------------------------------------------- 1 | let x = global.__abstract ? __abstract("number", "1") : 1; 2 | 3 | function g(x) { 4 | switch (x) { 5 | case 0: 6 | return 12; 7 | case 1: 8 | return 24; 9 | default: 10 | return 42; 11 | } 12 | } 13 | 14 | global.__optimize && __optimize(g); 15 | 16 | inspect = function() { 17 | return g(x); 18 | }; 19 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/SymbolGet.js: -------------------------------------------------------------------------------- 1 | function fn(x) { 2 | return x[Symbol.hasInstance]; 3 | } 4 | 5 | this.__optimize && __optimize(fn); 6 | 7 | inspect = function() { 8 | class Array1 { 9 | static [Symbol.hasInstance](instance) { 10 | return Array.isArray(instance); 11 | } 12 | } 13 | 14 | return fn(Array1)([]); 15 | }; 16 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/ToString.js: -------------------------------------------------------------------------------- 1 | // does not contain:.toString() 2 | function fn(someString) { 3 | var x = global.__abstract ? __abstract("string", "someString") : someString; 4 | 5 | return x.toString(); 6 | } 7 | 8 | inspect = function() { 9 | return fn("Hello world"); 10 | }; 11 | 12 | this.__optimize && __optimize(fn); 13 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/UnknownProperty.js: -------------------------------------------------------------------------------- 1 | var cache = {}; 2 | function f(x, y) { 3 | cache[x] = y; 4 | } 5 | if (global.__optimize) __optimize(f); 6 | 7 | inspect = function() { 8 | f(42, 5); 9 | return cache[42]; 10 | }; 11 | -------------------------------------------------------------------------------- /test/serializer/optimized-functions/UnknownProperty2.js: -------------------------------------------------------------------------------- 1 | var cache = {}; 2 | function f(x, y) { 3 | cache[x] = y; 4 | cache[x + 1] = y * 2; 5 | } 6 | if (global.__optimize) __optimize(f); 7 | 8 | inspect = function() { 9 | f(42, 5); 10 | return cache[42] + " " + cache[43]; 11 | }; 12 | -------------------------------------------------------------------------------- /test/serializer/trivial/Console.js: -------------------------------------------------------------------------------- 1 | inspect = function() { 2 | console.log("A"); 3 | console.warn("B"); 4 | console.error("C"); 5 | console.log({}); 6 | console.warn({}); 7 | console.error({}); 8 | }; 9 | -------------------------------------------------------------------------------- /test/serializer/trivial/Empty.js: -------------------------------------------------------------------------------- 1 | // no effect 2 | -------------------------------------------------------------------------------- /test/serializer/trivial/FunctionExpressionApplication.js: -------------------------------------------------------------------------------- 1 | // no effect 2 | (function() {})(); 3 | -------------------------------------------------------------------------------- /test/serializer/trivial/GlobalVariable.js: -------------------------------------------------------------------------------- 1 | // does not contain:void 0 2 | var x = 1; 3 | x = 2; 4 | inspect = function() { 5 | return x; 6 | }; 7 | -------------------------------------------------------------------------------- /test/serializer/trivial/GlobalVariable2.js: -------------------------------------------------------------------------------- 1 | // does contain:void 0 2 | var x = 1; 3 | x = 2; 4 | x = undefined; 5 | inspect = function() { 6 | return x; 7 | }; 8 | -------------------------------------------------------------------------------- /test/serializer/trivial/If.js: -------------------------------------------------------------------------------- 1 | // no effect 2 | // omit invariants 3 | let x = global.__abstract ? __abstract("boolean", "true") : true; 4 | let o = new Object(); 5 | if (x) o.x = 42; 6 | else o.x = 23; 7 | -------------------------------------------------------------------------------- /test/serializer/trivial/LocalVariable.js: -------------------------------------------------------------------------------- 1 | // no effect 2 | let x = 42; 3 | -------------------------------------------------------------------------------- /test/serializer/trivial/ObjectCreation.js: -------------------------------------------------------------------------------- 1 | // no effect 2 | // omit invariants 3 | (function() { 4 | var o = new Object(); 5 | o.x = 42; 6 | })(); 7 | -------------------------------------------------------------------------------- /test/source-maps/Stacktrace.js: -------------------------------------------------------------------------------- 1 | f = function() { 2 | throw new TypeError("not really"); 3 | }; 4 | -------------------------------------------------------------------------------- /test/std-in/StdIn.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | function hello() { 3 | return "Hello"; 4 | } 5 | function world() { 6 | return "world"; 7 | } 8 | let greeting = hello() + " " + world(); 9 | console.log(greeting + " from std-in"); 10 | -------------------------------------------------------------------------------- /website/.gitignore: -------------------------------------------------------------------------------- 1 | .*.haste_cache.* 2 | *~ 3 | /node_modules 4 | /lib 5 | npm-debug.log 6 | .DS_Store 7 | build/ 8 | .vscode 9 | coverage*/ 10 | test/ 11 | -------------------------------------------------------------------------------- /website/CNAME: -------------------------------------------------------------------------------- 1 | prepack.io -------------------------------------------------------------------------------- /website/README.md: -------------------------------------------------------------------------------- 1 | # prepack.io 2 | 3 | This website lives at [prepack.io](http://prepack.io). -------------------------------------------------------------------------------- /website/circle.yml: -------------------------------------------------------------------------------- 1 | general: 2 | branches: 3 | ignore: 4 | - gh-pages 5 | -------------------------------------------------------------------------------- /website/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/website/favicon.ico -------------------------------------------------------------------------------- /website/static/images/blue_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/website/static/images/blue_box.png -------------------------------------------------------------------------------- /website/static/images/green_diamond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/website/static/images/green_diamond.png -------------------------------------------------------------------------------- /website/static/images/grey_ellipse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/website/static/images/grey_ellipse.png -------------------------------------------------------------------------------- /website/static/images/orange_triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/website/static/images/orange_triangle.png -------------------------------------------------------------------------------- /website/static/images/oss_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/website/static/images/oss_logo.png -------------------------------------------------------------------------------- /website/static/images/prepack_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/website/static/images/prepack_logo.png -------------------------------------------------------------------------------- /website/static/images/red_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/website/static/images/red_circle.png -------------------------------------------------------------------------------- /website/static/images/yellow_star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/prepack/5beedbe85bd5b9d2de1264abafbb3b76f8584297/website/static/images/yellow_star.png --------------------------------------------------------------------------------