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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 28173002: Code review changes for ngeoffray's comments on r28278 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index 6cd0139c038383e235699e04a60a5d31e6df93c2..210003f410a4b2ed6bf68d485fb2183af2376883 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -274,6 +274,11 @@ class LocalsHandler {
// classes, or the same as [:this:] for non-intercepted classes.
ClassElement cls = element.getEnclosingClass();
JavaScriptBackend backend = compiler.backend;
+
+ // When the class extends a native class, the instance is pre-constructed
+ // and passed to the generative constructor factory function as a parameter.
+ // Instead of allocating and initializing the object, the constructor
+ // 'upgrades' the native subclass object by initializing the Dart fields.
bool isNativeUpgradeFactory = element.isGenerativeConstructor()
&& Elements.isNativeOrExtendsNative(cls);
if (backend.isInterceptedMethod(element)) {
@@ -291,7 +296,6 @@ class LocalsHandler {
}
value.instructionType = builder.getTypeOfThis();
} else if (isNativeUpgradeFactory) {
- bool isInterceptorClass = backend.isInterceptorClass(cls.declaration);
Element parameter = new InterceptedElement(
cls.computeType(compiler), 'receiver', element);
HParameterValue value = new HParameterValue(parameter);
@@ -1613,8 +1617,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
// Unassigned fields of native classes are not initialized to
// prevent overwriting pre-initialized native properties.
if (!Elements.isNativeOrExtendsNative(classElement)) {
- HInstruction value = graph.addConstantNull(compiler);
- fieldValues[member] = value;
+ fieldValues[member] = graph.addConstantNull(compiler);
}
} else {
Node right = assignment.arguments.head;
@@ -1626,8 +1629,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
member, node, elements);
inlinedFrom(member, () => right.accept(this));
elements = savedElements;
- HInstruction value = pop();
- fieldValues[member] = value;
+ fieldValues[member] = pop();
}
});
});

Powered by Google App Engine
This is Rietveld 408576698