As exampled in https://github.com/v8/v8/wiki/Design%20Elements#fast-property-access, I (attempt to) understand that properties of an object are stored based in a hidden class, call it "C[N]", of its constructor. I may not have understood it correctly... For example:
// Let's suppose Object has these hidden classes already
/* Object[[HiddenClasses]] > C0, C1, C2
*
* C0 - for "x", goto C1
* C1 - "x"; for "y", goto C2
* C2 - "x", "y";
*/
var obj = {
x: 0
};
// Currently based in C1 to get/put properties
obj.y = 0;
// Now based in C2
1. What happens if this new object adds a new property?
obj.z = 0
Will it still behave like the first instance of Object
?
2. What happens if an object of the same constructor adds properties in opposite order of the hidden classes?
({ y: 5; }); // Will this be based in C2?
3. What happens if a property is deleted? Is its value only changed in memory for representing deleted
?
4. Are lookups done inside hidden classes when the compiler can't see an object or name of its computed property access? I.e.:
({ [Math.random()]: 0 }),
randomlyReceivedObject.property;