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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart

Issue 1285173002: dart2js cps: Rewrite more List operations into JS array operations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Remove unused code and fix long line Created 5 years, 4 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) 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 library dart2js.ir_nodes; 4 library dart2js.ir_nodes;
5 5
6 import '../constants/values.dart' as values show ConstantValue; 6 import '../constants/values.dart' as values show ConstantValue;
7 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; 7 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType;
8 import '../elements/elements.dart'; 8 import '../elements/elements.dart';
9 import '../io/source_information.dart' show SourceInformation; 9 import '../io/source_information.dart' show SourceInformation;
10 import '../types/types.dart' show TypeMask; 10 import '../types/types.dart' show TypeMask;
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 List<Primitive> arguments, 512 List<Primitive> arguments,
513 this.sourceInformation) 513 this.sourceInformation)
514 : this.arguments = _referenceList(arguments); 514 : this.arguments = _referenceList(arguments);
515 515
516 accept(Visitor visitor) => visitor.visitApplyBuiltinOperator(this); 516 accept(Visitor visitor) => visitor.visitApplyBuiltinOperator(this);
517 517
518 bool get isSafeForElimination => true; 518 bool get isSafeForElimination => true;
519 bool get isSafeForReordering => true; 519 bool get isSafeForReordering => true;
520 } 520 }
521 521
522 /// Apply a built-in method.
523 ///
524 /// It must be known that the arguments have the proper types.
525 class ApplyBuiltinMethod extends Primitive {
526 BuiltinMethod method;
527 Reference<Primitive> receiver;
528 List<Reference<Primitive>> arguments;
529 final SourceInformation sourceInformation;
530
531 bool receiverIsNotNull = false;
532
533 ApplyBuiltinMethod(this.method,
534 Primitive receiver,
535 List<Primitive> arguments,
536 this.sourceInformation)
537 : this.receiver = new Reference<Primitive>(receiver),
538 this.arguments = _referenceList(arguments);
539
540 accept(Visitor visitor) => visitor.visitApplyBuiltinMethod(this);
541
542 bool get isSafeForElimination => false;
543 bool get isSafeForReordering => false;
544 }
545
522 /// Throw a value. 546 /// Throw a value.
523 /// 547 ///
524 /// Throw is an expression, i.e., it always occurs in tail position with 548 /// Throw is an expression, i.e., it always occurs in tail position with
525 /// respect to a body or expression. 549 /// respect to a body or expression.
526 class Throw extends TailExpression { 550 class Throw extends TailExpression {
527 Reference<Primitive> value; 551 Reference<Primitive> value;
528 552
529 Throw(Primitive value) : value = new Reference<Primitive>(value); 553 Throw(Primitive value) : value = new Reference<Primitive>(value);
530 554
531 accept(Visitor visitor) => visitor.visitThrow(this); 555 accept(Visitor visitor) => visitor.visitThrow(this);
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 T visitInterceptor(Interceptor node); 1173 T visitInterceptor(Interceptor node);
1150 T visitCreateInstance(CreateInstance node); 1174 T visitCreateInstance(CreateInstance node);
1151 T visitGetField(GetField node); 1175 T visitGetField(GetField node);
1152 T visitCreateBox(CreateBox node); 1176 T visitCreateBox(CreateBox node);
1153 T visitReifyRuntimeType(ReifyRuntimeType node); 1177 T visitReifyRuntimeType(ReifyRuntimeType node);
1154 T visitReadTypeVariable(ReadTypeVariable node); 1178 T visitReadTypeVariable(ReadTypeVariable node);
1155 T visitTypeExpression(TypeExpression node); 1179 T visitTypeExpression(TypeExpression node);
1156 T visitCreateInvocationMirror(CreateInvocationMirror node); 1180 T visitCreateInvocationMirror(CreateInvocationMirror node);
1157 T visitTypeTest(TypeTest node); 1181 T visitTypeTest(TypeTest node);
1158 T visitApplyBuiltinOperator(ApplyBuiltinOperator node); 1182 T visitApplyBuiltinOperator(ApplyBuiltinOperator node);
1183 T visitApplyBuiltinMethod(ApplyBuiltinMethod node);
1159 T visitGetLength(GetLength node); 1184 T visitGetLength(GetLength node);
1160 T visitGetIndex(GetIndex node); 1185 T visitGetIndex(GetIndex node);
1161 T visitSetIndex(SetIndex node); 1186 T visitSetIndex(SetIndex node);
1162 1187
1163 // Conditions. 1188 // Conditions.
1164 T visitIsTrue(IsTrue node); 1189 T visitIsTrue(IsTrue node);
1165 1190
1166 // Support for literal foreign code. 1191 // Support for literal foreign code.
1167 T visitForeignCode(ForeignCode node); 1192 T visitForeignCode(ForeignCode node);
1168 } 1193 }
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 processCreateInvocationMirror(node); 1444 processCreateInvocationMirror(node);
1420 node.arguments.forEach(processReference); 1445 node.arguments.forEach(processReference);
1421 } 1446 }
1422 1447
1423 processApplyBuiltinOperator(ApplyBuiltinOperator node) {} 1448 processApplyBuiltinOperator(ApplyBuiltinOperator node) {}
1424 visitApplyBuiltinOperator(ApplyBuiltinOperator node) { 1449 visitApplyBuiltinOperator(ApplyBuiltinOperator node) {
1425 processApplyBuiltinOperator(node); 1450 processApplyBuiltinOperator(node);
1426 node.arguments.forEach(processReference); 1451 node.arguments.forEach(processReference);
1427 } 1452 }
1428 1453
1454 processApplyBuiltinMethod(ApplyBuiltinMethod node) {}
1455 visitApplyBuiltinMethod(ApplyBuiltinMethod node) {
1456 processApplyBuiltinMethod(node);
1457 processReference(node.receiver);
1458 node.arguments.forEach(processReference);
1459 }
1460
1429 processForeignCode(ForeignCode node) {} 1461 processForeignCode(ForeignCode node) {}
1430 visitForeignCode(ForeignCode node) { 1462 visitForeignCode(ForeignCode node) {
1431 processForeignCode(node); 1463 processForeignCode(node);
1432 if (node.continuation != null) { 1464 if (node.continuation != null) {
1433 processReference(node.continuation); 1465 processReference(node.continuation);
1434 } 1466 }
1435 node.arguments.forEach(processReference); 1467 node.arguments.forEach(processReference);
1436 } 1468 }
1437 1469
1438 processUnreachable(Unreachable node) {} 1470 processUnreachable(Unreachable node) {}
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 /// Visit a just-deleted subterm and unlink all [Reference]s in it. 1623 /// Visit a just-deleted subterm and unlink all [Reference]s in it.
1592 class RemovalVisitor extends RecursiveVisitor { 1624 class RemovalVisitor extends RecursiveVisitor {
1593 processReference(Reference reference) { 1625 processReference(Reference reference) {
1594 reference.unlink(); 1626 reference.unlink();
1595 } 1627 }
1596 1628
1597 static void remove(Node node) { 1629 static void remove(Node node) {
1598 (new RemovalVisitor()).visit(node); 1630 (new RemovalVisitor()).visit(node);
1599 } 1631 }
1600 } 1632 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698