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

Issue 10103035: Share optimized code for closures. (Closed)

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

Description

Share optimized code for closures. Each SharedFunctionInfo gets an optimized code map to store one optimized code object per context. When allocating a new closure we consult this map and check if there is optimized code that can be shared. This patch is based on an original patch by Anton Muhin (http://codereview.chromium.org/6793013/). BUG=v8:2087, v8:2094 TEST=test/mjsunit/compiler/optimized-closures.js Committed: https://code.google.com/p/v8/source/detail?r=11817

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : rebased on r11394 #

Total comments: 3

Patch Set 4 : Added sharing of literals array #

Patch Set 5 : added x64 and ARM ports #

Total comments: 26

Patch Set 6 : addressed comments #

Total comments: 6

Patch Set 7 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+665 lines, -90 lines) Patch
M src/arm/code-stubs-arm.cc View 1 2 3 4 5 6 5 chunks +89 lines, -6 lines 0 comments Download
M src/arm/deoptimizer-arm.cc View 1 2 3 4 5 6 5 chunks +31 lines, -8 lines 0 comments Download
M src/arm/lithium-codegen-arm.cc View 1 2 3 4 5 6 2 chunks +5 lines, -2 lines 0 comments Download
M src/compiler.cc View 1 2 3 4 5 6 2 chunks +39 lines, -0 lines 0 comments Download
M src/deoptimizer.h View 1 2 3 4 5 6 1 chunk +3 lines, -0 lines 0 comments Download
M src/factory.cc View 1 2 3 4 5 6 1 chunk +35 lines, -9 lines 0 comments Download
M src/flag-definitions.h View 1 2 3 4 5 6 1 chunk +5 lines, -0 lines 0 comments Download
M src/frames.h View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M src/frames.cc View 1 2 3 4 5 6 4 chunks +14 lines, -6 lines 0 comments Download
M src/heap.cc View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M src/hydrogen.h View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M src/hydrogen.cc View 1 2 3 4 5 6 1 chunk +15 lines, -3 lines 0 comments Download
M src/hydrogen-instructions.h View 1 2 3 4 5 6 2 chunks +2 lines, -10 lines 0 comments Download
M src/ia32/code-stubs-ia32.cc View 1 2 3 4 5 6 5 chunks +81 lines, -4 lines 0 comments Download
M src/ia32/deoptimizer-ia32.cc View 1 2 3 4 5 6 5 chunks +32 lines, -9 lines 0 comments Download
M src/ia32/lithium-codegen-ia32.cc View 1 2 3 4 5 6 2 chunks +4 lines, -2 lines 0 comments Download
M src/mark-compact.cc View 1 2 3 4 5 6 3 chunks +4 lines, -6 lines 0 comments Download
M src/objects.h View 1 2 3 4 5 6 3 chunks +25 lines, -1 line 0 comments Download
M src/objects.cc View 1 2 3 4 5 6 3 chunks +70 lines, -3 lines 0 comments Download
M src/objects-debug.cc View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M src/objects-inl.h View 1 2 3 4 5 6 2 chunks +13 lines, -0 lines 0 comments Download
M src/runtime.cc View 1 2 3 4 5 6 1 chunk +3 lines, -0 lines 0 comments Download
M src/runtime-profiler.cc View 1 2 3 4 5 6 1 chunk +4 lines, -1 line 0 comments Download
M src/v8-counters.h View 1 2 3 4 5 6 2 chunks +3 lines, -4 lines 0 comments Download
M src/x64/code-stubs-x64.cc View 1 2 3 4 5 6 3 chunks +88 lines, -5 lines 0 comments Download
M src/x64/deoptimizer-x64.cc View 1 2 3 4 5 6 5 chunks +32 lines, -9 lines 0 comments Download
M src/x64/lithium-codegen-x64.cc View 1 2 3 4 5 6 2 chunks +5 lines, -2 lines 0 comments Download
A test/mjsunit/compiler/optimized-closures.js View 1 2 3 4 1 chunk +57 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
fschneider
ia32 only. Still missing the sharing for the literals array. http://codereview.chromium.org/10103035/diff/10006/src/factory.cc File src/factory.cc (right): http://codereview.chromium.org/10103035/diff/10006/src/factory.cc#newcode563 ...
8 years, 8 months ago (2012-04-20 14:05:43 UTC) #1
fschneider
New ia32 patch uploaded. I'll port to the other platforms when this looks good according ...
8 years, 7 months ago (2012-05-09 08:55:00 UTC) #2
fschneider
Ping?
8 years, 7 months ago (2012-05-16 16:56:42 UTC) #3
Michael Starzinger
First round. Sorry for the long delay, the CL fell through the cracks. https://chromiumcodereview.appspot.com/10103035/diff/23027/src/compiler.cc File ...
8 years, 7 months ago (2012-05-23 11:16:28 UTC) #4
fschneider
http://codereview.chromium.org/10103035/diff/23027/src/compiler.cc File src/compiler.cc (right): http://codereview.chromium.org/10103035/diff/23027/src/compiler.cc#newcode603 src/compiler.cc:603: static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, On 2012/05/23 11:16:29, Michael Starzinger ...
8 years, 6 months ago (2012-06-14 11:08:23 UTC) #5
Michael Starzinger
LGTM (if one comment and one nit is addressed). https://chromiumcodereview.appspot.com/10103035/diff/38005/src/factory.cc File src/factory.cc (right): https://chromiumcodereview.appspot.com/10103035/diff/38005/src/factory.cc#newcode555 src/factory.cc:555: ...
8 years, 6 months ago (2012-06-14 13:51:31 UTC) #6
Florian Schneider
8 years, 6 months ago (2012-06-14 14:02:41 UTC) #7
Thanks for the review. Landing.

https://chromiumcodereview.appspot.com/10103035/diff/38005/src/factory.cc
File src/factory.cc (right):

https://chromiumcodereview.appspot.com/10103035/diff/38005/src/factory.cc#new...
src/factory.cc:555: ?
function_info->SearchOptimizedCodeMap(context->global_context())
On 2012/06/14 13:51:32, Michael Starzinger wrote:
> We need to do this search anyways, even if the function is bound, so let's
hoist
> the search out to do it only once.

Good point. Done.

https://chromiumcodereview.appspot.com/10103035/diff/38005/src/factory.cc#new...
src/factory.cc:583:
function_info->SearchOptimizedCodeMap(context->global_context());
On 2012/06/14 13:51:32, Michael Starzinger wrote:
> Drop this search and the outer flag check.

Done.

https://chromiumcodereview.appspot.com/10103035/diff/38005/src/objects.cc
File src/objects.cc (right):

https://chromiumcodereview.appspot.com/10103035/diff/38005/src/objects.cc#new...
src/objects.cc:7583: set_optimized_code_map(Smi::FromInt(0));
On 2012/06/14 13:51:32, Michael Starzinger wrote:
> It would simplify the runtime code if we would initialize this with the empty
> fixed array. The FastNewClosureStub however would need to compare against a
root
> pointer instead of doing a Smi(0) check. I am not sure how much slower the
> pointer comparison will be.

I'll leave it as is for now. I assume it should not make a big difference in
terms of performance, but I'd like to confirm that before changing it.

Powered by Google App Engine
This is Rietveld 408576698