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

Issue 9536020: Work around buggy break in List.sort and optimize constant folding of negative values. (Closed)

Created:
8 years, 9 months ago by ahe
Modified:
8 years, 9 months ago
Reviewers:
floitsch, ngeoffray, kasperl
CC:
reviews_dartlang.org, Lasse Reichstein Nielsen, karlklose, ngeoffray
Visibility:
Public.

Description

Work around buggy break in List.sort and optimize constant folding of negative values. Committed: https://code.google.com/p/dart/source/detail?r=4779

Patch Set 1 #

Total comments: 6

Patch Set 2 : Add TODO for Kasperl #

Unified diffs Side-by-side diffs Delta from patch set Stats (+22 lines, -21 lines) Patch
M dart/frog/leg/lib/dual_pivot_quicksort.dart View 6 chunks +12 lines, -9 lines 0 comments Download
M dart/frog/leg/ssa/builder.dart View 1 1 chunk +10 lines, -1 line 0 comments Download
M dart/tests/co19/co19-leg.status View 1 chunk +0 lines, -9 lines 0 comments Download
M dart/tests/corelib/corelib-leg.status View 1 chunk +0 lines, -2 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
ahe
8 years, 9 months ago (2012-02-29 19:15:34 UTC) #1
floitsch
LGTM.
8 years, 9 months ago (2012-02-29 20:28:10 UTC) #2
ngeoffray
DBC https://chromiumcodereview.appspot.com/9536020/diff/1/dart/frog/leg/ssa/builder.dart File dart/frog/leg/ssa/builder.dart (right): https://chromiumcodereview.appspot.com/9536020/diff/1/dart/frog/leg/ssa/builder.dart#newcode1309 dart/frog/leg/ssa/builder.dart:1309: stack.add(graph.addNewLiteralInt(-operand.value)); Why is that not done in the ...
8 years, 9 months ago (2012-02-29 20:36:26 UTC) #3
ahe
Hi Florian and Nicolas, Thank you for taking a look. Cheers, Peter https://chromiumcodereview.appspot.com/9536020/diff/1/dart/frog/leg/ssa/builder.dart File dart/frog/leg/ssa/builder.dart ...
8 years, 9 months ago (2012-02-29 20:41:24 UTC) #4
kasperl
LGTM but: https://chromiumcodereview.appspot.com/9536020/diff/1/dart/frog/leg/ssa/builder.dart File dart/frog/leg/ssa/builder.dart (right): https://chromiumcodereview.appspot.com/9536020/diff/1/dart/frog/leg/ssa/builder.dart#newcode1305 dart/frog/leg/ssa/builder.dart:1305: case "-": This could possible be dealt ...
8 years, 9 months ago (2012-03-01 06:13:00 UTC) #5
ahe
Hi Kasper, Thank you for taking a look. I have added a TODO for you. ...
8 years, 9 months ago (2012-03-01 06:54:15 UTC) #6
ngeoffray
https://chromiumcodereview.appspot.com/9536020/diff/1/dart/frog/leg/ssa/builder.dart File dart/frog/leg/ssa/builder.dart (right): https://chromiumcodereview.appspot.com/9536020/diff/1/dart/frog/leg/ssa/builder.dart#newcode1309 dart/frog/leg/ssa/builder.dart:1309: stack.add(graph.addNewLiteralInt(-operand.value)); On 2012/02/29 20:41:24, ahe wrote: > On 2012/02/29 ...
8 years, 9 months ago (2012-03-01 08:15:51 UTC) #7
floitsch
8 years, 9 months ago (2012-03-01 10:32:18 UTC) #8
https://chromiumcodereview.appspot.com/9536020/diff/1/dart/frog/leg/ssa/build...
File dart/frog/leg/ssa/builder.dart (right):

https://chromiumcodereview.appspot.com/9536020/diff/1/dart/frog/leg/ssa/build...
dart/frog/leg/ssa/builder.dart:1309:
stack.add(graph.addNewLiteralInt(-operand.value));
On 2012/03/01 08:15:51, ngeoffray wrote:
> On 2012/02/29 20:41:24, ahe wrote:
> > On 2012/02/29 20:36:26, ngeoffray wrote:
> > > Why is that not done in the constant folder instead?
> > 
> > Because it is really slow at doing it.
> 
> Why is that?

The problem is not really the constant folding, but then replacing the
instruction with the folded one.
Currently we know in which instruction we are used, but not exactly at which
position. For arrays, which have hundreds of inputs, finding the old instruction
to replace it with the new folded one, boils down to doing a linear search.
The worst case is basically an array like: [-1, -2, -3....].
Then each input is replaced and searched for in a linear way yielding n^2
behavior.
This CL is a short-term fix, but we (kasper and I) have discussed better ways to
replace it.

Powered by Google App Engine
This is Rietveld 408576698