Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Issue 8372064: Fix setting array length to be ES5 conform. (Closed)

Created:
9 years, 1 month ago by Michael Starzinger
Modified:
9 years, 1 month ago
Reviewers:
danno
CC:
v8-dev
Visibility:
Public.

Description

Fix setting array length to be ES5 conform. This also refactors the way we set the length of an arrays' backing store to use the new elements accessor interface. The actual fix is in DictionaryElementsAccessor::SetLengthWithoutNormalize() where we first search for non-deletable elements according to ES5 section 15.4.5.2 specifications. Snippet from the specification: Attempting to set the length property of an Array object to a value that is numerically less than or equal to the largest numeric property name of an existing array indexed non-deletable property of the array will result in the length being set to a numeric value that is one greater than that largest numeric property name. R=danno@chromium.org TEST=test262/15.4.4.??-7-b-16 Committed: http://code.google.com/p/v8/source/detail?r=9911

Patch Set 1 #

Total comments: 14

Patch Set 2 : Addressed comments by Daniel Clifford. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+277 lines, -281 lines) Patch
M src/elements.h View 1 chunk +5 lines, -0 lines 0 comments Download
M src/elements.cc View 1 13 chunks +271 lines, -9 lines 0 comments Download
M src/objects.h View 1 2 chunks +0 lines, -4 lines 0 comments Download
M src/objects.cc View 3 chunks +1 line, -235 lines 0 comments Download
M test/test262/test262.status View 1 chunk +0 lines, -33 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Michael Starzinger
PTAL.
9 years, 1 month ago (2011-11-02 14:17:32 UTC) #1
danno
lgtm if you address comments http://codereview.chromium.org/8372064/diff/1/src/elements.cc File src/elements.cc (right): http://codereview.chromium.org/8372064/diff/1/src/elements.cc#newcode79 src/elements.cc:79: static Failure* ArrayLengthRangeError(Heap* heap) ...
9 years, 1 month ago (2011-11-07 19:26:02 UTC) #2
Michael Starzinger
9 years, 1 month ago (2011-11-08 12:00:33 UTC) #3
Added new patch set. Rebased. Landed.

http://codereview.chromium.org/8372064/diff/1/src/elements.cc
File src/elements.cc (right):

http://codereview.chromium.org/8372064/diff/1/src/elements.cc#newcode79
src/elements.cc:79: static Failure* ArrayLengthRangeError(Heap* heap) {
On 2011/11/07 19:26:02, danno wrote:
> Call this ThrowArrayLengthRangeError

Done.

http://codereview.chromium.org/8372064/diff/1/src/elements.cc#newcode388
src/elements.cc:388: obj->GetElementsKind() == FAST_SMI_ONLY_ELEMENTS
On 2011/11/07 19:26:02, danno wrote:
> Use obj->HasFastSmiOnlyElements()

Done.

http://codereview.chromium.org/8372064/diff/1/src/elements.cc#newcode549
src/elements.cc:549: { MaybeObject* maybe_obj = array->ResetElements();
On 2011/11/07 19:26:02, danno wrote:
> This weird formatting is an artifact of an automated GC-related change that
went
> in a long time ago. Take this opportunity to remove the unneeded extra scope
and
> clean this up. 

Done.

http://codereview.chromium.org/8372064/diff/1/src/elements.cc#newcode882
src/elements.cc:882: if (!maybe_object->To(&dictionary)) return maybe_object;
On 2011/11/07 19:26:02, danno wrote:
> remove extra scope

Done.

http://codereview.chromium.org/8372064/diff/1/src/elements.cc#newcode899
src/elements.cc:899: { MaybeObject* maybe_obj =
array->GetHeap()->AllocateFixedArray(1);
On 2011/11/07 19:26:02, danno wrote:
> prune extra scope

Done.

http://codereview.chromium.org/8372064/diff/1/src/elements.cc#newcode904
src/elements.cc:904: { MaybeObject* maybe_obj =
array->EnsureCanContainElements(&length, 1);
On 2011/11/07 19:26:02, danno wrote:
> prune extra scope

Done.

http://codereview.chromium.org/8372064/diff/1/src/elements.cc#newcode909
src/elements.cc:909: array->set_elements(new_backing_store);
On 2011/11/07 19:26:02, danno wrote:
> Consider using array->SetContent to simplify the previous several lines.

Done.

Powered by Google App Engine
This is Rietveld 408576698