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

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

Issue 1685893002: cpsir: insert guard and force specialization for [] and []= (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
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 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 case BuiltinOperator.LooseNeq: 1116 case BuiltinOperator.LooseNeq:
1117 return new js.Binary('!=', args[0], args[1]); 1117 return new js.Binary('!=', args[0], args[1]);
1118 case BuiltinOperator.IsFalsy: 1118 case BuiltinOperator.IsFalsy:
1119 return new js.Prefix('!', args[0]); 1119 return new js.Prefix('!', args[0]);
1120 case BuiltinOperator.IsNumber: 1120 case BuiltinOperator.IsNumber:
1121 return js.js('typeof # === "number"', args); 1121 return js.js('typeof # === "number"', args);
1122 case BuiltinOperator.IsNotNumber: 1122 case BuiltinOperator.IsNotNumber:
1123 return js.js('typeof # !== "number"', args); 1123 return js.js('typeof # !== "number"', args);
1124 case BuiltinOperator.IsFloor: 1124 case BuiltinOperator.IsFloor:
1125 return js.js('Math.floor(#) === #', args); 1125 return js.js('Math.floor(#) === #', args);
1126 case BuiltinOperator.IsNumberAndFloor: 1126 case BuiltinOperator.IsInteger:
1127 return js.js('typeof # === "number" && Math.floor(#) === #', args); 1127 return js.js('typeof # === "number" && Math.floor(#) === #', args);
1128 case BuiltinOperator.IsNotInteger:
1129 return js.js('typeof # !== "number" || Math.floor(#) !== #', args);
1128 case BuiltinOperator.IsFixedLengthJSArray: 1130 case BuiltinOperator.IsFixedLengthJSArray:
1129 // TODO(sra): Remove boolify (i.e. !!). 1131 // TODO(sra): Remove boolify (i.e. !!).
1130 return js.js(r'!!#.fixed$length', args); 1132 return js.js(r'!!#.fixed$length', args);
1131 case BuiltinOperator.IsExtendableJSArray: 1133 case BuiltinOperator.IsExtendableJSArray:
1132 return js.js(r'!#.fixed$length', args); 1134 return js.js(r'!#.fixed$length', args);
1133 case BuiltinOperator.IsModifiableJSArray: 1135 case BuiltinOperator.IsModifiableJSArray:
1134 return js.js(r'!#.immutable$list', args); 1136 return js.js(r'!#.immutable$list', args);
1135 case BuiltinOperator.IsUnmodifiableJSArray: 1137 case BuiltinOperator.IsUnmodifiableJSArray:
1136 // TODO(sra): Remove boolify (i.e. !!). 1138 // TODO(sra): Remove boolify (i.e. !!).
1137 return js.js(r'!!#.immutable$list', args); 1139 return js.js(r'!!#.immutable$list', args);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 void registerDefaultParameterValues(ExecutableElement element) { 1239 void registerDefaultParameterValues(ExecutableElement element) {
1238 if (element is! FunctionElement) return; 1240 if (element is! FunctionElement) return;
1239 FunctionElement function = element; 1241 FunctionElement function = element;
1240 if (function.isStatic) return; // Defaults are inlined at call sites. 1242 if (function.isStatic) return; // Defaults are inlined at call sites.
1241 function.functionSignature.forEachOptionalParameter((param) { 1243 function.functionSignature.forEachOptionalParameter((param) {
1242 ConstantValue constant = glue.getDefaultParameterValue(param); 1244 ConstantValue constant = glue.getDefaultParameterValue(param);
1243 registry.registerCompileTimeConstant(constant); 1245 registry.registerCompileTimeConstant(constant);
1244 }); 1246 });
1245 } 1247 }
1246 } 1248 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_propagation.dart ('k') | pkg/compiler/lib/src/tree_ir/optimization/logical_rewriter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698