mirror of
https://github.com/facebookarchive/prepack.git
synced 2024-09-20 03:27:09 +03:00
Correction of a few comment typos in the serializers
Summary: Hi all, It was a good way to get started on contributing. Closes https://github.com/facebook/prepack/pull/1259 Differential Revision: D6558546 Pulled By: hermanventer fbshipit-source-id: 815380c88aad36a7e1b34928b4eb6927a7c9d461
This commit is contained in:
parent
240fa7025d
commit
f4271d56f0
@ -44,10 +44,10 @@ const LAZY_OBJECTS_SERIALIZER_BODY_TYPE = "LazyObjectInitializer";
|
||||
* Objects are serialized into two parts:
|
||||
* 1. All lazy objects are created via lightweight LazyObjectsRuntime.createLazyObject() call.
|
||||
* 2. Lazy objects' property assignments are delayed in a callback function which is registered with the runtime.
|
||||
* lazy objects rutnime will execute this callback to hydrate the lazy objects.
|
||||
* lazy objects runtime will execute this callback to hydrate the lazy objects.
|
||||
*
|
||||
* Currently only the raw objects are taking part in the lazy objects feature.
|
||||
* TODO: suppor for other objects, like array, regex etc...
|
||||
* TODO: support for other objects, like array, regex etc...
|
||||
*/
|
||||
export class LazyObjectsSerializer extends ResidualHeapSerializer {
|
||||
constructor(
|
||||
|
@ -81,7 +81,7 @@ export class Referentializer {
|
||||
}
|
||||
|
||||
// Generate a shared function for accessing captured scope bindings.
|
||||
// TODO: skip generating this function if the captured scope is not shared by multiple residual funcitons.
|
||||
// TODO: skip generating this function if the captured scope is not shared by multiple residual functions.
|
||||
createCaptureScopeAccessFunction(referentializationScope: ReferentializationScope): BabelNodeStatement {
|
||||
const body = [];
|
||||
const selectorParam = t.identifier("selector");
|
||||
|
@ -217,7 +217,7 @@ export class ResidualHeapSerializer {
|
||||
// symbols, properties, prototype.
|
||||
// For every created object that corresponds to a value,
|
||||
// this function should be invoked once.
|
||||
// Thus, as a side effects, we gather statistics here on all emitted objects.
|
||||
// Thus, as a side effect, we gather statistics here on all emitted objects.
|
||||
_emitObjectProperties(
|
||||
obj: ObjectValue,
|
||||
properties: Map<string, PropertyBinding> = obj.properties,
|
||||
@ -1360,7 +1360,7 @@ export class ResidualHeapSerializer {
|
||||
return this._serializeAbstractValueHelper(val);
|
||||
} else {
|
||||
// This abstract value's dependencies should all be declared
|
||||
// but still need to check it again in case their serialized bodies are in different generator scope.
|
||||
// but still need to check them again in case their serialized bodies are in different generator scope.
|
||||
this.emitter.emitNowOrAfterWaitingForDependencies(val.args, () => {
|
||||
const serializedValue = this._serializeAbstractValueHelper(val);
|
||||
let uid = this.getSerializeObjectIdentifier(val);
|
||||
@ -1516,7 +1516,7 @@ export class ResidualHeapSerializer {
|
||||
let nestedFunctions = new Set([...createdObjects].filter(object => object instanceof FunctionValue));
|
||||
// result -- ignore TODO: return the result from the function somehow
|
||||
// Generator -- visit all entries
|
||||
// Bindings -- only need to serialize bindings if they're captured by some nested function ??
|
||||
// Bindings -- only need to serialize bindings if they're captured by some nested function?
|
||||
// -- need to apply them and maybe need to revisit functions in ancestors to make sure
|
||||
// -- we don't overwrite anything they capture
|
||||
// -- TODO: deal with these properly
|
||||
|
@ -19,7 +19,7 @@ import * as t from "babel-types";
|
||||
// This class can optionally track how often such value identifiers are referenced
|
||||
// when pass 1 is activated, which is usually followed by pass 2 in which
|
||||
// unneeded identifiers (those which were only ever referenced once) are
|
||||
// eliminated as the defining expression can be inlined.
|
||||
// eliminated as the defining expression can be inlined.
|
||||
export class ResidualHeapValueIdentifiers {
|
||||
constructor(values: Iterator<Value>, preludeGenerator: PreludeGenerator) {
|
||||
this.collectValToRefCountOnly = false;
|
||||
|
@ -52,7 +52,7 @@ import { Environment, To } from "../singletons.js";
|
||||
export type Scope = FunctionValue | Generator;
|
||||
|
||||
/* This class visits all values that are reachable in the residual heap.
|
||||
In particular, this "filters out" values that are...
|
||||
In particular, this "filters out" values that are:
|
||||
- captured by a DeclarativeEnvironmentRecord, but not actually used by any closure.
|
||||
- Unmodified prototype objects
|
||||
TODO #680: Figure out minimal set of values that need to be kept alive for WeakSet and WeakMap instances.
|
||||
@ -507,7 +507,7 @@ export class ResidualHeapVisitor {
|
||||
if (this.preProcessValue(val)) this.visitAbstractValue(val);
|
||||
} else if (val.isIntrinsic()) {
|
||||
// All intrinsic values exist from the beginning of time...
|
||||
// ...except for a few that come into existance as templates for abstract objects (TODO #882).
|
||||
// ...except for a few that come into existence as templates for abstract objects (TODO #882).
|
||||
if (val.isTemplate) this.preProcessValue(val);
|
||||
else
|
||||
this._withScope(this.commonScope, () => {
|
||||
|
@ -43,7 +43,7 @@ function shouldVisit(node, data) {
|
||||
return (node: any)._renamedOnce !== data;
|
||||
}
|
||||
|
||||
// replaceWith causes the node to be re-analysed, so to prevent double replacement
|
||||
// replaceWith causes the node to be re-analyzed, so to prevent double replacement
|
||||
// we add this property on the node to mark it such that it does not get replaced
|
||||
// again on this pass
|
||||
// TODO: Make this work when replacing with arbitrary BabelNodeExpressions. Currently
|
||||
|
Loading…
Reference in New Issue
Block a user