| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 205 } |
| 206 | 206 |
| 207 // For convenience, a statically declared encoding of typeof mode | 207 // For convenience, a statically declared encoding of typeof mode |
| 208 // IC state. | 208 // IC state. |
| 209 static const ExtraICState kInsideTypeOfState = INSIDE_TYPEOF | 209 static const ExtraICState kInsideTypeOfState = INSIDE_TYPEOF |
| 210 << TypeofModeBits::kShift; | 210 << TypeofModeBits::kShift; |
| 211 static const ExtraICState kNotInsideTypeOfState = NOT_INSIDE_TYPEOF | 211 static const ExtraICState kNotInsideTypeOfState = NOT_INSIDE_TYPEOF |
| 212 << TypeofModeBits::kShift; | 212 << TypeofModeBits::kShift; |
| 213 }; | 213 }; |
| 214 | 214 |
| 215 | |
| 216 class StoreICState final BASE_EMBEDDED { | |
| 217 public: | |
| 218 explicit StoreICState(ExtraICState extra_ic_state) : state_(extra_ic_state) {} | |
| 219 | |
| 220 explicit StoreICState(LanguageMode mode) | |
| 221 : state_(LanguageModeState::encode(mode)) {} | |
| 222 | |
| 223 ExtraICState GetExtraICState() const { return state_; } | |
| 224 | |
| 225 LanguageMode language_mode() const { | |
| 226 return LanguageModeState::decode(state_); | |
| 227 } | |
| 228 | |
| 229 static LanguageMode GetLanguageMode(ExtraICState state) { | |
| 230 return StoreICState(state).language_mode(); | |
| 231 } | |
| 232 | |
| 233 class LanguageModeState : public BitField<LanguageMode, 1, 1> {}; | |
| 234 STATIC_ASSERT(i::LANGUAGE_END == 2); | |
| 235 | |
| 236 // For convenience, a statically declared encoding of strict mode extra | |
| 237 // IC state. | |
| 238 static const ExtraICState kStrictModeState = STRICT | |
| 239 << LanguageModeState::kShift; | |
| 240 | |
| 241 private: | |
| 242 const ExtraICState state_; | |
| 243 }; | |
| 244 | |
| 245 } // namespace internal | 215 } // namespace internal |
| 246 } // namespace v8 | 216 } // namespace v8 |
| 247 | 217 |
| 248 #endif // V8_IC_STATE_H_ | 218 #endif // V8_IC_STATE_H_ |
| OLD | NEW |