| 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 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 | 12 |
| 13 | 13 |
| 14 const int kMaxKeyedPolymorphism = 4; | 14 const int kMaxKeyedPolymorphism = 4; |
| 15 | 15 |
| 16 | 16 |
| 17 class ICUtility : public AllStatic { | 17 class ICUtility : public AllStatic { |
| 18 public: | 18 public: |
| 19 // Clear the inline cache to initial state. | 19 // Clear the inline cache to initial state. |
| 20 static void Clear(Isolate* isolate, Address address, Address constant_pool); | 20 static void Clear(Isolate* isolate, Address address, Address constant_pool); |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 | 23 |
| 24 class CallICState final BASE_EMBEDDED { | 24 class CallICState final BASE_EMBEDDED { |
| 25 public: | 25 public: |
| 26 explicit CallICState(int argc) : argc_(argc) {} | 26 explicit CallICState(ExtraICState extra_ic_state) |
| 27 : bit_field_(extra_ic_state) {} |
| 28 CallICState(int argc, ConvertReceiverMode convert_mode) |
| 29 : bit_field_(ArgcBits::encode(argc) | |
| 30 ConvertModeBits::encode(convert_mode)) {} |
| 27 | 31 |
| 28 ExtraICState GetExtraICState() const; | 32 ExtraICState GetExtraICState() const { return bit_field_; } |
| 29 | 33 |
| 30 static void GenerateAheadOfTime(Isolate*, | 34 static void GenerateAheadOfTime(Isolate*, |
| 31 void (*Generate)(Isolate*, | 35 void (*Generate)(Isolate*, |
| 32 const CallICState&)); | 36 const CallICState&)); |
| 33 | 37 |
| 34 int arg_count() const { return argc_; } | 38 int argc() const { return ArgcBits::decode(bit_field_); } |
| 39 ConvertReceiverMode convert_mode() const { |
| 40 return ConvertModeBits::decode(bit_field_); |
| 41 } |
| 35 | 42 |
| 36 private: | 43 private: |
| 37 class ArgcBits : public BitField<int, 0, Code::kArgumentsBits> {}; | 44 typedef BitField<int, 0, Code::kArgumentsBits> ArgcBits; |
| 45 typedef BitField<ConvertReceiverMode, Code::kArgumentsBits, 2> |
| 46 ConvertModeBits; |
| 38 | 47 |
| 39 const int argc_; | 48 int const bit_field_; |
| 40 }; | 49 }; |
| 41 | 50 |
| 42 | 51 |
| 43 std::ostream& operator<<(std::ostream& os, const CallICState& s); | 52 std::ostream& operator<<(std::ostream& os, const CallICState& s); |
| 44 | 53 |
| 45 | 54 |
| 46 class BinaryOpICState final BASE_EMBEDDED { | 55 class BinaryOpICState final BASE_EMBEDDED { |
| 47 public: | 56 public: |
| 48 BinaryOpICState(Isolate* isolate, ExtraICState extra_ic_state); | 57 BinaryOpICState(Isolate* isolate, ExtraICState extra_ic_state); |
| 49 BinaryOpICState(Isolate* isolate, Token::Value op, Strength strength) | 58 BinaryOpICState(Isolate* isolate, Token::Value op, Strength strength) |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 << LanguageModeState::kShift; | 265 << LanguageModeState::kShift; |
| 257 | 266 |
| 258 private: | 267 private: |
| 259 const ExtraICState state_; | 268 const ExtraICState state_; |
| 260 }; | 269 }; |
| 261 | 270 |
| 262 } // namespace internal | 271 } // namespace internal |
| 263 } // namespace v8 | 272 } // namespace v8 |
| 264 | 273 |
| 265 #endif // V8_IC_STATE_H_ | 274 #endif // V8_IC_STATE_H_ |
| OLD | NEW |