mirror of
https://github.com/facebookarchive/prepack.git
synced 2024-09-11 14:46:37 +03:00
Added missing code paths from the emitter (#2108)
Summary: Release notes: none I noticed that we weren't visiting the dependencies of temporalAlias values, nor were we visiting ReactElements. Visiting both seems to improve visitor performance locally for me on our bundle. Closes https://github.com/facebook/prepack/pull/2108 Differential Revision: D8359160 Pulled By: trueadm fbshipit-source-id: 1d9cc0f1855772a46721b1675649269628062113
This commit is contained in:
parent
d5bb04fb8e
commit
0a41e05032
@ -26,6 +26,7 @@ import { Generator } from "../utils/generator.js";
|
||||
import invariant from "../invariant.js";
|
||||
import { BodyReference } from "./types.js";
|
||||
import { ResidualFunctions } from "./ResidualFunctions.js";
|
||||
import { getProperty } from "../react/utils.js";
|
||||
|
||||
// Type used to configure callbacks from the dependenciesVisitor of the Emitter.
|
||||
type EmitterDependenciesVisitorCallbacks<T> = {
|
||||
@ -368,6 +369,10 @@ export class Emitter {
|
||||
switch (kind) {
|
||||
case "Object":
|
||||
let proto = val.$Prototype;
|
||||
if (val.temporalAlias !== undefined) {
|
||||
result = recurse(val.temporalAlias);
|
||||
if (result !== undefined) return result;
|
||||
}
|
||||
if (
|
||||
proto instanceof ObjectValue &&
|
||||
// if this is falsy, prototype chain might be cyclic
|
||||
@ -382,6 +387,21 @@ export class Emitter {
|
||||
result = recurse(val.$DateValue);
|
||||
if (result !== undefined) return result;
|
||||
break;
|
||||
case "ReactElement":
|
||||
let realm = val.$Realm;
|
||||
let type = getProperty(realm, val, "type");
|
||||
let props = getProperty(realm, val, "props");
|
||||
let key = getProperty(realm, val, "key");
|
||||
let ref = getProperty(realm, val, "ref");
|
||||
result = recurse(type);
|
||||
if (result !== undefined) return result;
|
||||
result = recurse(props);
|
||||
if (result !== undefined) return result;
|
||||
result = recurse(key);
|
||||
if (result !== undefined) return result;
|
||||
result = recurse(ref);
|
||||
if (result !== undefined) return result;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user