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

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

Issue 2941033002: Finish strong mode cleaning of dart2js. (Closed)
Patch Set: Add bug numbers and address comments. Created 3 years, 6 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 closedWorld, 140 closedWorld,
141 emitter.nativeEmitter, 141 emitter.nativeEmitter,
142 sourceInformationFactory); 142 sourceInformationFactory);
143 HGraph graph = builder.build(); 143 HGraph graph = builder.build();
144 144
145 // Default arguments are handled elsewhere, but we must ensure 145 // Default arguments are handled elsewhere, but we must ensure
146 // that the default values are computed during codegen. 146 // that the default values are computed during codegen.
147 if (!identical(element.kind, ElementKind.FIELD)) { 147 if (!identical(element.kind, ElementKind.FIELD)) {
148 MethodElement function = element; 148 MethodElement function = element;
149 FunctionSignature signature = function.functionSignature; 149 FunctionSignature signature = function.functionSignature;
150 signature.forEachOptionalParameter((ParameterElement parameter) { 150 signature.forEachOptionalParameter((_parameter) {
151 ParameterElement parameter = _parameter;
151 // This ensures the default value will be computed. 152 // This ensures the default value will be computed.
152 ConstantValue constant = 153 ConstantValue constant =
153 backend.constants.getConstantValue(parameter.constant); 154 backend.constants.getConstantValue(parameter.constant);
154 work.registry.registerConstantUse(new ConstantUse.init(constant)); 155 work.registry.registerConstantUse(new ConstantUse.init(constant));
155 }); 156 });
156 } 157 }
157 if (backend.tracer.isEnabled) { 158 if (backend.tracer.isEnabled) {
158 String name; 159 String name;
159 if (element.isClassMember) { 160 if (element.isClassMember) {
160 String className = element.enclosingClass.name; 161 String className = element.enclosingClass.name;
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 876
876 inTryStatement = false; // TODO(lry): why? Document. 877 inTryStatement = false; // TODO(lry): why? Document.
877 878
878 int argumentIndex = 0; 879 int argumentIndex = 0;
879 if (function.isInstanceMember) { 880 if (function.isInstanceMember) {
880 localsHandler.updateLocal(localsHandler.closureData.thisLocal, 881 localsHandler.updateLocal(localsHandler.closureData.thisLocal,
881 compiledArguments[argumentIndex++]); 882 compiledArguments[argumentIndex++]);
882 } 883 }
883 884
884 FunctionSignature signature = function.functionSignature; 885 FunctionSignature signature = function.functionSignature;
885 signature.orderedForEachParameter((ParameterElement parameter) { 886 signature.orderedForEachParameter((_parameter) {
887 ParameterElement parameter = _parameter;
886 HInstruction argument = compiledArguments[argumentIndex++]; 888 HInstruction argument = compiledArguments[argumentIndex++];
887 localsHandler.updateLocal(parameter, argument); 889 localsHandler.updateLocal(parameter, argument);
888 }); 890 });
889 891
890 ClassElement enclosing = function.enclosingClass; 892 ClassElement enclosing = function.enclosingClass;
891 if ((function.isConstructor || function.isGenerativeConstructorBody) && 893 if ((function.isConstructor || function.isGenerativeConstructorBody) &&
892 rtiNeed.classNeedsRti(enclosing)) { 894 rtiNeed.classNeedsRti(enclosing)) {
893 enclosing.typeVariables 895 enclosing.typeVariables.forEach((_typeVariable) {
894 .forEach((ResolutionTypeVariableType typeVariable) { 896 ResolutionTypeVariableType typeVariable = _typeVariable;
895 HInstruction argument = compiledArguments[argumentIndex++]; 897 HInstruction argument = compiledArguments[argumentIndex++];
896 localsHandler.updateLocal( 898 localsHandler.updateLocal(
897 localsHandler.getTypeVariableAsLocal(typeVariable), argument); 899 localsHandler.getTypeVariableAsLocal(typeVariable), argument);
898 }); 900 });
899 } 901 }
900 assert(argumentIndex == compiledArguments.length); 902 assert(argumentIndex == compiledArguments.length);
901 903
902 returnType = signature.type.returnType; 904 returnType = signature.type.returnType;
903 stack = <HInstruction>[]; 905 stack = <HInstruction>[];
904 906
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 // by the effective target. 1009 // by the effective target.
1008 if (!callee.isRedirectingGenerative) { 1010 if (!callee.isRedirectingGenerative) {
1009 inlinedFrom(constructorResolvedAst, () { 1011 inlinedFrom(constructorResolvedAst, () {
1010 buildFieldInitializers( 1012 buildFieldInitializers(
1011 callee.enclosingClass.implementation, fieldValues); 1013 callee.enclosingClass.implementation, fieldValues);
1012 }); 1014 });
1013 } 1015 }
1014 1016
1015 int index = 0; 1017 int index = 0;
1016 FunctionSignature params = callee.functionSignature; 1018 FunctionSignature params = callee.functionSignature;
1017 params.orderedForEachParameter((ParameterElement parameter) { 1019 params.orderedForEachParameter((_parameter) {
1020 ParameterElement parameter = _parameter;
1018 HInstruction argument = compiledArguments[index++]; 1021 HInstruction argument = compiledArguments[index++];
1019 // Because we are inlining the initializer, we must update 1022 // Because we are inlining the initializer, we must update
1020 // what was given as parameter. This will be used in case 1023 // what was given as parameter. This will be used in case
1021 // there is a parameter check expression in the initializer. 1024 // there is a parameter check expression in the initializer.
1022 parameters[parameter] = argument; 1025 parameters[parameter] = argument;
1023 localsHandler.updateLocal(parameter, argument); 1026 localsHandler.updateLocal(parameter, argument);
1024 // Don't forget to update the field, if the parameter is of the 1027 // Don't forget to update the field, if the parameter is of the
1025 // form [:this.x:]. 1028 // form [:this.x:].
1026 if (parameter.isInitializingFormal) { 1029 if (parameter.isInitializingFormal) {
1027 InitializingFormalElement fieldParameterElement = parameter; 1030 InitializingFormalElement fieldParameterElement = parameter;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 1263
1261 // Compile the possible initialization code for local fields and 1264 // Compile the possible initialization code for local fields and
1262 // super fields, unless this is a redirecting constructor, in which case 1265 // super fields, unless this is a redirecting constructor, in which case
1263 // the effective target will initialize these. 1266 // the effective target will initialize these.
1264 if (!functionElement.isRedirectingGenerative) { 1267 if (!functionElement.isRedirectingGenerative) {
1265 buildFieldInitializers(classElement, fieldValues); 1268 buildFieldInitializers(classElement, fieldValues);
1266 } 1269 }
1267 1270
1268 // Compile field-parameters such as [:this.x:]. 1271 // Compile field-parameters such as [:this.x:].
1269 FunctionSignature params = functionElement.functionSignature; 1272 FunctionSignature params = functionElement.functionSignature;
1270 params.orderedForEachParameter((ParameterElement parameter) { 1273 params.orderedForEachParameter((_parameter) {
1274 ParameterElement parameter = _parameter;
1271 if (parameter.isInitializingFormal) { 1275 if (parameter.isInitializingFormal) {
1272 // If the [element] is a field-parameter then 1276 // If the [element] is a field-parameter then
1273 // initialize the field element with its value. 1277 // initialize the field element with its value.
1274 InitializingFormalElement fieldParameter = parameter; 1278 InitializingFormalElement fieldParameter = parameter;
1275 HInstruction parameterValue = localsHandler.readLocal(fieldParameter); 1279 HInstruction parameterValue = localsHandler.readLocal(fieldParameter);
1276 fieldValues[fieldParameter.fieldElement] = parameterValue; 1280 fieldValues[fieldParameter.fieldElement] = parameterValue;
1277 } 1281 }
1278 }); 1282 });
1279 1283
1280 // Analyze the constructor and all referenced constructors and collect 1284 // Analyze the constructor and all referenced constructors and collect
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 1318
1315 HInstruction newObject; 1319 HInstruction newObject;
1316 if (!isNativeUpgradeFactory) { 1320 if (!isNativeUpgradeFactory) {
1317 // Create the runtime type information, if needed. 1321 // Create the runtime type information, if needed.
1318 bool hasRtiInput = false; 1322 bool hasRtiInput = false;
1319 if (rtiNeed.classNeedsRtiField(classElement.declaration)) { 1323 if (rtiNeed.classNeedsRtiField(classElement.declaration)) {
1320 // Read the values of the type arguments and create a 1324 // Read the values of the type arguments and create a
1321 // HTypeInfoExpression to set on the newly create object. 1325 // HTypeInfoExpression to set on the newly create object.
1322 hasRtiInput = true; 1326 hasRtiInput = true;
1323 List<HInstruction> typeArguments = <HInstruction>[]; 1327 List<HInstruction> typeArguments = <HInstruction>[];
1324 classElement.typeVariables 1328 classElement.typeVariables.forEach((_typeVariable) {
1325 .forEach((ResolutionTypeVariableType typeVariable) { 1329 ResolutionTypeVariableType typeVariable = _typeVariable;
1326 HInstruction argument = localsHandler 1330 HInstruction argument = localsHandler
1327 .readLocal(localsHandler.getTypeVariableAsLocal(typeVariable)); 1331 .readLocal(localsHandler.getTypeVariableAsLocal(typeVariable));
1328 typeArguments.add(argument); 1332 typeArguments.add(argument);
1329 }); 1333 });
1330 1334
1331 HInstruction typeInfo = new HTypeInfoExpression( 1335 HInstruction typeInfo = new HTypeInfoExpression(
1332 TypeInfoExpressionKind.INSTANCE, 1336 TypeInfoExpressionKind.INSTANCE,
1333 classElement.thisType, 1337 classElement.thisType,
1334 typeArguments, 1338 typeArguments,
1335 commonMasks.dynamicType); 1339 commonMasks.dynamicType);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 ConstantValue constant = new InterceptorConstantValue(classElement); 1380 ConstantValue constant = new InterceptorConstantValue(classElement);
1377 interceptor = graph.addConstant(constant, closedWorld); 1381 interceptor = graph.addConstant(constant, closedWorld);
1378 } 1382 }
1379 bodyCallInputs.add(interceptor); 1383 bodyCallInputs.add(interceptor);
1380 } 1384 }
1381 bodyCallInputs.add(newObject); 1385 bodyCallInputs.add(newObject);
1382 ast.Node node = constructorResolvedAst.node; 1386 ast.Node node = constructorResolvedAst.node;
1383 1387
1384 FunctionSignature functionSignature = body.functionSignature; 1388 FunctionSignature functionSignature = body.functionSignature;
1385 // Provide the parameters to the generative constructor body. 1389 // Provide the parameters to the generative constructor body.
1386 functionSignature.orderedForEachParameter((ParameterElement parameter) { 1390 functionSignature.orderedForEachParameter((_parameter) {
1391 ParameterElement parameter = _parameter;
1387 // If [parameter] is boxed, it will be a field in the box passed as the 1392 // If [parameter] is boxed, it will be a field in the box passed as the
1388 // last parameter. So no need to directly pass it. 1393 // last parameter. So no need to directly pass it.
1389 if (!localsHandler.isBoxed(parameter)) { 1394 if (!localsHandler.isBoxed(parameter)) {
1390 bodyCallInputs.add(localsHandler.readLocal(parameter)); 1395 bodyCallInputs.add(localsHandler.readLocal(parameter));
1391 } 1396 }
1392 }); 1397 });
1393 1398
1394 // If there are locals that escape (ie mutated in closures), we 1399 // If there are locals that escape (ie mutated in closures), we
1395 // pass the box to the constructor. 1400 // pass the box to the constructor.
1396 // The box must be passed before any type variable. 1401 // The box must be passed before any type variable.
1397 ClosureAnalysisInfo scopeData = 1402 ClosureAnalysisInfo scopeData =
1398 closureDataLookup.getClosureAnalysisInfo(node); 1403 closureDataLookup.getClosureAnalysisInfo(node);
1399 if (scopeData.requiresContextBox) { 1404 if (scopeData.requiresContextBox) {
1400 bodyCallInputs.add(localsHandler.readLocal(scopeData.context)); 1405 bodyCallInputs.add(localsHandler.readLocal(scopeData.context));
1401 } 1406 }
1402 1407
1403 // Type variables arguments must come after the box (if there is one). 1408 // Type variables arguments must come after the box (if there is one).
1404 ClassElement currentClass = constructor.enclosingClass; 1409 ClassElement currentClass = constructor.enclosingClass;
1405 if (rtiNeed.classNeedsRti(currentClass)) { 1410 if (rtiNeed.classNeedsRti(currentClass)) {
1406 // If [currentClass] needs RTI, we add the type variables as 1411 // If [currentClass] needs RTI, we add the type variables as
1407 // parameters of the generative constructor body. 1412 // parameters of the generative constructor body.
1408 currentClass.typeVariables 1413 currentClass.typeVariables.forEach((_argument) {
1409 .forEach((ResolutionTypeVariableType argument) { 1414 ResolutionTypeVariableType argument = _argument;
1410 // TODO(johnniwinther): Substitute [argument] with 1415 // TODO(johnniwinther): Substitute [argument] with
1411 // `localsHandler.substInContext(argument)`. 1416 // `localsHandler.substInContext(argument)`.
1412 bodyCallInputs.add(localsHandler 1417 bodyCallInputs.add(localsHandler
1413 .readLocal(localsHandler.getTypeVariableAsLocal(argument))); 1418 .readLocal(localsHandler.getTypeVariableAsLocal(argument)));
1414 }); 1419 });
1415 } 1420 }
1416 1421
1417 if (!isNativeUpgradeFactory && // TODO(13836): Fix inlining. 1422 if (!isNativeUpgradeFactory && // TODO(13836): Fix inlining.
1418 tryInlineMethod(body, null, null, bodyCallInputs, function)) { 1423 tryInlineMethod(body, null, null, bodyCallInputs, function)) {
1419 pop(); 1424 pop();
(...skipping 19 matching lines...) Expand all
1439 * 1444 *
1440 * Invariant: [functionElement] must be the implementation element. 1445 * Invariant: [functionElement] must be the implementation element.
1441 */ 1446 */
1442 void openFunction(MemberElement element, ast.Node node) { 1447 void openFunction(MemberElement element, ast.Node node) {
1443 assert(element.isImplementation, failedAt(element)); 1448 assert(element.isImplementation, failedAt(element));
1444 HBasicBlock block = graph.addNewBlock(); 1449 HBasicBlock block = graph.addNewBlock();
1445 open(graph.entry); 1450 open(graph.entry);
1446 1451
1447 Map<Local, TypeMask> parameters = <Local, TypeMask>{}; 1452 Map<Local, TypeMask> parameters = <Local, TypeMask>{};
1448 if (element is MethodElement) { 1453 if (element is MethodElement) {
1449 element.functionSignature 1454 element.functionSignature.orderedForEachParameter((_parameter) {
1450 .orderedForEachParameter((ParameterElement parameter) { 1455 ParameterElement parameter = _parameter;
1451 parameters[parameter] = TypeMaskFactory.inferredTypeForParameter( 1456 parameters[parameter] = TypeMaskFactory.inferredTypeForParameter(
1452 parameter, globalInferenceResults); 1457 parameter, globalInferenceResults);
1453 }); 1458 });
1454 } 1459 }
1455 1460
1456 ClosureRepresentationInfo closureData = 1461 ClosureRepresentationInfo closureData =
1457 closureDataLookup.getClosureRepresentationInfo(element); 1462 closureDataLookup.getClosureRepresentationInfo(element);
1458 localsHandler.startFunction(element, closureData, 1463 localsHandler.startFunction(element, closureData,
1459 closureDataLookup.getClosureAnalysisInfo(node), parameters, 1464 closureDataLookup.getClosureAnalysisInfo(node), parameters,
1460 isGenerativeConstructorBody: element.isGenerativeConstructorBody); 1465 isGenerativeConstructorBody: element.isGenerativeConstructorBody);
1461 close(new HGoto()).addSuccessor(block); 1466 close(new HGoto()).addSuccessor(block);
1462 1467
1463 open(block); 1468 open(block);
1464 1469
1465 // Add the type parameters of the class as parameters of this method. This 1470 // Add the type parameters of the class as parameters of this method. This
1466 // must be done before adding the normal parameters, because their types 1471 // must be done before adding the normal parameters, because their types
1467 // may contain references to type variables. 1472 // may contain references to type variables.
1468 ClassElement cls = element.enclosingClass; 1473 ClassElement cls = element.enclosingClass;
1469 if ((element.isConstructor || element.isGenerativeConstructorBody) && 1474 if ((element.isConstructor || element.isGenerativeConstructorBody) &&
1470 rtiNeed.classNeedsRti(cls)) { 1475 rtiNeed.classNeedsRti(cls)) {
1471 cls.typeVariables.forEach((ResolutionTypeVariableType typeVariable) { 1476 cls.typeVariables.forEach((_typeVariable) {
1477 ResolutionTypeVariableType typeVariable = _typeVariable;
1472 HParameterValue param = 1478 HParameterValue param =
1473 addParameter(typeVariable.element, commonMasks.nonNullType); 1479 addParameter(typeVariable.element, commonMasks.nonNullType);
1474 localsHandler.directLocals[ 1480 localsHandler.directLocals[
1475 localsHandler.getTypeVariableAsLocal(typeVariable)] = param; 1481 localsHandler.getTypeVariableAsLocal(typeVariable)] = param;
1476 }); 1482 });
1477 } 1483 }
1478 1484
1479 if (element is MethodElement) { 1485 if (element is MethodElement) {
1480 MethodElement functionElement = element; 1486 MethodElement functionElement = element;
1481 FunctionSignature signature = functionElement.functionSignature; 1487 FunctionSignature signature = functionElement.functionSignature;
1482 1488
1483 // Put the type checks in the first successor of the entry, 1489 // Put the type checks in the first successor of the entry,
1484 // because that is where the type guards will also be inserted. 1490 // because that is where the type guards will also be inserted.
1485 // This way we ensure that a type guard will dominate the type 1491 // This way we ensure that a type guard will dominate the type
1486 // check. 1492 // check.
1487 signature.orderedForEachParameter((ParameterElement parameterElement) { 1493 signature.orderedForEachParameter((_parameterElement) {
1494 ParameterElement parameterElement = _parameterElement;
1488 if (element.isGenerativeConstructorBody) { 1495 if (element.isGenerativeConstructorBody) {
1489 if (closureDataLookup 1496 if (closureDataLookup
1490 .getClosureAnalysisInfo(node) 1497 .getClosureAnalysisInfo(node)
1491 .isCaptured(parameterElement)) { 1498 .isCaptured(parameterElement)) {
1492 // The parameter will be a field in the box passed as the 1499 // The parameter will be a field in the box passed as the
1493 // last parameter. So no need to have it. 1500 // last parameter. So no need to have it.
1494 return; 1501 return;
1495 } 1502 }
1496 } 1503 }
1497 HInstruction newParameter = 1504 HInstruction newParameter =
(...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after
3503 js.Template code = js.js.parseForeignJS('new Array(#)'); 3510 js.Template code = js.js.parseForeignJS('new Array(#)');
3504 var behavior = new native.NativeBehavior(); 3511 var behavior = new native.NativeBehavior();
3505 behavior.typesInstantiated.add(expectedType); 3512 behavior.typesInstantiated.add(expectedType);
3506 behavior.typesReturned.add(expectedType); 3513 behavior.typesReturned.add(expectedType);
3507 // The allocation can throw only if the given length is a double or 3514 // The allocation can throw only if the given length is a double or
3508 // outside the unsigned 32 bit range. 3515 // outside the unsigned 32 bit range.
3509 // TODO(sra): Array allocation should be an instruction so that canThrow 3516 // TODO(sra): Array allocation should be an instruction so that canThrow
3510 // can depend on a length type discovered in optimization. 3517 // can depend on a length type discovered in optimization.
3511 bool canThrow = true; 3518 bool canThrow = true;
3512 if (inputs[0].isInteger(closedWorld) && inputs[0] is HConstant) { 3519 if (inputs[0].isInteger(closedWorld) && inputs[0] is HConstant) {
3513 var constant = inputs[0]; 3520 dynamic constant = inputs[0];
3514 int value = constant.constant.primitiveValue; 3521 int value = constant.constant.primitiveValue;
3515 if (0 <= value && value < 0x100000000) canThrow = false; 3522 if (0 <= value && value < 0x100000000) canThrow = false;
3516 } 3523 }
3517 HForeignCode foreign = new HForeignCode(code, elementType, inputs, 3524 HForeignCode foreign = new HForeignCode(code, elementType, inputs,
3518 nativeBehavior: behavior, 3525 nativeBehavior: behavior,
3519 throwBehavior: canThrow 3526 throwBehavior: canThrow
3520 ? native.NativeThrowBehavior.MAY 3527 ? native.NativeThrowBehavior.MAY
3521 : native.NativeThrowBehavior.NEVER); 3528 : native.NativeThrowBehavior.NEVER);
3522 push(foreign); 3529 push(foreign);
3523 if (globalInferenceResults.isFixedArrayCheckedForGrowable(send)) { 3530 if (globalInferenceResults.isFixedArrayCheckedForGrowable(send)) {
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
4098 if (element.isFactoryConstructor && 4105 if (element.isFactoryConstructor &&
4099 nativeData.isAnonymousJsInteropClass(element.contextClass)) { 4106 nativeData.isAnonymousJsInteropClass(element.contextClass)) {
4100 // Factory constructor that is syntactic sugar for creating a JavaScript 4107 // Factory constructor that is syntactic sugar for creating a JavaScript
4101 // object literal. 4108 // object literal.
4102 ConstructorElement constructor = element; 4109 ConstructorElement constructor = element;
4103 FunctionSignature params = constructor.functionSignature; 4110 FunctionSignature params = constructor.functionSignature;
4104 int i = 0; 4111 int i = 0;
4105 int positions = 0; 4112 int positions = 0;
4106 var filteredArguments = <HInstruction>[]; 4113 var filteredArguments = <HInstruction>[];
4107 var parameterNameMap = new Map<String, js.Expression>(); 4114 var parameterNameMap = new Map<String, js.Expression>();
4108 params.orderedForEachParameter((ParameterElement parameter) { 4115 params.orderedForEachParameter((_parameter) {
4116 ParameterElement parameter = _parameter;
4109 // TODO(jacobr): consider throwing if parameter names do not match 4117 // TODO(jacobr): consider throwing if parameter names do not match
4110 // names of properties in the class. 4118 // names of properties in the class.
4111 assert(parameter.isNamed); 4119 assert(parameter.isNamed);
4112 HInstruction argument = arguments[i]; 4120 HInstruction argument = arguments[i];
4113 if (argument != null) { 4121 if (argument != null) {
4114 filteredArguments.add(argument); 4122 filteredArguments.add(argument);
4115 var jsName = nativeData.computeUnescapedJSInteropName(parameter.name); 4123 var jsName = nativeData.computeUnescapedJSInteropName(parameter.name);
4116 parameterNameMap[jsName] = new js.InterpolatedExpression(positions++); 4124 parameterNameMap[jsName] = new js.InterpolatedExpression(positions++);
4117 } 4125 }
4118 i++; 4126 i++;
(...skipping 1803 matching lines...) Expand 10 before | Expand all | Expand 10 after
5922 // ... 5930 // ...
5923 // case n: s_n; target = j; continue l; 5931 // case n: s_n; target = j; continue l;
5924 // } 5932 // }
5925 // } 5933 // }
5926 5934
5927 JumpTarget switchTarget = elements.getTargetDefinition(node); 5935 JumpTarget switchTarget = elements.getTargetDefinition(node);
5928 HInstruction initialValue = graph.addConstantNull(closedWorld); 5936 HInstruction initialValue = graph.addConstantNull(closedWorld);
5929 localsHandler.updateLocal(switchTarget, initialValue); 5937 localsHandler.updateLocal(switchTarget, initialValue);
5930 5938
5931 JumpHandler jumpHandler = createJumpHandler(node, isLoopJump: false); 5939 JumpHandler jumpHandler = createJumpHandler(node, isLoopJump: false);
5932 var switchCases = node.cases; 5940 dynamic switchCases = node.cases;
5933 if (!hasDefault) { 5941 if (!hasDefault) {
5934 // Use [:null:] as the marker for a synthetic default clause. 5942 // Use [:null:] as the marker for a synthetic default clause.
5935 // The synthetic default is added because otherwise, there would be no 5943 // The synthetic default is added because otherwise, there would be no
5936 // good place to give a default value to the local. 5944 // good place to give a default value to the local.
5937 switchCases = node.cases.nodes.toList()..add(null); 5945 switchCases = node.cases.nodes.toList()..add(null);
5938 } 5946 }
5939 HInstruction buildExpression() { 5947 HInstruction buildExpression() {
5940 visit(node.expression); 5948 visit(node.expression);
5941 return pop(); 5949 return pop();
5942 } 5950 }
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
6867 this.oldReturnLocal, 6875 this.oldReturnLocal,
6868 this.oldReturnType, 6876 this.oldReturnType,
6869 this.oldResolvedAst, 6877 this.oldResolvedAst,
6870 this.oldStack, 6878 this.oldStack,
6871 this.oldLocalsHandler, 6879 this.oldLocalsHandler,
6872 this.inTryStatement, 6880 this.inTryStatement,
6873 this.allFunctionsCalledOnce, 6881 this.allFunctionsCalledOnce,
6874 this.oldElementInferenceResults) 6882 this.oldElementInferenceResults)
6875 : super(function); 6883 : super(function);
6876 } 6884 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/serialization/constant_serialization.dart ('k') | pkg/compiler/lib/src/ssa/interceptor_simplifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698