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

Issue 650043: Faster moving FixedArray elements around. (Closed)

Created:
10 years, 10 months ago by antonm
Modified:
9 years, 4 months ago
CC:
v8-dev
Visibility:
Public.

Description

Faster moving FixedArray elements around.

Patch Set 1 #

Total comments: 18

Patch Set 2 : First round of Soren's comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+676 lines, -50 lines) Patch
M src/array.js View 1 chunk +2 lines, -0 lines 0 comments Download
M src/builtins.cc View 1 3 chunks +72 lines, -49 lines 0 comments Download
M src/objects.h View 1 1 chunk +3 lines, -0 lines 0 comments Download
M src/objects-inl.h View 1 chunk +5 lines, -0 lines 0 comments Download
M src/runtime.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/runtime.cc View 1 chunk +11 lines, -0 lines 0 comments Download
A test/mjsunit/array-elements-from-array-prototype.js View 1 1 chunk +191 lines, -0 lines 0 comments Download
A test/mjsunit/array-elements-from-array-prototype-chain.js View 1 chunk +191 lines, -0 lines 0 comments Download
A test/mjsunit/array-elements-from-object-prototype.js View 1 1 chunk +191 lines, -0 lines 0 comments Download
M test/mjsunit/fuzz-natives.js View 1 1 chunk +4 lines, -1 line 0 comments Download
M test/mjsunit/undeletable-functions.js View 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
antonm
Mads, Søren, may you have a look? Checking absence of this element incurs slight perf ...
10 years, 10 months ago (2010-02-19 18:04:59 UTC) #1
Søren Thygesen Gjesse
Sorry for the late review. http://codereview.chromium.org/650043/diff/1/3 File src/builtins.cc (right): http://codereview.chromium.org/650043/diff/1/3#newcode390 src/builtins.cc:390: static bool ArrayPrototypeHasNoElements() { ...
10 years, 10 months ago (2010-02-24 21:48:59 UTC) #2
antonm
10 years, 10 months ago (2010-02-25 15:39:38 UTC) #3
Søren,

thanks a lot for first round of comments.

http://codereview.chromium.org/650043/diff/1/3
File src/builtins.cc (right):

http://codereview.chromium.org/650043/diff/1/3#newcode390
src/builtins.cc:390: static bool ArrayPrototypeHasNoElements() {
On 2010/02/24 21:48:59, Søren Gjesse wrote:
> Are these checks enough? I think you can introduce elements higher up the
chain
> like this:
> 
>   Array.prototype.__proto__ = {a:1}
>   Array.prototype.__proto__.__proto__ = {"1":2}
>   a = new Array()
> 
> a[1] is now 2. Are there any constraints that the array operations will only
> look one step up the chain, or am I missing something here?

I hope the checks are enough (I added another test though).  The
idea---ArrayPrototypeHasNoElements() checks the whole prototype chain (see
IsNull check at the very end).  One catch: if one would manage to setup an
object with indexed interceptor getter, that might be a problem.

Alas, new check makes it slower somewhat.  I have an idea how to speed up this
check, but even this slower variant is still worth committing.

> Do we have a test on the non-writability of Object and Array prototype fields?

I didn't find immediately, but added one.  Is there a better place?  I'll add
another for Object and probably other types as well if overall approach is fine.

http://codereview.chromium.org/650043/diff/1/3#newcode464
src/builtins.cc:464: // TODO(antonm): try to shift/copy RSet bits when
moving/copying.
On 2010/02/24 21:48:59, Søren Gjesse wrote:
> Please open an issue and change this TODO to TODO(issue).

Just removed.  I'm working on it, so won't forget about it.

http://codereview.chromium.org/650043/diff/1/5
File src/objects.h (right):

http://codereview.chromium.org/650043/diff/1/5#newcode1629
src/objects.h:1629: // Gives access to raw memory which stores array's data.
On 2010/02/24 21:48:59, Søren Gjesse wrote:
> array's -> the array's

Done.

http://codereview.chromium.org/650043/diff/1/8
File test/mjsunit/array-elements-from-array-prototype.js (right):

http://codereview.chromium.org/650043/diff/1/8#newcode31
test/mjsunit/array-elements-from-array-prototype.js:31: // If add any new tests
here, consider adding them to all four files:
On 2010/02/24 21:48:59, Søren Gjesse wrote:
> four == two?

Ah, yes, I planned to have four (for getters), but ended with two.  Now with
three.  Thanks a lot for spotting this.

http://codereview.chromium.org/650043/diff/1/8#newcode174
test/mjsunit/array-elements-from-array-prototype.js:174: // now owned undefined
resides at 4 and rest is shifted right by one
On 2010/02/24 21:48:59, Søren Gjesse wrote:
> Start comment uppercase and end with period.

Done.

http://codereview.chromium.org/650043/diff/1/9
File test/mjsunit/array-elements-from-object-prototype.js (right):

http://codereview.chromium.org/650043/diff/1/9#newcode29
test/mjsunit/array-elements-from-object-prototype.js:29: // Tests below verify
that elements set on Array.prototype propagate
On 2010/02/24 21:48:59, Søren Gjesse wrote:
> Array -> Object?

Done.

http://codereview.chromium.org/650043/diff/1/9#newcode31
test/mjsunit/array-elements-from-object-prototype.js:31: // If add any new tests
here, consider adding them to all four files:
On 2010/02/24 21:48:59, Søren Gjesse wrote:
> four == two?

Done.

http://codereview.chromium.org/650043/diff/1/9#newcode174
test/mjsunit/array-elements-from-object-prototype.js:174: // now owned undefined
resides at 4 and rest is shifted right by one
On 2010/02/24 21:48:59, Søren Gjesse wrote:
> Start comment uppercase end with period.

Done.

http://codereview.chromium.org/650043/diff/1/10
File test/mjsunit/fuzz-natives.js (right):

http://codereview.chromium.org/650043/diff/1/10#newcode152
test/mjsunit/fuzz-natives.js:152: // That must only be invoked on
Array.prototype.
On 2010/02/24 21:48:59, Søren Gjesse wrote:
> That must -> This can

Done.

Powered by Google App Engine
This is Rietveld 408576698