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

Issue 220163012: Inline loading of immutable properties (Closed)

Created:
6 years, 8 months ago by p.antonov
Modified:
6 years, 8 months ago
Reviewers:
Toon Verwaest
CC:
v8-dev
Base URL:
https://github.com/v8/v8.git@master
Visibility:
Public.

Description

Inline loading of immutable properties Adds detection for property loads that are immutable (non-configurable and non-writable) and inlines them where possible. BUG= R=verwaest@chromium.org

Patch Set 1 #

Total comments: 3

Patch Set 2 : Fix issues with patch set 1 #

Patch Set 3 : Support loads from prototypes as well #

Unified diffs Side-by-side diffs Delta from patch set Stats (+84 lines, -50 lines) Patch
M src/hydrogen.h View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M src/hydrogen.cc View 1 2 2 chunks +39 lines, -0 lines 0 comments Download
A + test/mjsunit/compiler/immutable-load-inline.js View 1 2 1 chunk +41 lines, -50 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
p.antonov
Using a simpler and more generic approach in inlining immutable properties like Math.PI. PTAL.
6 years, 8 months ago (2014-04-02 13:12:37 UTC) #1
Toon Verwaest
Much cleaner! Could you move the code to BuildNamedAccess though? That's the single bottleneck where ...
6 years, 8 months ago (2014-04-02 14:51:46 UTC) #2
p.antonov
https://codereview.chromium.org/220163012/diff/1/src/hydrogen.cc File src/hydrogen.cc (right): https://codereview.chromium.org/220163012/diff/1/src/hydrogen.cc#newcode6736 src/hydrogen.cc:6736: !value->IsCallable()) { On 2014/04/02 14:51:47, Toon Verwaest wrote: > ...
6 years, 8 months ago (2014-04-02 15:53:58 UTC) #3
p.antonov
I moved the code which turned out to be handy in fixing the callable issue ...
6 years, 8 months ago (2014-04-03 09:35:31 UTC) #4
Toon Verwaest
That sounds reasonable. On second thought, please move all of this code to BuildLoadNamedField. The ...
6 years, 8 months ago (2014-04-03 11:42:34 UTC) #5
p.antonov
On 2014/04/03 11:42:34, Toon Verwaest wrote: > That sounds reasonable. > > On second thought, ...
6 years, 8 months ago (2014-04-03 12:26:07 UTC) #6
Toon Verwaest
Yes it does. But why do you limit it to just that case? Why not ...
6 years, 8 months ago (2014-04-03 15:41:59 UTC) #7
p.antonov
On 2014/04/03 15:41:59, Toon Verwaest wrote: > Yes it does. But why do you limit ...
6 years, 8 months ago (2014-04-03 16:02:05 UTC) #8
Toon Verwaest
Yes you are right, the HCheckMaps is unnecessary in the case it's directly on the ...
6 years, 8 months ago (2014-04-03 16:14:34 UTC) #9
p.antonov
I added support from loading from prototypes which works even if the object is not ...
6 years, 8 months ago (2014-04-04 13:23:09 UTC) #10
Toon Verwaest
6 years, 8 months ago (2014-04-08 11:50:28 UTC) #11
So I think this is going in the right direction. However, this should be split
into 3 patches. There are three independent optimizations at hand.

1) Inlining a constant when the holder (either receiver or a prototype up the
chain of the receiver) is an HConstant and the property is read-only
non-configurable, and
2) omitting the map-check for the holder if the holder is an HConstant and we're
emitting a map-check only as guard for a property load of a read-only,
non-configurable property.
3) What you suggested regarding the types in VisitCall: if the receiver is an
HConstant, we should adjust the types list accordingly.

Lets make 1) this patch, and figure out 2) in a separate patch; and land 3)
first to make sure that we don't have problems in 1).

My suggestions for the patches:

1) Move the code inlining the HConstant into BuildLoadNamedField if
checked_object->ActualValue()->IsConstant().

2) Don't delete nodes in place! Instead delay adding checks until they are
necessary:
- if the action is a load, delay the receiver mapcheck in BuildNamedAccess.
- in BuildMonomorphicAccess, add that map-check of the receiver if
info->has_holder(), but don't emit the map-check of the holder.
- in BuildLoadNamedField, emit the map-check of the incoming holder if the
holder is either not an HConstant (hence it's the receiver which is not an
HConstant), or the property is not read-only / non-configurable.

3) Update ComputeReceiverTypes to handle the case where receiver->IsConstant().
That could should either trim down the receiver maps to a transition from the
constant's map; or just add the constant's map as expected receiver type.

Does that sound reasonable?

Regards,
Toon

Powered by Google App Engine
This is Rietveld 408576698