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

Unified Diff: compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java

Issue 8253003: Don't emit calls to "Object.$Constructor" and "Object.$Initializer". Saves 17K (optimized) off of... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 2 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: compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java
===================================================================
--- compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java (revision 372)
+++ compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java (working copy)
@@ -961,7 +961,9 @@
for (DartInitializer init : initializers) {
if (init.isInvocation()) {
JsExprStmt statement = (JsExprStmt) generate(init);
- return (JsInvocation) statement.getExpression();
+ if (statement != null) {
+ return (JsInvocation) statement.getExpression();
+ }
}
}
}
@@ -1526,14 +1528,14 @@
@Override
public JsNode visitInitializer(DartInitializer x) {
JsExpression e = (JsExpression) generate(x.getValue());
- if (!x.isInvocation()) {
+ if (e != null && !x.isInvocation()) {
JsName fieldJsName = getJsName(x.getName().getTargetSymbol());
assert fieldJsName != null : "Field name must have been resolved.";
JsNameRef field = AstUtil.newNameRef(new JsThisRef(), fieldJsName);
e = AstUtil.newAssignment(field, e);
e.setSourceRef(x);
}
- return new JsExprStmt(e);
+ return e != null ? new JsExprStmt(e) : null;
}
@Override
@@ -3191,6 +3193,11 @@
elementName = element.getName();
}
+ // Skip emitting the super calls call if it is Object.
+ if (classElement.equals(typeProvider.getObjectType().getElement())) {
+ return null;
+ }
+
// TODO(floitsch): it would be good, if we could get a js-name instead of just a string.
// This way the debugging information would be better.
// We need to generate the JsName (for the initializer/factory) once only and store it
« 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