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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 static ContextualMode GetContextualMode(ExtraICState state) { | 217 static ContextualMode GetContextualMode(ExtraICState state) { |
218 return LoadICState(state).contextual_mode(); | 218 return LoadICState(state).contextual_mode(); |
219 } | 219 } |
220 | 220 |
221 private: | 221 private: |
222 class ContextualModeBits : public BitField<ContextualMode, 0, 1> {}; | 222 class ContextualModeBits : public BitField<ContextualMode, 0, 1> {}; |
223 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); | 223 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); |
224 | 224 |
225 const ExtraICState state_; | 225 const ExtraICState state_; |
226 }; | 226 }; |
| 227 |
| 228 |
| 229 class StoreICState final BASE_EMBEDDED { |
| 230 public: |
| 231 explicit StoreICState(ExtraICState extra_ic_state) : state_(extra_ic_state) {} |
| 232 |
| 233 explicit StoreICState(LanguageMode mode) |
| 234 : state_(LanguageModeState::encode(mode)) {} |
| 235 |
| 236 ExtraICState GetExtraICState() const { return state_; } |
| 237 |
| 238 LanguageMode language_mode() const { |
| 239 return LanguageModeState::decode(state_); |
| 240 } |
| 241 |
| 242 static LanguageMode GetLanguageMode(ExtraICState state) { |
| 243 return StoreICState(state).language_mode(); |
| 244 } |
| 245 |
| 246 class LanguageModeState : public BitField<LanguageMode, 1, 2> {}; |
| 247 STATIC_ASSERT(i::LANGUAGE_END == 3); |
| 248 |
| 249 // For convenience, a statically declared encoding of strict mode extra |
| 250 // IC state. |
| 251 static const ExtraICState kStrictModeState = STRICT |
| 252 << LanguageModeState::kShift; |
| 253 |
| 254 private: |
| 255 const ExtraICState state_; |
| 256 }; |
227 } | 257 } |
228 } | 258 } |
229 | 259 |
230 #endif // V8_IC_STATE_H_ | 260 #endif // V8_IC_STATE_H_ |
OLD | NEW |