Removing --abstractEffectsInAdditionalFunctions option

Summary:
Release notes: Removing --abstractEffectsInAdditionalFunctions option

It is now the new default, as nothing seems to depend on the old behavior.
Closes https://github.com/facebook/prepack/pull/1623

Differential Revision: D7342083

Pulled By: NTillmann

fbshipit-source-id: c02d13bddd0ff3d8a113a6a5a83c1bf35c96ba4d
This commit is contained in:
Nikolai Tillmann 2018-03-20 14:45:07 -07:00 committed by Facebook Github Bot
parent 2c0c943ba2
commit 032f71403f
40 changed files with 15 additions and 97 deletions

View File

@ -46,7 +46,6 @@ let prepackOptions = {
reactVerbose: true,
inlineExpressions: true,
omitInvariants: true,
abstractEffectsInAdditionalFunctions: true,
simpleClosures: true,
abstractValueImpliesMax: 1000,
};

View File

@ -55,7 +55,6 @@ function runTest(name: string, code: string): boolean {
let recover = code.includes("// recover-from-errors");
let delayUnsupportedRequires = code.includes("// delay unsupported requires");
let abstractEffects = code.includes("// abstract effects");
let compatibility = code.includes("// jsc") ? "jsc-600-1-4-17" : undefined;
let expectedErrors = code.match(/\/\/\s*expected errors:\s*(.*)/);
@ -74,7 +73,6 @@ function runTest(name: string, code: string): boolean {
errorHandler: errorHandler.bind(null, recover ? "Recover" : "Fail", errors),
serialize: true,
initializeMoreModules: false,
abstractEffectsInAdditionalFunctions: abstractEffects,
compatibility,
};
prepackFileSync([name], options);

View File

@ -80,7 +80,6 @@ function runTestSuite(outputJsx, shouldTranspileSource) {
reactOutput: outputJsx ? "jsx" : "create-element",
inlineExpressions: true,
omitInvariants: true,
abstractEffectsInAdditionalFunctions: true,
stripFlow: true,
};

View File

@ -268,7 +268,6 @@ function runTest(name, code, options: PrepackOptions, args) {
if (code.includes("// do not inline expressions")) options.inlineExpressions = false;
if (code.includes("// omit invariants")) options.omitInvariants = true;
if (code.includes("// emit concrete model")) options.emitConcreteModel = true;
if (code.includes("// abstract effects")) options.abstractEffectsInAdditionalFunctions = true;
if (code.includes("// exceeds stack limit")) options.maxStackDepth = 10;
if (code.includes("// react")) {
options.reactEnabled = true;

View File

@ -50,7 +50,6 @@ export type RealmOptions = {
reactOutput?: ReactOutputTypes,
reactVerbose?: boolean,
stripFlow?: boolean,
abstractEffectsInAdditionalFunctions?: boolean,
abstractValueImpliesMax?: number,
};

View File

@ -48,7 +48,6 @@ function run(
--srcmapOut The output sourcemap filename.
--maxStackDepth Specify the maximum call stack depth.
--timeout The amount of time in seconds until Prepack should time out.
--abstractEffectsInAdditionalFunctions Experimental flag to allow abstract effectful function calls.
--lazyObjectsRuntime Enable lazy objects feature and specify the JS runtime that support this feature.
--debugNames Changes the output of Prepack so that for named functions and variables that get emitted into
Prepack's output, the original name is appended as a suffix to Prepack's generated identifier.
@ -97,7 +96,6 @@ function run(
emitConcreteModel: false,
inlineExpressions: false,
simpleClosures: false,
abstractEffectsInAdditionalFunctions: false,
logStatistics: false,
logModules: false,
delayInitializations: false,

View File

@ -16,7 +16,6 @@ import invariant from "./invariant.js";
export type PrepackOptions = {|
additionalGlobals?: Realm => void,
abstractEffectsInAdditionalFunctions?: boolean,
lazyObjectsRuntime?: string,
heapGraphFormat?: "DotLanguage" | "VISJS",
compatibility?: Compatibility,
@ -59,7 +58,6 @@ export type PrepackOptions = {|
|};
export function getRealmOptions({
abstractEffectsInAdditionalFunctions = false,
compatibility = "browser",
debugNames = false,
errorHandler,
@ -80,7 +78,6 @@ export function getRealmOptions({
abstractValueImpliesMax,
}: PrepackOptions): RealmOptions {
return {
abstractEffectsInAdditionalFunctions,
compatibility,
debugNames,
errorHandler,

View File

@ -152,7 +152,6 @@ export class Realm {
constructor(opts: RealmOptions) {
this.isReadOnly = false;
this.useAbstractInterpretation = !!opts.serialize || !!opts.residual || !!opts.check;
this.trackLeaks = !!opts.abstractEffectsInAdditionalFunctions;
this.ignoreLeakLogic = false;
this.isInPureTryStatement = false;
if (opts.mathRandomSeed !== undefined) {
@ -227,7 +226,6 @@ export class Realm {
isReadOnly: boolean;
isStrict: boolean;
useAbstractInterpretation: boolean;
trackLeaks: boolean;
debugNames: void | boolean;
isInPureTryStatement: boolean; // TODO(1264): Remove this once we implement proper exception handling in abstract calls.
abstractValueImpliesMax: number;
@ -508,9 +506,6 @@ export class Realm {
// also won't have effects on any objects or bindings that weren't created in this
// call.
evaluatePure<T>(f: () => T) {
if (!this.trackLeaks) {
return f();
}
let saved_createdObjectsTrackedForLeaks = this.createdObjectsTrackedForLeaks;
// Track all objects (including function closures) created during
// this call. This will be used to make the assumption that every

View File

@ -1,5 +1,3 @@
// abstract effects
var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) : {foo:1};
var copyOfCopyOfObj;
@ -10,6 +8,6 @@ __evaluatePureFunction(() => {
copyOfObj.x = 10;
});
inspect = function() {
inspect = function() {
return JSON.stringify(copyOfCopyOfObj);
}

View File

@ -1,5 +1,3 @@
// abstract effects
var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) : {foo:1};
var copyOfObj;
@ -10,6 +8,6 @@ __evaluatePureFunction(() => {
copyOfObj.x = 10;
});
inspect = function() {
inspect = function() {
return JSON.stringify(copyOfObj);
}

View File

@ -1,5 +1,3 @@
// abstract effects
var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({foo: __abstract('number')}, "({foo:1})"))) : {foo:1};
var copyOfObj;
@ -10,6 +8,6 @@ __evaluatePureFunction(() => {
copyOfObj.foo = 2;
});
inspect = function() {
inspect = function() {
return JSON.stringify(copyOfObj);
}

View File

@ -1,5 +1,3 @@
// abstract effects
var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) : {foo:1};
var copyOfObj;
@ -15,6 +13,6 @@ __evaluatePureFunction(() => {
});
});
inspect = function() {
inspect = function() {
return JSON.stringify(copyOfObj);
}

View File

@ -1,5 +1,3 @@
// abstract effects
var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({foo: __abstract('number')}, "({foo:1})"))) : {foo:1};
var copyOfObj;
@ -10,6 +8,6 @@ __evaluatePureFunction(() => {
copyOfObj.foo = 2;
});
inspect = function() {
inspect = function() {
return JSON.stringify(copyOfObj);
}

View File

@ -1,5 +1,3 @@
// abstract effects
var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({foo: __abstract('number')}, "({foo:1})"))) : {foo:1};
var copyOfObj;
@ -17,6 +15,6 @@ __evaluatePureFunction(() => {
});
});
inspect = function() {
inspect = function() {
return JSON.stringify(y);
}

View File

@ -1,5 +1,3 @@
// abstract effects
var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({foo: __abstract('number')}, "({foo:1})"))) : {foo:1};
var copyOfObj;
@ -10,6 +8,6 @@ __evaluatePureFunction(() => {
delete copyOfObj.foo;
});
inspect = function() {
inspect = function() {
return JSON.stringify(copyOfObj);
}

View File

@ -1,5 +1,3 @@
// abstract effects
var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) : {foo:1};
var copyOfObj;
@ -21,6 +19,6 @@ __evaluatePureFunction(() => {
copyOfObj.__proto__ = proto;
});
inspect = function() {
inspect = function() {
return JSON.stringify(y);
}

View File

@ -1,5 +1,3 @@
// abstract effects
var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) : {foo:1};

View File

@ -1,5 +1,3 @@
// abstract effects
var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) : {foo:1};
var copyOfObj;
@ -8,6 +6,6 @@ __evaluatePureFunction(() => {
copyOfObj = Object.assign({}, obj, {foo: 2});
});
inspect = function() {
inspect = function() {
return JSON.stringify(copyOfObj);
}

View File

@ -1,5 +1,3 @@
// abstract effects
var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) : {foo:1};
var copyOfObj;
@ -8,6 +6,6 @@ __evaluatePureFunction(() => {
copyOfObj = Object.assign({}, {foo: 2}, obj);
});
inspect = function() {
inspect = function() {
return JSON.stringify(copyOfObj);
}

View File

@ -1,5 +1,3 @@
// abstract effects
var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
var obj = global.__abstract && global.__makePartial && global.__makeSimple ? __makeSimple(__makePartial(__abstract({}, "({foo:1})"))) : {foo:1};
var x;
@ -11,6 +9,6 @@ __evaluatePureFunction(() => {
y.foo = 2;
});
inspect = function() {
inspect = function() {
return JSON.stringify(x);
}

View File

@ -1,5 +1,3 @@
// abstract effects
var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());
__evaluatePureFunction(() => {
let dims = global.__abstract ? __abstract({

View File

@ -1,5 +1,3 @@
// abstract effects
global.f = function(x, y) {
if (y) Object.assign({}, x); else throw new Error();
};

View File

@ -1,5 +1,3 @@
// abstract effects
let forEach = global.__abstract ? __abstract('function', '(function(callback) { callback("a", 0); callback("b", 1); })') : function(callback) { callback("a", 0); callback("b", 1); };
let set = global.__abstract ? __abstract('function', '(function(obj, name, value) { obj[name] = value; })') : function(obj, name, value) { obj[name] = value; };

View File

@ -1,5 +1,3 @@
// abstract effects
let obj = global.__abstract ? __abstract('object', '({foo: function() { return 1; }})') : {foo: function() { return 1; }};
if (global.__makeSimple) {
__makeSimple(obj);

View File

@ -1,5 +1,3 @@
// abstract effects
let obj = {};
if (global.__makeSimple) {
__makeSimple(obj);

View File

@ -1,5 +1,3 @@
// abstract effects
let obj1 = global.__abstract ? __abstract('object', '({get foo() { return "bar"; }})') : {get foo() { return "bar"; }};
let obj2 = global.__abstract ? __abstract('object', '({foo:{bar:"baz"}})') : {foo:{bar:"baz"}};
if (global.__makeSimple) {

View File

@ -1,5 +1,3 @@
// abstract effects
let obj1 = global.__abstract ? __abstract('object', '({get foo() { return "bar"; }})') : {get foo() { return "bar"; }};
let obj2 = global.__abstract ? __abstract('object', '({foo:{extends:"baz"}})') : {foo:{"extends":"baz"}};
if (global.__makeSimple) {

View File

@ -1,4 +1,3 @@
// abstract effects
// does contain: "barone"
var __evaluatePureFunction = this.__evaluatePureFunction || (f => f());

View File

@ -1,4 +1,3 @@
// abstract effects
// does contain: "barone"
// does not contain: "23"

View File

@ -1,5 +1,3 @@
// abstract effects
let obj1 = global.__abstract ? __abstract('object', '({foo: {valueOf() { return 42; }}})') : {foo: {valueOf() { return 42; }}};
let obj2 = global.__abstract ? __abstract('object', '({foo: {bar: {valueOf() { return 42; }}}})') : {foo: {bar: {valueOf() { return 42; }}}};

View File

@ -1,5 +1,3 @@
// abstract effects
let obj1 = global.__abstract ? __abstract('object', '({foo: {valueOf() { return 42; }}})') : {foo: {valueOf() { return 42; }}};
let obj2 = global.__abstract ? __abstract('object', '({foo: {bar: {valueOf() { return 42; }}}})') : {foo: {bar: {valueOf() { return 42; }}}};

View File

@ -1,5 +1,3 @@
// abstract effects
let obj1 = global.__abstract ? __abstract('object', '({valueOf() { this.x = 10; return 42; }})') : {valueOf() { this.x = 10; return 42; }};
function additional1() {
@ -12,7 +10,7 @@ function additional2() {
var x = {
valueOf:
(global.__abstract
? __abstract('function', '(function() { this.foo++; return 10; })')
? __abstract('function', '(function() { this.foo++; return 10; })')
: function() { this.foo++; return 10; }
),
foo: 0

View File

@ -1,5 +1,3 @@
// abstract effects
let obj1 = global.__abstract ? __abstract('object', '({get foo() { return "bar"; }})') : {get foo() { return "bar"; }};
let obj2 = global.__abstract ? __abstract('object', '({foo:{bar:"baz"}})') : {foo:{bar:"baz"}};
if (global.__makeSimple) {

View File

@ -1,5 +1,3 @@
// abstract effects
var invariant = function(condition, message) {
if (condition) return;
throw new Error(message);
@ -10,8 +8,8 @@ if (!global.__evaluatePureFunction) {
}
__evaluatePureFunction(() => {
var x = global.__abstract
? __abstract("object", "({foo: {foo2: {}}, bar: {bar2: {}}})")
var x = global.__abstract
? __abstract("object", "({foo: {foo2: {}}, bar: {bar2: {}}})")
: {foo: {foo2: {}}, bar: {bar2: {}}};
if (global.__makeSimple) {
@ -26,4 +24,4 @@ __evaluatePureFunction(() => {
foo2 || invariant(0, "Should not error 1!");
bar2 || invariant(0, "Should not error 2!");
});
});

View File

@ -1,5 +1,3 @@
// abstract effects
var Foo = global.__abstract ? __abstract(undefined, "(function () { this.x = 10 })") : function () { this.x = 10 };
function additional1() {

View File

@ -1,5 +1,3 @@
// abstract effects
var obj = global.__abstract && global.__makePartial ? __makePartial(__abstract({}, "({foo:1})")) : {foo:1};
function additional1() {

View File

@ -1,5 +1,3 @@
// abstract effects
let obj1 = global.__abstract ? __abstract('object', '({foo: {valueOf() { return 42; }}})') : {foo: {valueOf() { return 42; }}};
let obj2 = global.__abstract ? __abstract('object', '({foo: {bar: {valueOf() { return 42; }}}})') : {foo: {bar: {valueOf() { return 42; }}}};

View File

@ -1,5 +1,3 @@
// abstract effects
var obj = global.__abstract && global.__makePartial ? __makePartial(__abstract({}, "({foo:1})")) : {foo:1};
if (global.__makeSimple) __makeSimple(obj);

View File

@ -1,5 +1,3 @@
// abstract effects
var obj = global.__abstract && global.__makePartial ? __makePartial(__abstract({}, "({foo:1})")) : {foo:1};
if (global.__makeSimple) __makeSimple(obj);

View File

@ -75,12 +75,6 @@ var optionsConfig = [
defaultVal: true,
description: "Removes Flow type annotations from the output."
},
{
type: "boolean",
name: "abstractEffectsInAdditionalFunctions",
defaultVal: true,
description: "Allows abstract effects in pure functions and React components."
},
];
var demos = [];