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