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

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

Issue 12528008: Implement CHA through type mask and TypedSelector in the simple type inferrer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 library native; 5 library native;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 import 'dart:uri'; 8 import 'dart:uri';
9 import 'dart2jslib.dart' hide SourceString; 9 import 'dart2jslib.dart' hide SourceString;
10 import 'dart_types.dart'; 10 import 'dart_types.dart';
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 539
540 var firstArg = argNodes.head; 540 var firstArg = argNodes.head;
541 LiteralString specLiteral = firstArg.asLiteralString(); 541 LiteralString specLiteral = firstArg.asLiteralString();
542 if (specLiteral != null) { 542 if (specLiteral != null) {
543 String specString = specLiteral.dartString.slowToString(); 543 String specString = specLiteral.dartString.slowToString();
544 // Various things that are not in fact types. 544 // Various things that are not in fact types.
545 if (specString == 'void') return NativeBehavior.NONE; 545 if (specString == 'void') return NativeBehavior.NONE;
546 if (specString == '' || specString == 'var') { 546 if (specString == '' || specString == 'var') {
547 var behavior = new NativeBehavior(); 547 var behavior = new NativeBehavior();
548 behavior.typesReturned.add(compiler.objectClass.computeType(compiler)); 548 behavior.typesReturned.add(compiler.objectClass.computeType(compiler));
549 behavior.typesReturned.add(compiler.nullClass.computeType(compiler));
549 return behavior; 550 return behavior;
550 } 551 }
551 var behavior = new NativeBehavior(); 552 var behavior = new NativeBehavior();
552 for (final typeString in specString.split('|')) { 553 for (final typeString in specString.split('|')) {
553 var type = _parseType(typeString, compiler, 554 var type = _parseType(typeString, compiler,
554 (name) => resolver.resolveTypeFromString(name), 555 (name) => resolver.resolveTypeFromString(name),
555 jsCall); 556 jsCall);
556 behavior.typesInstantiated.add(type); 557 behavior.typesInstantiated.add(type);
557 behavior.typesReturned.add(type); 558 behavior.typesReturned.add(type);
558 } 559 }
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 } else { 896 } else {
896 if (parameters.parameterCount != 0) { 897 if (parameters.parameterCount != 0) {
897 compiler.cancel( 898 compiler.cancel(
898 'native "..." syntax is restricted to functions with zero parameters', 899 'native "..." syntax is restricted to functions with zero parameters',
899 node: nativeBody); 900 node: nativeBody);
900 } 901 }
901 LiteralString jsCode = nativeBody.asLiteralString(); 902 LiteralString jsCode = nativeBody.asLiteralString();
902 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[])); 903 builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[]));
903 } 904 }
904 } 905 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698