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

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: 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2626 pop(); 2624 pop();
2627 } 2625 }
2628 2626
2629 visitCascadeReceiver(CascadeReceiver node) { 2627 visitCascadeReceiver(CascadeReceiver node) {
2630 visit(node.expression); 2628 visit(node.expression);
2631 dup(); 2629 dup();
2632 } 2630 }
2633 2631
2634 visitReturn(Return node) { 2632 visitReturn(Return node) {
2635 HInstruction value; 2633 HInstruction value;
2636 if (node.expression === null) { 2634 if (node.getBeginToken().stringValue === 'native') {
2635 if (!native.handleSsaNative(this, node.expression)) return;
Anton Muhin 2012/06/18 10:04:52 ugliness raises its head here.
2636 value = pop();
2637 } else if (node.expression === null) {
2637 value = graph.addConstantNull(); 2638 value = graph.addConstantNull();
2638 } else { 2639 } else {
2639 visit(node.expression); 2640 visit(node.expression);
2640 value = pop(); 2641 value = pop();
2641 } 2642 }
2642 close(new HReturn(value)).addSuccessor(graph.exit); 2643 close(new HReturn(value)).addSuccessor(graph.exit);
2643 } 2644 }
2644 2645
2645 visitThrow(Throw node) { 2646 visitThrow(Throw node) {
2646 if (node.expression === null) { 2647 if (node.expression === null) {
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
3460 void visitNodeList(NodeList node) { 3461 void visitNodeList(NodeList node) {
3461 node.visitChildren(this); 3462 node.visitChildren(this);
3462 } 3463 }
3463 3464
3464 HInstruction concat(HInstruction left, HInstruction right) { 3465 HInstruction concat(HInstruction left, HInstruction right) {
3465 HInstruction instruction = new HStringConcat(left, right, diagnosticNode); 3466 HInstruction instruction = new HStringConcat(left, right, diagnosticNode);
3466 builder.add(instruction); 3467 builder.add(instruction);
3467 return instruction; 3468 return instruction;
3468 } 3469 }
3469 } 3470 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698