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

Side by Side Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 1229673006: Generated source mapping through CPS. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of ssa; 5 part of ssa;
6 6
7 class SsaFunctionCompiler implements FunctionCompiler { 7 class SsaFunctionCompiler implements FunctionCompiler {
8 SsaCodeGeneratorTask generator; 8 SsaCodeGeneratorTask generator;
9 SsaBuilderTask builder; 9 SsaBuilderTask builder;
10 SsaOptimizerTask optimizer; 10 SsaOptimizerTask optimizer;
(...skipping 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 instantiatedTypes = new List<DartType>.from(currentInlinedInstantiations); 2184 instantiatedTypes = new List<DartType>.from(currentInlinedInstantiations);
2185 } 2185 }
2186 2186
2187 HInstruction newObject; 2187 HInstruction newObject;
2188 if (!isNativeUpgradeFactory) { 2188 if (!isNativeUpgradeFactory) {
2189 newObject = new HForeignNew(classElement, 2189 newObject = new HForeignNew(classElement,
2190 ssaType, 2190 ssaType,
2191 constructorArguments, 2191 constructorArguments,
2192 instantiatedTypes); 2192 instantiatedTypes);
2193 if (function != null) { 2193 if (function != null) {
2194 // TODO(johnniwinther): Provide source information for creation
2195 // through synthetic constructors.
2194 newObject.sourceInformation = 2196 newObject.sourceInformation =
2195 sourceInformationBuilder.buildGeneric(function); 2197 sourceInformationBuilder.buildCreate(function);
2196 } 2198 }
2197 add(newObject); 2199 add(newObject);
2198 } else { 2200 } else {
2199 // Bulk assign to the initialized fields. 2201 // Bulk assign to the initialized fields.
2200 newObject = graph.explicitReceiverParameter; 2202 newObject = graph.explicitReceiverParameter;
2201 // Null guard ensures an error if we are being called from an explicit 2203 // Null guard ensures an error if we are being called from an explicit
2202 // 'new' of the constructor instead of via an upgrade. It is optimized out 2204 // 'new' of the constructor instead of via an upgrade. It is optimized out
2203 // if there are field initializers. 2205 // if there are field initializers.
2204 add(new HFieldGet( 2206 add(new HFieldGet(
2205 null, newObject, backend.dynamicType, isAssignable: false)); 2207 null, newObject, backend.dynamicType, isAssignable: false));
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
3140 closureClassElement.closureFields.forEach((ClosureFieldElement field) { 3142 closureClassElement.closureFields.forEach((ClosureFieldElement field) {
3141 Local capturedLocal = 3143 Local capturedLocal =
3142 nestedClosureData.getLocalVariableForClosureField(field); 3144 nestedClosureData.getLocalVariableForClosureField(field);
3143 assert(capturedLocal != null); 3145 assert(capturedLocal != null);
3144 capturedVariables.add(localsHandler.readLocal(capturedLocal)); 3146 capturedVariables.add(localsHandler.readLocal(capturedLocal));
3145 }); 3147 });
3146 3148
3147 TypeMask type = 3149 TypeMask type =
3148 new TypeMask.nonNullExact(compiler.functionClass, compiler.world); 3150 new TypeMask.nonNullExact(compiler.functionClass, compiler.world);
3149 push(new HForeignNew(closureClassElement, type, capturedVariables) 3151 push(new HForeignNew(closureClassElement, type, capturedVariables)
3150 ..sourceInformation = sourceInformationBuilder.buildGeneric(node)); 3152 ..sourceInformation = sourceInformationBuilder.buildCreate(node));
3151 3153
3152 Element methodElement = nestedClosureData.closureElement; 3154 Element methodElement = nestedClosureData.closureElement;
3153 registry.registerInstantiatedClosure(methodElement); 3155 registry.registerInstantiatedClosure(methodElement);
3154 } 3156 }
3155 3157
3156 visitFunctionDeclaration(ast.FunctionDeclaration node) { 3158 visitFunctionDeclaration(ast.FunctionDeclaration node) {
3157 assert(isReachable); 3159 assert(isReachable);
3158 visit(node.function); 3160 visit(node.function);
3159 LocalFunctionElement localFunction = 3161 LocalFunctionElement localFunction =
3160 elements.getFunctionDefinition(node.function); 3162 elements.getFunctionDefinition(node.function);
(...skipping 5696 matching lines...) Expand 10 before | Expand all | Expand 10 after
8857 if (unaliased is TypedefType) throw 'unable to unalias $type'; 8859 if (unaliased is TypedefType) throw 'unable to unalias $type';
8858 unaliased.accept(this, builder); 8860 unaliased.accept(this, builder);
8859 } 8861 }
8860 8862
8861 void visitDynamicType(DynamicType type, SsaBuilder builder) { 8863 void visitDynamicType(DynamicType type, SsaBuilder builder) {
8862 JavaScriptBackend backend = builder.compiler.backend; 8864 JavaScriptBackend backend = builder.compiler.backend;
8863 ClassElement cls = backend.findHelper('DynamicRuntimeType'); 8865 ClassElement cls = backend.findHelper('DynamicRuntimeType');
8864 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 8866 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
8865 } 8867 }
8866 } 8868 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698