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 { | |
26 public: | |
27 explicit CallICState(ExtraICState extra_ic_state) | |
28 : bit_field_(extra_ic_state) {} | |
29 CallICState(ConvertReceiverMode convert_mode, TailCallMode tail_call_mode) | |
30 : bit_field_(ConvertModeBits::encode(convert_mode) | | |
31 TailCallModeBits::encode(tail_call_mode)) {} | |
32 | |
33 ExtraICState GetExtraICState() const { return bit_field_; } | |
34 | |
35 static void GenerateAheadOfTime(Isolate*, | |
36 void (*Generate)(Isolate*, | |
37 const CallICState&)); | |
38 | |
39 ConvertReceiverMode convert_mode() const { | |
40 return ConvertModeBits::decode(bit_field_); | |
41 } | |
42 TailCallMode tail_call_mode() const { | |
43 return TailCallModeBits::decode(bit_field_); | |
44 } | |
45 | |
46 private: | |
47 typedef BitField<ConvertReceiverMode, 0, 2> ConvertModeBits; | |
48 typedef BitField<TailCallMode, ConvertModeBits::kNext, 1> TailCallModeBits; | |
49 | |
50 int const bit_field_; | |
51 }; | |
52 | |
53 | |
54 std::ostream& operator<<(std::ostream& os, const CallICState& s); | |
55 | |
56 | |
57 class BinaryOpICState final BASE_EMBEDDED { | 25 class BinaryOpICState final BASE_EMBEDDED { |
58 public: | 26 public: |
59 BinaryOpICState(Isolate* isolate, ExtraICState extra_ic_state); | 27 BinaryOpICState(Isolate* isolate, ExtraICState extra_ic_state); |
60 BinaryOpICState(Isolate* isolate, Token::Value op) | 28 BinaryOpICState(Isolate* isolate, Token::Value op) |
61 : op_(op), | 29 : op_(op), |
62 left_kind_(NONE), | 30 left_kind_(NONE), |
63 right_kind_(NONE), | 31 right_kind_(NONE), |
64 result_kind_(NONE), | 32 result_kind_(NONE), |
65 fixed_right_arg_(Nothing<int>()), | 33 fixed_right_arg_(Nothing<int>()), |
66 isolate_(isolate) { | 34 isolate_(isolate) { |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 << LanguageModeState::kShift; | 239 << LanguageModeState::kShift; |
272 | 240 |
273 private: | 241 private: |
274 const ExtraICState state_; | 242 const ExtraICState state_; |
275 }; | 243 }; |
276 | 244 |
277 } // namespace internal | 245 } // namespace internal |
278 } // namespace v8 | 246 } // namespace v8 |
279 | 247 |
280 #endif // V8_IC_STATE_H_ | 248 #endif // V8_IC_STATE_H_ |
OLD | NEW |