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

Unified Diff: pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart

Issue 910723002: dart2js: don't emit tear-off data if not needed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | 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/new_emitter/model_emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart b/pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart
index 6e37f27edaf5e9bce1be9c4199c4851c21c1f9f6..54a834fdf804159efe8d5ec6f20268f1e3707bf7 100644
--- a/pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart
@@ -505,10 +505,10 @@ class ModelEmitter {
///
/// [Method.code]
/// [DartMethod.callName]
+ /// [InstanceMethod.aliasName]
/// [DartMethod.tearOffName]
/// [JavaScriptBackend.isInterceptedMethod]
/// functionType
- /// [InstanceMethod.aliasName]
///
/// followed by
///
@@ -529,15 +529,15 @@ function parseFunctionDescriptor(proto, name, descriptor) {
proto[descriptor[pos]] = stub;
funs.push(stub);
}
- if (descriptor[2] != null) {
- var isIntercepted = descriptor[3];
- var reflectionInfo = descriptor[4];
- proto[descriptor[2]] =
+ if (descriptor[3] != null) {
+ var isIntercepted = descriptor[4];
+ var reflectionInfo = descriptor[5];
+ proto[descriptor[3]] =
tearOff(funs, reflectionInfo, false, name, isIntercepted);
}
// Install the alias for super calls on the prototype chain.
floitsch 2015/02/09 12:41:41 Move this code into right order. First a check for
zarah 2015/02/09 15:52:00 Acknowledged.
- if (descriptor[5] != null) {
- proto[descriptor[5]] = descriptor[0];
+ if (descriptor[2] != null) {
+ proto[descriptor[2]] = descriptor[0];
}
} else {
proto[name] = descriptor;
@@ -571,19 +571,24 @@ function parseFunctionDescriptor(proto, name, descriptor) {
if (method.needsTearOff || method.aliasName != null) {
/// See [parseFunctionDescriptorBoilerplate] for a full description of
/// the format.
- // [name, [function, callName, tearOffName, isIntercepted, functionType,
- // aliasName, stub1_name, stub1_callName, stub1_code, ...]
- bool isIntercepted = backend.isInterceptedMethod(method.element);
+ // [name, [function, callName, aliasName, tearOffName, isIntercepted,
+ // functionType, stub1_name, stub1_callName, stub1_code, ...]
var data = [method.code];
data.add(js.string(method.callName));
- data.add(js.string(method.tearOffName));
- data.add(new js.LiteralBool(isIntercepted));
- data.add(_generateFunctionType(method.type));
+
if (method.aliasName != null) {
data.add(js.string(method.aliasName));
} else {
data.add(new js.LiteralNull());
}
+
+ if (method.needsTearOff) {
floitsch 2015/02/09 12:41:41 You can only avoid adding these if there aren't an
zarah 2015/02/09 15:52:00 Acknowledged.
+ data.add(js.string(method.tearOffName));
+ bool isIntercepted = backend.isInterceptedMethod(method.element);
+ data.add(new js.LiteralBool(isIntercepted));
+ data.add(_generateFunctionType(method.type));
+ }
+
data.addAll(method.parameterStubs.expand(makeNameCallNameCodeTriplet));
return [js.string(method.name), new js.ArrayInitializer(data)];
} else {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698