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

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

Issue 9958009: Implement cascaded calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 years, 8 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
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 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 1012
1013 void push(HInstruction instruction) { 1013 void push(HInstruction instruction) {
1014 add(instruction); 1014 add(instruction);
1015 stack.add(instruction); 1015 stack.add(instruction);
1016 } 1016 }
1017 1017
1018 HInstruction pop() { 1018 HInstruction pop() {
1019 return stack.removeLast(); 1019 return stack.removeLast();
1020 } 1020 }
1021 1021
1022 void dup() {
1023 stack.add(stack.last());
1024 }
1025
1022 HBoolify popBoolified() { 1026 HBoolify popBoolified() {
1023 HBoolify boolified = new HBoolify(pop()); 1027 HBoolify boolified = new HBoolify(pop());
1024 add(boolified); 1028 add(boolified);
1025 return boolified; 1029 return boolified;
1026 } 1030 }
1027 1031
1028 void visit(Node node) { 1032 void visit(Node node) {
1029 if (node !== null) node.accept(this); 1033 if (node !== null) node.accept(this);
1030 } 1034 }
1031 1035
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2291 2295
2292 void visitParenthesizedExpression(ParenthesizedExpression node) { 2296 void visitParenthesizedExpression(ParenthesizedExpression node) {
2293 visit(node.expression); 2297 visit(node.expression);
2294 } 2298 }
2295 2299
2296 visitOperator(Operator node) { 2300 visitOperator(Operator node) {
2297 // Operators are intercepted in their surrounding Send nodes. 2301 // Operators are intercepted in their surrounding Send nodes.
2298 unreachable(); 2302 unreachable();
2299 } 2303 }
2300 2304
2305 visitCascade(Cascade node) {
2306 visit(node.expression);
2307 // Remove the result and reveal the duplicated receiver on the stack.
2308 pop();
2309 }
2310
2311 visitCascadeReceiver(CascadeReceiver node) {
2312 visit(node.expression);
2313 dup();
2314 }
2315
2301 visitReturn(Return node) { 2316 visitReturn(Return node) {
2302 HInstruction value; 2317 HInstruction value;
2303 if (node.expression === null) { 2318 if (node.expression === null) {
2304 value = graph.addConstantNull(); 2319 value = graph.addConstantNull();
2305 } else { 2320 } else {
2306 visit(node.expression); 2321 visit(node.expression);
2307 value = pop(); 2322 value = pop();
2308 } 2323 }
2309 close(new HReturn(value)).addSuccessor(graph.exit); 2324 close(new HReturn(value)).addSuccessor(graph.exit);
2310 } 2325 }
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
3024 false, 3039 false,
3025 <HInstruction>[target, input])); 3040 <HInstruction>[target, input]));
3026 return builder.pop(); 3041 return builder.pop();
3027 } 3042 }
3028 3043
3029 HInstruction result() { 3044 HInstruction result() {
3030 flushLiterals(); 3045 flushLiterals();
3031 return prefix; 3046 return prefix;
3032 } 3047 }
3033 } 3048 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/scanner/token.dart ('k') | lib/compiler/implementation/tree/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698