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

Side by Side Diff: lib/runtime/dart/_isolate_helper.js

Issue 1071773002: metalet with postfix improvement (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | lib/runtime/dart/collection.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var _isolate_helper; 1 var _isolate_helper;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 // Function _serializeMessage: (dynamic) → dynamic 4 // Function _serializeMessage: (dynamic) → dynamic
5 function _serializeMessage(message) { 5 function _serializeMessage(message) {
6 return new _Serializer().serialize(message); 6 return new _Serializer().serialize(message);
7 } 7 }
8 // Function _deserializeMessage: (dynamic) → dynamic 8 // Function _deserializeMessage: (dynamic) → dynamic
9 function _deserializeMessage(message) { 9 function _deserializeMessage(message) {
10 return new _Deserializer().deserialize(message); 10 return new _Deserializer().deserialize(message);
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 } 351 }
352 // Function _callInIsolate: (_IsolateContext, Function) → dynamic 352 // Function _callInIsolate: (_IsolateContext, Function) → dynamic
353 function _callInIsolate(isolate, function$0) { 353 function _callInIsolate(isolate, function$0) {
354 let result = isolate.eval(function$0); 354 let result = isolate.eval(function$0);
355 exports._globalState.topEventLoop.run(); 355 exports._globalState.topEventLoop.run();
356 return result; 356 return result;
357 } 357 }
358 let _activeJsAsyncCount = Symbol('_activeJsAsyncCount'); 358 let _activeJsAsyncCount = Symbol('_activeJsAsyncCount');
359 // Function enterJsAsync: () → dynamic 359 // Function enterJsAsync: () → dynamic
360 function enterJsAsync() { 360 function enterJsAsync() {
361 let o$ = exports._globalState.topEventLoop; 361 dart.prop(exports._globalState.topEventLoop, _activeJsAsyncCount).notNull++;
vsm 2015/04/09 16:58:28 How about just specializing the increment case? E
Jennifer Messerly 2015/04/09 17:47:40 yeah, that could work, would we have different pre
vsm 2015/04/10 00:14:10 Another alternative: dart.nullcheck(exports._glob
Jennifer Messerly 2015/04/10 01:00:24 that won't work though ... it has to be an lvalue.
362 o$[_activeJsAsyncCount] = dart.notNull(o$[_activeJsAsyncCount]) + 1;
363 } 362 }
364 // Function leaveJsAsync: () → dynamic 363 // Function leaveJsAsync: () → dynamic
365 function leaveJsAsync() { 364 function leaveJsAsync() {
366 let o$ = exports._globalState.topEventLoop; 365 dart.prop(exports._globalState.topEventLoop, _activeJsAsyncCount).notNull--;
367 o$[_activeJsAsyncCount] = dart.notNull(o$[_activeJsAsyncCount]) - 1;
368 dart.assert(dart.notNull(exports._globalState.topEventLoop[_activeJsAsyncCou nt]) >= 0); 366 dart.assert(dart.notNull(exports._globalState.topEventLoop[_activeJsAsyncCou nt]) >= 0);
369 } 367 }
370 // Function isWorker: () → bool 368 // Function isWorker: () → bool
371 function isWorker() { 369 function isWorker() {
372 return exports._globalState.isWorker; 370 return exports._globalState.isWorker;
373 } 371 }
374 // Function _currentIsolate: () → _IsolateContext 372 // Function _currentIsolate: () → _IsolateContext
375 function _currentIsolate() { 373 function _currentIsolate() {
376 return exports._globalState.currentContext; 374 return exports._globalState.currentContext;
377 } 375 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 } 474 }
477 let _controlPort = Symbol('_controlPort'); 475 let _controlPort = Symbol('_controlPort');
478 let _scheduledControlEvents = Symbol('_scheduledControlEvents'); 476 let _scheduledControlEvents = Symbol('_scheduledControlEvents');
479 let _isExecutingEvent = Symbol('_isExecutingEvent'); 477 let _isExecutingEvent = Symbol('_isExecutingEvent');
480 let _updateGlobalState = Symbol('_updateGlobalState'); 478 let _updateGlobalState = Symbol('_updateGlobalState');
481 let _setGlobals = Symbol('_setGlobals'); 479 let _setGlobals = Symbol('_setGlobals');
482 let _addRegistration = Symbol('_addRegistration'); 480 let _addRegistration = Symbol('_addRegistration');
483 let _close = Symbol('_close'); 481 let _close = Symbol('_close');
484 class _IsolateContext extends core.Object { 482 class _IsolateContext extends core.Object {
485 _IsolateContext() { 483 _IsolateContext() {
486 this.id = (() => { 484 this.id = dart.prop(exports._globalState, 'nextIsolateId').notNull++;
487 let o$ = exports._globalState, x$ = o$.nextIsolateId;
488 o$.nextIsolateId = dart.notNull(x$) + 1;
489 return x$;
490 })();
491 this.ports = new (core.Map$(core.int, RawReceivePortImpl))(); 485 this.ports = new (core.Map$(core.int, RawReceivePortImpl))();
492 this.weakPorts = new (core.Set$(core.int))(); 486 this.weakPorts = new (core.Set$(core.int))();
493 this.isolateStatics = _foreign_helper.JS_CREATE_ISOLATE(); 487 this.isolateStatics = _foreign_helper.JS_CREATE_ISOLATE();
494 this.controlPort = new RawReceivePortImpl[_controlPort](); 488 this.controlPort = new RawReceivePortImpl[_controlPort]();
495 this.pauseCapability = new isolate.Capability(); 489 this.pauseCapability = new isolate.Capability();
496 this.terminateCapability = new isolate.Capability(); 490 this.terminateCapability = new isolate.Capability();
497 this.delayedEvents = dart.as(new core.List.from([]), core.List$(_IsolateEv ent)); 491 this.delayedEvents = dart.as(new core.List.from([]), core.List$(_IsolateEv ent));
498 this.pauseTokens = dart.as(new core.Set(), core.Set$(isolate.Capability)); 492 this.pauseTokens = dart.as(new core.Set(), core.Set$(isolate.Capability));
499 this.errorPorts = dart.as(new core.Set(), core.Set$(isolate.SendPort)); 493 this.errorPorts = dart.as(new core.Set(), core.Set$(isolate.SendPort));
500 this.initialized = false; 494 this.initialized = false;
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 }; 1085 };
1092 }(_foreign_helper.DART_CLOSURE_TO_JS(IsolateNatives.workerOnError), uri, o nError); 1086 }(_foreign_helper.DART_CLOSURE_TO_JS(IsolateNatives.workerOnError), uri, o nError);
1093 worker.onerror = onerrorTrampoline; 1087 worker.onerror = onerrorTrampoline;
1094 let processWorkerMessageTrampoline = function(f, a) { 1088 let processWorkerMessageTrampoline = function(f, a) {
1095 return function(e) { 1089 return function(e) {
1096 e.onerror = null; 1090 e.onerror = null;
1097 return f(a, e); 1091 return f(a, e);
1098 }; 1092 };
1099 }(_foreign_helper.DART_CLOSURE_TO_JS(IsolateNatives[_processWorkerMessage] ), worker); 1093 }(_foreign_helper.DART_CLOSURE_TO_JS(IsolateNatives[_processWorkerMessage] ), worker);
1100 worker.onmessage = processWorkerMessageTrampoline; 1094 worker.onmessage = processWorkerMessageTrampoline;
1101 let o$ = exports._globalState; 1095 let workerId = dart.prop(exports._globalState, 'nextManagerId').notNull++;
1102 let workerId = o$.nextManagerId;
1103 o$.nextManagerId = dart.notNull(workerId) + 1;
1104 IsolateNatives.workerIds.set(worker, workerId); 1096 IsolateNatives.workerIds.set(worker, workerId);
1105 exports._globalState.managers.set(workerId, worker); 1097 exports._globalState.managers.set(workerId, worker);
1106 worker.postMessage(_serializeMessage(dart.map({command: 'start', id: worke rId, replyTo: _serializeMessage(replyPort), args: args, msg: _serializeMessage(m essage), isSpawnUri: isSpawnUri, startPaused: startPaused, functionName: functio nName}))); 1098 worker.postMessage(_serializeMessage(dart.map({command: 'start', id: worke rId, replyTo: _serializeMessage(replyPort), args: args, msg: _serializeMessage(m essage), isSpawnUri: isSpawnUri, startPaused: startPaused, functionName: functio nName})));
1107 } 1099 }
1108 static workerOnError(event, uri, onError) { 1100 static workerOnError(event, uri, onError) {
1109 event.preventDefault(); 1101 event.preventDefault();
1110 let message = dart.as(event.message, core.String); 1102 let message = dart.as(event.message, core.String);
1111 if (message == null) { 1103 if (message == null) {
1112 message = `Error spawning worker for ${uri}`; 1104 message = `Error spawning worker for ${uri}`;
1113 } else { 1105 } else {
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 exports.leaveJsAsync = leaveJsAsync; 1384 exports.leaveJsAsync = leaveJsAsync;
1393 exports.isWorker = isWorker; 1385 exports.isWorker = isWorker;
1394 exports.startRootIsolate = startRootIsolate; 1386 exports.startRootIsolate = startRootIsolate;
1395 exports.IsolateNatives = IsolateNatives; 1387 exports.IsolateNatives = IsolateNatives;
1396 exports.RawReceivePortImpl = RawReceivePortImpl; 1388 exports.RawReceivePortImpl = RawReceivePortImpl;
1397 exports.ReceivePortImpl = ReceivePortImpl; 1389 exports.ReceivePortImpl = ReceivePortImpl;
1398 exports.TimerImpl = TimerImpl; 1390 exports.TimerImpl = TimerImpl;
1399 exports.hasTimer = hasTimer; 1391 exports.hasTimer = hasTimer;
1400 exports.CapabilityImpl = CapabilityImpl; 1392 exports.CapabilityImpl = CapabilityImpl;
1401 })(_isolate_helper || (_isolate_helper = {})); 1393 })(_isolate_helper || (_isolate_helper = {}));
OLDNEW
« no previous file with comments | « no previous file | lib/runtime/dart/collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698