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

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

Issue 1093143004: fixes #52, fields shadowing getters/setters or other fields (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 | « lib/runtime/dart/_internal.js ('k') | lib/runtime/dart/_js_helper.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 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 } 1189 }
1190 } 1190 }
1191 ['=='](other) { 1191 ['=='](other) {
1192 return dart.is(other, _WorkerSendPort) && dart.equals(this[_workerId], dar t.dload(other, _workerId)) && dart.equals(this[_isolateId], dart.dload(other, _i solateId)) && dart.equals(this[_receivePortId], dart.dload(other, _receivePortId )); 1192 return dart.is(other, _WorkerSendPort) && dart.equals(this[_workerId], dar t.dload(other, _workerId)) && dart.equals(this[_isolateId], dart.dload(other, _i solateId)) && dart.equals(this[_receivePortId], dart.dload(other, _receivePortId ));
1193 } 1193 }
1194 get hashCode() { 1194 get hashCode() {
1195 return dart.notNull(this[_workerId]) << 16 ^ dart.notNull(this[_isolateId] ) << 8 ^ dart.notNull(this[_receivePortId]); 1195 return dart.notNull(this[_workerId]) << 16 ^ dart.notNull(this[_isolateId] ) << 8 ^ dart.notNull(this[_receivePortId]);
1196 } 1196 }
1197 } 1197 }
1198 _WorkerSendPort[dart.implements] = () => [isolate.SendPort]; 1198 _WorkerSendPort[dart.implements] = () => [isolate.SendPort];
1199 let _nextFreeId = Symbol('_nextFreeId');
1199 let _handler = Symbol('_handler'); 1200 let _handler = Symbol('_handler');
1200 let _nextFreeId = Symbol('_nextFreeId');
1201 class RawReceivePortImpl extends core.Object { 1201 class RawReceivePortImpl extends core.Object {
1202 RawReceivePortImpl(handler) { 1202 RawReceivePortImpl(handler) {
1203 this[_handler] = handler; 1203 dart.initField(RawReceivePortImpl, this, _handler, handler);
1204 this[_id] = (() => { 1204 dart.initField(RawReceivePortImpl, this, _id, (() => {
1205 let x = RawReceivePortImpl[_nextFreeId]; 1205 let x = RawReceivePortImpl[_nextFreeId];
1206 RawReceivePortImpl[_nextFreeId] = dart.notNull(x) + 1; 1206 RawReceivePortImpl[_nextFreeId] = dart.notNull(x) + 1;
1207 return x; 1207 return x;
1208 })(); 1208 })());
1209 this[_isClosed] = false; 1209 dart.initField(RawReceivePortImpl, this, _isClosed, false);
1210 exports._globalState.currentContext.register(this[_id], this); 1210 exports._globalState.currentContext.register(this[_id], this);
1211 } 1211 }
1212 weak(handler) { 1212 weak(handler) {
1213 this[_handler] = handler; 1213 dart.initField(RawReceivePortImpl, this, _handler, handler);
1214 this[_id] = (() => { 1214 dart.initField(RawReceivePortImpl, this, _id, (() => {
1215 let x = RawReceivePortImpl[_nextFreeId]; 1215 let x = RawReceivePortImpl[_nextFreeId];
1216 RawReceivePortImpl[_nextFreeId] = dart.notNull(x) + 1; 1216 RawReceivePortImpl[_nextFreeId] = dart.notNull(x) + 1;
1217 return x; 1217 return x;
1218 })(); 1218 })());
1219 this[_isClosed] = false; 1219 dart.initField(RawReceivePortImpl, this, _isClosed, false);
1220 exports._globalState.currentContext.registerWeak(this[_id], this); 1220 exports._globalState.currentContext.registerWeak(this[_id], this);
1221 } 1221 }
1222 [_controlPort]() { 1222 [_controlPort]() {
1223 this[_handler] = null; 1223 dart.initField(RawReceivePortImpl, this, _handler, null);
1224 this[_id] = 0; 1224 dart.initField(RawReceivePortImpl, this, _id, 0);
1225 this[_isClosed] = false; 1225 dart.initField(RawReceivePortImpl, this, _isClosed, false);
1226 } 1226 }
1227 set handler(newHandler) { 1227 set handler(newHandler) {
1228 this[_handler] = newHandler; 1228 this[_handler] = newHandler;
1229 } 1229 }
1230 [_close]() { 1230 [_close]() {
1231 this[_isClosed] = true; 1231 this[_isClosed] = true;
1232 this[_handler] = null; 1232 this[_handler] = null;
1233 } 1233 }
1234 close() { 1234 close() {
1235 if (this[_isClosed]) 1235 if (this[_isClosed])
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 } 1282 }
1283 } 1283 }
1284 ReceivePortImpl[dart.implements] = () => [isolate.ReceivePort]; 1284 ReceivePortImpl[dart.implements] = () => [isolate.ReceivePort];
1285 dart.defineNamedConstructor(ReceivePortImpl, 'weak'); 1285 dart.defineNamedConstructor(ReceivePortImpl, 'weak');
1286 dart.defineNamedConstructor(ReceivePortImpl, 'fromRawReceivePort'); 1286 dart.defineNamedConstructor(ReceivePortImpl, 'fromRawReceivePort');
1287 let _once = Symbol('_once'); 1287 let _once = Symbol('_once');
1288 let _inEventLoop = Symbol('_inEventLoop'); 1288 let _inEventLoop = Symbol('_inEventLoop');
1289 let _handle = Symbol('_handle'); 1289 let _handle = Symbol('_handle');
1290 class TimerImpl extends core.Object { 1290 class TimerImpl extends core.Object {
1291 TimerImpl(milliseconds, callback) { 1291 TimerImpl(milliseconds, callback) {
1292 this[_once] = true; 1292 dart.initField(TimerImpl, this, _once, true);
1293 this[_inEventLoop] = false; 1293 dart.initField(TimerImpl, this, _inEventLoop, false);
1294 this[_handle] = null; 1294 dart.initField(TimerImpl, this, _handle, null);
1295 if (milliseconds == 0 && (!dart.notNull(hasTimer()) || dart.notNull(export s._globalState.isWorker))) { 1295 if (milliseconds == 0 && (!dart.notNull(hasTimer()) || dart.notNull(export s._globalState.isWorker))) {
1296 // Function internalCallback: () → void 1296 // Function internalCallback: () → void
1297 function internalCallback() { 1297 function internalCallback() {
1298 this[_handle] = null; 1298 this[_handle] = null;
1299 callback(); 1299 callback();
1300 } 1300 }
1301 this[_handle] = 1; 1301 this[_handle] = 1;
1302 exports._globalState.topEventLoop.enqueue(exports._globalState.currentCo ntext, internalCallback, 'timer'); 1302 exports._globalState.topEventLoop.enqueue(exports._globalState.currentCo ntext, internalCallback, 'timer');
1303 this[_inEventLoop] = true; 1303 this[_inEventLoop] = true;
1304 } else if (hasTimer()) { 1304 } else if (hasTimer()) {
1305 // Function internalCallback: () → void 1305 // Function internalCallback: () → void
1306 function internalCallback() { 1306 function internalCallback() {
1307 this[_handle] = null; 1307 this[_handle] = null;
1308 leaveJsAsync(); 1308 leaveJsAsync();
1309 callback(); 1309 callback();
1310 } 1310 }
1311 enterJsAsync(); 1311 enterJsAsync();
1312 this[_handle] = self.setTimeout(_js_helper.convertDartClosureToJS(intern alCallback, 0), milliseconds); 1312 this[_handle] = self.setTimeout(_js_helper.convertDartClosureToJS(intern alCallback, 0), milliseconds);
1313 } else { 1313 } else {
1314 dart.assert(dart.notNull(milliseconds) > 0); 1314 dart.assert(dart.notNull(milliseconds) > 0);
1315 throw new core.UnsupportedError("Timer greater than 0."); 1315 throw new core.UnsupportedError("Timer greater than 0.");
1316 } 1316 }
1317 } 1317 }
1318 periodic(milliseconds, callback) { 1318 periodic(milliseconds, callback) {
1319 this[_once] = false; 1319 dart.initField(TimerImpl, this, _once, false);
1320 this[_inEventLoop] = false; 1320 dart.initField(TimerImpl, this, _inEventLoop, false);
1321 this[_handle] = null; 1321 dart.initField(TimerImpl, this, _handle, null);
1322 if (hasTimer()) { 1322 if (hasTimer()) {
1323 enterJsAsync(); 1323 enterJsAsync();
1324 this[_handle] = self.setInterval(_js_helper.convertDartClosureToJS((() = > { 1324 this[_handle] = self.setInterval(_js_helper.convertDartClosureToJS((() = > {
1325 callback(this); 1325 callback(this);
1326 }).bind(this), 0), milliseconds); 1326 }).bind(this), 0), milliseconds);
1327 } else { 1327 } else {
1328 throw new core.UnsupportedError("Periodic timer."); 1328 throw new core.UnsupportedError("Periodic timer.");
1329 } 1329 }
1330 } 1330 }
1331 cancel() { 1331 cancel() {
(...skipping 24 matching lines...) Expand all
1356 function hasTimer() { 1356 function hasTimer() {
1357 _js_helper.requiresPreamble(); 1357 _js_helper.requiresPreamble();
1358 return self.setTimeout != null; 1358 return self.setTimeout != null;
1359 } 1359 }
1360 let _internal = Symbol('_internal'); 1360 let _internal = Symbol('_internal');
1361 class CapabilityImpl extends core.Object { 1361 class CapabilityImpl extends core.Object {
1362 CapabilityImpl() { 1362 CapabilityImpl() {
1363 this[_internal](_js_helper.random64()); 1363 this[_internal](_js_helper.random64());
1364 } 1364 }
1365 [_internal](id) { 1365 [_internal](id) {
1366 this[_id] = id; 1366 dart.initField(CapabilityImpl, this, _id, id);
1367 } 1367 }
1368 get hashCode() { 1368 get hashCode() {
1369 let hash = this[_id]; 1369 let hash = this[_id];
1370 hash = dart.notNull(hash) >> 0 ^ (dart.notNull(hash) / 4294967296).truncat e(); 1370 hash = dart.notNull(hash) >> 0 ^ (dart.notNull(hash) / 4294967296).truncat e();
1371 hash = ~dart.notNull(hash) + (dart.notNull(hash) << 15) & 4294967295; 1371 hash = ~dart.notNull(hash) + (dart.notNull(hash) << 15) & 4294967295;
1372 hash = dart.notNull(hash) ^ dart.notNull(hash) >> 12; 1372 hash = dart.notNull(hash) ^ dart.notNull(hash) >> 12;
1373 hash = dart.notNull(hash) * 5 & 4294967295; 1373 hash = dart.notNull(hash) * 5 & 4294967295;
1374 hash = dart.notNull(hash) ^ dart.notNull(hash) >> 4; 1374 hash = dart.notNull(hash) ^ dart.notNull(hash) >> 4;
1375 hash = dart.notNull(hash) * 2057 & 4294967295; 1375 hash = dart.notNull(hash) * 2057 & 4294967295;
1376 hash = dart.notNull(hash) ^ dart.notNull(hash) >> 16; 1376 hash = dart.notNull(hash) ^ dart.notNull(hash) >> 16;
(...skipping 15 matching lines...) Expand all
1392 exports.leaveJsAsync = leaveJsAsync; 1392 exports.leaveJsAsync = leaveJsAsync;
1393 exports.isWorker = isWorker; 1393 exports.isWorker = isWorker;
1394 exports.startRootIsolate = startRootIsolate; 1394 exports.startRootIsolate = startRootIsolate;
1395 exports.IsolateNatives = IsolateNatives; 1395 exports.IsolateNatives = IsolateNatives;
1396 exports.RawReceivePortImpl = RawReceivePortImpl; 1396 exports.RawReceivePortImpl = RawReceivePortImpl;
1397 exports.ReceivePortImpl = ReceivePortImpl; 1397 exports.ReceivePortImpl = ReceivePortImpl;
1398 exports.TimerImpl = TimerImpl; 1398 exports.TimerImpl = TimerImpl;
1399 exports.hasTimer = hasTimer; 1399 exports.hasTimer = hasTimer;
1400 exports.CapabilityImpl = CapabilityImpl; 1400 exports.CapabilityImpl = CapabilityImpl;
1401 })(_isolate_helper || (_isolate_helper = {})); 1401 })(_isolate_helper || (_isolate_helper = {}));
OLDNEW
« no previous file with comments | « lib/runtime/dart/_internal.js ('k') | lib/runtime/dart/_js_helper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698