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

Issue 6672027: Change order of operations in array functions to match the specification. (Closed)

Created:
9 years, 9 months ago by Lasse Reichstein
Modified:
9 years, 1 month ago
Reviewers:
sandholm
CC:
v8-dev
Visibility:
Public.

Description

Change order of operations in array functions to match the specification. In particular, read and convert the lenght to uint32 as the first step in most functions, so that if that operation throws, it does so before any other step has a chance to fail. Fixes issue 75562. BUG=75562 TEST=mjsunit/regress/regress-75562

Patch Set 1 #

Total comments: 3

Patch Set 2 : Avoid unneccesary calls. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+95 lines, -33 lines) Patch
M src/array.js View 1 11 chunks +31 lines, -33 lines 0 comments Download
A test/mjsunit/regress/regress-75562.js View 1 chunk +64 lines, -0 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
Lasse Reichstein
9 years, 9 months ago (2011-03-11 12:57:00 UTC) #1
sandholm
9 years, 9 months ago (2011-03-11 13:16:53 UTC) #2
LGTM with comments re performance impact.

http://codereview.chromium.org/6672027/diff/1/src/array.js
File src/array.js (right):

http://codereview.chromium.org/6672027/diff/1/src/array.js#newcode364
src/array.js:364: var array = ToObject(this);
You probably want IS_ARRAY(this) to be the fast case. E.g. check that this is
not an array before calling ToObject.

http://codereview.chromium.org/6672027/diff/1/src/array.js#newcode365
src/array.js:365: var func = array.join;
Not calling "Join" directly may have performance implications.

http://codereview.chromium.org/6672027/diff/1/src/array.js#newcode374
src/array.js:374: var array = ToObject(this);
Same comment re IS_ARRAY and ToObject.

Powered by Google App Engine
This is Rietveld 408576698