| 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(ExtraICState extra_ic_state) | 26 explicit CallICState(ExtraICState extra_ic_state) |
| 27 : bit_field_(extra_ic_state) {} | 27 : bit_field_(extra_ic_state) {} |
| 28 CallICState(int argc, ConvertReceiverMode convert_mode, | 28 CallICState(int argc, ConvertReceiverMode convert_mode, |
| 29 TailCallMode tail_call_mode, bool is_argc_in_reg = false) | 29 TailCallMode tail_call_mode) |
| 30 : bit_field_(ArgcBits::encode(argc) | | 30 : bit_field_(ArgcBits::encode(argc) | |
| 31 ConvertModeBits::encode(convert_mode) | | 31 ConvertModeBits::encode(convert_mode) | |
| 32 TailCallModeBits::encode(tail_call_mode) | | 32 TailCallModeBits::encode(tail_call_mode)) {} |
| 33 ArgcInRegBits::encode(is_argc_in_reg)) {} | |
| 34 | 33 |
| 35 ExtraICState GetExtraICState() const { return bit_field_; } | 34 ExtraICState GetExtraICState() const { return bit_field_; } |
| 36 | 35 |
| 37 static void GenerateAheadOfTime(Isolate*, | 36 static void GenerateAheadOfTime(Isolate*, |
| 38 void (*Generate)(Isolate*, | 37 void (*Generate)(Isolate*, |
| 39 const CallICState&)); | 38 const CallICState&)); |
| 40 | 39 |
| 41 int argc() const { return ArgcBits::decode(bit_field_); } | 40 int argc() const { return ArgcBits::decode(bit_field_); } |
| 42 ConvertReceiverMode convert_mode() const { | 41 ConvertReceiverMode convert_mode() const { |
| 43 return ConvertModeBits::decode(bit_field_); | 42 return ConvertModeBits::decode(bit_field_); |
| 44 } | 43 } |
| 45 TailCallMode tail_call_mode() const { | 44 TailCallMode tail_call_mode() const { |
| 46 return TailCallModeBits::decode(bit_field_); | 45 return TailCallModeBits::decode(bit_field_); |
| 47 } | 46 } |
| 48 bool argc_in_register() { return ArgcInRegBits::decode(bit_field_); } | |
| 49 | 47 |
| 50 private: | 48 private: |
| 51 typedef BitField<int, 0, Code::kArgumentsBits> ArgcBits; | 49 typedef BitField<int, 0, Code::kArgumentsBits> ArgcBits; |
| 52 typedef BitField<ConvertReceiverMode, ArgcBits::kNext, 2> ConvertModeBits; | 50 typedef BitField<ConvertReceiverMode, ArgcBits::kNext, 2> ConvertModeBits; |
| 53 typedef BitField<TailCallMode, ConvertModeBits::kNext, 1> TailCallModeBits; | 51 typedef BitField<TailCallMode, ConvertModeBits::kNext, 1> TailCallModeBits; |
| 54 typedef BitField<bool, TailCallModeBits::kNext, 1> ArgcInRegBits; | |
| 55 | 52 |
| 56 int const bit_field_; | 53 int const bit_field_; |
| 57 }; | 54 }; |
| 58 | 55 |
| 59 | 56 |
| 60 std::ostream& operator<<(std::ostream& os, const CallICState& s); | 57 std::ostream& operator<<(std::ostream& os, const CallICState& s); |
| 61 | 58 |
| 62 | 59 |
| 63 class BinaryOpICState final BASE_EMBEDDED { | 60 class BinaryOpICState final BASE_EMBEDDED { |
| 64 public: | 61 public: |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 << LanguageModeState::kShift; | 249 << LanguageModeState::kShift; |
| 253 | 250 |
| 254 private: | 251 private: |
| 255 const ExtraICState state_; | 252 const ExtraICState state_; |
| 256 }; | 253 }; |
| 257 | 254 |
| 258 } // namespace internal | 255 } // namespace internal |
| 259 } // namespace v8 | 256 } // namespace v8 |
| 260 | 257 |
| 261 #endif // V8_IC_STATE_H_ | 258 #endif // V8_IC_STATE_H_ |
| OLD | NEW |