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

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

Issue 10558023: New treatment of native methods. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tests added Created 8 years, 6 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 2256 matching lines...) Expand 10 before | Expand all | Expand 10 after
2267 } else if (element.name == const SourceString('UNINTERCEPTED')) { 2267 } else if (element.name == const SourceString('UNINTERCEPTED')) {
2268 handleForeignUnintercepted(node); 2268 handleForeignUnintercepted(node);
2269 } else if (element.name == const SourceString('JS_HAS_EQUALS')) { 2269 } else if (element.name == const SourceString('JS_HAS_EQUALS')) {
2270 handleForeignJsHasEquals(node); 2270 handleForeignJsHasEquals(node);
2271 } else if (element.name == const SourceString('JS_CURRENT_ISOLATE')) { 2271 } else if (element.name == const SourceString('JS_CURRENT_ISOLATE')) {
2272 handleForeignJsCurrentIsolate(node); 2272 handleForeignJsCurrentIsolate(node);
2273 } else if (element.name == const SourceString('JS_CALL_IN_ISOLATE')) { 2273 } else if (element.name == const SourceString('JS_CALL_IN_ISOLATE')) {
2274 handleForeignJsCallInIsolate(node); 2274 handleForeignJsCallInIsolate(node);
2275 } else if (element.name == const SourceString('DART_CLOSURE_TO_JS')) { 2275 } else if (element.name == const SourceString('DART_CLOSURE_TO_JS')) {
2276 handleForeignDartClosureToJs(node); 2276 handleForeignDartClosureToJs(node);
2277 } else if (element.name == const SourceString('native')) {
2278 native.handleSsaNative(this, node);
2279 } else { 2277 } else {
2280 throw "Unknown foreign: ${node.selector}"; 2278 throw "Unknown foreign: ${node.selector}";
2281 } 2279 }
2282 } 2280 }
2283 2281
2284 generateSuperNoSuchMethodSend(Send node) { 2282 generateSuperNoSuchMethodSend(Send node) {
2285 ClassElement cls = work.element.getEnclosingClass(); 2283 ClassElement cls = work.element.getEnclosingClass();
2286 Element element = cls.lookupSuperMember(Compiler.NO_SUCH_METHOD); 2284 Element element = cls.lookupSuperMember(Compiler.NO_SUCH_METHOD);
2287 HStatic target = new HStatic(element); 2285 HStatic target = new HStatic(element);
2288 add(target); 2286 add(target);
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
2627 // Remove the result and reveal the duplicated receiver on the stack. 2625 // Remove the result and reveal the duplicated receiver on the stack.
2628 pop(); 2626 pop();
2629 } 2627 }
2630 2628
2631 visitCascadeReceiver(CascadeReceiver node) { 2629 visitCascadeReceiver(CascadeReceiver node) {
2632 visit(node.expression); 2630 visit(node.expression);
2633 dup(); 2631 dup();
2634 } 2632 }
2635 2633
2636 visitReturn(Return node) { 2634 visitReturn(Return node) {
2635 if (node.getBeginToken().stringValue === 'native') {
2636 native.handleSsaNative(this, node.expression);
2637 return;
2638 }
2637 HInstruction value; 2639 HInstruction value;
2638 if (node.expression === null) { 2640 if (node.expression === null) {
2639 value = graph.addConstantNull(); 2641 value = graph.addConstantNull();
2640 } else { 2642 } else {
2641 visit(node.expression); 2643 visit(node.expression);
2642 value = pop(); 2644 value = pop();
2643 } 2645 }
2644 close(new HReturn(value)).addSuccessor(graph.exit); 2646 close(new HReturn(value)).addSuccessor(graph.exit);
2645 } 2647 }
2646 2648
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
3462 void visitNodeList(NodeList node) { 3464 void visitNodeList(NodeList node) {
3463 node.visitChildren(this); 3465 node.visitChildren(this);
3464 } 3466 }
3465 3467
3466 HInstruction concat(HInstruction left, HInstruction right) { 3468 HInstruction concat(HInstruction left, HInstruction right) {
3467 HInstruction instruction = new HStringConcat(left, right, diagnosticNode); 3469 HInstruction instruction = new HStringConcat(left, right, diagnosticNode);
3468 builder.add(instruction); 3470 builder.add(instruction);
3469 return instruction; 3471 return instruction;
3470 } 3472 }
3471 } 3473 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/scanner/parser.dart ('k') | lib/compiler/implementation/typechecker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698