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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart

Issue 2814453005: Merge CommonElements and BackendHelpers! (Closed)
Patch Set: comments and re-merge, take two Created 3 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 dart2js.js_emitter.startup_emitter.model_emitter; 5 part of dart2js.js_emitter.startup_emitter.model_emitter;
6 6
7 /// The name of the property that stores the tear-off getter on a static 7 /// The name of the property that stores the tear-off getter on a static
8 /// function. 8 /// function.
9 /// 9 ///
10 /// This property is only used when isolates are used. 10 /// This property is only used when isolates are used.
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 355
356 /// An expression that returns `true` if `__proto__` can be assigned to stitch 356 /// An expression that returns `true` if `__proto__` can be assigned to stitch
357 /// together a prototype chain, and the performance is good. 357 /// together a prototype chain, and the performance is good.
358 const String directAccessTestExpression = r''' 358 const String directAccessTestExpression = r'''
359 (function () { 359 (function () {
360 var cls = function () {}; 360 var cls = function () {};
361 cls.prototype = {'p': {}}; 361 cls.prototype = {'p': {}};
362 var object = new cls(); 362 var object = new cls();
363 if (!(object.__proto__ && object.__proto__.p === cls.prototype.p)) 363 if (!(object.__proto__ && object.__proto__.p === cls.prototype.p))
364 return false; 364 return false;
365 365
366 try { 366 try {
367 // Are we running on a platform where the performance is good? 367 // Are we running on a platform where the performance is good?
368 // (i.e. Chrome or d8). 368 // (i.e. Chrome or d8).
369 369
370 // Chrome userAgent? 370 // Chrome userAgent?
371 if (typeof navigator != "undefined" && 371 if (typeof navigator != "undefined" &&
372 typeof navigator.userAgent == "string" && 372 typeof navigator.userAgent == "string" &&
373 navigator.userAgent.indexOf("Chrome/") >= 0) return true; 373 navigator.userAgent.indexOf("Chrome/") >= 0) return true;
374 // d8 version() looks like "N.N.N.N", jsshell version() like "N". 374 // d8 version() looks like "N.N.N.N", jsshell version() like "N".
375 if (typeof version == "function" && 375 if (typeof version == "function" &&
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 Map<DeferredFragment, _DeferredFragmentHash> deferredLoadHashes) { 461 Map<DeferredFragment, _DeferredFragmentHash> deferredLoadHashes) {
462 MainFragment fragment = program.fragments.first; 462 MainFragment fragment = program.fragments.first;
463 463
464 Iterable<Holder> nonStaticStateHolders = 464 Iterable<Holder> nonStaticStateHolders =
465 program.holders.where((Holder holder) => !holder.isStaticStateHolder); 465 program.holders.where((Holder holder) => !holder.isStaticStateHolder);
466 466
467 return js.js.statement(mainBoilerplate, { 467 return js.js.statement(mainBoilerplate, {
468 'directAccessTestExpression': js.js(directAccessTestExpression), 468 'directAccessTestExpression': js.js(directAccessTestExpression),
469 'typeNameProperty': js.string(ModelEmitter.typeNameProperty), 469 'typeNameProperty': js.string(ModelEmitter.typeNameProperty),
470 'cyclicThrow': backend.emitter 470 'cyclicThrow': backend.emitter
471 .staticFunctionAccess(backend.helpers.cyclicThrowHelper), 471 .staticFunctionAccess(compiler.commonElements.cyclicThrowHelper),
472 'operatorIsPrefix': js.string(namer.operatorIsPrefix), 472 'operatorIsPrefix': js.string(namer.operatorIsPrefix),
473 'tearOffCode': new js.Block(buildTearOffCode(backend)), 473 'tearOffCode': new js.Block(buildTearOffCode(backend)),
474 'embeddedTypes': generateEmbeddedGlobalAccess(TYPES), 474 'embeddedTypes': generateEmbeddedGlobalAccess(TYPES),
475 'embeddedInterceptorTags': 475 'embeddedInterceptorTags':
476 generateEmbeddedGlobalAccess(INTERCEPTORS_BY_TAG), 476 generateEmbeddedGlobalAccess(INTERCEPTORS_BY_TAG),
477 'embeddedLeafTags': generateEmbeddedGlobalAccess(LEAF_TAGS), 477 'embeddedLeafTags': generateEmbeddedGlobalAccess(LEAF_TAGS),
478 'embeddedGlobalsObject': js.js("init"), 478 'embeddedGlobalsObject': js.js("init"),
479 'holdersList': new js.ArrayInitializer(nonStaticStateHolders 479 'holdersList': new js.ArrayInitializer(nonStaticStateHolders
480 .map((holder) => js.js("#", holder.name)) 480 .map((holder) => js.js("#", holder.name))
481 .toList(growable: false)), 481 .toList(growable: false)),
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 } 1392 }
1393 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);", 1393 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);",
1394 js.objectLiteral(interceptorsByTag))); 1394 js.objectLiteral(interceptorsByTag)));
1395 statements.add( 1395 statements.add(
1396 js.js.statement("setOrUpdateLeafTags(#);", js.objectLiteral(leafTags))); 1396 js.js.statement("setOrUpdateLeafTags(#);", js.objectLiteral(leafTags)));
1397 statements.addAll(subclassAssignments); 1397 statements.addAll(subclassAssignments);
1398 1398
1399 return wrapPhase('nativeSupport', new js.Block(statements)); 1399 return wrapPhase('nativeSupport', new js.Block(statements));
1400 } 1400 }
1401 } 1401 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart ('k') | pkg/compiler/lib/src/kernel/element_adapter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698