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

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

Issue 11778064: Cleanup the isolate library to pave the way for web worker support. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 part of ssa; 5 part of ssa;
6 6
7 /** 7 /**
8 * A special element for the extra parameter taken by intercepted 8 * A special element for the extra parameter taken by intercepted
9 * methods. We need to override [Element.computeType] because our 9 * methods. We need to override [Element.computeType] because our
10 * optimizers may look at its declared type. 10 * optimizers may look at its declared type.
(...skipping 3093 matching lines...) Expand 10 before | Expand all | Expand 10 after
3104 } 3104 }
3105 visit(closure); 3105 visit(closure);
3106 List<HInstruction> inputs = <HInstruction>[pop()]; 3106 List<HInstruction> inputs = <HInstruction>[pop()];
3107 String invocationName = backend.namer.closureInvocationName( 3107 String invocationName = backend.namer.closureInvocationName(
3108 new Selector.callClosure(params.requiredParameterCount)); 3108 new Selector.callClosure(params.requiredParameterCount));
3109 push(new HForeign(new DartString.literal('#.$invocationName'), 3109 push(new HForeign(new DartString.literal('#.$invocationName'),
3110 const LiteralDartString('var'), 3110 const LiteralDartString('var'),
3111 inputs)); 3111 inputs));
3112 } 3112 }
3113 3113
3114 void handleForeignSetCurrentIsolate(Send node) {
3115 if (node.arguments.isEmpty || !node.arguments.tail.isEmpty) {
3116 compiler.cancel('Exactly one argument required',
3117 node: node.argumentsNode);
3118 }
3119 visit(node.arguments.head);
3120 String isolateName = backend.namer.CURRENT_ISOLATE;
3121 push(new HForeign(new DartString.literal("$isolateName = #"),
3122 const LiteralDartString('void'),
3123 <HInstruction>[pop()]));
3124 }
3125
3126 void handleForeignCreateIsolate(Send node) {
3127 if (!node.arguments.isEmpty) {
3128 compiler.cancel('Too many arguments',
3129 node: node.argumentsNode);
3130 }
3131 String constructorName = backend.namer.isolateName;
3132 push(new HForeign(new DartString.literal("new $constructorName"),
3133 const LiteralDartString('var'),
3134 <HInstruction>[]));
3135 }
3136
3114 visitForeignSend(Send node) { 3137 visitForeignSend(Send node) {
3115 Selector selector = elements.getSelector(node); 3138 Selector selector = elements.getSelector(node);
3116 SourceString name = selector.name; 3139 SourceString name = selector.name;
3117 if (name == const SourceString('JS')) { 3140 if (name == const SourceString('JS')) {
3118 handleForeignJs(node); 3141 handleForeignJs(node);
3119 } else if (name == const SourceString('UNINTERCEPTED')) { 3142 } else if (name == const SourceString('UNINTERCEPTED')) {
3120 handleForeignUnintercepted(node); 3143 handleForeignUnintercepted(node);
3121 } else if (name == const SourceString('JS_HAS_EQUALS')) { 3144 } else if (name == const SourceString('JS_HAS_EQUALS')) {
3122 handleForeignJsHasEquals(node); 3145 handleForeignJsHasEquals(node);
3123 } else if (name == const SourceString('JS_CURRENT_ISOLATE')) { 3146 } else if (name == const SourceString('JS_CURRENT_ISOLATE')) {
3124 handleForeignJsCurrentIsolate(node); 3147 handleForeignJsCurrentIsolate(node);
3125 } else if (name == const SourceString('JS_CALL_IN_ISOLATE')) { 3148 } else if (name == const SourceString('JS_CALL_IN_ISOLATE')) {
3126 handleForeignJsCallInIsolate(node); 3149 handleForeignJsCallInIsolate(node);
3127 } else if (name == const SourceString('DART_CLOSURE_TO_JS')) { 3150 } else if (name == const SourceString('DART_CLOSURE_TO_JS')) {
3128 handleForeignDartClosureToJs(node); 3151 handleForeignDartClosureToJs(node);
3152 } else if (name == const SourceString('JS_SET_CURRENT_ISOLATE')) {
3153 handleForeignSetCurrentIsolate(node);
3154 } else if (name == const SourceString('JS_CREATE_ISOLATE')) {
3155 handleForeignCreateIsolate(node);
3129 } else { 3156 } else {
3130 throw "Unknown foreign: ${selector}"; 3157 throw "Unknown foreign: ${selector}";
3131 } 3158 }
3132 } 3159 }
3133 3160
3134 generateSuperNoSuchMethodSend(Send node) { 3161 generateSuperNoSuchMethodSend(Send node) {
3135 Selector selector = elements.getSelector(node); 3162 Selector selector = elements.getSelector(node);
3136 SourceString name = selector.name; 3163 SourceString name = selector.name;
3137 3164
3138 ClassElement cls = work.element.getEnclosingClass(); 3165 ClassElement cls = work.element.getEnclosingClass();
(...skipping 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after
5074 new HSubGraphBlockInformation(elseBranch.graph)); 5101 new HSubGraphBlockInformation(elseBranch.graph));
5075 5102
5076 HBasicBlock conditionStartBlock = conditionBranch.block; 5103 HBasicBlock conditionStartBlock = conditionBranch.block;
5077 conditionStartBlock.setBlockFlow(info, joinBlock); 5104 conditionStartBlock.setBlockFlow(info, joinBlock);
5078 SubGraph conditionGraph = conditionBranch.graph; 5105 SubGraph conditionGraph = conditionBranch.graph;
5079 HIf branch = conditionGraph.end.last; 5106 HIf branch = conditionGraph.end.last;
5080 assert(branch is HIf); 5107 assert(branch is HIf);
5081 branch.blockInformation = conditionStartBlock.blockFlow; 5108 branch.blockInformation = conditionStartBlock.blockFlow;
5082 } 5109 }
5083 } 5110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698