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

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 829913006: Optimize is-check to instanceof when it eliminates an interceptor (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of js_backend; 5 part of js_backend;
6 6
7 const VERBOSE_OPTIMIZER_HINTS = false; 7 const VERBOSE_OPTIMIZER_HINTS = false;
8 8
9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR");
10 10
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 element == compiler.boolClass || 1463 element == compiler.boolClass ||
1464 element == compiler.numClass || 1464 element == compiler.numClass ||
1465 element == compiler.intClass || 1465 element == compiler.intClass ||
1466 element == compiler.doubleClass || 1466 element == compiler.doubleClass ||
1467 element == jsArrayClass || 1467 element == jsArrayClass ||
1468 element == jsMutableArrayClass || 1468 element == jsMutableArrayClass ||
1469 element == jsExtendableArrayClass || 1469 element == jsExtendableArrayClass ||
1470 element == jsFixedArrayClass; 1470 element == jsFixedArrayClass;
1471 } 1471 }
1472 1472
1473 bool mayGenerateInstanceofCheck(DartType type) {
1474 // We can use an instanceof check for raw types that have no subclass that
1475 // is mixed-in or in an implements clause.
1476
1477 if (!type.isRaw) return false;
1478 ClassElement classElement = type.element;
1479 if (isInterceptorClass(classElement)) return false;
1480 return compiler.world.hasOnlySubclasses(classElement);
1481 }
1482
1473 Element getExceptionUnwrapper() { 1483 Element getExceptionUnwrapper() {
1474 return findHelper('unwrapException'); 1484 return findHelper('unwrapException');
1475 } 1485 }
1476 1486
1477 Element getThrowRuntimeError() { 1487 Element getThrowRuntimeError() {
1478 return findHelper('throwRuntimeError'); 1488 return findHelper('throwRuntimeError');
1479 } 1489 }
1480 1490
1481 Element getThrowTypeError() { 1491 Element getThrowTypeError() {
1482 return findHelper('throwTypeError'); 1492 return findHelper('throwTypeError');
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 } 2525 }
2516 } 2526 }
2517 2527
2518 /// Records that [constant] is used by the element behind [registry]. 2528 /// Records that [constant] is used by the element behind [registry].
2519 class Dependency { 2529 class Dependency {
2520 final ConstantValue constant; 2530 final ConstantValue constant;
2521 final Element annotatedElement; 2531 final Element annotatedElement;
2522 2532
2523 const Dependency(this.constant, this.annotatedElement); 2533 const Dependency(this.constant, this.annotatedElement);
2524 } 2534 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698