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

Side by Side Diff: runtime/vm/intermediate_language.cc

Issue 10908214: Revert "Whenever possible use length passed to the List constructor for bounds checks instead of lo… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
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 #include "vm/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/flow_graph_allocator.h" 9 #include "vm/flow_graph_allocator.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 RawAbstractType* CheckSmiInstr::CompileType() const { 1118 RawAbstractType* CheckSmiInstr::CompileType() const {
1119 return AbstractType::null(); 1119 return AbstractType::null();
1120 } 1120 }
1121 1121
1122 1122
1123 RawAbstractType* CheckArrayBoundInstr::CompileType() const { 1123 RawAbstractType* CheckArrayBoundInstr::CompileType() const {
1124 return AbstractType::null(); 1124 return AbstractType::null();
1125 } 1125 }
1126 1126
1127 1127
1128 RawAbstractType* CheckBoundInstr::CompileType() const {
1129 return AbstractType::null();
1130 }
1131
1132
1133 RawAbstractType* CheckEitherNonSmiInstr::CompileType() const { 1128 RawAbstractType* CheckEitherNonSmiInstr::CompileType() const {
1134 return AbstractType::null(); 1129 return AbstractType::null();
1135 } 1130 }
1136 1131
1137 1132
1138 // Optimizations that eliminate or simplify individual computations. 1133 // Optimizations that eliminate or simplify individual computations.
1139 Definition* Definition::Canonicalize() { 1134 Definition* Definition::Canonicalize() {
1140 return this; 1135 return this;
1141 } 1136 }
1142 1137
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 1174
1180 Definition* CheckEitherNonSmiInstr::Canonicalize() { 1175 Definition* CheckEitherNonSmiInstr::Canonicalize() {
1181 if ((left()->ResultCid() == kDoubleCid) || 1176 if ((left()->ResultCid() == kDoubleCid) ||
1182 (right()->ResultCid() == kDoubleCid)) { 1177 (right()->ResultCid() == kDoubleCid)) {
1183 return NULL; // Remove from the graph. 1178 return NULL; // Remove from the graph.
1184 } 1179 }
1185 return this; 1180 return this;
1186 } 1181 }
1187 1182
1188 1183
1189 Definition* CheckArrayBoundInstr::Canonicalize() {
1190 if (array_type() == kArrayCid) {
1191 // For fixed length arrays check if array is the result of a constructor
1192 // call. In this case we can use the length passed to the constructor
1193 // instead of loading it from array itself.
1194 StaticCallInstr* allocation = array()->definition()->AsStaticCall();
1195 if ((allocation != NULL) &&
1196 allocation->is_known_constructor() &&
1197 (allocation->ResultCid() == kArrayCid)) {
1198 CheckBoundInstr* check =
1199 new CheckBoundInstr(allocation->ArgumentAt(0)->value()->Copy(),
1200 index(),
1201 deopt_id_);
1202 check->set_env(env());
1203 set_env(NULL);
1204 return check;
1205 }
1206 }
1207 return this;
1208 }
1209
1210
1211 // Shared code generation methods (EmitNativeCode, MakeLocationSummary, and 1184 // Shared code generation methods (EmitNativeCode, MakeLocationSummary, and
1212 // PrepareEntry). Only assembly code that can be shared across all architectures 1185 // PrepareEntry). Only assembly code that can be shared across all architectures
1213 // can be used. Machine specific register allocation and code generation 1186 // can be used. Machine specific register allocation and code generation
1214 // is located in intermediate_language_<arch>.cc 1187 // is located in intermediate_language_<arch>.cc
1215 1188
1216 #define __ compiler->assembler()-> 1189 #define __ compiler->assembler()->
1217 1190
1218 void GraphEntryInstr::PrepareEntry(FlowGraphCompiler* compiler) { 1191 void GraphEntryInstr::PrepareEntry(FlowGraphCompiler* compiler) {
1219 // Nothing to do. 1192 // Nothing to do.
1220 } 1193 }
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 value->set_use_index(use_index++); 1663 value->set_use_index(use_index++);
1691 value->AddToEnvUseList(); 1664 value->AddToEnvUseList();
1692 } 1665 }
1693 instr->set_env(copy); 1666 instr->set_env(copy);
1694 } 1667 }
1695 1668
1696 1669
1697 #undef __ 1670 #undef __
1698 1671
1699 } // namespace dart 1672 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698