Class IsPristineObjectNode
java.lang.Object
com.oracle.truffle.api.nodes.Node
com.oracle.truffle.js.nodes.JavaScriptBaseNode
com.oracle.truffle.js.builtins.helper.IsPristineObjectNode
- All Implemented Interfaces:
com.oracle.truffle.api.nodes.NodeInterface, Cloneable
Helper node for optimization of built-in functions. Some built-in functions, like
RegExp.prototype.[@@replace], are suboptimal when implemented in full conformance to the
ECMAScript spec. We want to replace those functions with faster, non-spec-conforming variants
whenever possible. One of the prerequisites for doing so is that running the spec-conforming
variant must be side-effect-free, which can only be guaranteed when all properties and functions
used by the built-in function are known/built-in as well. Therefore, we define a "pristine"
property for built-in objects:
An object is considered "pristine" in respect to a given class and list of properties if and only if:
An object is considered "pristine" in respect to a given class and list of properties if and only if:
- The object is an instance of the given class
- The object's prototype's shape has never been changed
- None of the given properties have been overwritten in the prototype or the object
-
Nested Class Summary
Nested classes/interfaces inherited from class com.oracle.truffle.api.nodes.Node
com.oracle.truffle.api.nodes.Node.Child, com.oracle.truffle.api.nodes.Node.Children -
Method Summary
Modifier and TypeMethodDescriptionstatic IsPristineObjectNodecreate(JSClass jsClass, com.oracle.truffle.api.object.Shape initialPrototypeShape, Object... propertyKeys) static IsPristineObjectNodecreateRegExpExec(JSContext context) Guard for RegExpExec dispatch.static IsPristineObjectNodecreateRegExpExecAndFlagGetter(JSContext context, Object... extraPropertyKeys) Guard for fast paths that bypass both RegExpExec dispatch and the built-in flag getters, optionally with additional guarded properties for callers that bypass more observable work.abstract booleanexecute(JSDynamicObject object) Methods inherited from class JavaScriptBaseNode
copy, getJSContext, getLanguage, getLanguageOptions, getRealm, hasOverloadedOperators, onReplace, reportLoopCount, reportLoopCountMethods inherited from class com.oracle.truffle.api.nodes.Node
accept, adoptChildren, atomic, atomic, deepCopy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLock, getParent, getRootNode, getSourceSection, insert, insert, isAdoptable, isSafelyReplaceableBy, notifyInserted, replace, replace, reportPolymorphicSpecialize, reportReplace, toString
-
Method Details
-
create
public static IsPristineObjectNode create(JSClass jsClass, com.oracle.truffle.api.object.Shape initialPrototypeShape, Object... propertyKeys) -
createRegExpExec
Guard for RegExpExec dispatch. This only needs to ensure that looking upexecis unobservable. RegExpBuiltinExec uses internal slots rather than the public flag accessors. -
createRegExpExecAndFlagGetter
public static IsPristineObjectNode createRegExpExecAndFlagGetter(JSContext context, Object... extraPropertyKeys) Guard for fast paths that bypass both RegExpExec dispatch and the built-in flag getters, optionally with additional guarded properties for callers that bypass more observable work. -
execute
-