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

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

Issue 885783005: Revert "Move reflection support out of model." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « pkg/compiler/lib/src/js_emitter/old_emitter/container_builder.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_emitter/program_builder.dart
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder.dart
index 9f517342b513efb7ccabbbe7257a53eb0316ae5e..6f89f66b2e82423d057dff0fe247598a05d22861 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder.dart
@@ -389,6 +389,13 @@ class ProgramBuilder {
return !method.functionSignature.optionalParameters.isEmpty;
}
+ bool _methodCanBeReflected(FunctionElement method) {
+ return backend.isAccessibleByReflection(method) ||
+ // During incremental compilation, we have to assume that reflection
+ // *might* get enabled.
+ _compiler.hasIncrementalSupport;
+ }
+
bool _methodCanBeApplied(FunctionElement method) {
return _compiler.enabledFunctionApply &&
_compiler.world.getMightBePassedToApply(method);
@@ -417,6 +424,7 @@ class ProgramBuilder {
bool isNotApplyTarget = !element.isFunction || element.isAccessor;
final bool needsStubs = _methodNeedsStubs(element);
+ final bool canBeReflected = _methodCanBeReflected(element);
final bool canBeApplied = _methodCanBeApplied(element);
final bool hasSuperAlias = backend.isAliasedSuperMember(element);
@@ -428,7 +436,8 @@ class ProgramBuilder {
isClosure = true;
} else {
// Careful with operators.
- canTearOff = universe.hasInvokedGetter(element, _compiler.world);
+ canTearOff = universe.hasInvokedGetter(element, _compiler.world) ||
+ (canBeReflected && !element.isOperator);
assert(canTearOff ||
!universe.methodsNeedingSuperGetter.contains(element));
tearOffName = namer.getterName(element);
@@ -444,7 +453,7 @@ class ProgramBuilder {
return new InstanceMethod(element, name, code, needsTearOff: canTearOff,
tearOffName: tearOffName, isClosure: isClosure,
hasSuperAlias: hasSuperAlias, canBeApplied: canBeApplied,
- needsStubs: needsStubs);
+ canBeReflected: canBeReflected, needsStubs: needsStubs);
}
/// Builds a stub method.
@@ -552,12 +561,13 @@ class ProgramBuilder {
String holder = namer.globalObjectFor(element);
js.Expression code = backend.generatedCode[element];
+ final bool isNotApplyTarget = !element.isConstructor && !element.isAccessor;
final bool needsStubs = _methodNeedsStubs(element);
final bool canBeApplied = _methodCanBeApplied(element);
+ final bool canBeReflected = _methodCanBeReflected(element);
- final bool isApplyTarget = !element.isConstructor && !element.isAccessor;
- final bool needsTearOff = isApplyTarget &&
- universe.staticFunctionsNeedingGetter.contains(element);
+ final bool needsTearOff = isNotApplyTarget && (canBeReflected ||
+ universe.staticFunctionsNeedingGetter.contains(element));
final String tearOffName =
needsTearOff ? namer.getStaticClosureName(element) : null;
@@ -567,6 +577,7 @@ class ProgramBuilder {
needsTearOff: needsTearOff,
tearOffName: tearOffName,
canBeApplied: canBeApplied,
+ canBeReflected: canBeReflected,
needsStubs: needsStubs);
}
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/old_emitter/container_builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698