| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 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: |
| 205 class ContextualModeBits : public BitField<ContextualMode, 0, 1> {}; |
| 206 class LanguageModeBits : public BitField<LanguageMode, 1, 2> {}; |
| 207 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); |
| 208 const ExtraICState state_; |
| 209 |
| 204 public: | 210 public: |
| 211 static const ExtraICState kStrongModeState = STRONG |
| 212 << LanguageModeBits::kShift; |
| 213 |
| 205 explicit LoadICState(ExtraICState extra_ic_state) : state_(extra_ic_state) {} | 214 explicit LoadICState(ExtraICState extra_ic_state) : state_(extra_ic_state) {} |
| 206 | 215 |
| 207 explicit LoadICState(ContextualMode mode) | 216 explicit LoadICState(ContextualMode mode, LanguageMode language_mode) |
| 208 : state_(ContextualModeBits::encode(mode)) {} | 217 : state_(ContextualModeBits::encode(mode) | |
| 218 LanguageModeBits::encode(language_mode)) {} |
| 209 | 219 |
| 210 ExtraICState GetExtraICState() const { return state_; } | 220 ExtraICState GetExtraICState() const { return state_; } |
| 211 | 221 |
| 212 ContextualMode contextual_mode() const { | 222 ContextualMode contextual_mode() const { |
| 213 return ContextualModeBits::decode(state_); | 223 return ContextualModeBits::decode(state_); |
| 214 } | 224 } |
| 215 | 225 |
| 226 LanguageMode language_mode() const { |
| 227 return LanguageModeBits::decode(state_); |
| 228 } |
| 229 |
| 216 static ContextualMode GetContextualMode(ExtraICState state) { | 230 static ContextualMode GetContextualMode(ExtraICState state) { |
| 217 return LoadICState(state).contextual_mode(); | 231 return LoadICState(state).contextual_mode(); |
| 218 } | 232 } |
| 219 | 233 |
| 220 private: | 234 static LanguageMode GetLanguageMode(ExtraICState state) { |
| 221 class ContextualModeBits : public BitField<ContextualMode, 0, 1> {}; | 235 return LoadICState(state).language_mode(); |
| 222 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); | 236 } |
| 223 | |
| 224 const ExtraICState state_; | |
| 225 }; | 237 }; |
| 226 | 238 |
| 227 | 239 |
| 228 class StoreICState final BASE_EMBEDDED { | 240 class StoreICState final BASE_EMBEDDED { |
| 229 public: | 241 public: |
| 230 explicit StoreICState(ExtraICState extra_ic_state) : state_(extra_ic_state) {} | 242 explicit StoreICState(ExtraICState extra_ic_state) : state_(extra_ic_state) {} |
| 231 | 243 |
| 232 explicit StoreICState(LanguageMode mode) | 244 explicit StoreICState(LanguageMode mode) |
| 233 : state_(LanguageModeState::encode(mode)) {} | 245 : state_(LanguageModeState::encode(mode)) {} |
| 234 | 246 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 250 static const ExtraICState kStrictModeState = STRICT | 262 static const ExtraICState kStrictModeState = STRICT |
| 251 << LanguageModeState::kShift; | 263 << LanguageModeState::kShift; |
| 252 | 264 |
| 253 private: | 265 private: |
| 254 const ExtraICState state_; | 266 const ExtraICState state_; |
| 255 }; | 267 }; |
| 256 } | 268 } |
| 257 } | 269 } |
| 258 | 270 |
| 259 #endif // V8_IC_STATE_H_ | 271 #endif // V8_IC_STATE_H_ |
| OLD | NEW |