Skip to content

JavascriptLibrary.cpp Initialization methods with wrong property counts #6563

Open
@rhuanjl

Description

@rhuanjl

In the file JavascriptLibrary.cpp various objects (particularly builtin constructors and prototypes) have initialization methods when properties of one of these objects are first accessed the initialization method is called to set them all.

Each method begins by doing typeHandler->Convert(object, mode, slots); which allocates a row with enough memory for slots number of properties to be set on the object.

A cursory review shows that many of these are setting the wrong number of slots - normally too few meaning that by the end of the Initialization method the row has to be resized to store all of the properties - though in some cases it's too high so excess memory is being allocated.

This has happened because as ChakraCore has been developed more and more properties have been aded and slots numbers have not been consistently updated.

The file should be updated to have the correct numbers AND assertions should be added to prevent these numbers going wrong in the future.

(Note I began this offline BUT the related issue #6562 prevented me completing it - I think that that needs to be done first)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions