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

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

Issue 8769012: Start resolving classes and default constructors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « frog/leg/scanner/listener.dart ('k') | frog/leg/tree/nodes.dart » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 SsaBuilderTask extends CompilerTask { 5 class SsaBuilderTask extends CompilerTask {
6 SsaBuilderTask(Compiler compiler) : super(compiler); 6 SsaBuilderTask(Compiler compiler) : super(compiler);
7 String get name() => 'SSA builder'; 7 String get name() => 'SSA builder';
8 8
9 HGraph build(Node tree, TreeElements elements) { 9 HGraph build(Node tree, TreeElements elements) {
10 return measure(() { 10 return measure(() {
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 case "&": 493 case "&":
494 case "&=": push(new HBitAnd(target, left, right)); break; 494 case "&=": push(new HBitAnd(target, left, right)); break;
495 case "^": 495 case "^":
496 case "^=": push(new HBitXor(target, left, right)); break; 496 case "^=": push(new HBitXor(target, left, right)); break;
497 case "==": push(new HEquals(target, left, right)); break; 497 case "==": push(new HEquals(target, left, right)); break;
498 case "<": push(new HLess(target, left, right)); break; 498 case "<": push(new HLess(target, left, right)); break;
499 case "<=": push(new HLessEqual(target, left, right)); break; 499 case "<=": push(new HLessEqual(target, left, right)); break;
500 case ">": push(new HGreater(target, left, right)); break; 500 case ">": push(new HGreater(target, left, right)); break;
501 case ">=": push(new HGreaterEqual(target, left, right)); break; 501 case ">=": push(new HGreaterEqual(target, left, right)); break;
502 default: compiler.unimplemented("SsaBuilder.visitBinary"); 502 default: compiler.unimplemented("SsaBuilder.visitBinary");
503 } 503 }
504 } 504 }
505 505
506 visitSend(Send node) { 506 visitSend(Send node) {
507 Element element = elements[node]; 507 Element element = elements[node];
508 // TODO(kasperl): This only works for very special cases. Make 508 // TODO(kasperl): This only works for very special cases. Make
509 // this way more general soon. 509 // this way more general soon.
510 if (node.selector is Operator) { 510 if (node.selector is Operator) {
511 Operator op = node.selector; 511 Operator op = node.selector;
512 if (const SourceString("&&") == op.source || 512 if (const SourceString("&&") == op.source ||
513 const SourceString("||") == op.source) { 513 const SourceString("||") == op.source) {
514 visitLogicalAndOr(node, op); 514 visitLogicalAndOr(node, op);
515 } else if (const SourceString("!") == op.source) { 515 } else if (const SourceString("!") == op.source) {
516 visitLogicalNot(node); 516 visitLogicalNot(node);
517 } else if (node.argumentsNode is Prefix || 517 } else if (node.argumentsNode is Prefix ||
518 node.argumentsNode is Postfix) { 518 node.argumentsNode is Postfix) {
519 visitUnary(node, op, element); 519 visitUnary(node, op, element);
520 } else { 520 } else {
521 visit(node.receiver); 521 visit(node.receiver);
522 visit(node.argumentsNode); 522 visit(node.argumentsNode);
523 var right = pop(); 523 var right = pop();
524 var left = pop(); 524 var left = pop();
525 visitBinary(left, op, right, element); 525 visitBinary(left, op, right, element);
526 } 526 }
527 } else if (node.isPropertyAccess) { 527 } else if (node.isPropertyAccess) {
528 if (node.receiver !== null) { 528 if (node.receiver !== null) {
529 compiler.unimplemented("SsaBuilder.visitSend with receiver"); 529 compiler.unimplemented("SsaBuilder.visitSend with receiver");
530 } 530 }
531 HInstruction instruction = definitions[element]; 531 HInstruction instruction = definitions[element];
532 assert(instruction !== null); 532 assert(instruction !== null);
533 stack.add(instruction); 533 stack.add(instruction);
534 } else { 534 } else {
(...skipping 19 matching lines...) Expand all
554 } else { 554 } else {
555 HStatic target = new HStatic(element); 555 HStatic target = new HStatic(element);
556 add(target); 556 add(target);
557 List inputs = <HInstruction>[target]; 557 List inputs = <HInstruction>[target];
558 inputs.addAll(arguments); 558 inputs.addAll(arguments);
559 push(new HInvokeStatic(inputs)); 559 push(new HInvokeStatic(inputs));
560 } 560 }
561 } 561 }
562 } 562 }
563 563
564 visitNewExpression(NewExpression node) {
565 compiler.unimplemented("SsaBuilder: new expression");
566 }
567
564 HInstruction updateDefinition(Node node, HInstruction value) { 568 HInstruction updateDefinition(Node node, HInstruction value) {
565 VariableElement element = elements[node]; 569 VariableElement element = elements[node];
566 value = guard(element.type, value); 570 value = guard(element.type, value);
567 definitions[element] = value; 571 definitions[element] = value;
568 return value; 572 return value;
569 } 573 }
570 574
571 visitSendSet(SendSet node) { 575 visitSendSet(SendSet node) {
572 if (node.receiver != null) { 576 if (node.receiver != null) {
573 compiler.unimplemented("SsaBuilder: property access"); 577 compiler.unimplemented("SsaBuilder: property access");
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 List<HInstruction> inputs = <HInstruction>[]; 692 List<HInstruction> inputs = <HInstruction>[];
689 for (Link<Node> link = node.elements.nodes; 693 for (Link<Node> link = node.elements.nodes;
690 !link.isEmpty(); 694 !link.isEmpty();
691 link = link.tail) { 695 link = link.tail) {
692 visit(link.head); 696 visit(link.head);
693 inputs.add(pop()); 697 inputs.add(pop());
694 } 698 }
695 push(new HLiteralList(inputs)); 699 push(new HLiteralList(inputs));
696 } 700 }
697 } 701 }
OLDNEW
« no previous file with comments | « frog/leg/scanner/listener.dart ('k') | frog/leg/tree/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698