enhancementhelp wanted
Description
Tangentially related to #584. In the React ecosystem we tend to Object.freeze objects only in development mode but not in production because VMs are slower with freeze than with it. However, we do rely on objects not being mutated in production neither because of that.
I'd like to have a way to tell Prepack that an object or individual property is immutable for sake of optimizations and during the runtime of the initialization - but don't serialize it.
var obj1 = { immutable: 0 };
var obj2 = { immutable: 1, mutable: 2 };
if (__PREPACK__) {
__pseudoFreeze(obj1);
__pseudoFreezeProperty(obj1, 'immutable');
} else if (process.env.NODE_ENV !== 'production') {
Object.freeze(obj);
Object.defineProperty(obj2, 'immutable', { configurable: false, writable: false });
}
->
var obj1 = { immutable: 0 };
var obj2 = { immutable: 1, mutable: 2 };