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

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

Issue 15984010: Improve array bounds check elimination for growable lists. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language.cc » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 6190 matching lines...) Expand 10 before | Expand all | Expand 10 after
6201 6201
6202 private: 6202 private:
6203 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); 6203 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr);
6204 }; 6204 };
6205 6205
6206 6206
6207 class CheckArrayBoundInstr : public TemplateInstruction<2> { 6207 class CheckArrayBoundInstr : public TemplateInstruction<2> {
6208 public: 6208 public:
6209 CheckArrayBoundInstr(Value* length, 6209 CheckArrayBoundInstr(Value* length,
6210 Value* index, 6210 Value* index,
6211 intptr_t array_type, 6211 InstanceCallInstr* instance_call) {
6212 InstanceCallInstr* instance_call)
6213 : array_type_(array_type) {
6214 SetInputAt(kLengthPos, length); 6212 SetInputAt(kLengthPos, length);
6215 SetInputAt(kIndexPos, index); 6213 SetInputAt(kIndexPos, index);
6216 deopt_id_ = instance_call->deopt_id(); 6214 deopt_id_ = instance_call->deopt_id();
6217 } 6215 }
6218 6216
6219 Value* length() const { return inputs_[kLengthPos]; } 6217 Value* length() const { return inputs_[kLengthPos]; }
6220 Value* index() const { return inputs_[kIndexPos]; } 6218 Value* index() const { return inputs_[kIndexPos]; }
6221 6219
6222 intptr_t array_type() const { return array_type_; }
6223
6224 DECLARE_INSTRUCTION(CheckArrayBound) 6220 DECLARE_INSTRUCTION(CheckArrayBound)
6225 6221
6226 virtual intptr_t ArgumentCount() const { return 0; } 6222 virtual intptr_t ArgumentCount() const { return 0; }
6227 6223
6228 virtual bool CanDeoptimize() const { return true; } 6224 virtual bool CanDeoptimize() const { return true; }
6229 6225
6230 bool IsRedundant(RangeBoundary length); 6226 bool IsRedundant(RangeBoundary length);
6231 6227
6232 virtual Instruction* Canonicalize(FlowGraph* flow_graph); 6228 virtual Instruction* Canonicalize(FlowGraph* flow_graph);
6233 6229
6234 // Returns the length offset for array and string types. 6230 // Returns the length offset for array and string types.
6235 static intptr_t LengthOffsetFor(intptr_t class_id); 6231 static intptr_t LengthOffsetFor(intptr_t class_id);
6236 6232
6237 static bool IsFixedLengthArrayType(intptr_t class_id); 6233 static bool IsFixedLengthArrayType(intptr_t class_id);
6238 6234
6239 virtual bool AllowsCSE() const { return true; } 6235 virtual bool AllowsCSE() const { return true; }
6240 virtual EffectSet Effects() const { return EffectSet::None(); } 6236 virtual EffectSet Effects() const { return EffectSet::None(); }
6241 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6237 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6242 virtual bool AttributesEqual(Instruction* other) const; 6238 virtual bool AttributesEqual(Instruction* other) const { return true; }
6243 6239
6244 virtual bool MayThrow() const { return false; } 6240 virtual bool MayThrow() const { return false; }
6245 6241
6246 private: 6242 private:
6247 // Give a name to the location/input indices. 6243 // Give a name to the location/input indices.
6248 enum { 6244 enum {
6249 kLengthPos = 0, 6245 kLengthPos = 0,
6250 kIndexPos = 1 6246 kIndexPos = 1
6251 }; 6247 };
6252 intptr_t array_type_;
6253 6248
6254 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr); 6249 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr);
6255 }; 6250 };
6256 6251
6257 6252
6258 #undef DECLARE_INSTRUCTION 6253 #undef DECLARE_INSTRUCTION
6259 6254
6260 class Environment : public ZoneAllocated { 6255 class Environment : public ZoneAllocated {
6261 public: 6256 public:
6262 // Iterate the non-NULL values in the innermost level of an environment. 6257 // Iterate the non-NULL values in the innermost level of an environment.
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
6472 ForwardInstructionIterator* current_iterator_; 6467 ForwardInstructionIterator* current_iterator_;
6473 6468
6474 private: 6469 private:
6475 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 6470 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
6476 }; 6471 };
6477 6472
6478 6473
6479 } // namespace dart 6474 } // namespace dart
6480 6475
6481 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 6476 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698