Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8134609

Allow constructors with same prototoype map to share the allocator map

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • None
    • core-libs
    • b83
    • generic
    • generic

        As shown by JDK-8133925 we want to be able to allow different instances of a constructor function to use the same allocator map as long as their prototypes have the same maps as well. This helps us keep callsites monomorphic in a couple of circumstances, such as the various non-global constructor code patterns, or scripts with global constructors being evaluated multiple times with different globals.

        This means we have to keep track of what a map's expected prototype map is, and change the map if the actual prototype map differs or has been modified on any of the (prototype) objects using it. We also need to introduce a switchpoint for callsites involving shared prototype maps, as the prototype may have changed on any object not directly involved in the linking of the callsite.

        Basically, we make an assumption about the JavaScript code that prototypes are usually not modified after objects have been constructed. This makes property maps a bit more like classes, allowing us to assume objects with the same property map also have prototypes with the same map.

              hannesw Hannes Wallnoefer
              hannesw Hannes Wallnoefer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: