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

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: 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 "-":
kasperl 2012/03/01 06:13:00 This could possible be dealt with in a faster way
ahe 2012/03/01 06:54:15 Done.
1306 if ((operand is HLiteral) && (operand.value is double)) {
1307 stack.add(graph.addNewLiteralDouble(-operand.value));
1308 } else if ((operand is HLiteral) && (operand.value is int)) {
1309 stack.add(graph.addNewLiteralInt(-operand.value));
ngeoffray 2012/02/29 20:36:26 Why is that not done in the constant folder instea
ahe 2012/02/29 20:41:24 Because it is really slow at doing it.
ngeoffray 2012/03/01 08:15:51 Why is that?
floitsch 2012/03/01 10:32:18 The problem is not really the constant folding, bu
1310 } else {
1311 push(new HNegate(target, operand));
1312 }
1313 break;
1306 case "~": push(new HBitNot(target, operand)); break; 1314 case "~": push(new HBitNot(target, operand)); break;
1307 default: unreachable(); 1315 default: unreachable();
1308 } 1316 }
1309 } 1317 }
1310 1318
1311 void visitBinary(HInstruction left, Operator op, HInstruction right) { 1319 void visitBinary(HInstruction left, Operator op, HInstruction right) {
1312 Element element = interceptors.getOperatorInterceptor(op); 1320 Element element = interceptors.getOperatorInterceptor(op);
1313 assert(element != null); 1321 assert(element != null);
1314 HInstruction target = new HStatic(element); 1322 HInstruction target = new HStatic(element);
1315 add(target); 1323 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 2366 // Normally, we would call [close] here. However, then we hit
2359 // another unimplemented feature: aborting loop body. Simply 2367 // another unimplemented feature: aborting loop body. Simply
2360 // calling [add] does not work as it asserts that the instruction 2368 // calling [add] does not work as it asserts that the instruction
2361 // isn't a control flow instruction. So we inline parts of [add]. 2369 // isn't a control flow instruction. So we inline parts of [add].
2362 current.addAfter(current.last, new HThrow(message)); 2370 current.addAfter(current.last, new HThrow(message));
2363 if (isExpression) { 2371 if (isExpression) {
2364 stack.add(graph.addNewLiteralNull()); 2372 stack.add(graph.addNewLiteralNull());
2365 } 2373 }
2366 } 2374 }
2367 } 2375 }
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