| 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; |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 case BuiltinOperator.NumShr: | 942 case BuiltinOperator.NumShr: |
| 943 // No normalization required since output is always uint32. | 943 // No normalization required since output is always uint32. |
| 944 return js.js('# >>> #', args); | 944 return js.js('# >>> #', args); |
| 945 case BuiltinOperator.NumBitNot: | 945 case BuiltinOperator.NumBitNot: |
| 946 return js.js('(~#) >>> 0', args); | 946 return js.js('(~#) >>> 0', args); |
| 947 case BuiltinOperator.NumNegate: | 947 case BuiltinOperator.NumNegate: |
| 948 return js.js('-#', args); | 948 return js.js('-#', args); |
| 949 case BuiltinOperator.StringConcatenate: | 949 case BuiltinOperator.StringConcatenate: |
| 950 if (args.isEmpty) return js.string(''); | 950 if (args.isEmpty) return js.string(''); |
| 951 return args.reduce((e1,e2) => new js.Binary('+', e1, e2)); | 951 return args.reduce((e1,e2) => new js.Binary('+', e1, e2)); |
| 952 case BuiltinOperator.CharCodeAt: | |
| 953 return js.js('#.charCodeAt(#)', args); | |
| 954 case BuiltinOperator.Identical: | 952 case BuiltinOperator.Identical: |
| 955 registry.registerStaticUse(new StaticUse.staticInvoke( | 953 registry.registerStaticUse(new StaticUse.staticInvoke( |
| 956 glue.identicalFunction, new CallStructure.unnamed(args.length))); | 954 glue.identicalFunction, new CallStructure.unnamed(args.length))); |
| 957 return buildStaticHelperInvocation(glue.identicalFunction, args); | 955 return buildStaticHelperInvocation(glue.identicalFunction, args); |
| 958 case BuiltinOperator.StrictEq: | 956 case BuiltinOperator.StrictEq: |
| 959 return new js.Binary('===', args[0], args[1]); | 957 return new js.Binary('===', args[0], args[1]); |
| 960 case BuiltinOperator.StrictNeq: | 958 case BuiltinOperator.StrictNeq: |
| 961 return new js.Binary('!==', args[0], args[1]); | 959 return new js.Binary('!==', args[0], args[1]); |
| 962 case BuiltinOperator.LooseEq: | 960 case BuiltinOperator.LooseEq: |
| 963 return new js.Binary('==', args[0], args[1]); | 961 return new js.Binary('==', args[0], args[1]); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 void registerDefaultParameterValues(ExecutableElement element) { | 1089 void registerDefaultParameterValues(ExecutableElement element) { |
| 1092 if (element is! FunctionElement) return; | 1090 if (element is! FunctionElement) return; |
| 1093 FunctionElement function = element; | 1091 FunctionElement function = element; |
| 1094 if (function.isStatic) return; // Defaults are inlined at call sites. | 1092 if (function.isStatic) return; // Defaults are inlined at call sites. |
| 1095 function.functionSignature.forEachOptionalParameter((param) { | 1093 function.functionSignature.forEachOptionalParameter((param) { |
| 1096 ConstantValue constant = glue.getDefaultParameterValue(param); | 1094 ConstantValue constant = glue.getDefaultParameterValue(param); |
| 1097 registry.registerCompileTimeConstant(constant); | 1095 registry.registerCompileTimeConstant(constant); |
| 1098 }); | 1096 }); |
| 1099 } | 1097 } |
| 1100 } | 1098 } |
| OLD | NEW |