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