==Object model==

The object representation is gathered in the class ES_Object, which
consists of both the storage of properties as well as the
implementation of the protocol for interacting with objects. Any kind
of action taken on an object will pass through the API defined by
ES_Object.

The handling of properties are divided into three types:

# class
# indexed
# hashed

This is done with the intent of capturing the different ways
properties are used. Every object can handle the different types of
properties, and sometimes there is an overlap when one type of
property is used as another type due to how that property was created
to begin with. The different types of properties have their own
specialised storage and API, but the three are gatherd in the API of
ES_Object.

See ecmascript/src/object/es_object{.h,.cpp,_inlines.h}

===Class properties===

Class properties are properties that are known by the compiler at
compile time. For example:

var x = {};
x.foo = 12;

Here 'foo' is considered a class property. The first assumption
regarding class properties is that objects with class properties
behave, or rather the programmer intends them to behave, as if there
is an actual class governing their use and storage. The second
assumtion is that specific objects with class properties will be used
more or less the same every time, just as if they were instances of a
specific class.

To take advantage of these characteristic runtime classes of objects
are introduced via ES_Class. The runtime classes capture common
aspects of objects; which properties they have, what the prototype
object is, attributes of properties and the objects [[Class]].

See ecmascript/src/object/es_class{.h,.cpp,_inlines.h}

====Runtime classes====

Classes are represented by a rooted tree where every node is a class
in itself and has zero or more children and every edge from parent to
child represent the addition of a property. This way the root node is
the empty class that the empty object starts with. Adding a property
to an object will extend and replace the object's current class with
the new property. A class node will either follow an edge to a child
node, if it exists, or add a new child. With this scheme classes of
objects are re-used since all empty objects share the same class, and
adding a set of properties to two objects (in the same order) will
result in the two objects having the same class, i.e. the class of the
objects will be the same node in the class tree. This property of
objects with a common class is important since it allows inline
caching in the virtual machine, which is discussed below.

Every node has enough information to determine the attributes and
location of a property from the current class up to the root
node. Since this has to be efficient every class node has a hash table
for fast lookup. This table is in turn shared by classes which share
common prefixes to avoid memory blowup.

Deletion of a class property is a bit more expensive since it is
required to first find the parent node of where the property was added
and then add to that node all the properties between the current class
node up to the node just after the property that is to be deleted.

====Class property storage====

Class properties are stored in an class ES_Properties, which more or
less wraps an array of ES_Value_Internal to enable re-allocation when
the property storage runs out of memory. ES_Properties supports
reading, writing, deletion of values with the help of an index, and
allows for appending values with automatic re-sizing.

===Indexed properties===

Indexed properties are all properties denoted by an integer in the
range [0, 2^32 - 1]. They capture the entirety of all kinds of array
behaviour, not just for the case of Array objects. That is, whenever a
property with an index is used they will lead to a that an instance of
the indexed represenation being created. Indexed properties are
separated into two representations, compact and sparse.

See ecmascript/src/object/es_indexed{.h,.cpp,_inlines.h}

====Compact indexed properties====

Compact indexed properties are stored in arrays. The requirement for
an array to be considered compact are defined by the compact limits
stating that either the length is less than 16 or that the total
number of slots divided by the number of used slots is less than
2. This of course implies that possibly the number of used slots are
less than the total number of slots, indicating unused, i.e. empty,
slots in the array.

====Sparse indexed properties====

The sparse representation is used for when the above mentioned limits
are passed, indicating potentially large and/or many holes in the
array that would render a compact representation ineffective. A self
balancing binary tree is used for the sparse special case giving a
reasonable trade-off between memory and performance.

===Hash table properties===

Just as with class properties and indexed properties the hash table
properties are intended to capture a certain use case, and in the case
of hash table properties it is the case when objects are used as
dictionaries. That is, the different properties will in general have a
shorter life span and be added/removed multiple time in such a fashion
that their use is not similar to how a class based object would be
used.

The hypothesis we base this on is that properties that are not known
at compile time are just those properties that behave as the keys of a
hash table/dictionary.

===Object protocol===

===Host objects and the host object protocol===

