• vitalyr@chromium.org's avatar
    Copy-on-write arrays. · 3202df6c
    vitalyr@chromium.org authored
    Object model changes
    ----------------------------------------
    New fixed_cow_array_map is used for the elements array of a JSObject
    to mark it as COW. The JSObject's map and other fields are not
    affected. The JSObject's map still has the "fast elements" bit set. It
    means we can do only the receiver map check in keyed loads and the
    receiver and the elements map checks in keyed stores. So introducing
    COW arrays doesn't hurt performance of these operations. But note that
    the elements map check is necessary in all mutating operations because
    the "has fast elements" bit now means "has fast elements for reading".
    EnsureWritableFastElements can be used in runtime functions to perform
    the necessary lazy copying.
    
    Generated code changes
    ----------------------------------------
    Generic keyed load is updated to only do the receiver map check (this
    could have been done earlier). FastCloneShallowArrayStub now has two
    modes: clone elements and use COW elements. AssertFastElements macro
    is added to check the elements when necessary. The custom call IC
    generators for Array.prototype.{push,pop} are updated to avoid going
    to the slow case (and patching the IC) when calling the builtin should
    work.
    
    COW enablement
    ----------------------------------------
    Currently we only put shallow and simple literal arrays in the COW
    mode. This is done by the parser.
    
    Review URL: http://codereview.chromium.org/3144002
    
    git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5275 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
    3202df6c
parser.cc 166 KB