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

Issue 1668913002: dart2js cps: More aggressive operator specialization. (Closed)

Created:
4 years, 10 months ago by asgerf
Modified:
4 years, 10 months ago
CC:
reviews_dartlang.org
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

dart2js cps: More aggressive operator specialization. Inline more unsafe operator calls, and insert more checks accordingly. When "num" is the only receiver that does not respond with NSM, insert a check and use the builtin operator. Previously we only did this when the receiver was a number or null. For example: if (typeof x !== "number") return x.$lt(); result = x < 4; When the argument might have the wrong type, insert an argument check and use the builtin operator. Previously we never did this if the argument might have the wrong type. For example: if (typeof x !== "number") return H.iae(x); result = 4 < x; If both receiver and argument need checks, we join the two checks and use a one-shot interceptor to throw the error: if (typeof x !== "number" || typeof y !== "number") return J.$lt(x, y); result = x < y; NullCheck has been generalized to a ReceiverCheck instruction to support "x.$lt()" above, that throws even if x is a non-null value. BUG= R=sigmund@google.com Committed: https://github.com/dart-lang/sdk/commit/bbca76a5e2df6c5adf0ee9327f3a7af21fb1c19a

Patch Set 1 #

Total comments: 14

Patch Set 2 : Address comments #

Patch Set 3 : Fix elimination of receiver check #

Patch Set 4 : Update test expectations #

Unified diffs Side-by-side diffs Delta from patch set Stats (+494 lines, -175 lines) Patch
M pkg/compiler/lib/src/cps_ir/backward_null_check_remover.dart View 3 chunks +4 lines, -4 lines 0 comments Download
M pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart View 1 8 chunks +100 lines, -38 lines 0 comments Download
M pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart View 1 chunk +3 lines, -2 lines 0 comments Download
M pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart View 2 chunks +4 lines, -3 lines 0 comments Download
M pkg/compiler/lib/src/cps_ir/gvn.dart View 1 chunk +1 line, -1 line 0 comments Download
M pkg/compiler/lib/src/cps_ir/inline.dart View 4 chunks +28 lines, -5 lines 0 comments Download
M pkg/compiler/lib/src/cps_ir/redundant_join.dart View 1 chunk +1 line, -1 line 0 comments Download
M pkg/compiler/lib/src/cps_ir/type_propagation.dart View 1 2 15 chunks +230 lines, -62 lines 0 comments Download
M pkg/compiler/lib/src/cps_ir/update_refinements.dart View 3 chunks +8 lines, -5 lines 0 comments Download
M pkg/compiler/lib/src/js_backend/codegen/codegen.dart View 2 chunks +5 lines, -2 lines 0 comments Download
M pkg/compiler/lib/src/tree_ir/optimization/pull_into_initializers.dart View 1 chunk +1 line, -1 line 0 comments Download
M pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart View 1 chunk +1 line, -1 line 0 comments Download
M pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart View 1 chunk +6 lines, -2 lines 0 comments Download
M pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart View 5 chunks +10 lines, -9 lines 0 comments Download
M pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart View 2 chunks +2 lines, -2 lines 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_1.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_10.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_11.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_12.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_13.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_19.js View 1 2 3 1 chunk +5 lines, -5 lines 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_2.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_20.js View 1 2 3 1 chunk +5 lines, -5 lines 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_21.js View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_7.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_8.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_9.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_num_1.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_num_10.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_num_11.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_num_12.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_num_13.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_num_2.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_num_7.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_num_8.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/argument_refinement_num_9.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/operators2_6.js View 1 2 3 1 chunk +5 lines, -2 lines 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/operators2_7.js View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/expected/operators2_8.js View 1 2 3 1 chunk +5 lines, -2 lines 0 comments Download
M tests/compiler/dart2js/cps_ir/input/operators2_6.dart View 1 2 3 1 chunk +4 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/input/operators2_7.dart View 1 2 3 1 chunk +4 lines, -1 line 0 comments Download
M tests/compiler/dart2js/cps_ir/input/operators2_8.dart View 1 2 3 1 chunk +4 lines, -1 line 0 comments Download

Messages

Total messages: 6 (2 generated)
asgerf
4 years, 10 months ago (2016-02-05 09:32:44 UTC) #2
Siggi Cherem (dart-lang)
lgtm! https://codereview.chromium.org/1668913002/diff/1/pkg/compiler/lib/src/cps_ir/backward_null_check_remover.dart File pkg/compiler/lib/src/cps_ir/backward_null_check_remover.dart (right): https://codereview.chromium.org/1668913002/diff/1/pkg/compiler/lib/src/cps_ir/backward_null_check_remover.dart#newcode26 pkg/compiler/lib/src/cps_ir/backward_null_check_remover.dart:26: /// Note that code motion may not occur ...
4 years, 10 months ago (2016-02-05 18:19:40 UTC) #3
asgerf
https://codereview.chromium.org/1668913002/diff/1/pkg/compiler/lib/src/cps_ir/backward_null_check_remover.dart File pkg/compiler/lib/src/cps_ir/backward_null_check_remover.dart (right): https://codereview.chromium.org/1668913002/diff/1/pkg/compiler/lib/src/cps_ir/backward_null_check_remover.dart#newcode26 pkg/compiler/lib/src/cps_ir/backward_null_check_remover.dart:26: /// Note that code motion may not occur after ...
4 years, 10 months ago (2016-02-09 12:19:54 UTC) #4
asgerf
4 years, 10 months ago (2016-02-09 12:34:43 UTC) #6
Message was sent while issue was closed.
Committed patchset #4 (id:60001) manually as
bbca76a5e2df6c5adf0ee9327f3a7af21fb1c19a (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698