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

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

Issue 10914008: Add explicit smi-checks to smi comparisons. (Closed) Base URL: http://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
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language_ia32.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) 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 #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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 class Computation : public ZoneAllocated { 130 class Computation : public ZoneAllocated {
131 public: 131 public:
132 Computation() : deopt_id_(Isolate::kNoDeoptId), ic_data_(NULL), locs_(NULL) { 132 Computation() : deopt_id_(Isolate::kNoDeoptId), ic_data_(NULL), locs_(NULL) {
133 Isolate* isolate = Isolate::Current(); 133 Isolate* isolate = Isolate::Current();
134 deopt_id_ = isolate->GetNextDeoptId(); 134 deopt_id_ = isolate->GetNextDeoptId();
135 ic_data_ = isolate->GetICDataForDeoptId(deopt_id_); 135 ic_data_ = isolate->GetICDataForDeoptId(deopt_id_);
136 } 136 }
137 137
138 // Unique id used for deoptimization. 138 // Unique id used for deoptimization.
139 intptr_t deopt_id() const { 139 virtual intptr_t deopt_id() const {
140 ASSERT(CanDeoptimize()); 140 ASSERT(CanDeoptimize());
141 return deopt_id_; 141 return deopt_id_;
142 } 142 }
143 143
144 const ICData* ic_data() const { return ic_data_; } 144 const ICData* ic_data() const { return ic_data_; }
145 void set_ic_data(const ICData* value) { ic_data_ = value; } 145 void set_ic_data(const ICData* value) { ic_data_ = value; }
146 bool HasICData() const { 146 bool HasICData() const {
147 return (ic_data() != NULL) && !ic_data()->IsNull(); 147 return (ic_data() != NULL) && !ic_data()->IsNull();
148 } 148 }
149 149
(...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 1917
1918 virtual bool CanDeoptimize() const { return true; } 1918 virtual bool CanDeoptimize() const { return true; }
1919 virtual intptr_t ResultCid() const { return kIllegalCid; } 1919 virtual intptr_t ResultCid() const { return kIllegalCid; }
1920 1920
1921 virtual bool AttributesEqual(Computation* other) const; 1921 virtual bool AttributesEqual(Computation* other) const;
1922 1922
1923 virtual bool HasSideEffect() const { return false; } 1923 virtual bool HasSideEffect() const { return false; }
1924 1924
1925 Value* value() const { return inputs_[0]; } 1925 Value* value() const { return inputs_[0]; }
1926 1926
1927 intptr_t deopt_id() const { return original_->deopt_id(); } 1927 virtual intptr_t deopt_id() const { return original_->deopt_id(); }
1928 1928
1929 virtual Definition* TryReplace(BindInstr* instr) const; 1929 virtual Definition* TryReplace(BindInstr* instr) const;
1930 1930
1931 virtual void PrintOperandsTo(BufferFormatter* f) const; 1931 virtual void PrintOperandsTo(BufferFormatter* f) const;
1932 1932
1933 private: 1933 private:
1934 InstanceCallComp* original_; 1934 InstanceCallComp* original_;
1935 1935
1936 DISALLOW_COPY_AND_ASSIGN(CheckClassComp); 1936 DISALLOW_COPY_AND_ASSIGN(CheckClassComp);
1937 }; 1937 };
1938 1938
1939 1939
1940 class CheckSmiComp : public TemplateComputation<1> { 1940 class CheckSmiComp : public TemplateComputation<1> {
1941 public: 1941 public:
1942 CheckSmiComp(Value* value, InstanceCallComp* original) 1942 CheckSmiComp(Value* value, intptr_t original_deopt_id)
1943 : original_(original) { 1943 : original_deopt_id_(original_deopt_id) {
1944 ASSERT(value != NULL); 1944 ASSERT(value != NULL);
1945 ASSERT(original_deopt_id != Isolate::kNoDeoptId);
1945 inputs_[0] = value; 1946 inputs_[0] = value;
1946 } 1947 }
1947 1948
1948 DECLARE_COMPUTATION(CheckSmi) 1949 DECLARE_COMPUTATION(CheckSmi)
1949 1950
1950 virtual bool CanDeoptimize() const { return true; } 1951 virtual bool CanDeoptimize() const { return true; }
1951 virtual intptr_t ResultCid() const { return kIllegalCid; } 1952 virtual intptr_t ResultCid() const { return kIllegalCid; }
1952 1953
1953 virtual bool AttributesEqual(Computation* other) const { return true; } 1954 virtual bool AttributesEqual(Computation* other) const { return true; }
1954 1955
1955 virtual bool HasSideEffect() const { return false; } 1956 virtual bool HasSideEffect() const { return false; }
1956 1957
1957 virtual Definition* TryReplace(BindInstr* instr) const; 1958 virtual Definition* TryReplace(BindInstr* instr) const;
1958 1959
1959 Value* value() const { return inputs_[0]; } 1960 Value* value() const { return inputs_[0]; }
1960 1961
1961 intptr_t deopt_id() const { return original_->deopt_id(); } 1962 virtual intptr_t deopt_id() const { return original_deopt_id_; }
1962 1963
1963 private: 1964 private:
1964 InstanceCallComp* original_; 1965 const intptr_t original_deopt_id_;
1965 1966
1966 DISALLOW_COPY_AND_ASSIGN(CheckSmiComp); 1967 DISALLOW_COPY_AND_ASSIGN(CheckSmiComp);
1967 }; 1968 };
1968 1969
1969 1970
1970 class CheckArrayBoundComp : public TemplateComputation<2> { 1971 class CheckArrayBoundComp : public TemplateComputation<2> {
1971 public: 1972 public:
1972 CheckArrayBoundComp(Value* array, 1973 CheckArrayBoundComp(Value* array,
1973 Value* index, 1974 Value* index,
1974 intptr_t array_type, 1975 intptr_t array_type,
(...skipping 12 matching lines...) Expand all
1987 1988
1988 virtual bool AttributesEqual(Computation* other) const; 1989 virtual bool AttributesEqual(Computation* other) const;
1989 1990
1990 virtual bool HasSideEffect() const { return false; } 1991 virtual bool HasSideEffect() const { return false; }
1991 1992
1992 Value* array() const { return inputs_[0]; } 1993 Value* array() const { return inputs_[0]; }
1993 Value* index() const { return inputs_[1]; } 1994 Value* index() const { return inputs_[1]; }
1994 1995
1995 intptr_t array_type() const { return array_type_; } 1996 intptr_t array_type() const { return array_type_; }
1996 1997
1997 intptr_t deopt_id() const { return original_->deopt_id(); } 1998 virtual intptr_t deopt_id() const { return original_->deopt_id(); }
1998 1999
1999 private: 2000 private:
2000 intptr_t array_type_; 2001 intptr_t array_type_;
2001 InstanceCallComp* original_; 2002 InstanceCallComp* original_;
2002 2003
2003 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundComp); 2004 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundComp);
2004 }; 2005 };
2005 2006
2006 2007
2007 #undef DECLARE_COMPUTATION 2008 #undef DECLARE_COMPUTATION
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
3182 ForwardInstructionIterator* current_iterator_; 3183 ForwardInstructionIterator* current_iterator_;
3183 3184
3184 private: 3185 private:
3185 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 3186 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
3186 }; 3187 };
3187 3188
3188 3189
3189 } // namespace dart 3190 } // namespace dart
3190 3191
3191 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 3192 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698