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

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

Issue 1967073002: Check closure data for serialization (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. 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 'dart:collection'; 5 import 'dart:collection';
6 6
7 import 'package:js_runtime/shared/embedded_names.dart'; 7 import 'package:js_runtime/shared/embedded_names.dart';
8 8
9 import '../closure.dart'; 9 import '../closure.dart';
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 } 505 }
506 return res; 506 return res;
507 } 507 }
508 508
509 HLocalValue getLocal(Local local, {SourceInformation sourceInformation}) { 509 HLocalValue getLocal(Local local, {SourceInformation sourceInformation}) {
510 // If the element is a parameter, we already have a 510 // If the element is a parameter, we already have a
511 // HParameterValue for it. We cannot create another one because 511 // HParameterValue for it. We cannot create another one because
512 // it could then have another name than the real parameter. And 512 // it could then have another name than the real parameter. And
513 // the other one would not know it is just a copy of the real 513 // the other one would not know it is just a copy of the real
514 // parameter. 514 // parameter.
515 if (local is ParameterElement) return builder.parameters[local]; 515 if (local is ParameterElement) {
516 assert(invariant(local, builder.parameters.containsKey(local),
517 message: "No local value for parameter $local in "
518 "${builder.parameters}."));
519 return builder.parameters[local];
520 }
516 521
517 return builder.activationVariables.putIfAbsent(local, () { 522 return builder.activationVariables.putIfAbsent(local, () {
518 JavaScriptBackend backend = builder.backend; 523 JavaScriptBackend backend = builder.backend;
519 HLocalValue localValue = new HLocalValue(local, backend.nonNullType) 524 HLocalValue localValue = new HLocalValue(local, backend.nonNullType)
520 ..sourceInformation = sourceInformation; 525 ..sourceInformation = sourceInformation;
521 builder.graph.entry.addAtExit(localValue); 526 builder.graph.entry.addAtExit(localValue);
522 return localValue; 527 return localValue;
523 }); 528 });
524 } 529 }
525 530
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 if (backendMember.isGenerativeConstructorBody) { 1799 if (backendMember.isGenerativeConstructorBody) {
1795 ConstructorBodyElement body = backendMember; 1800 ConstructorBodyElement body = backendMember;
1796 if (body.constructor == constructor) { 1801 if (body.constructor == constructor) {
1797 // TODO(kasperl): Find a way of stopping the iteration 1802 // TODO(kasperl): Find a way of stopping the iteration
1798 // through the backend members. 1803 // through the backend members.
1799 bodyElement = backendMember; 1804 bodyElement = backendMember;
1800 } 1805 }
1801 } 1806 }
1802 }); 1807 });
1803 if (bodyElement == null) { 1808 if (bodyElement == null) {
1804 bodyElement = new ConstructorBodyElementX(constructor); 1809 bodyElement =
1810 new ConstructorBodyElementX(constructorResolvedAst, constructor);
1805 classElement.addBackendMember(bodyElement); 1811 classElement.addBackendMember(bodyElement);
1806 1812
1807 if (constructor.isPatch) { 1813 if (constructor.isPatch) {
1808 // Create origin body element for patched constructors. 1814 // Create origin body element for patched constructors.
1809 ConstructorBodyElementX patch = bodyElement; 1815 ConstructorBodyElementX patch = bodyElement;
1810 ConstructorBodyElementX origin = 1816 ConstructorBodyElementX origin = new ConstructorBodyElementX(
1811 new ConstructorBodyElementX(constructor.origin); 1817 constructorResolvedAst, constructor.origin);
1812 origin.applyPatch(patch); 1818 origin.applyPatch(patch);
1813 classElement.origin.addBackendMember(bodyElement.origin); 1819 classElement.origin.addBackendMember(bodyElement.origin);
1814 } 1820 }
1815 } 1821 }
1816 assert(bodyElement.isGenerativeConstructorBody); 1822 assert(bodyElement.isGenerativeConstructorBody);
1817 return bodyElement; 1823 return bodyElement;
1818 } 1824 }
1819 1825
1820 HParameterValue addParameter(Entity parameter, TypeMask type) { 1826 HParameterValue addParameter(Entity parameter, TypeMask type) {
1821 assert(inliningStack.isEmpty); 1827 assert(inliningStack.isEmpty);
(...skipping 6778 matching lines...) Expand 10 before | Expand all | Expand 10 after
8600 const _LoopTypeVisitor(); 8606 const _LoopTypeVisitor();
8601 int visitNode(ast.Node node) => HLoopBlockInformation.NOT_A_LOOP; 8607 int visitNode(ast.Node node) => HLoopBlockInformation.NOT_A_LOOP;
8602 int visitWhile(ast.While node) => HLoopBlockInformation.WHILE_LOOP; 8608 int visitWhile(ast.While node) => HLoopBlockInformation.WHILE_LOOP;
8603 int visitFor(ast.For node) => HLoopBlockInformation.FOR_LOOP; 8609 int visitFor(ast.For node) => HLoopBlockInformation.FOR_LOOP;
8604 int visitDoWhile(ast.DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; 8610 int visitDoWhile(ast.DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP;
8605 int visitAsyncForIn(ast.AsyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; 8611 int visitAsyncForIn(ast.AsyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP;
8606 int visitSyncForIn(ast.SyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; 8612 int visitSyncForIn(ast.SyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP;
8607 int visitSwitchStatement(ast.SwitchStatement node) => 8613 int visitSwitchStatement(ast.SwitchStatement node) =>
8608 HLoopBlockInformation.SWITCH_CONTINUE_LOOP; 8614 HLoopBlockInformation.SWITCH_CONTINUE_LOOP;
8609 } 8615 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart ('k') | pkg/compiler/lib/src/world.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698