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

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

Issue 2791993002: Fix dart2js warnings and add test to ensure it stays clean. (Closed)
Patch Set: Address comments and fix duplicated library names. Created 3 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/nodes.dart ('k') | pkg/compiler/lib/src/ssa/variable_allocator.dart » ('j') | 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) 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/codegen.dart' show CodegenRegistry, CodegenWorkItem; 5 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
6 import '../common/names.dart' show Selectors; 6 import '../common/names.dart' show Selectors;
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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // makes the field load available to further optimization, e.g. LICM. 511 // makes the field load available to further optimization, e.g. LICM.
512 512
513 if (element != null && 513 if (element != null &&
514 element.isField && 514 element.isField &&
515 element.name == node.selector.name) { 515 element.name == node.selector.name) {
516 FieldEntity field = element; 516 FieldEntity field = element;
517 if (!_nativeData.isNativeMember(field) && 517 if (!_nativeData.isNativeMember(field) &&
518 !node.isCallOnInterceptor(_closedWorld)) { 518 !node.isCallOnInterceptor(_closedWorld)) {
519 HInstruction receiver = node.getDartReceiver(_closedWorld); 519 HInstruction receiver = node.getDartReceiver(_closedWorld);
520 TypeMask type = TypeMaskFactory.inferredTypeForMember( 520 TypeMask type = TypeMaskFactory.inferredTypeForMember(
521 field as Entity, _globalInferenceResults); 521 // ignore: UNNECESSARY_CAST
522 field as Entity,
523 _globalInferenceResults);
522 HInstruction load = new HFieldGet(field, receiver, type); 524 HInstruction load = new HFieldGet(field, receiver, type);
523 node.block.addBefore(node, load); 525 node.block.addBefore(node, load);
524 Selector callSelector = new Selector.callClosureFrom(node.selector); 526 Selector callSelector = new Selector.callClosureFrom(node.selector);
525 List<HInstruction> inputs = <HInstruction>[load] 527 List<HInstruction> inputs = <HInstruction>[load]
526 ..addAll(node.inputs.skip(node.isInterceptedCall ? 2 : 1)); 528 ..addAll(node.inputs.skip(node.isInterceptedCall ? 2 : 1));
527 HInstruction closureCall = 529 HInstruction closureCall =
528 new HInvokeClosure(callSelector, inputs, node.instructionType) 530 new HInvokeClosure(callSelector, inputs, node.instructionType)
529 ..sourceInformation = node.sourceInformation; 531 ..sourceInformation = node.sourceInformation;
530 node.block.addAfter(load, closureCall); 532 node.block.addAfter(load, closureCall);
531 return closureCall; 533 return closureCall;
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 990
989 HInstruction directFieldGet(HInstruction receiver, FieldEntity field) { 991 HInstruction directFieldGet(HInstruction receiver, FieldEntity field) {
990 bool isAssignable = !_closedWorld.fieldNeverChanges(field); 992 bool isAssignable = !_closedWorld.fieldNeverChanges(field);
991 993
992 TypeMask type; 994 TypeMask type;
993 if (_nativeData.isNativeClass(field.enclosingClass)) { 995 if (_nativeData.isNativeClass(field.enclosingClass)) {
994 type = TypeMaskFactory.fromNativeBehavior( 996 type = TypeMaskFactory.fromNativeBehavior(
995 _nativeData.getNativeFieldLoadBehavior(field), _closedWorld); 997 _nativeData.getNativeFieldLoadBehavior(field), _closedWorld);
996 } else { 998 } else {
997 type = TypeMaskFactory.inferredTypeForMember( 999 type = TypeMaskFactory.inferredTypeForMember(
998 field as Entity, _globalInferenceResults); 1000 // ignore: UNNECESSARY_CAST
1001 field as Entity,
1002 _globalInferenceResults);
999 } 1003 }
1000 1004
1001 return new HFieldGet(field, receiver, type, isAssignable: isAssignable); 1005 return new HFieldGet(field, receiver, type, isAssignable: isAssignable);
1002 } 1006 }
1003 1007
1004 HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) { 1008 HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) {
1005 if (node.isInterceptedCall) { 1009 if (node.isInterceptedCall) {
1006 HInstruction folded = handleInterceptedCall(node); 1010 HInstruction folded = handleInterceptedCall(node);
1007 if (folded != node) return folded; 1011 if (folded != node) return folded;
1008 } 1012 }
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after
2372 memorySet.registerFieldValueUpdate( 2376 memorySet.registerFieldValueUpdate(
2373 instruction.element, receiver, instruction.inputs.last); 2377 instruction.element, receiver, instruction.inputs.last);
2374 } 2378 }
2375 2379
2376 void visitCreate(HCreate instruction) { 2380 void visitCreate(HCreate instruction) {
2377 memorySet.registerAllocation(instruction); 2381 memorySet.registerAllocation(instruction);
2378 if (shouldTrackInitialValues(instruction)) { 2382 if (shouldTrackInitialValues(instruction)) {
2379 int argumentIndex = 0; 2383 int argumentIndex = 0;
2380 compiler.codegenWorldBuilder.forEachInstanceField(instruction.element, 2384 compiler.codegenWorldBuilder.forEachInstanceField(instruction.element,
2381 (_, FieldEntity member) { 2385 (_, FieldEntity member) {
2382 if (compiler.elementHasCompileTimeError(member as Entity)) return; 2386 if (compiler.elementHasCompileTimeError(
2387 // ignore: UNNECESSARY_CAST
2388 member as Entity)) return;
2383 memorySet.registerFieldValue( 2389 memorySet.registerFieldValue(
2384 member, instruction, instruction.inputs[argumentIndex++]); 2390 member, instruction, instruction.inputs[argumentIndex++]);
2385 }); 2391 });
2386 } 2392 }
2387 // In case this instruction has as input non-escaping objects, we 2393 // In case this instruction has as input non-escaping objects, we
2388 // need to mark these objects as escaping. 2394 // need to mark these objects as escaping.
2389 memorySet.killAffectedBy(instruction); 2395 memorySet.killAffectedBy(instruction);
2390 } 2396 }
2391 2397
2392 bool shouldTrackInitialValues(HCreate instruction) { 2398 bool shouldTrackInitialValues(HCreate instruction) {
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
2820 2826
2821 keyedValues.forEach((receiver, values) { 2827 keyedValues.forEach((receiver, values) {
2822 result.keyedValues[receiver] = 2828 result.keyedValues[receiver] =
2823 new Map<HInstruction, HInstruction>.from(values); 2829 new Map<HInstruction, HInstruction>.from(values);
2824 }); 2830 });
2825 2831
2826 result.nonEscapingReceivers.addAll(nonEscapingReceivers); 2832 result.nonEscapingReceivers.addAll(nonEscapingReceivers);
2827 return result; 2833 return result;
2828 } 2834 }
2829 } 2835 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/nodes.dart ('k') | pkg/compiler/lib/src/ssa/variable_allocator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698