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

Side by Side Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.dart

Issue 1437373002: dart2js cps: Add CharCodeAt builtin. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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
OLDNEW
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 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 case BuiltinOperator.NumShr: 943 case BuiltinOperator.NumShr:
944 // No normalization required since output is always uint32. 944 // No normalization required since output is always uint32.
945 return js.js('# >>> #', args); 945 return js.js('# >>> #', args);
946 case BuiltinOperator.NumBitNot: 946 case BuiltinOperator.NumBitNot:
947 return js.js('(~#) >>> 0', args); 947 return js.js('(~#) >>> 0', args);
948 case BuiltinOperator.NumNegate: 948 case BuiltinOperator.NumNegate:
949 return js.js('-#', args); 949 return js.js('-#', args);
950 case BuiltinOperator.StringConcatenate: 950 case BuiltinOperator.StringConcatenate:
951 if (args.isEmpty) return js.string(''); 951 if (args.isEmpty) return js.string('');
952 return args.reduce((e1,e2) => new js.Binary('+', e1, e2)); 952 return args.reduce((e1,e2) => new js.Binary('+', e1, e2));
953 case BuiltinOperator.CharCodeAt:
954 return js.js('#.charCodeAt(#)', args);
953 case BuiltinOperator.Identical: 955 case BuiltinOperator.Identical:
954 registry.registerStaticUse(new StaticUse.staticInvoke( 956 registry.registerStaticUse(new StaticUse.staticInvoke(
955 glue.identicalFunction, new CallStructure.unnamed(args.length))); 957 glue.identicalFunction, new CallStructure.unnamed(args.length)));
956 return buildStaticHelperInvocation(glue.identicalFunction, args); 958 return buildStaticHelperInvocation(glue.identicalFunction, args);
957 case BuiltinOperator.StrictEq: 959 case BuiltinOperator.StrictEq:
958 return new js.Binary('===', args[0], args[1]); 960 return new js.Binary('===', args[0], args[1]);
959 case BuiltinOperator.StrictNeq: 961 case BuiltinOperator.StrictNeq:
960 return new js.Binary('!==', args[0], args[1]); 962 return new js.Binary('!==', args[0], args[1]);
961 case BuiltinOperator.LooseEq: 963 case BuiltinOperator.LooseEq:
962 return new js.Binary('==', args[0], args[1]); 964 return new js.Binary('==', args[0], args[1]);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 void registerDefaultParameterValues(ExecutableElement element) { 1092 void registerDefaultParameterValues(ExecutableElement element) {
1091 if (element is! FunctionElement) return; 1093 if (element is! FunctionElement) return;
1092 FunctionElement function = element; 1094 FunctionElement function = element;
1093 if (function.isStatic) return; // Defaults are inlined at call sites. 1095 if (function.isStatic) return; // Defaults are inlined at call sites.
1094 function.functionSignature.forEachOptionalParameter((param) { 1096 function.functionSignature.forEachOptionalParameter((param) {
1095 ConstantValue constant = glue.getDefaultParameterValue(param); 1097 ConstantValue constant = glue.getDefaultParameterValue(param);
1096 registry.registerCompileTimeConstant(constant); 1098 registry.registerCompileTimeConstant(constant);
1097 }); 1099 });
1098 } 1100 }
1099 } 1101 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_propagation.dart ('k') | pkg/compiler/lib/src/types/type_mask.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698