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

Issue 1144163004: dart2js cps: Always use interceptors and type tags for 'is' checks. (Closed)

Created:
5 years, 7 months ago by asgerf
Modified:
5 years, 7 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: Always use interceptors and type tags for 'is' checks. "x is Foo" will become getInterceptor(x).$isFoo Testing against a type with type arguments is still a giveup(). This test always works, but is not very fast. For instance, testing against an int should be "typeof x === 'number' && Math.floor(x) === x". Following an offline discussion with Karl, the plan is to rewrite 'is'-checks to more fine-grained tests in a CPS optimization pass, probably the type propagator. Concretely, we plan to introduce IR nodes like TypeOfTest, FloorTest, InstanceofTest, etc, which optimization phases can introduce under the right circumstances. That way, the code generation phase remains simple. BUG= R=karlklose@google.com Committed: https://github.com/dart-lang/sdk/commit/f42a0ef25cd042f7fdd2b6afdc3cbb2a36b6dfd4

Patch Set 1 #

Patch Set 2 : Long line #

Total comments: 2

Patch Set 3 : Moved interceptor from unsugar to build-time #

Patch Set 4 : Intercept TypeOperator in buildTry #

Patch Set 5 : Rebase + status file #

Unified diffs Side-by-side diffs Delta from patch set Stats (+66 lines, -271 lines) Patch
M pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart View 1 2 3 8 chunks +45 lines, -9 lines 0 comments Download
M pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart View 1 2 3 4 2 chunks +3 lines, -0 lines 0 comments Download
M pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart View 1 2 3 2 chunks +2 lines, -1 line 0 comments Download
M pkg/compiler/lib/src/js_backend/backend.dart View 1 2 3 1 chunk +0 lines, -12 lines 0 comments Download
M pkg/compiler/lib/src/js_backend/codegen/codegen.dart View 1 2 3 4 3 chunks +2 lines, -5 lines 0 comments Download
M pkg/compiler/lib/src/js_backend/codegen/glue.dart View 1 2 3 2 chunks +0 lines, -17 lines 0 comments Download
D pkg/compiler/lib/src/js_backend/codegen/type_test_emitter.dart View 1 chunk +0 lines, -92 lines 0 comments Download
M pkg/compiler/lib/src/js_backend/codegen/unsugar.dart View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart View 1 chunk +1 line, -0 lines 0 comments Download
M tests/co19/co19-dart2js.status View 1 2 3 4 7 chunks +6 lines, -121 lines 0 comments Download
M tests/compiler/dart2js_extra/dart2js_extra.status View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M tests/corelib/corelib.status View 1 2 3 4 3 chunks +0 lines, -7 lines 0 comments Download
M tests/language/language_dart2js.status View 1 2 3 4 6 chunks +2 lines, -6 lines 0 comments Download
M tests/lib/lib.status View 1 2 3 4 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 5 (1 generated)
asgerf
5 years, 7 months ago (2015-05-21 12:34:07 UTC) #2
karlklose
LGTM. https://codereview.chromium.org/1144163004/diff/20001/pkg/compiler/lib/src/js_backend/codegen/unsugar.dart File pkg/compiler/lib/src/js_backend/codegen/unsugar.dart (right): https://codereview.chromium.org/1144163004/diff/20001/pkg/compiler/lib/src/js_backend/codegen/unsugar.dart#newcode265 pkg/compiler/lib/src/js_backend/codegen/unsugar.dart:265: processTypeOperator(TypeOperator node) { I think we should do ...
5 years, 7 months ago (2015-05-22 07:40:49 UTC) #3
asgerf
PTAL at delta 4 -> 2. It gets more complicated when we do interception in ...
5 years, 7 months ago (2015-05-22 12:31:36 UTC) #4
asgerf
5 years, 7 months ago (2015-05-26 15:50:53 UTC) #5
Message was sent while issue was closed.
Committed patchset #5 (id:80001) manually as
f42a0ef25cd042f7fdd2b6afdc3cbb2a36b6dfd4 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698