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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/bailout.dart

Issue 11348316: Move the handling of operator[] into the new interceptors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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
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 ssa; 5 part of ssa;
6 6
7 class BailoutInfo { 7 class BailoutInfo {
8 int instructionId; 8 int instructionId;
9 int bailoutId; 9 int bailoutId;
10 BailoutInfo(this.instructionId, this.bailoutId); 10 BailoutInfo(this.instructionId, this.bailoutId);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 return false; 132 return false;
133 } 133 }
134 134
135 // If the instruction is not in a loop then the header will be null. 135 // If the instruction is not in a loop then the header will be null.
136 HBasicBlock currentLoopHeader = instruction.block.enclosingLoopHeader; 136 HBasicBlock currentLoopHeader = instruction.block.enclosingLoopHeader;
137 for (HInstruction user in instruction.usedBy) { 137 for (HInstruction user in instruction.usedBy) {
138 HBasicBlock userLoopHeader = user.block.enclosingLoopHeader; 138 HBasicBlock userLoopHeader = user.block.enclosingLoopHeader;
139 if (isNested(userLoopHeader, currentLoopHeader)) return true; 139 if (isNested(userLoopHeader, currentLoopHeader)) return true;
140 } 140 }
141 141
142 bool isIndexOperatorOnIndexablePrimitive(instruction, types) {
143 return instruction is HIndex
144 || (instruction is HInvokeDynamicMethod
145 && instruction.isIndexOperatorOnIndexablePrimitive(types));
146 }
147
142 // To speed up computations on values loaded from arrays, we 148 // To speed up computations on values loaded from arrays, we
143 // insert type guards for builtin array indexing operations in 149 // insert type guards for builtin array indexing operations in
144 // nested loops. Since this can blow up code size quite 150 // nested loops. Since this can blow up code size quite
145 // significantly, we only do it if type guards have already been 151 // significantly, we only do it if type guards have already been
146 // inserted for this method. The code size price for an additional 152 // inserted for this method. The code size price for an additional
147 // type guard is much smaller than the first one that causes the 153 // type guard is much smaller than the first one that causes the
148 // generation of a bailout method. 154 // generation of a bailout method.
149 if (instruction is HIndex && 155 if (hasTypeGuards
150 (instruction as HIndex).isBuiltin(types) && 156 && isIndexOperatorOnIndexablePrimitive(instruction, types)) {
151 hasTypeGuards) {
152 HBasicBlock loopHeader = instruction.block.enclosingLoopHeader; 157 HBasicBlock loopHeader = instruction.block.enclosingLoopHeader;
153 if (loopHeader != null && loopHeader.parentLoopHeader != null) { 158 if (loopHeader != null && loopHeader.parentLoopHeader != null) {
154 return true; 159 return true;
155 } 160 }
156 } 161 }
157 162
158 // If the instruction is used by a phi where a guard would be 163 // If the instruction is used by a phi where a guard would be
159 // valuable, put the guard on that instruction. 164 // valuable, put the guard on that instruction.
160 for (HInstruction user in instruction.usedBy) { 165 for (HInstruction user in instruction.usedBy) {
161 if (user is HPhi 166 if (user is HPhi
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 hasComplexBailoutTargets = true; 544 hasComplexBailoutTargets = true;
540 } 545 }
541 } else { 546 } else {
542 hasComplexBailoutTargets = true; 547 hasComplexBailoutTargets = true;
543 blocks.forEach((HBasicBlock block) { 548 blocks.forEach((HBasicBlock block) {
544 block.bailoutTargets.add(target); 549 block.bailoutTargets.add(target);
545 }); 550 });
546 } 551 }
547 } 552 }
548 } 553 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698