MCPcopy
hub / github.com/rollup/rollup / deoptimizePath

Method deoptimizePath

src/ast/nodes/shared/ObjectEntity.ts:224–259  ·  view source on GitHub ↗
(path: ObjectPath)

Source from the content-addressed store, hash-verified

222
223 // Assumption: If only a specific path is deoptimized, no accessors are created
224 deoptimizePath(path: ObjectPath): void {
225 if (this.hasLostTrack || this.immutable) {
226 return;
227 }
228 const key = path[0];
229 if (path.length === 1) {
230 if (key === UnknownInteger) {
231 return this.deoptimizeIntegerProperties();
232 } else if (!isConcreteKey(key)) {
233 return this.deoptimizeAllProperties(key === UnknownNonAccessorKey);
234 }
235 if (!this.deoptimizedPaths.get(key)) {
236 this.deoptimizedPaths.set(key, true);
237
238 // we only deoptimizeCache exact matches as in all other cases,
239 // we do not return a literal value or return expression
240 const expressionsToBeDeoptimized = this.expressionsToBeDeoptimizedByKey.get(key);
241 if (expressionsToBeDeoptimized) {
242 for (const expression of expressionsToBeDeoptimized) {
243 expression.deoptimizeCache();
244 }
245 }
246 }
247 }
248
249 const subPath = path.length === 1 ? UNKNOWN_PATH : path.slice(1);
250 for (const property of isConcreteKey(key)
251 ? [
252 ...(this.propertiesAndGettersByKey.get(key) || this.unmatchablePropertiesAndGetters),
253 ...(this.settersByKey.get(key) || this.unmatchableSetters)
254 ]
255 : this.allProperties) {
256 property.deoptimizePath(subPath);
257 }
258 this.prototypeExpression?.deoptimizePath(path.length === 1 ? [path[0], UnknownKey] : path);
259 }
260
261 getLiteralValueAtPath(
262 path: ObjectPath,

Callers

nothing calls this directly

Calls 7

isConcreteKeyFunction · 0.90
getMethod · 0.80
setMethod · 0.65
deoptimizeCacheMethod · 0.65
deoptimizePathMethod · 0.65

Tested by

no test coverage detected