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

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

Issue 23003026: Avoid array bounds check when allowed by guarded field. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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) 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 6470 matching lines...) Expand 10 before | Expand all | Expand 10 after
6481 6481
6482 virtual bool MayThrow() const { return false; } 6482 virtual bool MayThrow() const { return false; }
6483 6483
6484 private: 6484 private:
6485 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); 6485 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr);
6486 }; 6486 };
6487 6487
6488 6488
6489 class CheckArrayBoundInstr : public TemplateInstruction<2> { 6489 class CheckArrayBoundInstr : public TemplateInstruction<2> {
6490 public: 6490 public:
6491 CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id) { 6491 CheckArrayBoundInstr(const Field* array, Value* length, Value* index,
6492 intptr_t deopt_id) : array_(array) {
6492 SetInputAt(kLengthPos, length); 6493 SetInputAt(kLengthPos, length);
6493 SetInputAt(kIndexPos, index); 6494 SetInputAt(kIndexPos, index);
6494 // Override generated deopt-id. 6495 // Override generated deopt-id.
6495 deopt_id_ = deopt_id; 6496 deopt_id_ = deopt_id;
6496 } 6497 }
6497 6498
6498 Value* length() const { return inputs_[kLengthPos]; } 6499 Value* length() const { return inputs_[kLengthPos]; }
6499 Value* index() const { return inputs_[kIndexPos]; } 6500 Value* index() const { return inputs_[kIndexPos]; }
6500 6501
6501 DECLARE_INSTRUCTION(CheckArrayBound) 6502 DECLARE_INSTRUCTION(CheckArrayBound)
(...skipping 18 matching lines...) Expand all
6520 6521
6521 virtual bool MayThrow() const { return false; } 6522 virtual bool MayThrow() const { return false; }
6522 6523
6523 private: 6524 private:
6524 // Give a name to the location/input indices. 6525 // Give a name to the location/input indices.
6525 enum { 6526 enum {
6526 kLengthPos = 0, 6527 kLengthPos = 0,
6527 kIndexPos = 1 6528 kIndexPos = 1
6528 }; 6529 };
6529 6530
6531 const Field* array_;
6532
6530 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr); 6533 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr);
6531 }; 6534 };
6532 6535
6533 6536
6534 #undef DECLARE_INSTRUCTION 6537 #undef DECLARE_INSTRUCTION
6535 6538
6536 class Environment : public ZoneAllocated { 6539 class Environment : public ZoneAllocated {
6537 public: 6540 public:
6538 // Iterate the non-NULL values in the innermost level of an environment. 6541 // Iterate the non-NULL values in the innermost level of an environment.
6539 class ShallowIterator : public ValueObject { 6542 class ShallowIterator : public ValueObject {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
6748 ForwardInstructionIterator* current_iterator_; 6751 ForwardInstructionIterator* current_iterator_;
6749 6752
6750 private: 6753 private:
6751 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 6754 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
6752 }; 6755 };
6753 6756
6754 6757
6755 } // namespace dart 6758 } // namespace dart
6756 6759
6757 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 6760 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698