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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 12210142: Implement is-checks against type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Do not emit Object.isObject. Created 7 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 | Annotate | Revision Log
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 typedef void Recompile(Element element); 7 typedef void Recompile(Element element);
8 8
9 class ReturnInfo { 9 class ReturnInfo {
10 HType returnType; 10 HType returnType;
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 enqueueInResolution(getTraceFromException()); 983 enqueueInResolution(getTraceFromException());
984 } 984 }
985 985
986 void registerRuntimeType() { 986 void registerRuntimeType() {
987 enqueueInResolution(getSetRuntimeTypeInfo()); 987 enqueueInResolution(getSetRuntimeTypeInfo());
988 enqueueInResolution(getGetRuntimeTypeInfo()); 988 enqueueInResolution(getGetRuntimeTypeInfo());
989 enqueueInResolution(getGetRuntimeTypeArgument()); 989 enqueueInResolution(getGetRuntimeTypeArgument());
990 } 990 }
991 991
992 void registerIsCheck(DartType type, Enqueuer world) { 992 void registerIsCheck(DartType type, Enqueuer world) {
993 if (!type.isRaw) { 993 if (!type.isRaw || type is TypeVariableType) {
ngeoffray 2013/02/19 09:00:41 Banned is check :) Do you really need all the fol
994 enqueueInResolution(getSetRuntimeTypeInfo()); 994 enqueueInResolution(getSetRuntimeTypeInfo());
995 enqueueInResolution(getGetRuntimeTypeInfo()); 995 enqueueInResolution(getGetRuntimeTypeInfo());
996 enqueueInResolution(getGetRuntimeTypeArgument()); 996 enqueueInResolution(getGetRuntimeTypeArgument());
997 enqueueInResolution(getCheckArguments()); 997 enqueueInResolution(getCheckArguments());
998 enqueueInResolution(getGetObjectIsSubtype());
998 } 999 }
999 // [registerIsCheck] is also called for checked mode checks, so we 1000 // [registerIsCheck] is also called for checked mode checks, so we
1000 // need to register checked mode helpers. 1001 // need to register checked mode helpers.
1001 if (compiler.enableTypeAssertions) { 1002 if (compiler.enableTypeAssertions) {
1002 SourceString helperName = getCheckedModeHelper(type); 1003 SourceString helperName = getCheckedModeHelper(type);
1003 Element e = compiler.findHelper(helperName); 1004 Element e = compiler.findHelper(helperName);
1004 if (e != null) world.addToWorkList(e); 1005 if (e != null) world.addToWorkList(e);
1005 // We also need the native variant of the check (for DOM types). 1006 // We also need the native variant of the check (for DOM types).
1006 helperName = nativeNames[helperName.stringValue]; 1007 helperName = nativeNames[helperName.stringValue];
1007 if (helperName != null) { 1008 if (helperName != null) {
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 } 1421 }
1421 1422
1422 Element getGetRuntimeTypeArgument() { 1423 Element getGetRuntimeTypeArgument() {
1423 return compiler.findHelper(const SourceString('getRuntimeTypeArgument')); 1424 return compiler.findHelper(const SourceString('getRuntimeTypeArgument'));
1424 } 1425 }
1425 1426
1426 Element getCheckArguments() { 1427 Element getCheckArguments() {
1427 return compiler.findHelper(const SourceString('checkArguments')); 1428 return compiler.findHelper(const SourceString('checkArguments'));
1428 } 1429 }
1429 1430
1431 Element getGetObjectIsSubtype() {
1432 return compiler.findHelper(const SourceString('objectIsSubtype'));
1433 }
1434
1430 Element getThrowNoSuchMethod() { 1435 Element getThrowNoSuchMethod() {
1431 return compiler.findHelper(const SourceString('throwNoSuchMethod')); 1436 return compiler.findHelper(const SourceString('throwNoSuchMethod'));
1432 } 1437 }
1433 1438
1434 Element getCreateRuntimeType() { 1439 Element getCreateRuntimeType() {
1435 return compiler.findHelper(const SourceString('createRuntimeType')); 1440 return compiler.findHelper(const SourceString('createRuntimeType'));
1436 } 1441 }
1437 1442
1438 Element getFallThroughError() { 1443 Element getFallThroughError() {
1439 return compiler.findHelper(const SourceString("getFallThroughError")); 1444 return compiler.findHelper(const SourceString("getFallThroughError"));
(...skipping 13 matching lines...) Expand all
1453 * 1458 *
1454 * Invariant: [element] must be a declaration element. 1459 * Invariant: [element] must be a declaration element.
1455 */ 1460 */
1456 void eagerRecompile(Element element) { 1461 void eagerRecompile(Element element) {
1457 assert(invariant(element, element.isDeclaration)); 1462 assert(invariant(element, element.isDeclaration));
1458 generatedCode.remove(element); 1463 generatedCode.remove(element);
1459 generatedBailoutCode.remove(element); 1464 generatedBailoutCode.remove(element);
1460 compiler.enqueuer.codegen.addToWorkList(element); 1465 compiler.enqueuer.codegen.addToWorkList(element);
1461 } 1466 }
1462 } 1467 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698