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

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

Issue 1609843002: partial fix for #414, avoid dcall in _convertToDart (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | test/codegen/expect/collection/wrappers.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 dart_library.library('dart/js', null, /* Imports */[ 1 dart_library.library('dart/js', null, /* Imports */[
2 "dart/_runtime", 2 "dart/_runtime",
3 'dart/core', 3 'dart/core',
4 'dart/collection', 4 'dart/collection',
5 'dart/_js_helper' 5 'dart/_js_helper'
6 ], /* Lazy imports */[ 6 ], /* Lazy imports */[
7 ], function(exports, dart, core, collection, _js_helper) { 7 ], function(exports, dart, core, collection, _js_helper) {
8 'use strict'; 8 'use strict';
9 let dartx = dart.dartx; 9 let dartx = dart.dartx;
10 const _global = dart.global; 10 const _global = dart.global;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 dart.fn(_convertToJS); 336 dart.fn(_convertToJS);
337 function _wrapDartFunction(f) { 337 function _wrapDartFunction(f) {
338 let wrapper = function() { 338 let wrapper = function() {
339 let args = Array.prototype.map.call(arguments, _convertToDart); 339 let args = Array.prototype.map.call(arguments, _convertToDart);
340 return _convertToJS(f(...args)); 340 return _convertToJS(f(...args));
341 }; 341 };
342 dart.dsetindex(_dartProxies, wrapper, f); 342 dart.dsetindex(_dartProxies, wrapper, f);
343 return wrapper; 343 return wrapper;
344 } 344 }
345 dart.fn(_wrapDartFunction); 345 dart.fn(_wrapDartFunction);
346 function _convertToDart(o, isBrowserType) { 346 function _convertToDart(o) {
347 if (isBrowserType === void 0) isBrowserType = null; 347 if (o == null || typeof o == "string" || typeof o == "number" || typeof o == "boolean" || dart.notNull(_isBrowserType(o))) {
348 if (isBrowserType == null) isBrowserType = _isBrowserType;
349 if (o == null || typeof o == "string" || typeof o == "number" || typeof o == "boolean" || dart.notNull(dart.dcall(isBrowserType, o))) {
350 return o; 348 return o;
351 } else if (o instanceof Date) { 349 } else if (o instanceof Date) {
352 let ms = o.getTime(); 350 let ms = o.getTime();
353 return new core.DateTime.fromMillisecondsSinceEpoch(dart.asInt(ms)); 351 return new core.DateTime.fromMillisecondsSinceEpoch(dart.asInt(ms));
354 } else if (dart.is(o, _DartObject) && dart.jsobject != dart.realRuntimeType( o)) { 352 } else if (dart.is(o, _DartObject) && dart.jsobject != dart.realRuntimeType( o)) {
355 return dart.dload(o, _dartObj); 353 return dart.dload(o, _dartObj);
356 } else { 354 } else {
357 return _putIfAbsent(_dartProxies, o, _wrapToDart); 355 return _putIfAbsent(_dartProxies, o, _wrapToDart);
358 } 356 }
359 } 357 }
360 dart.fn(_convertToDart, core.Object, [dart.dynamic], [dart.functionType(core.b ool, [dart.dynamic])]); 358 dart.fn(_convertToDart, core.Object, [dart.dynamic]);
361 function _wrapToDart(o) { 359 function _wrapToDart(o) {
362 if (typeof o == "function") { 360 if (typeof o == "function") {
363 return new JsFunction._fromJs(o); 361 return new JsFunction._fromJs(o);
364 } 362 }
365 if (o instanceof Array) { 363 if (o instanceof Array) {
366 return new JsArray._fromJs(o); 364 return new JsArray._fromJs(o);
367 } 365 }
368 return new JsObject._fromJs(o); 366 return new JsObject._fromJs(o);
369 } 367 }
370 dart.fn(_wrapToDart, JsObject, [dart.dynamic]); 368 dart.fn(_wrapToDart, JsObject, [dart.dynamic]);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 }); 408 });
411 let __CastType0 = __CastType0$(); 409 let __CastType0 = __CastType0$();
412 // Exports: 410 // Exports:
413 exports.JsObject = JsObject; 411 exports.JsObject = JsObject;
414 exports.JsFunction = JsFunction; 412 exports.JsFunction = JsFunction;
415 exports.JsArray$ = JsArray$; 413 exports.JsArray$ = JsArray$;
416 exports.JsArray = JsArray; 414 exports.JsArray = JsArray;
417 exports.allowInterop = allowInterop; 415 exports.allowInterop = allowInterop;
418 exports.allowInteropCaptureThis = allowInteropCaptureThis; 416 exports.allowInteropCaptureThis = allowInteropCaptureThis;
419 }); 417 });
OLDNEW
« no previous file with comments | « no previous file | test/codegen/expect/collection/wrappers.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698