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

Side by Side Diff: frog/leg/compiler.dart

Issue 9702074: Add support for capturing and changing the current isolate in the closure wrapper. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 WorkItem { 5 class WorkItem {
6 final Element element; 6 final Element element;
7 TreeElements resolutionTree; 7 TreeElements resolutionTree;
8 Function run; 8 Function run;
9 Map<int, BailoutInfo> bailouts = null; 9 Map<int, BailoutInfo> bailouts = null;
10 bool allowSpeculativeOptimization = true; 10 bool allowSpeculativeOptimization = true;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 if (enabledNoSuchMethod) return; 182 if (enabledNoSuchMethod) return;
183 if (element.enclosingElement == objectClass) return; 183 if (element.enclosingElement == objectClass) return;
184 enabledNoSuchMethod = true; 184 enabledNoSuchMethod = true;
185 Set<Invocation> invocations = universe.invokedNames.putIfAbsent( 185 Set<Invocation> invocations = universe.invokedNames.putIfAbsent(
186 NO_SUCH_METHOD, () => new Set<Invocation>()); 186 NO_SUCH_METHOD, () => new Set<Invocation>());
187 invocations.add(new Invocation(2)); 187 invocations.add(new Invocation(2));
188 } 188 }
189 189
190 void enableIsolateSupport(LibraryElement element) { 190 void enableIsolateSupport(LibraryElement element) {
191 isolateLibrary = element; 191 isolateLibrary = element;
192 addToWorkList(element.find(START_ROOT_ISOLATE)); 192 addToWorkList(element.find(START_ROOT_ISOLATE));
193 } 193 }
194 194
195 bool hasIsolateSupport() => isolateLibrary !== null;
196
195 void onLibraryLoaded(LibraryElement library, Uri uri) { 197 void onLibraryLoaded(LibraryElement library, Uri uri) {
196 if (uri.toString() == 'dart:isolate') { 198 if (uri.toString() == 'dart:isolate') {
197 enableIsolateSupport(library); 199 enableIsolateSupport(library);
198 } 200 }
199 } 201 }
200 202
201 abstract LibraryElement scanBuiltinLibrary(String filename); 203 abstract LibraryElement scanBuiltinLibrary(String filename);
202 204
203 void scanBuiltinLibraries() { 205 void scanBuiltinLibraries() {
204 coreImplLibrary = scanBuiltinLibrary('coreimpl.dart'); 206 coreImplLibrary = scanBuiltinLibrary('coreimpl.dart');
(...skipping 16 matching lines...) Expand all
221 } 223 }
222 224
223 /** Define the JS helper functions in the given library. */ 225 /** Define the JS helper functions in the given library. */
224 void addForeignFunctions(LibraryElement library) { 226 void addForeignFunctions(LibraryElement library) {
225 library.define(new ForeignElement( 227 library.define(new ForeignElement(
226 const SourceString('JS'), library), this); 228 const SourceString('JS'), library), this);
227 library.define(new ForeignElement( 229 library.define(new ForeignElement(
228 const SourceString('UNINTERCEPTED'), library), this); 230 const SourceString('UNINTERCEPTED'), library), this);
229 library.define(new ForeignElement( 231 library.define(new ForeignElement(
230 const SourceString('JS_HAS_EQUALS'), library), this); 232 const SourceString('JS_HAS_EQUALS'), library), this);
233 library.define(new ForeignElement(
234 const SourceString('JS_CURRENT_ISOLATE'), library), this);
235 library.define(new ForeignElement(
236 const SourceString('JS_CALL_IN_ISOLATE'), library), this);
231 } 237 }
232 238
233 void runCompiler(Uri uri) { 239 void runCompiler(Uri uri) {
234 scanBuiltinLibraries(); 240 scanBuiltinLibraries();
235 mainApp = scanner.loadLibrary(uri, null); 241 mainApp = scanner.loadLibrary(uri, null);
236 Element element; 242 Element element;
237 withCurrentElement(mainApp, () { 243 withCurrentElement(mainApp, () {
238 element = mainApp.find(MAIN); 244 element = mainApp.find(MAIN);
239 if (element === null) cancel('Could not find $MAIN'); 245 if (element === null) cancel('Could not find $MAIN');
240 }); 246 });
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 } 481 }
476 } 482 }
477 483
478 class SourceSpan { 484 class SourceSpan {
479 final Uri uri; 485 final Uri uri;
480 final int begin; 486 final int begin;
481 final int end; 487 final int end;
482 488
483 const SourceSpan(this.uri, this.begin, this.end); 489 const SourceSpan(this.uri, this.begin, this.end);
484 } 490 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698