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 #include "src/parsing/token.h" | 9 #include "src/parsing/token.h" |
10 | 10 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 static State NewInputState(State old_state, Handle<Object> value); | 174 static State NewInputState(State old_state, Handle<Object> value); |
175 | 175 |
176 static const char* GetStateName(CompareICState::State state); | 176 static const char* GetStateName(CompareICState::State state); |
177 | 177 |
178 static State TargetState(Isolate* isolate, State old_state, State old_left, | 178 static State TargetState(Isolate* isolate, State old_state, State old_left, |
179 State old_right, Token::Value op, | 179 State old_right, Token::Value op, |
180 bool has_inlined_smi_code, Handle<Object> x, | 180 bool has_inlined_smi_code, Handle<Object> x, |
181 Handle<Object> y); | 181 Handle<Object> y); |
182 }; | 182 }; |
183 | 183 |
184 class LoadGlobalICState final BASE_EMBEDDED { | |
185 private: | |
186 class TypeofModeBits : public BitField<TypeofMode, 0, 1> {}; | |
187 STATIC_ASSERT(static_cast<int>(INSIDE_TYPEOF) == 0); | |
188 const ExtraICState state_; | |
189 | |
190 public: | |
191 static const uint32_t kNextBitFieldOffset = TypeofModeBits::kNext; | |
192 | |
193 explicit LoadGlobalICState(ExtraICState extra_ic_state) | |
194 : state_(extra_ic_state) {} | |
195 | |
196 explicit LoadGlobalICState(TypeofMode typeof_mode) | |
197 : state_(TypeofModeBits::encode(typeof_mode)) {} | |
198 | |
199 ExtraICState GetExtraICState() const { return state_; } | |
200 | |
201 TypeofMode typeof_mode() const { return TypeofModeBits::decode(state_); } | |
202 | |
203 static TypeofMode GetTypeofMode(ExtraICState state) { | |
204 return LoadGlobalICState(state).typeof_mode(); | |
205 } | |
206 | |
207 // For convenience, a statically declared encoding of typeof mode | |
208 // IC state. | |
209 static const ExtraICState kInsideTypeOfState = INSIDE_TYPEOF | |
210 << TypeofModeBits::kShift; | |
211 static const ExtraICState kNotInsideTypeOfState = NOT_INSIDE_TYPEOF | |
212 << TypeofModeBits::kShift; | |
213 }; | |
214 | |
215 } // namespace internal | 184 } // namespace internal |
216 } // namespace v8 | 185 } // namespace v8 |
217 | 186 |
218 #endif // V8_IC_STATE_H_ | 187 #endif // V8_IC_STATE_H_ |
OLD | NEW |