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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart

Issue 1576063003: dart2js cps: Translate identity placeholders to refinement nodes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase again Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
index 4974de815f4dbd02632ef49f88de9fff71559418..9fa4144d97de32d5bcde8ffad1ccf2f8efdaca6a 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
@@ -21,7 +21,8 @@ import '../io/source_information.dart';
import '../js/js.dart' as js show
js,
LiteralStatement,
- Template;
+ Template,
+ isIdentityTemplate;
import '../native/native.dart' show
NativeBehavior;
import '../tree/tree.dart' as ast;
@@ -2639,6 +2640,13 @@ class IrBuilder {
if (type == null) {
type = program.getTypeMaskForForeign(behavior);
}
+ if (js.isIdentityTemplate(codeTemplate) && !program.isArrayType(type)) {
+ // JS expression is just a refinement.
+ // Do not do this for arrays - those are special because array types can
+ // change after creation. The input and output must therefore be modeled
+ // as distinct values.
+ return addPrimitive(new ir.Refinement(arguments.single, type));
+ }
ir.Primitive result = addPrimitive(new ir.ForeignCode(
codeTemplate,
type,
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698