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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 154353002: Fix for issue 16497 - fix load elimination aliasing for typed arrays (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 | sdk/lib/_internal/compiler/implementation/ssa/optimize.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 part of js_backend; 5 part of js_backend;
6 6
7 const VERBOSE_OPTIMIZER_HINTS = false; 7 const VERBOSE_OPTIMIZER_HINTS = false;
8 8
9 class JavaScriptItemCompilationContext extends ItemCompilationContext { 9 class JavaScriptItemCompilationContext extends ItemCompilationContext {
10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>();
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 bool isTypedArray(TypeMask mask) { 1731 bool isTypedArray(TypeMask mask) {
1732 // Just checking for [:TypedData:] is not sufficient, as it is an 1732 // Just checking for [:TypedData:] is not sufficient, as it is an
1733 // abstract class any user-defined class can implement. So we also 1733 // abstract class any user-defined class can implement. So we also
1734 // check for the interface [JavaScriptIndexingBehavior]. 1734 // check for the interface [JavaScriptIndexingBehavior].
1735 return compiler.typedDataClass != null 1735 return compiler.typedDataClass != null
1736 && mask.satisfies(compiler.typedDataClass, compiler) 1736 && mask.satisfies(compiler.typedDataClass, compiler)
1737 && mask.satisfies(jsIndexingBehaviorInterface, compiler); 1737 && mask.satisfies(jsIndexingBehaviorInterface, compiler);
1738 } 1738 }
1739 1739
1740 bool couldBeTypedArray(TypeMask mask) { 1740 bool couldBeTypedArray(TypeMask mask) {
1741 TypeMask indexing = new TypeMask.subtype(jsIndexingBehaviorInterface); 1741 bool intersects(TypeMask type1, TypeMask type2) =>
ngeoffray 2014/02/05 09:25:53 What is it that the previous implementation did no
sra1 2014/02/05 21:32:18 containsMask is a subtype test. The inputs might n
1742 // Checking if [mask] contains [indexing] means that we want to 1742 !type1.intersection(type2, compiler).isEmpty;
1743 // know if [mask] is not a more specific type than [indexing]. 1743
1744 return isTypedArray(mask) || mask.containsMask(indexing, compiler); 1744 return compiler.typedDataClass != null
1745 && intersects(mask, new TypeMask.subtype(compiler.typedDataClass))
1746 && intersects(mask, new TypeMask.subtype(jsIndexingBehaviorInterface));
1745 } 1747 }
1746 1748
1747 /// Returns all static fields that are referenced through [targetsUsed]. 1749 /// Returns all static fields that are referenced through [targetsUsed].
1748 /// If the target is a library or class all nested static fields are 1750 /// If the target is a library or class all nested static fields are
1749 /// included too. 1751 /// included too.
1750 Iterable<Element> _findStaticFieldTargets() { 1752 Iterable<Element> _findStaticFieldTargets() {
1751 List staticFields = []; 1753 List staticFields = [];
1752 1754
1753 void addFieldsInContainer(ScopeContainerElement container) { 1755 void addFieldsInContainer(ScopeContainerElement container) {
1754 container.forEachLocalMember((Element member) { 1756 container.forEachLocalMember((Element member) {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 copy(constant.values); 1909 copy(constant.values);
1908 copy(constant.protoValue); 1910 copy(constant.protoValue);
1909 copy(constant); 1911 copy(constant);
1910 } 1912 }
1911 1913
1912 void visitConstructed(ConstructedConstant constant) { 1914 void visitConstructed(ConstructedConstant constant) {
1913 copy(constant.fields); 1915 copy(constant.fields);
1914 copy(constant); 1916 copy(constant);
1915 } 1917 }
1916 } 1918 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698