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

Issue 6240012: Optimize calls to object literal properties that are initialized with a funct... (Closed)

Created:
9 years, 11 months ago by fschneider
Modified:
9 years, 6 months ago
CC:
v8-dev
Visibility:
Public.

Description

Optimize calls to object literal properties that are initialized with a function literal. This allows fast calls and inlining of functions like: var o = {f: function() { return "foo"; }} o.f(); Object literals that contain function literals are initially created a dictionary mode object and only transformed to fast properties once all properties are computed and added. This allows us to create constant function properties for functions declared inside the object literal. Function literals inside object literals are marked for pretenuring so that they work as contant function properties. Object literals without functions should just function as before. Committed: http://code.google.com/p/v8/source/detail?r=7283

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 8

Patch Set 3 : '' #

Patch Set 4 : added x64 and arm code. #

Total comments: 2

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Patch Set 8 : rebased and fixed lintos #

Unified diffs Side-by-side diffs Delta from patch set Stats (+280 lines, -119 lines) Patch
M src/arm/full-codegen-arm.cc View 1 2 3 4 5 6 2 chunks +14 lines, -1 line 0 comments Download
M src/arm/lithium-arm.h View 1 2 3 4 5 6 2 chunks +12 lines, -0 lines 0 comments Download
M src/arm/lithium-arm.cc View 1 2 3 4 5 6 1 chunk +7 lines, -0 lines 0 comments Download
M src/arm/lithium-codegen-arm.cc View 1 2 3 4 5 6 1 chunk +7 lines, -0 lines 0 comments Download
M src/ast.h View 1 2 3 4 5 6 2 chunks +12 lines, -2 lines 0 comments Download
M src/handles.h View 1 2 3 4 5 6 1 chunk +0 lines, -19 lines 0 comments Download
M src/handles.cc View 1 2 3 4 5 6 1 chunk +0 lines, -30 lines 0 comments Download
M src/hydrogen.cc View 1 2 3 4 5 6 2 chunks +15 lines, -2 lines 0 comments Download
M src/hydrogen-instructions.h View 1 2 3 4 5 6 7 5 chunks +25 lines, -2 lines 0 comments Download
M src/ia32/full-codegen-ia32.cc View 1 2 3 4 5 6 2 chunks +13 lines, -1 line 0 comments Download
M src/ia32/lithium-codegen-ia32.cc View 1 2 3 4 5 6 2 chunks +14 lines, -1 line 0 comments Download
M src/ia32/lithium-ia32.h View 1 2 3 4 5 6 2 chunks +12 lines, -0 lines 0 comments Download
M src/ia32/lithium-ia32.cc View 1 2 3 4 5 6 1 chunk +7 lines, -0 lines 0 comments Download
M src/parser.cc View 1 2 3 4 5 6 3 chunks +10 lines, -1 line 0 comments Download
M src/runtime.cc View 1 2 3 4 5 6 7 8 chunks +93 lines, -59 lines 0 comments Download
M src/x64/full-codegen-x64.cc View 1 2 3 4 5 6 2 chunks +13 lines, -1 line 0 comments Download
M src/x64/lithium-codegen-x64.cc View 1 2 3 4 5 6 1 chunk +7 lines, -0 lines 0 comments Download
M src/x64/lithium-x64.h View 1 2 3 4 5 6 2 chunks +12 lines, -0 lines 0 comments Download
M src/x64/lithium-x64.cc View 1 2 3 4 5 6 1 chunk +7 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
fschneider
This is a proposal to speed up calls to functions defined as object literal properties.
9 years, 11 months ago (2011-01-27 11:29:14 UTC) #1
Mads Ager (chromium)
Let's keep iteration order in this case. Can we make the construction of the fast-case ...
9 years, 11 months ago (2011-01-27 14:12:17 UTC) #2
fschneider
Uploaded a new version. It preserves the order of properties and should not affect object ...
9 years, 10 months ago (2011-02-01 13:31:20 UTC) #3
Mads Ager (chromium)
A couple of comments. Also, you should modify x64 and arm as well. http://codereview.chromium.org/6240012/diff/6001/src/handles.cc File ...
9 years, 10 months ago (2011-02-01 13:50:59 UTC) #4
fschneider
Addressed comments. I added a new HIR/LIR instruction to enable the same optimization in optimized ...
9 years, 10 months ago (2011-02-02 10:18:38 UTC) #5
fschneider
added arm and x64 ports.
9 years, 10 months ago (2011-02-02 12:49:39 UTC) #6
Mads Ager (chromium)
Almost there. One question below. http://codereview.chromium.org/6240012/diff/6004/src/hydrogen-instructions.h File src/hydrogen-instructions.h (right): http://codereview.chromium.org/6240012/diff/6004/src/hydrogen-instructions.h#newcode3085 src/hydrogen-instructions.h:3085: class HToFastProperties: public HUnaryOperation ...
9 years, 10 months ago (2011-02-02 13:07:52 UTC) #7
fschneider
I also fixed the use of the pretenure-flags on function literals in the lithium codegen. ...
9 years, 10 months ago (2011-02-02 14:23:32 UTC) #8
Mads Ager (chromium)
9 years, 10 months ago (2011-02-02 14:29:05 UTC) #9
LGTM

Good catch on the pretenuring!

Kevin, if you have cycles it might be good if you double check the safety of not
marking the 'to fast properties' instruction as changing maps.

Powered by Google App Engine
This is Rietveld 408576698