Introduce safe interface to "copy and grow" FixedArray.
authormstarzinger <mstarzinger@chromium.org>
Tue, 4 Aug 2015 17:48:42 +0000 (10:48 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 4 Aug 2015 17:49:42 +0000 (17:49 +0000)
commitbcad9b547d00320f818ce6ff08016a02ce0b6e5b
treebff430c76f4aacf72aeb8e150204aa61cd7fea1b
parent0215fb56f4c75b054116632039edbff0d7f40373
Introduce safe interface to "copy and grow" FixedArray.

This introduces a CopyFixedArrayAndGrow method on Factory that takes
the "grow amount" instead of the "new size" as an argument. The new
interface is safer because it allows for mutations by the GC that
potentially trim the source array.

This also fixes a bug in SharedFunctionInfo::AddToOptimizedCodeMap
where the aformentioned scenario led to unused entries within the
optimized code map.

Note that FixedArray::CopySize is hereby deprecated because it is
considered unsafe and should no longer be used.

R=hpayer@chromium.org
TEST=mjsunit/regress/regress-crbug-513507
BUG=chromium:513507
LOG=n

Review URL: https://codereview.chromium.org/1255173006

Cr-Commit-Position: refs/heads/master@{#30012}
src/factory.cc
src/factory.h
src/heap/heap.cc
src/heap/heap.h
src/objects.cc
src/objects.h
test/cctest/test-heap.cc
test/mjsunit/regress/regress-crbug-513507.js [new file with mode: 0644]