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

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

Issue 939753002: dart2js: only allocate one closure in 'setupClass' of the new emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update comment. 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 ad7057b5154513348953c6f6d30b6f2a4cd1bfc7..db33c9fe1776e1acccfe188ff25b10aaff924cc8 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
@@ -841,23 +841,19 @@ function parseFunctionDescriptor(proto, name, descriptor) {
}
function setupClass(name, holder, descriptor) {
- var ensureResolved = function() {
+ var patch = function() {
var constructor = compileConstructor(name, descriptor);
holder[name] = constructor;
constructor.ensureResolved = function() { return this; };
- return constructor;
- };
-
- var patch = function() {
- var constructor = ensureResolved();
+ if (this === patch) return constructor; // Was used as "ensureResolved".
var object = new constructor();
constructor.apply(object, arguments);
return object;
};
- // We store the ensureResolved function on the patch function to make it
+ // We store the patch function on itself to make it
// possible to resolve superclass references without constructing instances.
- patch.ensureResolved = ensureResolved;
+ patch.ensureResolved = patch;
holder[name] = patch;
}
« 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