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