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

Side by Side Diff: dart/frog/leg/ssa/builder.dart

Issue 9536020: Work around buggy break in List.sort and optimize constant folding of negative values. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add TODO for Kasperl Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « dart/frog/leg/lib/dual_pivot_quicksort.dart ('k') | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class Interceptors { 5 class Interceptors {
6 Compiler compiler; 6 Compiler compiler;
7 Interceptors(Compiler this.compiler); 7 Interceptors(Compiler this.compiler);
8 8
9 SourceString mapOperatorToMethodName(Operator op) { 9 SourceString mapOperatorToMethodName(Operator op) {
10 String name = op.source.stringValue; 10 String name = op.source.stringValue;
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 1295
1296 void visitUnary(Send node, Operator op) { 1296 void visitUnary(Send node, Operator op) {
1297 assert(node.argumentsNode is Prefix); 1297 assert(node.argumentsNode is Prefix);
1298 visit(node.receiver); 1298 visit(node.receiver);
1299 assert(op.token.kind !== PLUS_TOKEN); 1299 assert(op.token.kind !== PLUS_TOKEN);
1300 HInstruction operand = pop(); 1300 HInstruction operand = pop();
1301 HInstruction target = 1301 HInstruction target =
1302 new HStatic(interceptors.getPrefixOperatorInterceptor(op)); 1302 new HStatic(interceptors.getPrefixOperatorInterceptor(op));
1303 add(target); 1303 add(target);
1304 switch (op.source.stringValue) { 1304 switch (op.source.stringValue) {
1305 case "-": push(new HNegate(target, operand)); break; 1305 case "-":
1306 // TODO(kasperl): Avoid calling visit(node.receiver) above.
1307 if ((operand is HLiteral) && (operand.value is double)) {
1308 stack.add(graph.addNewLiteralDouble(-operand.value));
1309 } else if ((operand is HLiteral) && (operand.value is int)) {
1310 stack.add(graph.addNewLiteralInt(-operand.value));
1311 } else {
1312 push(new HNegate(target, operand));
1313 }
1314 break;
1306 case "~": push(new HBitNot(target, operand)); break; 1315 case "~": push(new HBitNot(target, operand)); break;
1307 default: unreachable(); 1316 default: unreachable();
1308 } 1317 }
1309 } 1318 }
1310 1319
1311 void visitBinary(HInstruction left, Operator op, HInstruction right) { 1320 void visitBinary(HInstruction left, Operator op, HInstruction right) {
1312 Element element = interceptors.getOperatorInterceptor(op); 1321 Element element = interceptors.getOperatorInterceptor(op);
1313 assert(element != null); 1322 assert(element != null);
1314 HInstruction target = new HStatic(element); 1323 HInstruction target = new HStatic(element);
1315 add(target); 1324 add(target);
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
2358 // Normally, we would call [close] here. However, then we hit 2367 // Normally, we would call [close] here. However, then we hit
2359 // another unimplemented feature: aborting loop body. Simply 2368 // another unimplemented feature: aborting loop body. Simply
2360 // calling [add] does not work as it asserts that the instruction 2369 // calling [add] does not work as it asserts that the instruction
2361 // isn't a control flow instruction. So we inline parts of [add]. 2370 // isn't a control flow instruction. So we inline parts of [add].
2362 current.addAfter(current.last, new HThrow(message)); 2371 current.addAfter(current.last, new HThrow(message));
2363 if (isExpression) { 2372 if (isExpression) {
2364 stack.add(graph.addNewLiteralNull()); 2373 stack.add(graph.addNewLiteralNull());
2365 } 2374 }
2366 } 2375 }
2367 } 2376 }
OLDNEW
« no previous file with comments | « dart/frog/leg/lib/dual_pivot_quicksort.dart ('k') | dart/tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698