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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart

Issue 1642493002: Add type info to JSArray. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: array changes Created 4 years, 10 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 tree_ir.optimization.statement_rewriter; 5 library tree_ir.optimization.statement_rewriter;
6 6
7 import 'optimization.dart' show Pass; 7 import 'optimization.dart' show Pass;
8 import '../tree_ir_nodes.dart'; 8 import '../tree_ir_nodes.dart';
9 import '../../io/source_information.dart'; 9 import '../../io/source_information.dart';
10 import '../../elements/elements.dart'; 10 import '../../elements/elements.dart';
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 /// any given activation of the enclosing method. 365 /// any given activation of the enclosing method.
366 bool isEffectivelyConstant(Expression exp) { 366 bool isEffectivelyConstant(Expression exp) {
367 // TODO(asgerf): Can be made more aggressive e.g. by checking conditional 367 // TODO(asgerf): Can be made more aggressive e.g. by checking conditional
368 // expressions recursively. Determine if that is a valuable optimization 368 // expressions recursively. Determine if that is a valuable optimization
369 // and/or if it is better handled at the CPS level. 369 // and/or if it is better handled at the CPS level.
370 return exp is Constant || 370 return exp is Constant ||
371 exp is This || 371 exp is This ||
372 exp is CreateInvocationMirror || 372 exp is CreateInvocationMirror ||
373 exp is CreateInstance || 373 exp is CreateInstance ||
374 exp is CreateBox || 374 exp is CreateBox ||
375 exp is TypeExpression ||
375 exp is GetStatic && exp.element.isFunction || 376 exp is GetStatic && exp.element.isFunction ||
376 exp is Interceptor || 377 exp is Interceptor ||
377 exp is ApplyBuiltinOperator || 378 exp is ApplyBuiltinOperator ||
378 exp is VariableUse && constantEnvironment.containsKey(exp.variable); 379 exp is VariableUse && constantEnvironment.containsKey(exp.variable);
379 } 380 }
380 381
381 /// True if [node] is an assignment that can be propagated as a constant. 382 /// True if [node] is an assignment that can be propagated as a constant.
382 bool isEffectivelyConstantAssignment(Expression node) { 383 bool isEffectivelyConstantAssignment(Expression node) {
383 return node is Assign && 384 return node is Assign &&
384 node.variable.writeCount == 1 && 385 node.variable.writeCount == 1 &&
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 Expression visitGetTypeTestProperty(GetTypeTestProperty node) { 816 Expression visitGetTypeTestProperty(GetTypeTestProperty node) {
816 node.object = visitExpression(node.object); 817 node.object = visitExpression(node.object);
817 return node; 818 return node;
818 } 819 }
819 820
820 Expression visitCreateBox(CreateBox node) { 821 Expression visitCreateBox(CreateBox node) {
821 return node; 822 return node;
822 } 823 }
823 824
824 Expression visitCreateInstance(CreateInstance node) { 825 Expression visitCreateInstance(CreateInstance node) {
826 if (node.typeInformation != null) {
827 node.typeInformation = visitExpression(node.typeInformation);
828 }
825 _rewriteList(node.arguments); 829 _rewriteList(node.arguments);
826 return node; 830 return node;
827 } 831 }
828 832
829 Expression visitReifyRuntimeType(ReifyRuntimeType node) { 833 Expression visitReifyRuntimeType(ReifyRuntimeType node) {
830 node.value = visitExpression(node.value); 834 node.value = visitExpression(node.value);
831 return node; 835 return node;
832 } 836 }
833 837
834 Expression visitReadTypeVariable(ReadTypeVariable node) { 838 Expression visitReadTypeVariable(ReadTypeVariable node) {
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 } 1381 }
1378 1382
1379 /// Decrement the reference count for [e] if it is a variable use. 1383 /// Decrement the reference count for [e] if it is a variable use.
1380 void destroyPrimaryExpression(Expression e) { 1384 void destroyPrimaryExpression(Expression e) {
1381 if (e is VariableUse) { 1385 if (e is VariableUse) {
1382 --e.variable.readCount; 1386 --e.variable.readCount;
1383 } else { 1387 } else {
1384 assert(e is This); 1388 assert(e is This);
1385 } 1389 }
1386 } 1390 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698