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

Side by Side Diff: lib/compiler/implementation/ssa/codegen.dart

Issue 10993036: Implement the apply functionality for dart2js and currently just put it in a test. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 | « lib/compiler/implementation/ssa/builder.dart ('k') | tests/co19/co19-dart2js.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 SsaCodeGeneratorTask extends CompilerTask { 5 class SsaCodeGeneratorTask extends CompilerTask {
6 6
7 final JavaScriptBackend backend; 7 final JavaScriptBackend backend;
8 8
9 SsaCodeGeneratorTask(JavaScriptBackend backend) 9 SsaCodeGeneratorTask(JavaScriptBackend backend)
10 : this.backend = backend, 10 : this.backend = backend,
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 return new js.Call(new js.PropertyAccess.field(receiver, fieldName), 1462 return new js.Call(new js.PropertyAccess.field(receiver, fieldName),
1463 arguments); 1463 arguments);
1464 } 1464 }
1465 1465
1466 visitInvokeDynamicMethod(HInvokeDynamicMethod node) { 1466 visitInvokeDynamicMethod(HInvokeDynamicMethod node) {
1467 use(node.receiver); 1467 use(node.receiver);
1468 js.Expression object = pop(); 1468 js.Expression object = pop();
1469 SourceString name = node.selector.name; 1469 SourceString name = node.selector.name;
1470 String methodName; 1470 String methodName;
1471 List<js.Expression> arguments; 1471 List<js.Expression> arguments;
1472 Element target = node.element;
1472 1473
1473 // Avoid adding the generative constructor name to the list of 1474 // Avoid adding the generative constructor name to the list of
1474 // seen selectors. 1475 // seen selectors.
1475 if (node.inputs[0] is HForeignNew) { 1476 if (target != null && target.isGenerativeConstructorBody()) {
1476 // TODO(ahe): The constructor name was statically resolved in
1477 // SsaBuilder.buildFactory. Is there a cleaner way to do this?
1478 methodName = name.slowToString(); 1477 methodName = name.slowToString();
1479 arguments = visitArguments(node.inputs); 1478 arguments = visitArguments(node.inputs);
1480 } else { 1479 } else {
1481 methodName = backend.namer.instanceMethodInvocationName( 1480 methodName = backend.namer.instanceMethodInvocationName(
1482 node.selector.library, name, node.selector); 1481 node.selector.library, name, node.selector);
1483 arguments = visitArguments(node.inputs); 1482 arguments = visitArguments(node.inputs);
1484 bool inLoop = node.block.enclosingLoopHeader !== null; 1483 bool inLoop = node.block.enclosingLoopHeader !== null;
1485 1484
1486 // Register this invocation to collect the types used at all call sites. 1485 // Register this invocation to collect the types used at all call sites.
1487 Selector selector = getOptimizedSelectorFor(node, node.selector); 1486 Selector selector = getOptimizedSelectorFor(node, node.selector);
1488 backend.registerDynamicInvocation(node, selector, types); 1487 backend.registerDynamicInvocation(node, selector, types);
1489 1488
1490 // If we don't know what we're calling or if we are calling a getter, 1489 // If we don't know what we're calling or if we are calling a getter,
1491 // we need to register that fact that we may be calling a closure 1490 // we need to register that fact that we may be calling a closure
1492 // with the same arguments. 1491 // with the same arguments.
1493 Element target = node.element;
1494 if (target === null || target.isGetter()) { 1492 if (target === null || target.isGetter()) {
1495 // TODO(kasperl): If we have a typed selector for the call, we 1493 // TODO(kasperl): If we have a typed selector for the call, we
1496 // may know something about the types of closures that need 1494 // may know something about the types of closures that need
1497 // the specific closure call method. 1495 // the specific closure call method.
1498 Selector call = new Selector.callClosureFrom(selector); 1496 Selector call = new Selector.callClosureFrom(selector);
1499 world.registerDynamicInvocation(call.name, call); 1497 world.registerDynamicInvocation(call.name, call);
1500 } 1498 }
1501 1499
1502 if (target !== null) { 1500 if (target !== null) {
1503 // If we know we're calling a specific method, register that 1501 // If we know we're calling a specific method, register that
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
2997 if (leftType.canBeNull() && rightType.canBeNull()) { 2995 if (leftType.canBeNull() && rightType.canBeNull()) {
2998 if (left.isConstantNull() || right.isConstantNull() || 2996 if (left.isConstantNull() || right.isConstantNull() ||
2999 (leftType.isPrimitive() && leftType == rightType)) { 2997 (leftType.isPrimitive() && leftType == rightType)) {
3000 return '=='; 2998 return '==';
3001 } 2999 }
3002 return null; 3000 return null;
3003 } else { 3001 } else {
3004 return '==='; 3002 return '===';
3005 } 3003 }
3006 } 3004 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698