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

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

Issue 1126423002: Avoid reparsing metadata expressions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library dart2js.new_js_emitter.model; 5 library dart2js.new_js_emitter.model;
6 6
7 import '../js/js.dart' as js show Expression, Statement; 7 import '../js/js.dart' as js show Expression, Statement;
8 import '../constants/values.dart' show ConstantValue; 8 import '../constants/values.dart' show ConstantValue;
9 9
10 import '../deferred_load.dart' show OutputUnit; 10 import '../deferred_load.dart' show OutputUnit;
(...skipping 25 matching lines...) Expand all
36 this.typeToInterceptorMap, 36 this.typeToInterceptorMap,
37 this._metadataCollector, 37 this._metadataCollector,
38 {this.needsNativeSupport, 38 {this.needsNativeSupport,
39 this.outputContainsConstantList, 39 this.outputContainsConstantList,
40 this.hasIsolateSupport}) { 40 this.hasIsolateSupport}) {
41 assert(needsNativeSupport != null); 41 assert(needsNativeSupport != null);
42 assert(outputContainsConstantList != null); 42 assert(outputContainsConstantList != null);
43 assert(hasIsolateSupport != null); 43 assert(hasIsolateSupport != null);
44 } 44 }
45 45
46 /// A list of pretty-printed JavaScript expressions. 46 /// A list of metadata expressions.
47 /// 47 ///
48 /// This list must be emitted in the `METADATA` embedded global. 48 /// This list must be emitted in the `METADATA` embedded global.
49 /// The list references constants and must hence be emitted after constants 49 /// The list references constants and must hence be emitted after constants
50 /// have been initialized. 50 /// have been initialized.
51 /// 51 ///
52 /// Note: the metadata is derived from the task's `metadataCollector`. The 52 /// Note: the metadata is derived from the task's `metadataCollector`. The
53 /// list must not be emitted before all operations on it are done. For 53 /// list must not be emitted before all operations on it are done. For
54 /// example, the old emitter generates metadata when emitting reflection 54 /// example, the old emitter generates metadata when emitting reflection
55 /// data. 55 /// data.
56 List<String> get metadata => _metadataCollector.globalMetadata; 56 List<js.Expression> get metadata => _metadataCollector.globalMetadata;
57 57
58 /// A map with lists of pretty-printed JavaScript expressions. 58 /// A map with lists of type expressions.
59 /// 59 ///
60 /// There is one list for each output unit. The list belonging to the main 60 /// There is one list for each output unit. The list belonging to the main
61 /// unit must be emitted in the `TYPES` embedded global. The list references 61 /// unit must be emitted in the `TYPES` embedded global. The list references
62 /// constants and must hence be emitted after constants have been initialized. 62 /// constants and must hence be emitted after constants have been initialized.
63 /// 63 ///
64 /// Note: the metadata is derived from the task's `metadataCollector`. The 64 /// Note: the metadata is derived from the task's `metadataCollector`. The
65 /// list must not be emitted before all operations on it are done. For 65 /// list must not be emitted before all operations on it are done. For
66 /// example, the old emitter generates metadata when emitting reflection 66 /// example, the old emitter generates metadata when emitting reflection
67 /// data. 67 /// data.
68 Map<OutputUnit, List<String>> get metadataTypes 68 Map<OutputUnit, List<js.Expression>> get metadataTypes
69 => _metadataCollector.types; 69 => _metadataCollector.types;
70 70
71 71
72 bool get isSplit => fragments.length > 1; 72 bool get isSplit => fragments.length > 1;
73 Iterable<Fragment> get deferredFragments => fragments.skip(1); 73 Iterable<Fragment> get deferredFragments => fragments.skip(1);
74 Fragment get mainFragment => fragments.first; 74 Fragment get mainFragment => fragments.first;
75 } 75 }
76 76
77 /** 77 /**
78 * This class represents a JavaScript object that contains static state, like 78 * This class represents a JavaScript object that contains static state, like
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 requiredParameterCount: requiredParameterCount, 481 requiredParameterCount: requiredParameterCount,
482 optionalParameterDefaultValues: optionalParameterDefaultValues, 482 optionalParameterDefaultValues: optionalParameterDefaultValues,
483 functionType: functionType); 483 functionType: functionType);
484 } 484 }
485 485
486 class StaticStubMethod extends StubMethod implements StaticMethod { 486 class StaticStubMethod extends StubMethod implements StaticMethod {
487 Holder holder; 487 Holder holder;
488 StaticStubMethod(String name, this.holder, js.Expression code) 488 StaticStubMethod(String name, this.holder, js.Expression code)
489 : super(name, code); 489 : super(name, code);
490 } 490 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698