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

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

Issue 10964016: Change the type inference for fields in dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased to r12841 Created 8 years, 2 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 typedef void Recompile(Element element); 5 typedef void Recompile(Element element);
6 6
7 class ReturnInfo { 7 class ReturnInfo {
8 HType returnType; 8 HType returnType;
9 List<Element> compiledFunctions; 9 List<Element> compiledFunctions;
10 10
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 216 }
217 index++; 217 index++;
218 }); 218 });
219 return result; 219 return result;
220 } 220 }
221 221
222 String toString() => 222 String toString() =>
223 allUnknown ? "HTypeList.ALL_UNKNOWN" : "HTypeList $types"; 223 allUnknown ? "HTypeList.ALL_UNKNOWN" : "HTypeList $types";
224 } 224 }
225 225
226 class FieldTypesRegistry {
227 final JavaScriptBackend backend;
228 final Map<Element, Set<Element>> constructors;
ngeoffray 2012/09/25 21:15:43 Please explain why we have three maps and that in
Søren Gjesse 2012/09/27 11:53:40 Done.
229 final Map<Element, HType> fieldInitializerTypeMap;
230 final Map<Element, HType> fieldConstructorTypeMap;
231 final Map<Element, HType> fieldTypeMap;
232 final Set<SourceString> setterSelectorsUsed;
233 final Map<Element, Set<Element>> optimizedStaticFunctions;
234 final Map<Element, FunctionSet> optimizedFunctions;
235
236 FieldTypesRegistry(JavaScriptBackend backend)
237 : constructors = new Map<Element, Set<Element>>(),
238 fieldInitializerTypeMap = new Map<Element, HType>(),
239 fieldConstructorTypeMap = new Map<Element, HType>(),
240 fieldTypeMap = new Map<Element, HType>(),
241 setterSelectorsUsed = new Set<SourceString>(),
242 optimizedStaticFunctions = new Map<Element, Set<Element>>(),
243 optimizedFunctions = new Map<Element, FunctionSet>(),
244 this.backend = backend;
245
246 Compiler get compiler => backend.compiler;
247
248 void scheduleRecompilation(Element field) {
249 Set optimizedStatics = optimizedStaticFunctions[field];
250 if (optimizedStatics != null) {
251 optimizedStatics.forEach(backend.scheduleForRecompilation);
252 optimizedStaticFunctions.remove(field);
253 }
254 FunctionSet optimized = optimizedFunctions[field];
255 if (optimized != null) {
256 optimized.forEach(backend.scheduleForRecompilation);
257 optimizedFunctions.remove(field);
258 }
259 }
260
261 int constructorCount(Element element) {
262 assert(element.isClass());
263 Set<Element> ctors = constructors[element];
264 return ctors === null ? 0 : ctors.length;
265 }
266
267 void registerFieldType(Map<Element, HType> typeMap,
268 Element field,
269 HType type) {
270 assert(field.isField());
271 HType before = optimisticFieldType(field);
272
273 HType oldType = typeMap[field];
274 HType newType;
275
276 if (oldType != null) {
277 newType = oldType.union(type);
278 } else {
279 newType = type;
280 }
281 typeMap[field] = newType;
282 if (oldType != newType) {
283 scheduleRecompilation(field);
284 }
285 }
286
287 void registerConstructor(Element element) {
288 assert(element.isGenerativeConstructor());
289 Element cls = element.enclosingElement;
290 constructors.putIfAbsent(cls, () => new Set<Element>());
291 Set<Element> ctors = constructors[cls];
292 if (ctors.contains(element)) return;
ngeoffray 2012/09/25 21:15:43 Looks like this will never happen right? Maybe ass
Søren Gjesse 2012/09/27 11:53:40 It can, as the same constructor can be compiled mo
293 ctors.add(element);
294 if (ctors.length == 2) {
ngeoffray 2012/09/25 21:15:43 Please add a comment and a TODO.
Søren Gjesse 2012/09/27 11:53:40 Done.
295 optimizedFunctions.forEach((Element field, _) {
296 if (field.enclosingElement === cls) {
297 scheduleRecompilation(field);
298 }
299 });
300 }
301 }
302
303 void registerFieldInitializer(Element field, HType type) {
304 registerFieldType(fieldInitializerTypeMap, field, type);
305 }
306
307 void registerFieldConstructor(Element field, HType type) {
308 registerFieldType(fieldConstructorTypeMap, field, type);
309 }
310
311 void registerFieldSetter(FunctionElement element, Element field, HType type) {
312 HType initializerType = fieldInitializerTypeMap[field];
313 HType constructorType = fieldConstructorTypeMap[field];
314 HType setterType = fieldTypeMap[field];
315 if (type == HType.UNKNOWN &&
ngeoffray 2012/09/25 21:15:43 weird identation. I believe the style is more: a
Søren Gjesse 2012/09/27 11:53:40 Done.
316 initializerType == null &&
317 constructorType == null &&
318 setterType == null) {
319 // Don't register UNKONWN if there is currently no type information
320 // present for the field. Instead register the function holding the
321 // setter for recompilation if better type information for the field
322 // becomes available.
323 registerOptimizedFunction(element, field, type);
324 return;
325 }
326 registerFieldType(fieldTypeMap, field, type);
327 }
328
329 void addedDynamicSetter(Selector setter, HType type) {
330 // Field type optimizations are disabled for all fields matching a
331 // setter selector.
332 assert(setter.isSetter());
333 // TODO(sgjesse): Take the type of the setter into account.
334 if (setterSelectorsUsed.contains(setter.name)) return;
335 setterSelectorsUsed.add(setter.name);
336 optimizedStaticFunctions.forEach((Element field, _) {
337 if (field.name == setter.name) {
338 scheduleRecompilation(field);
339 }
340 });
341 optimizedFunctions.forEach((Element field, _) {
342 if (field.name == setter.name) {
343 scheduleRecompilation(field);
344 }
345 });
346 }
347
348 HType optimisticFieldType(Element field) {
349 assert(field.isField());
350 if (constructorCount(field.enclosingElement) > 1) {
351 return HType.UNKNOWN;
352 }
353 if (setterSelectorsUsed.contains(field.name)) {
354 return HType.UNKNOWN;
355 }
356 HType initializerType = fieldInitializerTypeMap[field];
357 HType constructorType = fieldConstructorTypeMap[field];
358 if (initializerType === null && constructorType === null) {
359 return HType.UNKNOWN;
360 }
361 HType result = constructorType != null ? constructorType : initializerType;
362 HType type = fieldTypeMap[field];
363 if (type !== null) result = result.union(type);
364 return result;
365 }
366
367 void registerOptimizedFunction(FunctionElement element,
368 Element field,
369 HType type) {
370 assert(field.isField());
371 if (Elements.isStaticOrTopLevel(element)) {
372 optimizedStaticFunctions.putIfAbsent(
373 field, () => new Set<Element>());
374 optimizedStaticFunctions[field].add(element);
375 } else {
376 optimizedFunctions.putIfAbsent(
377 field, () => new FunctionSet(backend.compiler));
378 optimizedFunctions[field].add(element);
379 }
380 }
381
382 void dump() {
383 Set<Element> allFields = new Set<Element>();
384 fieldInitializerTypeMap.getKeys().forEach(allFields.add);
385 fieldConstructorTypeMap.getKeys().forEach(allFields.add);
386 fieldTypeMap.getKeys().forEach(allFields.add);
387 allFields.forEach((Element field) {
388 print("Inferred $field has type ${optimisticFieldType(field)}");
389 });
390 }
391 }
392
226 class ArgumentTypesRegistry { 393 class ArgumentTypesRegistry {
227 final JavaScriptBackend backend; 394 final JavaScriptBackend backend;
228 395
229 /** 396 /**
230 * Documentation wanted -- johnniwinther 397 * Documentation wanted -- johnniwinther
231 * 398 *
232 * Invariant: Keys must be declaration elements. 399 * Invariant: Keys must be declaration elements.
233 */ 400 */
234 final Map<Element, HTypeList> staticTypeMap; 401 final Map<Element, HTypeList> staticTypeMap;
235 402
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 signature, 545 signature,
379 defaultValueTypes); 546 defaultValueTypes);
380 } 547 }
381 assert(types.allUnknown || types.length == signature.parameterCount); 548 assert(types.allUnknown || types.length == signature.parameterCount);
382 found = (found === null) ? types : found.union(types); 549 found = (found === null) ? types : found.union(types);
383 return !found.allUnknown; 550 return !found.allUnknown;
384 }); 551 });
385 return found !== null ? found : HTypeList.ALL_UNKNOWN; 552 return found !== null ? found : HTypeList.ALL_UNKNOWN;
386 } 553 }
387 554
388 void registerOptimization(Element element, 555 void registerOptimizedFunction(Element element,
389 HTypeList parameterTypes, 556 HTypeList parameterTypes,
390 OptionalParameterTypes defaultValueTypes) { 557 OptionalParameterTypes defaultValueTypes) {
391 assert(invariant(element, element.isDeclaration));
392 if (Elements.isStaticOrTopLevelFunction(element)) { 558 if (Elements.isStaticOrTopLevelFunction(element)) {
393 if (parameterTypes.allUnknown) { 559 if (parameterTypes.allUnknown) {
394 optimizedStaticFunctions.remove(element); 560 optimizedStaticFunctions.remove(element);
395 } else { 561 } else {
396 optimizedStaticFunctions.add(element); 562 optimizedStaticFunctions.add(element);
397 } 563 }
398 } 564 }
399 565
400 // TODO(kasperl): What kind of non-members do we get here? 566 // TODO(kasperl): What kind of non-members do we get here?
401 if (!element.isMember()) return; 567 if (!element.isMember()) return;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 602
437 final Namer namer; 603 final Namer namer;
438 604
439 /** 605 /**
440 * Interface used to determine if an object has the JavaScript 606 * Interface used to determine if an object has the JavaScript
441 * indexing behavior. The interface is only visible to specific 607 * indexing behavior. The interface is only visible to specific
442 * libraries. 608 * libraries.
443 */ 609 */
444 ClassElement jsIndexingBehaviorInterface; 610 ClassElement jsIndexingBehaviorInterface;
445 611
446 final Map<Element, Map<Element, HType>> fieldInitializers;
447 final Map<Element, Map<Element, HType>> fieldConstructorSetters;
448 final Map<Element, Map<Element, HType>> fieldSettersType;
449
450 final Map<Element, ReturnInfo> returnInfo; 612 final Map<Element, ReturnInfo> returnInfo;
451 613
452 /** 614 /**
453 * Documentation wanted -- johnniwinther 615 * Documentation wanted -- johnniwinther
454 * 616 *
455 * Invariant: Elements must be declaration elements. 617 * Invariant: Elements must be declaration elements.
456 */ 618 */
457 final List<Element> invalidateAfterCodegen; 619 final List<Element> invalidateAfterCodegen;
458 ArgumentTypesRegistry argumentTypes; 620 ArgumentTypesRegistry argumentTypes;
621 FieldTypesRegistry fieldTypes;
459 622
460 List<CompilerTask> get tasks { 623 List<CompilerTask> get tasks {
461 return <CompilerTask>[builder, optimizer, generator, emitter]; 624 return <CompilerTask>[builder, optimizer, generator, emitter];
462 } 625 }
463 626
464 JavaScriptBackend(Compiler compiler, bool generateSourceMap) 627 JavaScriptBackend(Compiler compiler, bool generateSourceMap)
465 : fieldInitializers = new Map<Element, Map<Element, HType>>(), 628 : namer = new Namer(compiler),
466 fieldConstructorSetters = new Map<Element, Map<Element, HType>>(),
467 fieldSettersType = new Map<Element, Map<Element, HType>>(),
468 namer = new Namer(compiler),
469 returnInfo = new Map<Element, ReturnInfo>(), 629 returnInfo = new Map<Element, ReturnInfo>(),
470 invalidateAfterCodegen = new List<Element>(), 630 invalidateAfterCodegen = new List<Element>(),
471 super(compiler, constantSystem: JAVA_SCRIPT_CONSTANT_SYSTEM) { 631 super(compiler, constantSystem: JAVA_SCRIPT_CONSTANT_SYSTEM) {
472 emitter = new CodeEmitterTask(compiler, namer, generateSourceMap); 632 emitter = new CodeEmitterTask(compiler, namer, generateSourceMap);
473 builder = new SsaBuilderTask(this); 633 builder = new SsaBuilderTask(this);
474 optimizer = new SsaOptimizerTask(this); 634 optimizer = new SsaOptimizerTask(this);
475 generator = new SsaCodeGeneratorTask(this); 635 generator = new SsaCodeGeneratorTask(this);
476 argumentTypes = new ArgumentTypesRegistry(this); 636 argumentTypes = new ArgumentTypesRegistry(this);
637 fieldTypes = new FieldTypesRegistry(this);
477 } 638 }
478 639
479 Element get cyclicThrowHelper { 640 Element get cyclicThrowHelper {
480 return compiler.findHelper(const SourceString("throwCyclicInit")); 641 return compiler.findHelper(const SourceString("throwCyclicInit"));
481 } 642 }
482 643
483 JavaScriptItemCompilationContext createItemCompilationContext() { 644 JavaScriptItemCompilationContext createItemCompilationContext() {
484 return new JavaScriptItemCompilationContext(); 645 return new JavaScriptItemCompilationContext();
485 } 646 }
486 647
(...skipping 22 matching lines...) Expand all
509 } else { 670 } else {
510 // If the constant-handler was not able to produce a result we have to 671 // If the constant-handler was not able to produce a result we have to
511 // go through the builder (below) to generate the lazy initializer for 672 // go through the builder (below) to generate the lazy initializer for
512 // the static variable. 673 // the static variable.
513 // We also need to register the use of the cyclic-error helper. 674 // We also need to register the use of the cyclic-error helper.
514 compiler.enqueuer.codegen.registerStaticUse(cyclicThrowHelper); 675 compiler.enqueuer.codegen.registerStaticUse(cyclicThrowHelper);
515 } 676 }
516 } 677 }
517 678
518 HGraph graph = builder.build(work); 679 HGraph graph = builder.build(work);
519 optimizer.optimize(work, graph); 680 optimizer.optimize(work, graph, false);
520 if (work.allowSpeculativeOptimization 681 if (work.allowSpeculativeOptimization
521 && optimizer.trySpeculativeOptimizations(work, graph)) { 682 && optimizer.trySpeculativeOptimizations(work, graph)) {
522 CodeBuffer codeBuffer = generator.generateBailoutMethod(work, graph); 683 CodeBuffer codeBuffer = generator.generateBailoutMethod(work, graph);
523 compiler.codegenWorld.addBailoutCode(work, codeBuffer); 684 compiler.codegenWorld.addBailoutCode(work, codeBuffer);
524 optimizer.prepareForSpeculativeOptimizations(work, graph); 685 optimizer.prepareForSpeculativeOptimizations(work, graph);
525 optimizer.optimize(work, graph); 686 optimizer.optimize(work, graph, true);
526 } 687 }
527 CodeBuffer codeBuffer = generator.generateCode(work, graph); 688 CodeBuffer codeBuffer = generator.generateCode(work, graph);
528 compiler.codegenWorld.addGeneratedCode(work, codeBuffer); 689 compiler.codegenWorld.addGeneratedCode(work, codeBuffer);
529 invalidateAfterCodegen.forEach(compiler.enqueuer.codegen.eagerRecompile); 690 invalidateAfterCodegen.forEach(compiler.enqueuer.codegen.eagerRecompile);
530 invalidateAfterCodegen.clear(); 691 invalidateAfterCodegen.clear();
531 } 692 }
532 693
533 void processNativeClasses(Enqueuer world, 694 void processNativeClasses(Enqueuer world,
534 Collection<LibraryElement> libraries) { 695 Collection<LibraryElement> libraries) {
535 native.processNativeClasses(world, emitter, libraries); 696 native.processNativeClasses(world, emitter, libraries);
536 } 697 }
537 698
538 void assembleProgram() { 699 void assembleProgram() {
539 emitter.assembleProgram(); 700 emitter.assembleProgram();
540 } 701 }
541 702
542 void updateFieldInitializers(Element field, HType propagatedType) {
543 assert(field.isField());
544 assert(field.isMember());
545 Map<Element, HType> fields =
546 fieldInitializers.putIfAbsent(
547 field.getEnclosingClass(), () => new Map<Element, HType>());
548 if (!fields.containsKey(field)) {
549 fields[field] = propagatedType;
550 } else {
551 fields[field] = fields[field].union(propagatedType);
552 }
553 }
554
555 HType typeFromInitializersSoFar(Element field) {
556 assert(field.isField());
557 assert(field.isMember());
558 if (!fieldInitializers.containsKey(field.getEnclosingClass())) {
559 return HType.CONFLICTING;
560 }
561 Map<Element, HType> fields = fieldInitializers[field.getEnclosingClass()];
562 return fields[field];
563 }
564
565 void updateFieldConstructorSetters(Element field, HType type) {
566 assert(field.isField());
567 assert(field.isMember());
568 Map<Element, HType> fields =
569 fieldConstructorSetters.putIfAbsent(
570 field.getEnclosingClass(), () => new Map<Element, HType>());
571 if (!fields.containsKey(field)) {
572 fields[field] = type;
573 } else {
574 fields[field] = fields[field].union(type);
575 }
576 }
577
578 // Check if this field is set in the constructor body.
579 bool hasConstructorBodyFieldSetter(Element field) {
580 ClassElement enclosingClass = field.getEnclosingClass();
581 if (!fieldConstructorSetters.containsKey(enclosingClass)) {
582 return false;
583 }
584 return fieldConstructorSetters[enclosingClass][field] != null;
585 }
586
587 // Provide an optimistic estimate of the type of a field after construction.
588 // If the constructor body has setters for fields returns HType.UNKNOWN.
589 // This only takes the initializer lists and field assignments in the
590 // constructor body into account. The constructor body might have method calls
591 // that could alter the field.
592 HType optimisticFieldTypeAfterConstruction(Element field) {
593 assert(field.isField());
594 assert(field.isMember());
595
596 ClassElement classElement = field.getEnclosingClass();
597 if (hasConstructorBodyFieldSetter(field)) {
598 // If there are field setters but there is only constructor then the type
599 // of the field is determined by the assignments in the constructor
600 // body.
601 var constructors = classElement.constructors;
602 if (constructors.head !== null && constructors.tail.isEmpty()) {
603 return fieldConstructorSetters[classElement][field];
604 } else {
605 return HType.UNKNOWN;
606 }
607 } else if (fieldInitializers.containsKey(classElement)) {
608 HType type = fieldInitializers[classElement][field];
609 return type == null ? HType.CONFLICTING : type;
610 } else {
611 return HType.CONFLICTING;
612 }
613 }
614
615 void updateFieldSetters(Element field, HType type) {
616 assert(field.isField());
617 assert(field.isMember());
618 Map<Element, HType> fields =
619 fieldSettersType.putIfAbsent(
620 field.getEnclosingClass(), () => new Map<Element, HType>());
621 if (!fields.containsKey(field)) {
622 fields[field] = type;
623 } else {
624 fields[field] = fields[field].union(type);
625 }
626 }
627
628 // Returns the type that field setters are setting the field to based on what
629 // have been seen during compilation so far.
630 HType fieldSettersTypeSoFar(Element field) {
631 assert(field.isField());
632 assert(field.isMember());
633 ClassElement enclosingClass = field.getEnclosingClass();
634 if (!fieldSettersType.containsKey(enclosingClass)) {
635 return HType.CONFLICTING;
636 }
637 Map<Element, HType> fields = fieldSettersType[enclosingClass];
638 if (!fields.containsKey(field)) return HType.CONFLICTING;
639 return fields[field];
640 }
641
642 /** 703 /**
643 * Documentation wanted -- johnniwinther 704 * Documentation wanted -- johnniwinther
644 * 705 *
645 * Invariant: [element] must be a declaration element. 706 * Invariant: [element] must be a declaration element.
646 */ 707 */
647 void scheduleForRecompilation(Element element) { 708 void scheduleForRecompilation(Element element) {
648 assert(invariant(element, element.isDeclaration)); 709 assert(invariant(element, element.isDeclaration));
649 if (compiler.phase == Compiler.PHASE_COMPILING) { 710 if (compiler.phase == Compiler.PHASE_COMPILING) {
650 invalidateAfterCodegen.add(element); 711 invalidateAfterCodegen.add(element);
651 } 712 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 * scheduled for recompilation. 761 * scheduled for recompilation.
701 * 762 *
702 * Invariant: [element] must be a declaration element. 763 * Invariant: [element] must be a declaration element.
703 */ 764 */
704 registerParameterTypesOptimization( 765 registerParameterTypesOptimization(
705 FunctionElement element, 766 FunctionElement element,
706 HTypeList parameterTypes, 767 HTypeList parameterTypes,
707 OptionalParameterTypes defaultValueTypes) { 768 OptionalParameterTypes defaultValueTypes) {
708 assert(invariant(element, element.isDeclaration)); 769 assert(invariant(element, element.isDeclaration));
709 if (element.parameterCount(compiler) == 0) return; 770 if (element.parameterCount(compiler) == 0) return;
710 argumentTypes.registerOptimization( 771 argumentTypes.registerOptimizedFunction(
711 element, parameterTypes, defaultValueTypes); 772 element, parameterTypes, defaultValueTypes);
712 } 773 }
713 774
775 registerFieldTypesOptimization(FunctionElement element,
776 Element field,
777 HType type) {
778 fieldTypes.registerOptimizedFunction(element, field, type);
779 }
780
714 /** 781 /**
715 * Documentation wanted -- johnniwinther 782 * Documentation wanted -- johnniwinther
716 * 783 *
717 * Invariant: [element] must be a declaration element. 784 * Invariant: [element] must be a declaration element.
718 */ 785 */
719 void registerReturnType(FunctionElement element, HType returnType) { 786 void registerReturnType(FunctionElement element, HType returnType) {
720 assert(invariant(element, element.isDeclaration)); 787 assert(invariant(element, element.isDeclaration));
721 ReturnInfo info = returnInfo[element]; 788 ReturnInfo info = returnInfo[element];
722 if (info != null) { 789 if (info != null) {
723 info.update(returnType, scheduleForRecompilation); 790 info.update(returnType, scheduleForRecompilation);
(...skipping 24 matching lines...) Expand all
748 } 815 }
749 816
750 void dumpReturnTypes() { 817 void dumpReturnTypes() {
751 returnInfo.forEach((Element element, ReturnInfo info) { 818 returnInfo.forEach((Element element, ReturnInfo info) {
752 if (info.returnType != HType.UNKNOWN) { 819 if (info.returnType != HType.UNKNOWN) {
753 print("Inferred $element has return type ${info.returnType}"); 820 print("Inferred $element has return type ${info.returnType}");
754 } 821 }
755 }); 822 });
756 } 823 }
757 824
825 void registerConstructor(Element element) {
826 fieldTypes.registerConstructor(element);
827 }
828
829 void registerFieldInitializer(Element field, HType type) {
830 fieldTypes.registerFieldInitializer(field, type);
831 }
832
833 void registerFieldConstructor(Element field, HType type) {
834 fieldTypes.registerFieldConstructor(field, type);
835 }
836
837 void registerFieldSetter(FunctionElement element, Element field, HType type) {
838 fieldTypes.registerFieldSetter(element, field, type);
839 }
840
841 void addedDynamicSetter(Selector setter, HType type) {
842 fieldTypes.addedDynamicSetter(setter, type);
843 }
844
845 HType optimisticFieldType(Element element) {
846 return fieldTypes.optimisticFieldType(element);
847 }
848
758 SourceString getCheckedModeHelper(DartType type) { 849 SourceString getCheckedModeHelper(DartType type) {
759 Element element = type.element; 850 Element element = type.element;
760 bool nativeCheck = 851 bool nativeCheck =
761 emitter.nativeEmitter.requiresNativeIsCheck(element); 852 emitter.nativeEmitter.requiresNativeIsCheck(element);
762 if (element == compiler.stringClass) { 853 if (element == compiler.stringClass) {
763 return const SourceString('stringTypeCheck'); 854 return const SourceString('stringTypeCheck');
764 } else if (element == compiler.doubleClass) { 855 } else if (element == compiler.doubleClass) {
765 return const SourceString('doubleTypeCheck'); 856 return const SourceString('doubleTypeCheck');
766 } else if (element == compiler.numClass) { 857 } else if (element == compiler.numClass) {
767 return const SourceString('numTypeCheck'); 858 return const SourceString('numTypeCheck');
(...skipping 19 matching lines...) Expand all
787 ? const SourceString('listSuperNativeTypeCheck') 878 ? const SourceString('listSuperNativeTypeCheck')
788 : const SourceString('listSuperTypeCheck'); 879 : const SourceString('listSuperTypeCheck');
789 } else { 880 } else {
790 return nativeCheck 881 return nativeCheck
791 ? const SourceString('callTypeCheck') 882 ? const SourceString('callTypeCheck')
792 : const SourceString('propertyTypeCheck'); 883 : const SourceString('propertyTypeCheck');
793 } 884 }
794 } 885 }
795 } 886 }
796 } 887 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698