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

Issue 3144002: Copy-on-write arrays. (Closed)

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

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. Committed: http://code.google.com/p/v8/source/detail?r=5275

Patch Set 1 #

Total comments: 29

Patch Set 2 : Ports and review fixes. #

Total comments: 4

Patch Set 3 : Review fixes. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+523 lines, -200 lines) Patch
M src/arm/codegen-arm.h View 1 chunk +1 line, -1 line 0 comments Download
M src/arm/codegen-arm.cc View 5 chunks +35 lines, -12 lines 0 comments Download
M src/arm/full-codegen-arm.cc View 1 chunk +8 lines, -3 lines 0 comments Download
M src/arm/ic-arm.cc View 7 chunks +32 lines, -18 lines 0 comments Download
M src/arm/macro-assembler-arm.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/arm/macro-assembler-arm.cc View 1 chunk +19 lines, -0 lines 0 comments Download
M src/arm/stub-cache-arm.cc View 2 chunks +0 lines, -10 lines 0 comments Download
M src/builtins.cc View 1 10 chunks +41 lines, -34 lines 0 comments Download
M src/codegen.h View 1 2 chunks +18 lines, -4 lines 0 comments Download
M src/heap.h View 1 1 chunk +1 line, -0 lines 0 comments Download
src/heap.cc View 1 2 chunks +8 lines, -1 line 0 comments Download
M src/ia32/codegen-ia32.cc View 1 6 chunks +36 lines, -17 lines 0 comments Download
M src/ia32/full-codegen-ia32.cc View 1 1 chunk +8 lines, -3 lines 0 comments Download
M src/ia32/ic-ia32.cc View 1 7 chunks +20 lines, -7 lines 0 comments Download
M src/ia32/macro-assembler-ia32.h View 1 chunk +2 lines, -0 lines 0 comments Download
M src/ia32/macro-assembler-ia32.cc View 1 1 chunk +15 lines, -0 lines 0 comments Download
M src/ia32/stub-cache-ia32.cc View 1 3 chunks +8 lines, -7 lines 0 comments Download
M src/objects.h View 1 2 6 chunks +26 lines, -4 lines 0 comments Download
M src/objects.cc View 1 2 7 chunks +15 lines, -3 lines 0 comments Download
M src/objects-debug.cc View 1 chunk +2 lines, -1 line 0 comments Download
M src/objects-inl.h View 1 2 12 chunks +45 lines, -8 lines 0 comments Download
M src/parser.h View 1 chunk +2 lines, -0 lines 0 comments Download
M src/parser.cc View 1 2 chunks +19 lines, -0 lines 0 comments Download
M src/runtime.cc View 1 5 chunks +50 lines, -21 lines 0 comments Download
M src/serialize.h View 1 1 chunk +2 lines, -1 line 0 comments Download
M src/v8-counters.h View 1 2 chunks +5 lines, -0 lines 0 comments Download
M src/x64/codegen-x64.cc View 6 chunks +37 lines, -17 lines 0 comments Download
M src/x64/full-codegen-x64.cc View 1 chunk +8 lines, -3 lines 0 comments Download
M src/x64/ic-x64.cc View 7 chunks +22 lines, -9 lines 0 comments Download
M src/x64/macro-assembler-x64.h View 1 chunk +2 lines, -0 lines 0 comments Download
M src/x64/macro-assembler-x64.cc View 1 chunk +15 lines, -0 lines 0 comments Download
M src/x64/stub-cache-x64.cc View 7 chunks +20 lines, -16 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
Vitaly Repeshko
10 years, 4 months ago (2010-08-10 15:52:57 UTC) #1
Mads Ager (chromium)
LGTM! http://codereview.chromium.org/3144002/diff/1/8 File src/ia32/ic-ia32.cc (right): http://codereview.chromium.org/3144002/diff/1/8#newcode454 src/ia32/ic-ia32.cc:454: // Loads an indexed element from a fast ...
10 years, 4 months ago (2010-08-11 10:42:31 UTC) #2
antonm
LGTM. Do we believe current test coverage is enough? Maybe throw in some more tests? ...
10 years, 4 months ago (2010-08-11 11:28:22 UTC) #3
antonm
http://codereview.chromium.org/3144002/diff/1/2 File src/builtins.cc (right): http://codereview.chromium.org/3144002/diff/1/2#newcode357 src/builtins.cc:357: return array->EnsureWritableFastElements(); just as an idea for speed up: ...
10 years, 4 months ago (2010-08-11 12:39:38 UTC) #4
Vitaly Repeshko
All issues addressed. Ported to x64 and arm. Also fixed a bug in generic keyed ...
10 years, 4 months ago (2010-08-13 14:14:00 UTC) #5
Vyacheslav Egorov (Chromium)
I was driving by on my fancy markbits-mobile :-) http://codereview.chromium.org/3144002/diff/1/13 File src/objects-inl.h (right): http://codereview.chromium.org/3144002/diff/1/13#newcode1401 src/objects-inl.h:1401: ...
10 years, 4 months ago (2010-08-13 16:15:08 UTC) #6
antonm
http://codereview.chromium.org/3144002/diff/4002/13004 File src/arm/ic-arm.cc (right): http://codereview.chromium.org/3144002/diff/4002/13004#newcode1143 src/arm/ic-arm.cc:1143: __ ldr(r4, FieldMemOperand(r1, JSObject::kElementsOffset)); Do we need to load ...
10 years, 4 months ago (2010-08-13 16:50:47 UTC) #7
Vitaly Repeshko
All done. Please take yet another look. Thanks, Vitaly http://codereview.chromium.org/3144002/diff/1/13 File src/objects-inl.h (right): http://codereview.chromium.org/3144002/diff/1/13#newcode1401 src/objects-inl.h:1401: ...
10 years, 4 months ago (2010-08-16 12:35:02 UTC) #8
Mads Ager (chromium)
10 years, 4 months ago (2010-08-16 13:38:04 UTC) #9
LGTM

Powered by Google App Engine
This is Rietveld 408576698