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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart

Issue 1059443008: Revert "Remove an unused field from one of the CPS translation classes." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart2js.ir_builder; 5 library dart2js.ir_builder;
6 6
7 import '../constants/expressions.dart'; 7 import '../constants/expressions.dart';
8 import '../constants/values.dart' show PrimitiveConstantValue; 8 import '../constants/values.dart' show PrimitiveConstantValue;
9 import '../dart_types.dart'; 9 import '../dart_types.dart';
10 import '../dart2jslib.dart'; 10 import '../dart2jslib.dart';
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 472
473 /// Creates an access to the receiver from the current (or enclosing) method. 473 /// Creates an access to the receiver from the current (or enclosing) method.
474 /// 474 ///
475 /// If inside a closure class, [buildThis] will redirect access through 475 /// If inside a closure class, [buildThis] will redirect access through
476 /// closure fields in order to access the receiver from the enclosing method. 476 /// closure fields in order to access the receiver from the enclosing method.
477 ir.Primitive buildThis(); 477 ir.Primitive buildThis();
478 478
479 // TODO(johnniwinther): Make these field final and remove the default values 479 // TODO(johnniwinther): Make these field final and remove the default values
480 // when [IrBuilder] is a property of [IrBuilderVisitor] instead of a mixin. 480 // when [IrBuilder] is a property of [IrBuilderVisitor] instead of a mixin.
481 481
482 final List<ir.Parameter> _parameters = <ir.Parameter>[];
483
482 IrBuilderDelimitedState state; 484 IrBuilderDelimitedState state;
483 485
484 /// A map from variable indexes to their values. 486 /// A map from variable indexes to their values.
485 /// 487 ///
486 /// [BoxLocal]s map to their box. [LocalElement]s that are boxed are not 488 /// [BoxLocal]s map to their box. [LocalElement]s that are boxed are not
487 /// in the map; look up their [BoxLocal] instead. 489 /// in the map; look up their [BoxLocal] instead.
488 Environment environment; 490 Environment environment;
489 491
490 // The IR builder maintains a context, which is an expression with a hole in 492 // The IR builder maintains a context, which is an expression with a hole in
491 // it. The hole represents the focus where new expressions can be added. 493 // it. The hole represents the focus where new expressions can be added.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 ..environment = new Environment.empty(); 555 ..environment = new Environment.empty();
554 } 556 }
555 557
556 bool get isOpen => _root == null || _current != null; 558 bool get isOpen => _root == null || _current != null;
557 559
558 560
559 void buildFieldInitializerHeader({ClosureScope closureScope}) { 561 void buildFieldInitializerHeader({ClosureScope closureScope}) {
560 _enterScope(closureScope); 562 _enterScope(closureScope);
561 } 563 }
562 564
563 void buildFunctionHeader(Iterable<Local> parameters, 565 List<ir.Primitive> buildFunctionHeader(Iterable<Local> parameters,
564 {ClosureScope closureScope, 566 {ClosureScope closureScope,
565 ClosureEnvironment env}) { 567 ClosureEnvironment env}) {
566 _createThisParameter(); 568 _createThisParameter();
567 _enterClosureEnvironment(env); 569 _enterClosureEnvironment(env);
568 _enterScope(closureScope); 570 _enterScope(closureScope);
569 parameters.forEach(_createFunctionParameter); 571 parameters.forEach(_createFunctionParameter);
572 return _parameters;
570 } 573 }
571 574
572 /// Creates a parameter for [local] and adds it to the current environment. 575 /// Creates a parameter for [local] and adds it to the current environment.
573 ir.Parameter createLocalParameter(Local local) { 576 ir.Parameter createLocalParameter(Local local) {
574 ir.Parameter parameter = new ir.Parameter(local); 577 ir.Parameter parameter = new ir.Parameter(local);
578 _parameters.add(parameter);
575 environment.extend(local, parameter); 579 environment.extend(local, parameter);
576 return parameter; 580 return parameter;
577 } 581 }
578 582
579 /// Adds the constant [variableElement] to the environment with [value] as its 583 /// Adds the constant [variableElement] to the environment with [value] as its
580 /// constant value. 584 /// constant value.
581 void declareLocalConstant(LocalVariableElement variableElement, 585 void declareLocalConstant(LocalVariableElement variableElement,
582 ConstantExpression value) { 586 ConstantExpression value) {
583 state.localConstants.add(new ConstDeclaration(variableElement, value)); 587 state.localConstants.add(new ConstDeclaration(variableElement, value));
584 } 588 }
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
2179 ir.Primitive value = 2183 ir.Primitive value =
2180 addPrimitive(new ir.GetMutableVariable(mutableVariable)); 2184 addPrimitive(new ir.GetMutableVariable(mutableVariable));
2181 environment.update(loopVariable, value); 2185 environment.update(loopVariable, value);
2182 dartState.registerizedMutableVariables.add(loopVariable); 2186 dartState.registerizedMutableVariables.add(loopVariable);
2183 } 2187 }
2184 } 2188 }
2185 } 2189 }
2186 2190
2187 void _createFunctionParameter(Local parameterElement) { 2191 void _createFunctionParameter(Local parameterElement) {
2188 ir.Parameter parameter = new ir.Parameter(parameterElement); 2192 ir.Parameter parameter = new ir.Parameter(parameterElement);
2193 _parameters.add(parameter);
2189 if (isInMutableVariable(parameterElement)) { 2194 if (isInMutableVariable(parameterElement)) {
2190 state.functionParameters.add(getMutableVariable(parameterElement)); 2195 state.functionParameters.add(getMutableVariable(parameterElement));
2191 } else { 2196 } else {
2192 state.functionParameters.add(parameter); 2197 state.functionParameters.add(parameter);
2193 environment.extend(parameterElement, parameter); 2198 environment.extend(parameterElement, parameter);
2194 } 2199 }
2195 } 2200 }
2196 2201
2197 void _createThisParameter() { 2202 void _createThisParameter() {
2198 void create() { 2203 void create() {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
2387 scope.capturedVariables.forEach((Local local, ClosureLocation location) { 2392 scope.capturedVariables.forEach((Local local, ClosureLocation location) {
2388 assert(!jsState.boxedVariables.containsKey(local)); 2393 assert(!jsState.boxedVariables.containsKey(local));
2389 if (location.isBox) { 2394 if (location.isBox) {
2390 jsState.boxedVariables[local] = location; 2395 jsState.boxedVariables[local] = location;
2391 } 2396 }
2392 }); 2397 });
2393 } 2398 }
2394 2399
2395 void _createFunctionParameter(Local parameterElement) { 2400 void _createFunctionParameter(Local parameterElement) {
2396 ir.Parameter parameter = new ir.Parameter(parameterElement); 2401 ir.Parameter parameter = new ir.Parameter(parameterElement);
2402 _parameters.add(parameter);
2397 state.functionParameters.add(parameter); 2403 state.functionParameters.add(parameter);
2398 ClosureLocation location = jsState.boxedVariables[parameterElement]; 2404 ClosureLocation location = jsState.boxedVariables[parameterElement];
2399 if (location != null) { 2405 if (location != null) {
2400 add(new ir.SetField(environment.lookup(location.box), 2406 add(new ir.SetField(environment.lookup(location.box),
2401 location.field, 2407 location.field,
2402 parameter)); 2408 parameter));
2403 } else { 2409 } else {
2404 environment.extend(parameterElement, parameter); 2410 environment.extend(parameterElement, parameter);
2405 } 2411 }
2406 } 2412 }
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
2692 } 2698 }
2693 2699
2694 /// Synthetic parameter to a JavaScript factory method that takes the type 2700 /// Synthetic parameter to a JavaScript factory method that takes the type
2695 /// argument given for the type variable [variable]. 2701 /// argument given for the type variable [variable].
2696 class TypeInformationParameter implements Local { 2702 class TypeInformationParameter implements Local {
2697 final TypeVariableElement variable; 2703 final TypeVariableElement variable;
2698 final ExecutableElement executableContext; 2704 final ExecutableElement executableContext;
2699 TypeInformationParameter(this.variable, this.executableContext); 2705 TypeInformationParameter(this.variable, this.executableContext);
2700 String get name => variable.name; 2706 String get name => variable.name;
2701 } 2707 }
OLDNEW
« 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