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

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

Issue 1935933002: Fix source information positions for deserialized patched elements. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fixes Created 4 years, 7 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 import '../common.dart'; 5 import '../common.dart';
6 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; 6 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
7 import '../common/tasks.dart' show CompilerTask; 7 import '../common/tasks.dart' show CompilerTask;
8 import '../compiler.dart' show Compiler; 8 import '../compiler.dart' show Compiler;
9 import '../constants/constant_system.dart'; 9 import '../constants/constant_system.dart';
10 import '../constants/values.dart'; 10 import '../constants/values.dart';
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 js.AsyncModifier asyncModifier = element.asyncMarker.isAsync 44 js.AsyncModifier asyncModifier = element.asyncMarker.isAsync
45 ? (element.asyncMarker.isYielding 45 ? (element.asyncMarker.isYielding
46 ? const js.AsyncModifier.asyncStar() 46 ? const js.AsyncModifier.asyncStar()
47 : const js.AsyncModifier.async()) 47 : const js.AsyncModifier.async())
48 : (element.asyncMarker.isYielding 48 : (element.asyncMarker.isYielding
49 ? const js.AsyncModifier.syncStar() 49 ? const js.AsyncModifier.syncStar()
50 : const js.AsyncModifier.sync()); 50 : const js.AsyncModifier.sync());
51 51
52 return new js.Fun(parameters, body, asyncModifier: asyncModifier) 52 return new js.Fun(parameters, body, asyncModifier: asyncModifier)
53 .withSourceInformation(sourceInformationFactory 53 .withSourceInformation(sourceInformationFactory
54 .createBuilderForContext(resolvedAst.element) 54 .createBuilderForContext(resolvedAst)
55 .buildDeclaration(resolvedAst)); 55 .buildDeclaration(resolvedAst));
56 } 56 }
57 57
58 js.Expression generateCode(CodegenWorkItem work, HGraph graph) { 58 js.Expression generateCode(CodegenWorkItem work, HGraph graph) {
59 if (work.element.isField) { 59 if (work.element.isField) {
60 return generateLazyInitializer(work, graph); 60 return generateLazyInitializer(work, graph);
61 } else { 61 } else {
62 return generateMethod(work, graph); 62 return generateMethod(work, graph);
63 } 63 }
64 } 64 }
65 65
66 js.Expression generateLazyInitializer(CodegenWorkItem work, HGraph graph) { 66 js.Expression generateLazyInitializer(CodegenWorkItem work, HGraph graph) {
67 return measure(() { 67 return measure(() {
68 compiler.tracer.traceGraph("codegen", graph); 68 compiler.tracer.traceGraph("codegen", graph);
69 SourceInformation sourceInformation = sourceInformationFactory 69 SourceInformation sourceInformation = sourceInformationFactory
70 .createBuilderForContext(work.element) 70 .createBuilderForContext(work.resolvedAst)
71 .buildDeclaration(work.resolvedAst); 71 .buildDeclaration(work.resolvedAst);
72 SsaCodeGenerator codegen = new SsaCodeGenerator(backend, work); 72 SsaCodeGenerator codegen = new SsaCodeGenerator(backend, work);
73 codegen.visitGraph(graph); 73 codegen.visitGraph(graph);
74 return new js.Fun(codegen.parameters, codegen.body) 74 return new js.Fun(codegen.parameters, codegen.body)
75 .withSourceInformation(sourceInformation); 75 .withSourceInformation(sourceInformation);
76 }); 76 });
77 } 77 }
78 78
79 js.Expression generateMethod(CodegenWorkItem work, HGraph graph) { 79 js.Expression generateMethod(CodegenWorkItem work, HGraph graph) {
80 return measure(() { 80 return measure(() {
(...skipping 2813 matching lines...) Expand 10 before | Expand all | Expand 10 after
2894 registry.registerStaticUse(new StaticUse.staticInvoke( 2894 registry.registerStaticUse(new StaticUse.staticInvoke(
2895 helper, new CallStructure.unnamed(argumentCount))); 2895 helper, new CallStructure.unnamed(argumentCount)));
2896 return backend.emitter.staticFunctionAccess(helper); 2896 return backend.emitter.staticFunctionAccess(helper);
2897 } 2897 }
2898 2898
2899 @override 2899 @override
2900 void visitRef(HRef node) { 2900 void visitRef(HRef node) {
2901 visit(node.value); 2901 visit(node.value);
2902 } 2902 }
2903 } 2903 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | tests/compiler/dart2js/serialization_compilation_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698