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

public abstract class IsPristineObjectNode extends JavaScriptBaseNode
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:
  • 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
  • Method Details

    • create

      public static IsPristineObjectNode create(JSClass jsClass, com.oracle.truffle.api.object.Shape initialPrototypeShape, Object... propertyKeys)
    • createRegExpExec

      public static IsPristineObjectNode createRegExpExec(JSContext context)
      Guard for RegExpExec dispatch. This only needs to ensure that looking up exec is 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

      public abstract boolean execute(JSDynamicObject object)