Reviewers: Mads Ager, antonm,

Description:
Copy-on-write arrays.

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.

Please review this at http://codereview.chromium.org/3144002/show

Affected files:
  M src/builtins.cc
  M src/codegen.h
  M src/heap.h
  M src/heap.cc
  M src/ia32/codegen-ia32.cc
  M src/ia32/full-codegen-ia32.cc
  M src/ia32/ic-ia32.cc
  M src/ia32/macro-assembler-ia32.h
  M src/ia32/macro-assembler-ia32.cc
  M src/ia32/stub-cache-ia32.cc
  M src/objects-debug.cc
  M src/objects-inl.h
  M src/objects.h
  M src/objects.cc
  M src/parser.cc
  M src/runtime.cc
  M src/serialize.h
  M src/v8-counters.h


--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev

Reply via email to