| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 static const char* GetStateName(CompareICState::State state); | 195 static const char* GetStateName(CompareICState::State state); |
| 196 | 196 |
| 197 static State TargetState(State old_state, State old_left, State old_right, | 197 static State TargetState(State old_state, State old_left, State old_right, |
| 198 Token::Value op, bool has_inlined_smi_code, | 198 Token::Value op, bool has_inlined_smi_code, |
| 199 Handle<Object> x, Handle<Object> y); | 199 Handle<Object> x, Handle<Object> y); |
| 200 }; | 200 }; |
| 201 | 201 |
| 202 | 202 |
| 203 class LoadICState final BASE_EMBEDDED { | 203 class LoadICState final BASE_EMBEDDED { |
| 204 private: | 204 private: |
| 205 class ContextualModeBits : public BitField<ContextualMode, 0, 1> {}; | 205 class TypeofModeBits : public BitField<TypeofMode, 0, 1> {}; |
| 206 class LanguageModeBits | 206 class LanguageModeBits |
| 207 : public BitField<LanguageMode, ContextualModeBits::kNext, 2> {}; | 207 : public BitField<LanguageMode, TypeofModeBits::kNext, 2> {}; |
| 208 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); | 208 STATIC_ASSERT(static_cast<int>(INSIDE_TYPEOF) == 0); |
| 209 const ExtraICState state_; | 209 const ExtraICState state_; |
| 210 | 210 |
| 211 public: | 211 public: |
| 212 static const uint32_t kNextBitFieldOffset = LanguageModeBits::kNext; | 212 static const uint32_t kNextBitFieldOffset = LanguageModeBits::kNext; |
| 213 | 213 |
| 214 static const ExtraICState kStrongModeState = STRONG | 214 static const ExtraICState kStrongModeState = STRONG |
| 215 << LanguageModeBits::kShift; | 215 << LanguageModeBits::kShift; |
| 216 | 216 |
| 217 explicit LoadICState(ExtraICState extra_ic_state) : state_(extra_ic_state) {} | 217 explicit LoadICState(ExtraICState extra_ic_state) : state_(extra_ic_state) {} |
| 218 | 218 |
| 219 explicit LoadICState(ContextualMode mode, LanguageMode language_mode) | 219 explicit LoadICState(TypeofMode typeof_mode, LanguageMode language_mode) |
| 220 : state_(ContextualModeBits::encode(mode) | | 220 : state_(TypeofModeBits::encode(typeof_mode) | |
| 221 LanguageModeBits::encode(language_mode)) {} | 221 LanguageModeBits::encode(language_mode)) {} |
| 222 | 222 |
| 223 ExtraICState GetExtraICState() const { return state_; } | 223 ExtraICState GetExtraICState() const { return state_; } |
| 224 | 224 |
| 225 ContextualMode contextual_mode() const { | 225 TypeofMode typeof_mode() const { return TypeofModeBits::decode(state_); } |
| 226 return ContextualModeBits::decode(state_); | |
| 227 } | |
| 228 | 226 |
| 229 LanguageMode language_mode() const { | 227 LanguageMode language_mode() const { |
| 230 return LanguageModeBits::decode(state_); | 228 return LanguageModeBits::decode(state_); |
| 231 } | 229 } |
| 232 | 230 |
| 233 static ContextualMode GetContextualMode(ExtraICState state) { | 231 static TypeofMode GetTypeofMode(ExtraICState state) { |
| 234 return LoadICState(state).contextual_mode(); | 232 return LoadICState(state).typeof_mode(); |
| 235 } | 233 } |
| 236 | 234 |
| 237 static LanguageMode GetLanguageMode(ExtraICState state) { | 235 static LanguageMode GetLanguageMode(ExtraICState state) { |
| 238 return LoadICState(state).language_mode(); | 236 return LoadICState(state).language_mode(); |
| 239 } | 237 } |
| 240 }; | 238 }; |
| 241 | 239 |
| 242 | 240 |
| 243 class StoreICState final BASE_EMBEDDED { | 241 class StoreICState final BASE_EMBEDDED { |
| 244 public: | 242 public: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 265 static const ExtraICState kStrictModeState = STRICT | 263 static const ExtraICState kStrictModeState = STRICT |
| 266 << LanguageModeState::kShift; | 264 << LanguageModeState::kShift; |
| 267 | 265 |
| 268 private: | 266 private: |
| 269 const ExtraICState state_; | 267 const ExtraICState state_; |
| 270 }; | 268 }; |
| 271 } | 269 } |
| 272 } | 270 } |
| 273 | 271 |
| 274 #endif // V8_IC_STATE_H_ | 272 #endif // V8_IC_STATE_H_ |
| OLD | NEW |