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