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

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

Issue 9355031: Improve List implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased and resolved conflicts Created 8 years, 10 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/ssa/builder.dart ('k') | dart/frog/leg/ssa/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) 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 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler);
7 String get name() => 'SSA code generator'; 7 String get name() => 'SSA code generator';
8 8
9 String generate(WorkItem work, HGraph graph) { 9 String generate(WorkItem work, HGraph graph) {
10 return measure(() { 10 return measure(() {
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 buffer.add(';\n'); 687 buffer.add(';\n');
688 } 688 }
689 689
690 visitBoundsCheck(HBoundsCheck node) { 690 visitBoundsCheck(HBoundsCheck node) {
691 buffer.add('if ('); 691 buffer.add('if (');
692 use(node.index, JSPrecedence.RELATIONAL_PRECEDENCE); 692 use(node.index, JSPrecedence.RELATIONAL_PRECEDENCE);
693 buffer.add(' < 0 || '); 693 buffer.add(' < 0 || ');
694 use(node.index, JSPrecedence.RELATIONAL_PRECEDENCE); 694 use(node.index, JSPrecedence.RELATIONAL_PRECEDENCE);
695 buffer.add(' >= '); 695 buffer.add(' >= ');
696 use(node.length, JSPrecedence.SHIFT_PRECEDENCE); 696 use(node.length, JSPrecedence.SHIFT_PRECEDENCE);
697 buffer.add(") throw 'Out of bounds'"); 697 buffer.add(") ");
698 generateFail('ioore', node.index);
698 } 699 }
699 700
700 visitIntegerCheck(HIntegerCheck node) { 701 visitIntegerCheck(HIntegerCheck node) {
701 buffer.add('if ('); 702 buffer.add('if (');
702 use(node.value, JSPrecedence.EQUALITY_PRECEDENCE); 703 use(node.value, JSPrecedence.EQUALITY_PRECEDENCE);
703 buffer.add(' !== ('); 704 buffer.add(' !== (');
704 use(node.value, JSPrecedence.BITWISE_OR_PRECEDENCE); 705 use(node.value, JSPrecedence.BITWISE_OR_PRECEDENCE);
705 buffer.add(" | 0)) throw 'Illegal argument'"); 706 buffer.add(" | 0)) ");
707 generateFail('iae', node.value);
708 }
709
710 void generateFail(String helperName, HInstruction argument) {
711 Element helper = compiler.findHelper(new SourceString(helperName));
712 compiler.registerStaticUse(helper);
713 buffer.add('throw ');
714 beginExpression(JSPrecedence.EXPRESSION_PRECEDENCE);
715 beginExpression(JSPrecedence.CALL_PRECEDENCE);
716 buffer.add(compiler.namer.isolateAccess(helper));
717 visitArguments([null, argument]);
718 endExpression(JSPrecedence.CALL_PRECEDENCE);
719 endExpression(JSPrecedence.EXPRESSION_PRECEDENCE);
706 } 720 }
707 721
708 void addIndentation() { 722 void addIndentation() {
709 for (int i = 0; i < indent; i++) { 723 for (int i = 0; i < indent; i++) {
710 buffer.add(' '); 724 buffer.add(' ');
711 } 725 }
712 } 726 }
713 727
714 void visitStatic(HStatic node) { 728 void visitStatic(HStatic node) {
715 compiler.registerStaticUse(node.element); 729 compiler.registerStaticUse(node.element);
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 startBailoutSwitch(); 1256 startBailoutSwitch();
1243 } 1257 }
1244 } 1258 }
1245 1259
1246 void endElse(HIf node) { 1260 void endElse(HIf node) {
1247 if (node.elseBlock.hasBailouts()) { 1261 if (node.elseBlock.hasBailouts()) {
1248 endBailoutSwitch(); 1262 endBailoutSwitch();
1249 } 1263 }
1250 } 1264 }
1251 } 1265 }
OLDNEW
« no previous file with comments | « dart/frog/leg/ssa/builder.dart ('k') | dart/frog/leg/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698