OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 code_generator; | 5 library code_generator; |
6 | 6 |
7 import 'glue.dart'; | 7 import 'glue.dart'; |
8 | 8 |
9 import '../../closure.dart' show | 9 import '../../closure.dart' show |
10 ClosureClassElement; | 10 ClosureClassElement; |
11 import '../../common.dart'; | 11 import '../../common.dart'; |
12 import '../../common/codegen.dart' show | 12 import '../../common/codegen.dart' show |
13 CodegenRegistry; | 13 CodegenRegistry; |
14 import '../../constants/values.dart'; | 14 import '../../constants/values.dart'; |
15 import '../../dart_types.dart'; | 15 import '../../dart_types.dart'; |
16 import '../../elements/elements.dart'; | 16 import '../../elements/elements.dart'; |
17 import '../../io/source_information.dart' show | 17 import '../../io/source_information.dart' show |
18 SourceInformation; | 18 SourceInformation; |
19 import '../../js/js.dart' as js; | 19 import '../../js/js.dart' as js; |
20 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir; | 20 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir; |
21 import '../../tree_ir/tree_ir_nodes.dart' show | 21 import '../../tree_ir/tree_ir_nodes.dart' show |
22 BuiltinMethod, | 22 BuiltinMethod, |
23 BuiltinOperator; | 23 BuiltinOperator; |
24 import '../../types/types.dart' show | 24 import '../../types/types.dart' show |
25 TypeMask; | 25 TypeMask; |
| 26 import '../../universe/call_structure.dart' show |
| 27 CallStructure; |
26 import '../../universe/selector.dart' show | 28 import '../../universe/selector.dart' show |
27 Selector; | 29 Selector; |
28 import '../../universe/universe.dart' show | 30 import '../../universe/universe.dart' show |
29 UniverseSelector; | 31 UniverseSelector; |
| 32 import '../../universe/use.dart' show |
| 33 StaticUse; |
30 import '../../util/maplet.dart'; | 34 import '../../util/maplet.dart'; |
31 | 35 |
32 class CodegenBailout { | 36 class CodegenBailout { |
33 final tree_ir.Node node; | 37 final tree_ir.Node node; |
34 final String reason; | 38 final String reason; |
35 CodegenBailout(this.node, this.reason); | 39 CodegenBailout(this.node, this.reason); |
36 String get message { | 40 String get message { |
37 return 'bailout${node != null ? " on $node" : ""}: $reason'; | 41 return 'bailout${node != null ? " on $node" : ""}: $reason'; |
38 } | 42 } |
39 } | 43 } |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 @override | 233 @override |
230 js.Expression visitConstant(tree_ir.Constant node) { | 234 js.Expression visitConstant(tree_ir.Constant node) { |
231 return buildConstant( | 235 return buildConstant( |
232 node.value, | 236 node.value, |
233 sourceInformation: node.sourceInformation); | 237 sourceInformation: node.sourceInformation); |
234 } | 238 } |
235 | 239 |
236 js.Expression buildStaticInvoke(Element target, | 240 js.Expression buildStaticInvoke(Element target, |
237 List<js.Expression> arguments, | 241 List<js.Expression> arguments, |
238 {SourceInformation sourceInformation}) { | 242 {SourceInformation sourceInformation}) { |
239 registry.registerStaticInvocation(target.declaration); | 243 if (target.isConstructor) { |
| 244 // TODO(johnniwinther): Avoid dependency on [isGenerativeConstructor] by |
| 245 // using backend-specific [StatisUse] classes. |
| 246 registry.registerStaticUse( |
| 247 new StaticUse.constructorInvoke(target.declaration, |
| 248 new CallStructure.unnamed(arguments.length))); |
| 249 } else { |
| 250 registry.registerStaticUse( |
| 251 new StaticUse.staticInvoke(target.declaration, |
| 252 new CallStructure.unnamed(arguments.length))); |
| 253 } |
240 js.Expression elementAccess = glue.staticFunctionAccess(target); | 254 js.Expression elementAccess = glue.staticFunctionAccess(target); |
241 return new js.Call(elementAccess, arguments, | 255 return new js.Call(elementAccess, arguments, |
242 sourceInformation: sourceInformation); | 256 sourceInformation: sourceInformation); |
243 } | 257 } |
244 | 258 |
245 @override | 259 @override |
246 js.Expression visitInvokeConstructor(tree_ir.InvokeConstructor node) { | 260 js.Expression visitInvokeConstructor(tree_ir.InvokeConstructor node) { |
247 if (node.constant != null) return giveup(node); | 261 if (node.constant != null) return giveup(node); |
248 | 262 |
249 registry.registerInstantiatedType(node.type); | 263 registry.registerInstantiation(node.type); |
250 FunctionElement target = node.target; | 264 FunctionElement target = node.target; |
251 List<js.Expression> arguments = visitExpressionList(node.arguments); | 265 List<js.Expression> arguments = visitExpressionList(node.arguments); |
252 return buildStaticInvoke( | 266 return buildStaticInvoke( |
253 target, arguments, sourceInformation: node.sourceInformation); | 267 target, |
| 268 arguments, |
| 269 sourceInformation: node.sourceInformation); |
254 } | 270 } |
255 | 271 |
256 void registerMethodInvoke(tree_ir.InvokeMethod node) { | 272 void registerMethodInvoke(tree_ir.InvokeMethod node) { |
257 Selector selector = node.selector; | 273 Selector selector = node.selector; |
258 TypeMask mask = node.mask; | 274 TypeMask mask = node.mask; |
259 if (selector.isGetter) { | 275 if (selector.isGetter) { |
260 registry.registerDynamicGetter(new UniverseSelector(selector, mask)); | 276 registry.registerDynamicUse(new UniverseSelector(selector, mask)); |
261 } else if (selector.isSetter) { | 277 } else if (selector.isSetter) { |
262 registry.registerDynamicSetter(new UniverseSelector(selector, mask)); | 278 registry.registerDynamicUse(new UniverseSelector(selector, mask)); |
263 } else { | 279 } else { |
264 assert(invariant(CURRENT_ELEMENT_SPANNABLE, | 280 assert(invariant(CURRENT_ELEMENT_SPANNABLE, |
265 selector.isCall || selector.isOperator || | 281 selector.isCall || selector.isOperator || |
266 selector.isIndex || selector.isIndexSet, | 282 selector.isIndex || selector.isIndexSet, |
267 message: 'unexpected kind ${selector.kind}')); | 283 message: 'unexpected kind ${selector.kind}')); |
268 // TODO(sigurdm): We should find a better place to register the call. | 284 // TODO(sigurdm): We should find a better place to register the call. |
269 Selector call = new Selector.callClosureFrom(selector); | 285 Selector call = new Selector.callClosureFrom(selector); |
270 registry.registerDynamicInvocation(new UniverseSelector(call, null)); | 286 registry.registerDynamicUse(new UniverseSelector(call, null)); |
271 registry.registerDynamicInvocation(new UniverseSelector(selector, mask)); | 287 registry.registerDynamicUse(new UniverseSelector(selector, mask)); |
272 } | 288 } |
273 } | 289 } |
274 | 290 |
275 @override | 291 @override |
276 js.Expression visitInvokeMethod(tree_ir.InvokeMethod node) { | 292 js.Expression visitInvokeMethod(tree_ir.InvokeMethod node) { |
277 registerMethodInvoke(node); | 293 registerMethodInvoke(node); |
278 return js.propertyCall(visitExpression(node.receiver), | 294 return js.propertyCall(visitExpression(node.receiver), |
279 glue.invocationName(node.selector), | 295 glue.invocationName(node.selector), |
280 visitExpressionList(node.arguments)) | 296 visitExpressionList(node.arguments)) |
281 .withSourceInformation(node.sourceInformation); | 297 .withSourceInformation(node.sourceInformation); |
282 } | 298 } |
283 | 299 |
284 @override | 300 @override |
285 js.Expression visitInvokeStatic(tree_ir.InvokeStatic node) { | 301 js.Expression visitInvokeStatic(tree_ir.InvokeStatic node) { |
286 FunctionElement target = node.target; | 302 FunctionElement target = node.target; |
287 List<js.Expression> arguments = visitExpressionList(node.arguments); | 303 List<js.Expression> arguments = visitExpressionList(node.arguments); |
288 return buildStaticInvoke(target, arguments, | 304 return buildStaticInvoke(target, arguments, |
289 sourceInformation: node.sourceInformation); | 305 sourceInformation: node.sourceInformation); |
290 } | 306 } |
291 | 307 |
292 @override | 308 @override |
293 js.Expression visitInvokeMethodDirectly(tree_ir.InvokeMethodDirectly node) { | 309 js.Expression visitInvokeMethodDirectly(tree_ir.InvokeMethodDirectly node) { |
294 registry.registerDirectInvocation(node.target.declaration); | |
295 if (node.target is ConstructorBodyElement) { | 310 if (node.target is ConstructorBodyElement) { |
| 311 registry.registerStaticUse( |
| 312 new StaticUse.constructorBodyInvoke( |
| 313 node.target.declaration, |
| 314 new CallStructure.unnamed(node.arguments.length))); |
296 // A constructor body cannot be overriden or intercepted, so we can | 315 // A constructor body cannot be overriden or intercepted, so we can |
297 // use the short form for this invocation. | 316 // use the short form for this invocation. |
298 return js.js('#.#(#)', | 317 return js.js('#.#(#)', |
299 [visitExpression(node.receiver), | 318 [visitExpression(node.receiver), |
300 glue.instanceMethodName(node.target), | 319 glue.instanceMethodName(node.target), |
301 visitExpressionList(node.arguments)]) | 320 visitExpressionList(node.arguments)]) |
302 .withSourceInformation(node.sourceInformation); | 321 .withSourceInformation(node.sourceInformation); |
303 } | 322 } |
| 323 registry.registerStaticUse( |
| 324 new StaticUse.superInvoke( |
| 325 node.target.declaration, |
| 326 new CallStructure.unnamed(node.arguments.length))); |
304 return js.js('#.#.call(#, #)', | 327 return js.js('#.#.call(#, #)', |
305 [glue.prototypeAccess(node.target.enclosingClass), | 328 [glue.prototypeAccess(node.target.enclosingClass), |
306 glue.invocationName(node.selector), | 329 glue.invocationName(node.selector), |
307 visitExpression(node.receiver), | 330 visitExpression(node.receiver), |
308 visitExpressionList(node.arguments)]) | 331 visitExpressionList(node.arguments)]) |
309 .withSourceInformation(node.sourceInformation); | 332 .withSourceInformation(node.sourceInformation); |
310 } | 333 } |
311 | 334 |
312 @override | 335 @override |
313 js.Expression visitLiteralList(tree_ir.LiteralList node) { | 336 js.Expression visitLiteralList(tree_ir.LiteralList node) { |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 return new js.ObjectInitializer(const <js.Property>[]); | 694 return new js.ObjectInitializer(const <js.Property>[]); |
672 } | 695 } |
673 | 696 |
674 @override | 697 @override |
675 js.Expression visitCreateInstance(tree_ir.CreateInstance node) { | 698 js.Expression visitCreateInstance(tree_ir.CreateInstance node) { |
676 ClassElement classElement = node.classElement; | 699 ClassElement classElement = node.classElement; |
677 // TODO(asgerf): To allow inlining of InvokeConstructor, CreateInstance must | 700 // TODO(asgerf): To allow inlining of InvokeConstructor, CreateInstance must |
678 // carry a DartType so we can register the instantiated type | 701 // carry a DartType so we can register the instantiated type |
679 // with its type arguments. Otherwise dataflow analysis is | 702 // with its type arguments. Otherwise dataflow analysis is |
680 // needed to reconstruct the instantiated type. | 703 // needed to reconstruct the instantiated type. |
681 registry.registerInstantiatedClass(classElement); | 704 registry.registerInstantiation(classElement.rawType); |
682 if (classElement is ClosureClassElement) { | 705 if (classElement is ClosureClassElement) { |
683 registry.registerInstantiatedClosure(classElement.methodElement); | 706 registry.registerInstantiatedClosure(classElement.methodElement); |
684 } | 707 } |
685 js.Expression instance = new js.New( | 708 js.Expression instance = new js.New( |
686 glue.constructorAccess(classElement), | 709 glue.constructorAccess(classElement), |
687 visitExpressionList(node.arguments)) | 710 visitExpressionList(node.arguments)) |
688 .withSourceInformation(node.sourceInformation); | 711 .withSourceInformation(node.sourceInformation); |
689 | 712 |
690 List<tree_ir.Expression> typeInformation = node.typeInformation; | 713 List<tree_ir.Expression> typeInformation = node.typeInformation; |
691 assert(typeInformation.isEmpty || | 714 assert(typeInformation.isEmpty || |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 registry.registerSpecializedGetInterceptor(node.interceptedClasses); | 746 registry.registerSpecializedGetInterceptor(node.interceptedClasses); |
724 js.Name helperName = glue.getInterceptorName(node.interceptedClasses); | 747 js.Name helperName = glue.getInterceptorName(node.interceptedClasses); |
725 js.Expression globalHolder = glue.getInterceptorLibrary(); | 748 js.Expression globalHolder = glue.getInterceptorLibrary(); |
726 return js.js('#.#(#)', | 749 return js.js('#.#(#)', |
727 [globalHolder, helperName, visitExpression(node.input)]) | 750 [globalHolder, helperName, visitExpression(node.input)]) |
728 .withSourceInformation(node.sourceInformation); | 751 .withSourceInformation(node.sourceInformation); |
729 } | 752 } |
730 | 753 |
731 @override | 754 @override |
732 js.Expression visitGetField(tree_ir.GetField node) { | 755 js.Expression visitGetField(tree_ir.GetField node) { |
733 registry.registerFieldGetter(node.field); | 756 registry.registerStaticUse(new StaticUse.fieldGet(node.field)); |
734 return new js.PropertyAccess( | 757 return new js.PropertyAccess( |
735 visitExpression(node.object), | 758 visitExpression(node.object), |
736 glue.instanceFieldPropertyName(node.field)); | 759 glue.instanceFieldPropertyName(node.field)); |
737 } | 760 } |
738 | 761 |
739 @override | 762 @override |
740 js.Assignment visitSetField(tree_ir.SetField node) { | 763 js.Assignment visitSetField(tree_ir.SetField node) { |
741 registry.registerFieldSetter(node.field); | 764 registry.registerStaticUse(new StaticUse.fieldSet(node.field)); |
742 js.PropertyAccess field = | 765 js.PropertyAccess field = |
743 new js.PropertyAccess( | 766 new js.PropertyAccess( |
744 visitExpression(node.object), | 767 visitExpression(node.object), |
745 glue.instanceFieldPropertyName(node.field)); | 768 glue.instanceFieldPropertyName(node.field)); |
746 return new js.Assignment(field, visitExpression(node.value)); | 769 return new js.Assignment(field, visitExpression(node.value)); |
747 } | 770 } |
748 | 771 |
749 @override | 772 @override |
750 js.Expression visitGetStatic(tree_ir.GetStatic node) { | 773 js.Expression visitGetStatic(tree_ir.GetStatic node) { |
751 assert(node.element is FieldElement || node.element is FunctionElement); | 774 assert(node.element is FieldElement || node.element is FunctionElement); |
752 if (node.element is FunctionElement) { | 775 if (node.element is FunctionElement) { |
753 // Tear off a method. | 776 // Tear off a method. |
754 registry.registerGetOfStaticFunction(node.element.declaration); | 777 registry.registerStaticUse( |
| 778 new StaticUse.staticTearOff(node.element.declaration)); |
755 return glue.isolateStaticClosureAccess(node.element); | 779 return glue.isolateStaticClosureAccess(node.element); |
756 } | 780 } |
757 if (glue.isLazilyInitialized(node.element)) { | 781 if (glue.isLazilyInitialized(node.element)) { |
758 // Read a lazily initialized field. | 782 // Read a lazily initialized field. |
759 registry.registerStaticUse(node.element.declaration); | 783 registry.registerStaticUse( |
| 784 new StaticUse.staticInit(node.element.declaration)); |
760 js.Expression getter = glue.isolateLazyInitializerAccess(node.element); | 785 js.Expression getter = glue.isolateLazyInitializerAccess(node.element); |
761 return new js.Call(getter, <js.Expression>[], | 786 return new js.Call(getter, <js.Expression>[], |
762 sourceInformation: node.sourceInformation); | 787 sourceInformation: node.sourceInformation); |
763 } | 788 } |
764 // Read an eagerly initialized field. | 789 // Read an eagerly initialized field. |
765 registry.registerStaticUse(node.element.declaration); | 790 registry.registerStaticUse( |
| 791 new StaticUse.staticGet(node.element.declaration)); |
766 return glue.staticFieldAccess(node.element); | 792 return glue.staticFieldAccess(node.element); |
767 } | 793 } |
768 | 794 |
769 @override | 795 @override |
770 js.Expression visitSetStatic(tree_ir.SetStatic node) { | 796 js.Expression visitSetStatic(tree_ir.SetStatic node) { |
771 assert(node.element is FieldElement); | 797 assert(node.element is FieldElement); |
772 registry.registerStaticUse(node.element.declaration); | 798 registry.registerStaticUse( |
| 799 new StaticUse.staticSet(node.element.declaration)); |
773 js.Expression field = glue.staticFieldAccess(node.element); | 800 js.Expression field = glue.staticFieldAccess(node.element); |
774 js.Expression value = visitExpression(node.value); | 801 js.Expression value = visitExpression(node.value); |
775 return new js.Assignment(field, value); | 802 return new js.Assignment(field, value); |
776 } | 803 } |
777 | 804 |
778 @override | 805 @override |
779 js.Expression visitGetLength(tree_ir.GetLength node) { | 806 js.Expression visitGetLength(tree_ir.GetLength node) { |
780 return new js.PropertyAccess.field(visitExpression(node.object), 'length'); | 807 return new js.PropertyAccess.field(visitExpression(node.object), 'length'); |
781 } | 808 } |
782 | 809 |
783 @override | 810 @override |
784 js.Expression visitGetIndex(tree_ir.GetIndex node) { | 811 js.Expression visitGetIndex(tree_ir.GetIndex node) { |
785 return new js.PropertyAccess( | 812 return new js.PropertyAccess( |
786 visitExpression(node.object), | 813 visitExpression(node.object), |
787 visitExpression(node.index)); | 814 visitExpression(node.index)); |
788 } | 815 } |
789 | 816 |
790 @override | 817 @override |
791 js.Expression visitSetIndex(tree_ir.SetIndex node) { | 818 js.Expression visitSetIndex(tree_ir.SetIndex node) { |
792 return js.js('#[#] = #', | 819 return js.js('#[#] = #', |
793 [visitExpression(node.object), | 820 [visitExpression(node.object), |
794 visitExpression(node.index), | 821 visitExpression(node.index), |
795 visitExpression(node.value)]); | 822 visitExpression(node.value)]); |
796 } | 823 } |
797 | 824 |
798 js.Expression buildStaticHelperInvocation( | 825 js.Expression buildStaticHelperInvocation( |
799 FunctionElement helper, | 826 FunctionElement helper, |
800 List<js.Expression> arguments, | 827 List<js.Expression> arguments, |
801 {SourceInformation sourceInformation}) { | 828 {SourceInformation sourceInformation}) { |
802 registry.registerStaticUse(helper); | 829 registry.registerStaticUse(new StaticUse.staticInvoke( |
| 830 helper, new CallStructure.unnamed(arguments.length))); |
803 return buildStaticInvoke( | 831 return buildStaticInvoke( |
804 helper, arguments, sourceInformation: sourceInformation); | 832 helper, arguments, sourceInformation: sourceInformation); |
805 } | 833 } |
806 | 834 |
807 @override | 835 @override |
808 js.Expression visitReifyRuntimeType(tree_ir.ReifyRuntimeType node) { | 836 js.Expression visitReifyRuntimeType(tree_ir.ReifyRuntimeType node) { |
809 js.Expression typeToString = buildStaticHelperInvocation( | 837 js.Expression typeToString = buildStaticHelperInvocation( |
810 glue.getRuntimeTypeToString(), | 838 glue.getRuntimeTypeToString(), |
811 [visitExpression(node.value)], | 839 [visitExpression(node.value)], |
812 sourceInformation: node.sourceInformation); | 840 sourceInformation: node.sourceInformation); |
(...skipping 24 matching lines...) Expand all Loading... |
837 @override | 865 @override |
838 js.Expression visitTypeExpression(tree_ir.TypeExpression node) { | 866 js.Expression visitTypeExpression(tree_ir.TypeExpression node) { |
839 List<js.Expression> arguments = visitExpressionList(node.arguments); | 867 List<js.Expression> arguments = visitExpressionList(node.arguments); |
840 return glue.generateTypeRepresentation(node.dartType, arguments, registry); | 868 return glue.generateTypeRepresentation(node.dartType, arguments, registry); |
841 } | 869 } |
842 | 870 |
843 js.Node handleForeignCode(tree_ir.ForeignCode node) { | 871 js.Node handleForeignCode(tree_ir.ForeignCode node) { |
844 if (node.dependency != null) { | 872 if (node.dependency != null) { |
845 // Dependency is only used if [node] calls a Dart function. Currently only | 873 // Dependency is only used if [node] calls a Dart function. Currently only |
846 // through foreign function `RAW_DART_FUNCTION_REF`. | 874 // through foreign function `RAW_DART_FUNCTION_REF`. |
847 registry.registerStaticUse(node.dependency); | 875 registry.registerStaticUse( |
| 876 new StaticUse.staticInvoke( |
| 877 node.dependency, |
| 878 new CallStructure.unnamed(node.arguments.length))); |
848 } | 879 } |
849 // TODO(sra): Should this be in CodegenRegistry? | 880 // TODO(sra,johnniwinther): Should this be in CodegenRegistry? |
850 glue.registerNativeBehavior(node.nativeBehavior, node); | 881 glue.registerNativeBehavior(node.nativeBehavior, node); |
851 return node.codeTemplate.instantiate(visitExpressionList(node.arguments)); | 882 return node.codeTemplate.instantiate(visitExpressionList(node.arguments)); |
852 } | 883 } |
853 | 884 |
854 @override | 885 @override |
855 js.Expression visitForeignExpression(tree_ir.ForeignExpression node) { | 886 js.Expression visitForeignExpression(tree_ir.ForeignExpression node) { |
856 return handleForeignCode(node); | 887 return handleForeignCode(node); |
857 } | 888 } |
858 | 889 |
859 @override | 890 @override |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 // No normalization required since output is always uint32. | 934 // No normalization required since output is always uint32. |
904 return js.js('# >>> #', args); | 935 return js.js('# >>> #', args); |
905 case BuiltinOperator.NumBitNot: | 936 case BuiltinOperator.NumBitNot: |
906 return js.js('(~#) >>> 0', args); | 937 return js.js('(~#) >>> 0', args); |
907 case BuiltinOperator.NumNegate: | 938 case BuiltinOperator.NumNegate: |
908 return js.js('-#', args); | 939 return js.js('-#', args); |
909 case BuiltinOperator.StringConcatenate: | 940 case BuiltinOperator.StringConcatenate: |
910 if (args.isEmpty) return js.string(''); | 941 if (args.isEmpty) return js.string(''); |
911 return args.reduce((e1,e2) => new js.Binary('+', e1, e2)); | 942 return args.reduce((e1,e2) => new js.Binary('+', e1, e2)); |
912 case BuiltinOperator.Identical: | 943 case BuiltinOperator.Identical: |
913 registry.registerStaticInvocation(glue.identicalFunction); | 944 registry.registerStaticUse(new StaticUse.staticInvoke( |
| 945 glue.identicalFunction, new CallStructure.unnamed(args.length))); |
914 return buildStaticHelperInvocation(glue.identicalFunction, args); | 946 return buildStaticHelperInvocation(glue.identicalFunction, args); |
915 case BuiltinOperator.StrictEq: | 947 case BuiltinOperator.StrictEq: |
916 return new js.Binary('===', args[0], args[1]); | 948 return new js.Binary('===', args[0], args[1]); |
917 case BuiltinOperator.StrictNeq: | 949 case BuiltinOperator.StrictNeq: |
918 return new js.Binary('!==', args[0], args[1]); | 950 return new js.Binary('!==', args[0], args[1]); |
919 case BuiltinOperator.LooseEq: | 951 case BuiltinOperator.LooseEq: |
920 return new js.Binary('==', args[0], args[1]); | 952 return new js.Binary('==', args[0], args[1]); |
921 case BuiltinOperator.LooseNeq: | 953 case BuiltinOperator.LooseNeq: |
922 return new js.Binary('!=', args[0], args[1]); | 954 return new js.Binary('!=', args[0], args[1]); |
923 case BuiltinOperator.IsFalsy: | 955 case BuiltinOperator.IsFalsy: |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 void registerDefaultParameterValues(ExecutableElement element) { | 1080 void registerDefaultParameterValues(ExecutableElement element) { |
1049 if (element is! FunctionElement) return; | 1081 if (element is! FunctionElement) return; |
1050 FunctionElement function = element; | 1082 FunctionElement function = element; |
1051 if (function.isStatic) return; // Defaults are inlined at call sites. | 1083 if (function.isStatic) return; // Defaults are inlined at call sites. |
1052 function.functionSignature.forEachOptionalParameter((param) { | 1084 function.functionSignature.forEachOptionalParameter((param) { |
1053 ConstantValue constant = glue.getDefaultParameterValue(param); | 1085 ConstantValue constant = glue.getDefaultParameterValue(param); |
1054 registry.registerCompileTimeConstant(constant); | 1086 registry.registerCompileTimeConstant(constant); |
1055 }); | 1087 }); |
1056 } | 1088 } |
1057 } | 1089 } |
OLD | NEW |