OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_IC_STATE_H_ | 5 #ifndef V8_IC_STATE_H_ |
6 #define V8_IC_STATE_H_ | 6 #define V8_IC_STATE_H_ |
7 | 7 |
8 #include "src/macro-assembler.h" | 8 #include "src/macro-assembler.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 bool UseInlinedSmiCode() const { | 113 bool UseInlinedSmiCode() const { |
114 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_); | 114 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_); |
115 } | 115 } |
116 | 116 |
117 static const int FIRST_TOKEN = Token::BIT_OR; | 117 static const int FIRST_TOKEN = Token::BIT_OR; |
118 static const int LAST_TOKEN = Token::MOD; | 118 static const int LAST_TOKEN = Token::MOD; |
119 | 119 |
120 Token::Value op() const { return op_; } | 120 Token::Value op() const { return op_; } |
121 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } | 121 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } |
122 | 122 |
123 Type* GetLeftType() const { return KindToType(left_kind_); } | 123 AstType* GetLeftType() const { return KindToType(left_kind_); } |
124 Type* GetRightType() const { return KindToType(right_kind_); } | 124 AstType* GetRightType() const { return KindToType(right_kind_); } |
125 Type* GetResultType() const; | 125 AstType* GetResultType() const; |
126 | 126 |
127 void Update(Handle<Object> left, Handle<Object> right, Handle<Object> result); | 127 void Update(Handle<Object> left, Handle<Object> right, Handle<Object> result); |
128 | 128 |
129 Isolate* isolate() const { return isolate_; } | 129 Isolate* isolate() const { return isolate_; } |
130 | 130 |
131 enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC }; | 131 enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC }; |
132 Kind kind() const { | 132 Kind kind() const { |
133 return KindGeneralize(KindGeneralize(left_kind_, right_kind_), | 133 return KindGeneralize(KindGeneralize(left_kind_, right_kind_), |
134 result_kind_); | 134 result_kind_); |
135 } | 135 } |
136 | 136 |
137 private: | 137 private: |
138 friend std::ostream& operator<<(std::ostream& os, const BinaryOpICState& s); | 138 friend std::ostream& operator<<(std::ostream& os, const BinaryOpICState& s); |
139 | 139 |
140 Kind UpdateKind(Handle<Object> object, Kind kind) const; | 140 Kind UpdateKind(Handle<Object> object, Kind kind) const; |
141 | 141 |
142 static const char* KindToString(Kind kind); | 142 static const char* KindToString(Kind kind); |
143 static Type* KindToType(Kind kind); | 143 static AstType* KindToType(Kind kind); |
144 static bool KindMaybeSmi(Kind kind) { | 144 static bool KindMaybeSmi(Kind kind) { |
145 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; | 145 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; |
146 } | 146 } |
147 static bool KindLessGeneralThan(Kind kind1, Kind kind2) { | 147 static bool KindLessGeneralThan(Kind kind1, Kind kind2) { |
148 if (kind1 == NONE) return true; | 148 if (kind1 == NONE) return true; |
149 if (kind1 == kind2) return true; | 149 if (kind1 == kind2) return true; |
150 if (kind2 == GENERIC) return true; | 150 if (kind2 == GENERIC) return true; |
151 if (kind2 == STRING) return false; | 151 if (kind2 == STRING) return false; |
152 return kind1 <= kind2; | 152 return kind1 <= kind2; |
153 } | 153 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 SMI, | 195 SMI, |
196 NUMBER, | 196 NUMBER, |
197 STRING, | 197 STRING, |
198 INTERNALIZED_STRING, | 198 INTERNALIZED_STRING, |
199 UNIQUE_NAME, // Symbol or InternalizedString | 199 UNIQUE_NAME, // Symbol or InternalizedString |
200 RECEIVER, // JSReceiver | 200 RECEIVER, // JSReceiver |
201 KNOWN_RECEIVER, // JSReceiver with specific map (faster check) | 201 KNOWN_RECEIVER, // JSReceiver with specific map (faster check) |
202 GENERIC | 202 GENERIC |
203 }; | 203 }; |
204 | 204 |
205 static Type* StateToType(Zone* zone, State state, | 205 static AstType* StateToType(Zone* zone, State state, |
206 Handle<Map> map = Handle<Map>()); | 206 Handle<Map> map = Handle<Map>()); |
207 | 207 |
208 static State NewInputState(State old_state, Handle<Object> value); | 208 static State NewInputState(State old_state, Handle<Object> value); |
209 | 209 |
210 static const char* GetStateName(CompareICState::State state); | 210 static const char* GetStateName(CompareICState::State state); |
211 | 211 |
212 static State TargetState(Isolate* isolate, State old_state, State old_left, | 212 static State TargetState(Isolate* isolate, State old_state, State old_left, |
213 State old_right, Token::Value op, | 213 State old_right, Token::Value op, |
214 bool has_inlined_smi_code, Handle<Object> x, | 214 bool has_inlined_smi_code, Handle<Object> x, |
215 Handle<Object> y); | 215 Handle<Object> y); |
216 }; | 216 }; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 << LanguageModeState::kShift; | 266 << LanguageModeState::kShift; |
267 | 267 |
268 private: | 268 private: |
269 const ExtraICState state_; | 269 const ExtraICState state_; |
270 }; | 270 }; |
271 | 271 |
272 } // namespace internal | 272 } // namespace internal |
273 } // namespace v8 | 273 } // namespace v8 |
274 | 274 |
275 #endif // V8_IC_STATE_H_ | 275 #endif // V8_IC_STATE_H_ |
OLD | NEW |