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

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

Issue 2561533002: dart2js: Constant folding and specialization for remainder (Closed)
Patch Set: improve range analysis of remainder Created 3 years, 11 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) 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 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 assert(node.right.isPositiveInteger(closedWorld)); 1403 assert(node.right.isPositiveInteger(closedWorld));
1404 use(node.left); 1404 use(node.left);
1405 js.Expression jsLeft = pop(); 1405 js.Expression jsLeft = pop();
1406 use(node.right); 1406 use(node.right);
1407 push(new js.Binary('/', jsLeft, pop()) 1407 push(new js.Binary('/', jsLeft, pop())
1408 .withSourceInformation(node.sourceInformation)); 1408 .withSourceInformation(node.sourceInformation));
1409 push(new js.Binary('|', pop(), new js.LiteralNumber("0")) 1409 push(new js.Binary('|', pop(), new js.LiteralNumber("0"))
1410 .withSourceInformation(node.sourceInformation)); 1410 .withSourceInformation(node.sourceInformation));
1411 } 1411 }
1412 1412
1413 visitRemainder(HRemainder node) {
1414 return visitInvokeBinary(node, '%');
1415 }
1416
1413 visitNegate(HNegate node) => visitInvokeUnary(node, '-'); 1417 visitNegate(HNegate node) => visitInvokeUnary(node, '-');
1414 1418
1415 visitLess(HLess node) => visitRelational(node, '<'); 1419 visitLess(HLess node) => visitRelational(node, '<');
1416 visitLessEqual(HLessEqual node) => visitRelational(node, '<='); 1420 visitLessEqual(HLessEqual node) => visitRelational(node, '<=');
1417 visitGreater(HGreater node) => visitRelational(node, '>'); 1421 visitGreater(HGreater node) => visitRelational(node, '>');
1418 visitGreaterEqual(HGreaterEqual node) => visitRelational(node, '>='); 1422 visitGreaterEqual(HGreaterEqual node) => visitRelational(node, '>=');
1419 1423
1420 visitBoolify(HBoolify node) { 1424 visitBoolify(HBoolify node) {
1421 assert(node.inputs.length == 1); 1425 assert(node.inputs.length == 1);
1422 use(node.inputs[0]); 1426 use(node.inputs[0]);
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after
3116 registry.registerStaticUse(new StaticUse.staticInvoke( 3120 registry.registerStaticUse(new StaticUse.staticInvoke(
3117 helper, new CallStructure.unnamed(argumentCount))); 3121 helper, new CallStructure.unnamed(argumentCount)));
3118 return backend.emitter.staticFunctionAccess(helper); 3122 return backend.emitter.staticFunctionAccess(helper);
3119 } 3123 }
3120 3124
3121 @override 3125 @override
3122 void visitRef(HRef node) { 3126 void visitRef(HRef node) {
3123 visit(node.value); 3127 visit(node.value);
3124 } 3128 }
3125 } 3129 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698