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

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

Issue 2561533002: dart2js: Constant folding and specialization for remainder (Closed)
Patch Set: fix range analysis Created 4 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) 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 import 'dart:math' as math; 5 import 'dart:math' as math;
6 import '../common.dart'; 6 import '../common.dart';
7 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; 7 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
8 import '../common/tasks.dart' show CompilerTask; 8 import '../common/tasks.dart' show CompilerTask;
9 import '../compiler.dart' show Compiler; 9 import '../compiler.dart' show Compiler;
10 import '../constants/constant_system.dart'; 10 import '../constants/constant_system.dart';
(...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 assert(node.right.isPositiveInteger(compiler)); 1388 assert(node.right.isPositiveInteger(compiler));
1389 use(node.left); 1389 use(node.left);
1390 js.Expression jsLeft = pop(); 1390 js.Expression jsLeft = pop();
1391 use(node.right); 1391 use(node.right);
1392 push(new js.Binary('/', jsLeft, pop()) 1392 push(new js.Binary('/', jsLeft, pop())
1393 .withSourceInformation(node.sourceInformation)); 1393 .withSourceInformation(node.sourceInformation));
1394 push(new js.Binary('|', pop(), new js.LiteralNumber("0")) 1394 push(new js.Binary('|', pop(), new js.LiteralNumber("0"))
1395 .withSourceInformation(node.sourceInformation)); 1395 .withSourceInformation(node.sourceInformation));
1396 } 1396 }
1397 1397
1398 visitRemainder(HRemainder node) {
1399 return visitInvokeBinary(node, '%');
1400 }
1401
1398 visitNegate(HNegate node) => visitInvokeUnary(node, '-'); 1402 visitNegate(HNegate node) => visitInvokeUnary(node, '-');
1399 1403
1400 visitLess(HLess node) => visitRelational(node, '<'); 1404 visitLess(HLess node) => visitRelational(node, '<');
1401 visitLessEqual(HLessEqual node) => visitRelational(node, '<='); 1405 visitLessEqual(HLessEqual node) => visitRelational(node, '<=');
1402 visitGreater(HGreater node) => visitRelational(node, '>'); 1406 visitGreater(HGreater node) => visitRelational(node, '>');
1403 visitGreaterEqual(HGreaterEqual node) => visitRelational(node, '>='); 1407 visitGreaterEqual(HGreaterEqual node) => visitRelational(node, '>=');
1404 1408
1405 visitBoolify(HBoolify node) { 1409 visitBoolify(HBoolify node) {
1406 assert(node.inputs.length == 1); 1410 assert(node.inputs.length == 1);
1407 use(node.inputs[0]); 1411 use(node.inputs[0]);
(...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after
3096 registry.registerStaticUse(new StaticUse.staticInvoke( 3100 registry.registerStaticUse(new StaticUse.staticInvoke(
3097 helper, new CallStructure.unnamed(argumentCount))); 3101 helper, new CallStructure.unnamed(argumentCount)));
3098 return backend.emitter.staticFunctionAccess(helper); 3102 return backend.emitter.staticFunctionAccess(helper);
3099 } 3103 }
3100 3104
3101 @override 3105 @override
3102 void visitRef(HRef node) { 3106 void visitRef(HRef node) {
3103 visit(node.value); 3107 visit(node.value);
3104 } 3108 }
3105 } 3109 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698