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

Issue 159783002: Re-optimize faster after making a pretenuring decision.

Created:
6 years, 10 months ago by Hannes Payer (out of office)
Modified:
4 years, 11 months ago
CC:
v8-dev
Visibility:
Public.

Description

Re-optimize faster after making a pretenuring decision. BUG=

Patch Set 1 #

Total comments: 6

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : #

Total comments: 6

Patch Set 7 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+126 lines, -63 lines) Patch
M src/compiler.h View 1 1 chunk +2 lines, -0 lines 0 comments Download
M src/compiler.cc View 1 1 chunk +37 lines, -0 lines 0 comments Download
M src/deoptimizer.cc View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M src/objects.h View 1 2 3 5 chunks +18 lines, -3 lines 0 comments Download
M src/objects.cc View 1 2 3 4 5 6 3 chunks +22 lines, -1 line 0 comments Download
M src/objects-inl.h View 1 2 1 chunk +15 lines, -0 lines 0 comments Download
M src/runtime-profiler.h View 1 1 chunk +0 lines, -2 lines 0 comments Download
M src/runtime-profiler.cc View 1 3 chunks +4 lines, -57 lines 0 comments Download
M test/cctest/test-deoptimization.cc View 1 2 3 4 5 1 chunk +24 lines, -0 lines 0 comments Download

Messages

Total messages: 10 (2 generated)
Hannes Payer (out of office)
6 years, 10 months ago (2014-02-11 14:19:58 UTC) #1
mvstanton
I think it looks pretty good, can you add a cctest that illustrates the "fast ...
6 years, 10 months ago (2014-02-18 09:13:05 UTC) #2
titzer
https://codereview.chromium.org/159783002/diff/1/src/objects.cc File src/objects.cc (right): https://codereview.chromium.org/159783002/diff/1/src/objects.cc#newcode9910 src/objects.cc:9910: void JSFunction::Optimize(const char* reason) { Looks like you copied ...
6 years, 10 months ago (2014-02-18 09:24:47 UTC) #3
Hannes Payer (out of office)
https://codereview.chromium.org/159783002/diff/1/src/objects.cc File src/objects.cc (right): https://codereview.chromium.org/159783002/diff/1/src/objects.cc#newcode9910 src/objects.cc:9910: void JSFunction::Optimize(const char* reason) { On 2014/02/18 09:24:48, titzer ...
6 years, 7 months ago (2014-05-12 09:37:07 UTC) #4
Hannes Payer (out of office)
Hi Michael, I just added a simple test case.
6 years, 7 months ago (2014-05-12 11:48:07 UTC) #5
mvstanton
Thx for test case, lgtm.
6 years, 7 months ago (2014-05-12 11:50:12 UTC) #6
titzer
https://codereview.chromium.org/159783002/diff/200001/src/deoptimizer.cc File src/deoptimizer.cc (right): https://codereview.chromium.org/159783002/diff/200001/src/deoptimizer.cc#newcode326 src/deoptimizer.cc:326: if (code->marked_for_instant_optimization()) { This isn't the right place for ...
6 years, 7 months ago (2014-05-12 12:05:24 UTC) #7
Hannes Payer (out of office)
6 years, 7 months ago (2014-05-12 16:31:19 UTC) #8
I am not sure if we can get what you are asking for without adding a mapping
from Code to JSFunction.

https://codereview.chromium.org/159783002/diff/200001/src/deoptimizer.cc
File src/deoptimizer.cc (right):

https://codereview.chromium.org/159783002/diff/200001/src/deoptimizer.cc#newc...
src/deoptimizer.cc:326: if (code->marked_for_instant_optimization()) {
On 2014/05/12 12:05:24, titzer wrote:
> This isn't the right place for this somehow. It's surprising that
> DeoptimizeMarkedCode actually calls the compiler.

Not sure, it seems like the right place to express "deoptimize and re-optimize
immediately semantics". And since we just have the code object at gc time which
we can mark for deoptimization and re-optimization, it seems to be fine.

https://codereview.chromium.org/159783002/diff/200001/src/objects.cc
File src/objects.cc (right):

https://codereview.chromium.org/159783002/diff/200001/src/objects.cc#newcode1...
src/objects.cc:12352: if (instant_optimization)
code->set_marked_for_deoptimization(true);
On 2014/05/12 12:05:24, titzer wrote:
> You're setting the wrong thing here, I think. Why don't you collect the
> functions you want to reoptimize here, and then do a loop over them to compile
> them? Then you don't need extra machinery in the deoptimizer.

Done, that was a renaming mistake.

https://codereview.chromium.org/159783002/diff/200001/src/objects.h
File src/objects.h (right):

https://codereview.chromium.org/159783002/diff/200001/src/objects.h#newcode5730
src/objects.h:5730: static const int kMarkedForInstantOptimizationBitCount = 1;
On 2014/05/12 12:05:24, titzer wrote:
> This bit is just carrying stuff through the deoptimizer, to a place that I
don't
> think it belongs. I think you want to gather the list of functions to
reoptimize
> outside of the deoptimization infrastructure and then process them there.

This is problematic on so many levels:
1) For allocation sites when we set the stack guard for deoptimization at gc
time we just have the dependent code i.e. the code objects. There is no mapping
from code to JSFunction (and friends). Getting the JSFunction would require us
to go over all  JSFunctions and find the given code objects.
2) If we have that, we could just mark the JSFunction for optimization. One
problem with that approach is that an active activation on the stack would never
get replaced.
3) If we want a list of functions, this list would have to be weak. I do not
want to add another weak list.

WDYT?

Powered by Google App Engine
This is Rietveld 408576698