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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.ir_builder; 5 library dart2js.ir_builder;
6 6
7 import '../closure.dart' as closure; 7 import '../closure.dart' as closure;
8 import '../common.dart'; 8 import '../common.dart';
9 import '../common/names.dart' show 9 import '../common/names.dart' show
10 Names, 10 Names,
11 Selectors; 11 Selectors;
12 import '../compile_time_constants.dart' show 12 import '../compile_time_constants.dart' show
13 BackendConstantEnvironment; 13 BackendConstantEnvironment;
14 import '../constants/constant_system.dart'; 14 import '../constants/constant_system.dart';
15 import '../constants/values.dart' show 15 import '../constants/values.dart' show
16 ConstantValue, 16 ConstantValue,
17 PrimitiveConstantValue; 17 PrimitiveConstantValue;
18 import '../dart_types.dart'; 18 import '../dart_types.dart';
19 import '../elements/elements.dart'; 19 import '../elements/elements.dart';
20 import '../io/source_information.dart'; 20 import '../io/source_information.dart';
21 import '../js/js.dart' as js show 21 import '../js/js.dart' as js show
22 js, 22 js,
23 LiteralStatement, 23 LiteralStatement,
24 Template; 24 Template,
25 isIdentityTemplate;
25 import '../native/native.dart' show 26 import '../native/native.dart' show
26 NativeBehavior; 27 NativeBehavior;
27 import '../tree/tree.dart' as ast; 28 import '../tree/tree.dart' as ast;
28 import '../types/types.dart' show 29 import '../types/types.dart' show
29 TypeMask; 30 TypeMask;
30 import '../universe/call_structure.dart' show 31 import '../universe/call_structure.dart' show
31 CallStructure; 32 CallStructure;
32 import '../universe/selector.dart' show 33 import '../universe/selector.dart' show
33 Selector, 34 Selector,
34 SelectorKind; 35 SelectorKind;
(...skipping 2597 matching lines...) Expand 10 before | Expand all | Expand 10 after
2632 2633
2633 ir.Primitive buildForeignCode(js.Template codeTemplate, 2634 ir.Primitive buildForeignCode(js.Template codeTemplate,
2634 List<ir.Primitive> arguments, 2635 List<ir.Primitive> arguments,
2635 NativeBehavior behavior, 2636 NativeBehavior behavior,
2636 {Element dependency, 2637 {Element dependency,
2637 TypeMask type}) { 2638 TypeMask type}) {
2638 assert(behavior != null); 2639 assert(behavior != null);
2639 if (type == null) { 2640 if (type == null) {
2640 type = program.getTypeMaskForForeign(behavior); 2641 type = program.getTypeMaskForForeign(behavior);
2641 } 2642 }
2643 if (js.isIdentityTemplate(codeTemplate) && !program.isArrayType(type)) {
2644 // JS expression is just a refinement.
2645 // Do not do this for arrays - those are special because array types can
2646 // change after creation. The input and output must therefore be modeled
2647 // as distinct values.
2648 return addPrimitive(new ir.Refinement(arguments.single, type));
2649 }
2642 ir.Primitive result = addPrimitive(new ir.ForeignCode( 2650 ir.Primitive result = addPrimitive(new ir.ForeignCode(
2643 codeTemplate, 2651 codeTemplate,
2644 type, 2652 type,
2645 arguments, 2653 arguments,
2646 behavior, 2654 behavior,
2647 dependency: dependency)); 2655 dependency: dependency));
2648 if (!codeTemplate.isExpression) { 2656 if (!codeTemplate.isExpression) {
2649 // Close the term if this is a "throw" expression or native body. 2657 // Close the term if this is a "throw" expression or native body.
2650 add(new ir.Unreachable()); 2658 add(new ir.Unreachable());
2651 _current = null; 2659 _current = null;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2834 this.stackTraceVariable, 2842 this.stackTraceVariable,
2835 this.buildCatchBlock}); 2843 this.buildCatchBlock});
2836 } 2844 }
2837 2845
2838 class SwitchCaseInfo { 2846 class SwitchCaseInfo {
2839 final SubbuildFunction buildCondition; 2847 final SubbuildFunction buildCondition;
2840 final SubbuildFunction buildBody; 2848 final SubbuildFunction buildBody;
2841 2849
2842 SwitchCaseInfo(this.buildCondition, this.buildBody); 2850 SwitchCaseInfo(this.buildCondition, this.buildBody);
2843 } 2851 }
OLDNEW
« 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