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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/js_emitter/nsm_emitter.dart

Issue 27524003: Generate tear-off closures dynamically. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r30954 Created 7 years 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
Index: dart/sdk/lib/_internal/compiler/implementation/js_emitter/nsm_emitter.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/js_emitter/nsm_emitter.dart b/dart/sdk/lib/_internal/compiler/implementation/js_emitter/nsm_emitter.dart
index 4e61cd7aa04b3226f837c349887c2419ab414ea0..5fabe215d7c823926a491426e03a9c858c3d3dd6 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/js_emitter/nsm_emitter.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/js_emitter/nsm_emitter.dart
@@ -18,7 +18,7 @@ class NsmEmitter extends CodeEmitterHelper {
static const MAX_MINIFIED_LENGTH_FOR_DIFF_ENCODING = 4;
- void emitNoSuchMethodHandlers(DefineStubFunction defineStub) {
+ void emitNoSuchMethodHandlers(AddPropertyFunction addProperty) {
// Do not generate no such method handlers if there is no class.
if (compiler.codegenWorld.instantiatedClasses.isEmpty) return;
@@ -55,8 +55,8 @@ class NsmEmitter extends CodeEmitterHelper {
compiler.codegenWorld.invokedSetters.forEach(addNoSuchMethodHandlers);
// Set flag used by generateMethod helper below. If we have very few
- // handlers we use defineStub for them all, rather than try to generate them
- // at runtime.
+ // handlers we use addProperty for them all, rather than try to generate
+ // them at runtime.
bool haveVeryFewNoSuchMemberHandlers =
(addedJsNames.length < VERY_FEW_NO_SUCH_METHOD_HANDLERS);
@@ -104,12 +104,12 @@ class NsmEmitter extends CodeEmitterHelper {
Selector selector = addedJsNames[jsName];
jsAst.Expression method = generateMethod(jsName, selector);
if (method != null) {
- defineStub(jsName, method);
+ addProperty(jsName, method);
String reflectionName = task.getReflectionName(selector, jsName);
if (reflectionName != null) {
bool accessible = compiler.world.allFunctions.filter(selector).any(
(Element e) => backend.isAccessibleByReflection(e));
- defineStub('+$reflectionName', js(accessible ? '1' : '0'));
+ addProperty('+$reflectionName', js(accessible ? '1' : '0'));
}
}
}

Powered by Google App Engine
This is Rietveld 408576698