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

Unified Diff: pkg/compiler/lib/src/js_emitter/model.dart

Issue 889643002: dart2js: emit metadata in new emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_emitter/model.dart
diff --git a/pkg/compiler/lib/src/js_emitter/model.dart b/pkg/compiler/lib/src/js_emitter/model.dart
index 1c3f80d72cbbf1e8885d7ab12b17cb6ece405431..248a7b85c25a322f57ea85f2ec768a573036707d 100644
--- a/pkg/compiler/lib/src/js_emitter/model.dart
+++ b/pkg/compiler/lib/src/js_emitter/model.dart
@@ -9,6 +9,8 @@ import '../constants/values.dart' show ConstantValue;
import '../deferred_load.dart' show OutputUnit;
+import 'js_emitter.dart' show MetadataCollector;
+
import '../common.dart';
class Program {
@@ -22,15 +24,34 @@ class Program {
// global `TYPE_TO_INTERCEPTOR_MAP`. The map references constants and classes.
final js.Expression typeToInterceptorMap;
+ // TODO(floitsch): we should store the metadata directly instead of storing
+ // the collector. However, the old emitter still updates the data.
+ final MetadataCollector _metadataCollector;
+
Program(this.fragments,
this.loadMap,
this.typeToInterceptorMap,
+ this._metadataCollector,
{this.outputContainsNativeClasses,
this.outputContainsConstantList}) {
assert(outputContainsNativeClasses != null);
assert(outputContainsConstantList != null);
}
+ /// A list of pretty-printed JavaScript expressions.
+ ///
+ /// This list must be emitted in the `METADATA` embedded global.
+ /// References to classes or constants are wrapped into functions (that are
floitsch 2015/01/29 17:06:31 I'm not yet 100% sure of these claims. If necessar
floitsch 2015/01/29 17:12:18 Already updated...
+ /// only executed at runtime). It is safe to emit the data before classes
+ /// and constants are completely set up. In fact, the data must be emitted
+ /// before any class (including constant) is constructed.
+ ///
+ /// Note: the metadata is derived from the task's `metadataCollector`. The
+ /// list must not be emitted before all operations on it are done. For
+ /// example, the old emitter generates metadata when emitting reflection
+ /// data.
+ List<String> get metadata => _metadataCollector.globalMetadata;
+
bool get isSplit => fragments.length > 1;
Iterable<Fragment> get deferredFragments => fragments.skip(1);
}
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698