Index: pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart |
diff --git a/pkg/compiler/lib/src/js_emitter/lazy_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart |
similarity index 82% |
copy from pkg/compiler/lib/src/js_emitter/lazy_emitter/emitter.dart |
copy to pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart |
index e8b7a5d974beb9b34f5a93a25f7cbaa2d5ea1d99..99cb746cfc85ec87b51549b0d1ff3669a00e0646 100644 |
--- a/pkg/compiler/lib/src/js_emitter/lazy_emitter/emitter.dart |
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart |
@@ -1,8 +1,8 @@ |
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
-library dart2js.js_emitter.lazy_emitter; |
+library dart2js.js_emitter.startup_emitter; |
import 'package:js_runtime/shared/embedded_names.dart' show |
JsBuiltin, |
@@ -17,8 +17,8 @@ import '../../elements/elements.dart' show FieldElement; |
import '../../js/js.dart' as js; |
import '../../js_backend/js_backend.dart' show |
- JavaScriptBackend, |
- Namer; |
+JavaScriptBackend, |
+Namer; |
import '../js_emitter.dart' show |
NativeEmitter; |
@@ -47,13 +47,11 @@ class Emitter implements emitterTask.Emitter { |
return _emitter.emitProgram(program); |
} |
- // TODO(floitsch): copied from full emitter. Adjust or share. |
@override |
bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant) { |
return _emitter.isConstantInlinedOrAlreadyEmitted(constant); |
} |
- // TODO(floitsch): copied from full emitter. Adjust or share. |
@override |
int compareConstants(ConstantValue a, ConstantValue b) { |
return _emitter.compareConstants(a, b); |
@@ -85,7 +83,7 @@ class Emitter implements emitterTask.Emitter { |
@override |
js.Expression isolateLazyInitializerAccess(FieldElement element) { |
return js.js('#.#', [namer.globalObjectFor(element), |
- namer.lazyInitializerName(element)]); |
+ namer.lazyInitializerName(element)]); |
} |
@override |
@@ -118,16 +116,12 @@ class Emitter implements emitterTask.Emitter { |
@override |
js.Expression interceptorClassAccess(ClassElement element) { |
- // Some interceptors are eagerly constructed. However, native interceptors |
- // aren't. |
- return js.js('#.ensureResolved()', _globalPropertyAccess(element)); |
+ return _globalPropertyAccess(element); |
} |
@override |
js.Expression typeAccess(Element element) { |
- // TODO(floitsch): minify 'ensureResolved'. |
- // TODO(floitsch): don't emit `ensureResolved` for eager classes. |
- return js.js('#.ensureResolved()', _globalPropertyAccess(element)); |
+ return _globalPropertyAccess(element); |
} |
@override |
@@ -154,11 +148,11 @@ class Emitter implements emitterTask.Emitter { |
case JsBuiltin.createFunctionTypeRti: |
return _backend.rti.representationGenerator |
- .templateForCreateFunctionType; |
+ .templateForCreateFunctionType; |
case JsBuiltin.isSubtype: |
- // TODO(floitsch): move this closer to where is-check properties are |
- // built. |
+ // TODO(floitsch): move this closer to where is-check properties are |
+ // built. |
String isPrefix = namer.operatorIsPrefix; |
return js.js.expressionTemplateFor("('$isPrefix' + #) in #.prototype"); |
@@ -166,14 +160,18 @@ class Emitter implements emitterTask.Emitter { |
return js.js.expressionTemplateFor('#.$typeNameProperty === #'); |
case JsBuiltin.getMetadata: |
- return _emitter.templateForReadMetadata; |
+ String metadataAccess = |
+ _emitter.generateEmbeddedGlobalAccessString(METADATA); |
+ return js.js.expressionTemplateFor("$metadataAccess[#]"); |
case JsBuiltin.getType: |
- return _emitter.templateForReadType; |
+ String typesAccess = |
+ _emitter.generateEmbeddedGlobalAccessString(TYPES); |
+ return js.js.expressionTemplateFor("$typesAccess[#]"); |
default: |
_compiler.internalError(NO_LOCATION_SPANNABLE, |
- "Unhandled Builtin: $builtin"); |
+ "Unhandled Builtin: $builtin"); |
return null; |
} |
} |