• verwaest@chromium.org's avatar
    Sharing of descriptor arrays. · ebd3241b
    verwaest@chromium.org authored
    This CL adds multiple things:
    Transition arrays do not directly point at their descriptor array anymore, but rather do so via an indirect pointer (a JSGlobalPropertyCell).
    
    An ownership bit is added to maps indicating whether it owns its own descriptor array or not.
    
    Maps owning a descriptor array can pass on ownership if a transition from that map is generated; but only if the descriptor array stays exactly the same; or if a descriptor is added.
    
    Maps that don't have ownership get ownership back if their direct child to which ownership was passed is cleared in ClearNonLiveTransitions.
    
    To detect which descriptors in an array are valid, each map knows its own NumberOfOwnDescriptors. Since the descriptors are sorted in order of addition, if we search and find a descriptor with index bigger than this number, it is not valid for the given map.
    
    We currently still build up an enumeration cache (although this may disappear). The enumeration cache is always built for the entire descriptor array, even if not all descriptors are owned by the map. Once a descriptor array has an enumeration cache for a given map; this invariant will always be true, even if the descriptor array was extended. The extended array will inherit the enumeration cache from the smaller descriptor array. If a map with more descriptors needs an enumeration cache, it's EnumLength will still be set to invalid, so it will have to recompute the enumeration cache. This new cache will also be valid for smaller maps since they have their own enumlength; and use this to loop over the cache. If the EnumLength is still invalid, but there is already a cache present that is big enough; we just initialize the EnumLength field for the map.
    
    When we apply ClearNonLiveTransitions and descriptor ownership is passed back to a parent map, the descriptor array is trimmed in-place and resorted. At the same time, the enumeration cache is trimmed in-place.
    
    Only transition arrays contain descriptor arrays. If we transition to a map and pass ownership of the descriptor array along, the child map will not store the descriptor array it owns. Rather its parent will keep the pointer. So for every leaf-map, we find the descriptor array by following the back pointer, reading out the transition array, and fetching the descriptor array from the JSGlobalPropertyCell. If a map has a transition array, we fetch it from there. If a map has undefined as its back-pointer and has no transition array; it is considered to have an empty descriptor array.
    
    When we modify properties, we cannot share the descriptor array. To accommodate this, the child map will get its own transition array; even if there are not necessarily any transitions leaving from the child map. This is necessary since it's the only way to store its own descriptor array.
    
    Review URL: https://chromiumcodereview.appspot.com/10909007
    
    git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12492 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
    ebd3241b
Name
Last commit
Last update
..
SConscript Loading commit data...
cctest.cc Loading commit data...
cctest.gyp Loading commit data...
cctest.h Loading commit data...
cctest.status Loading commit data...
gay-fixed.cc Loading commit data...
gay-fixed.h Loading commit data...
gay-precision.cc Loading commit data...
gay-precision.h Loading commit data...
gay-shortest.cc Loading commit data...
gay-shortest.h Loading commit data...
log-eq-of-logging-and-traversal.js Loading commit data...
test-accessors.cc Loading commit data...
test-alloc.cc Loading commit data...
test-api.cc Loading commit data...
test-assembler-arm.cc Loading commit data...
test-assembler-ia32.cc Loading commit data...
test-assembler-mips.cc Loading commit data...
test-assembler-x64.cc Loading commit data...
test-ast.cc Loading commit data...
test-bignum-dtoa.cc Loading commit data...
test-bignum.cc Loading commit data...
test-circular-queue.cc Loading commit data...
test-compiler.cc Loading commit data...
test-conversions.cc Loading commit data...
test-cpu-profiler.cc Loading commit data...
test-dataflow.cc Loading commit data...
test-date.cc Loading commit data...
test-debug.cc Loading commit data...
test-decls.cc Loading commit data...
test-deoptimization.cc Loading commit data...
test-dictionary.cc Loading commit data...
test-disasm-arm.cc Loading commit data...
test-disasm-ia32.cc Loading commit data...
test-disasm-mips.cc Loading commit data...
test-disasm-x64.cc Loading commit data...
test-diy-fp.cc Loading commit data...
test-double.cc Loading commit data...
test-dtoa.cc Loading commit data...
test-fast-dtoa.cc Loading commit data...
test-fixed-dtoa.cc Loading commit data...
test-flags.cc Loading commit data...
test-func-name-inference.cc Loading commit data...
test-hashing.cc Loading commit data...
test-hashmap.cc Loading commit data...
test-heap-profiler.cc Loading commit data...
test-heap.cc Loading commit data...
test-list.cc Loading commit data...
test-liveedit.cc Loading commit data...
test-lock.cc Loading commit data...
test-lockers.cc Loading commit data...
test-log-stack-tracer.cc Loading commit data...
test-log.cc Loading commit data...
test-macro-assembler-x64.cc Loading commit data...
test-mark-compact.cc Loading commit data...
test-parsing.cc Loading commit data...
test-platform-linux.cc Loading commit data...
test-platform-macos.cc Loading commit data...
test-platform-nullos.cc Loading commit data...
test-platform-tls.cc Loading commit data...
test-platform-win32.cc Loading commit data...
test-profile-generator.cc Loading commit data...
test-random.cc Loading commit data...
test-regexp.cc Loading commit data...
test-reloc-info.cc Loading commit data...
test-serialize.cc Loading commit data...
test-sockets.cc Loading commit data...
test-spaces.cc Loading commit data...
test-strings.cc Loading commit data...
test-strtod.cc Loading commit data...
test-thread-termination.cc Loading commit data...
test-threads.cc Loading commit data...
test-unbound-queue.cc Loading commit data...
test-utils.cc Loading commit data...
test-version.cc Loading commit data...
test-weakmaps.cc Loading commit data...
testcfg.py Loading commit data...