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, | 20 static void Clear(Isolate* isolate, Address address, |
21 ConstantPoolArray* constant_pool); | 21 ConstantPoolArray* 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 | 28 |
29 enum CallType { METHOD, FUNCTION }; | 29 enum CallType { METHOD, FUNCTION }; |
30 | 30 |
31 CallICState(int argc, CallType call_type) | 31 CallICState(int argc, CallType call_type) |
32 : argc_(argc), call_type_(call_type) {} | 32 : argc_(argc), call_type_(call_type) {} |
33 | 33 |
34 ExtraICState GetExtraICState() const; | 34 ExtraICState GetExtraICState() const; |
35 | 35 |
(...skipping 11 matching lines...) Expand all Loading... |
47 class CallTypeBits : public BitField<CallType, Code::kArgumentsBits, 1> {}; | 47 class CallTypeBits : public BitField<CallType, Code::kArgumentsBits, 1> {}; |
48 | 48 |
49 const int argc_; | 49 const int argc_; |
50 const CallType call_type_; | 50 const CallType call_type_; |
51 }; | 51 }; |
52 | 52 |
53 | 53 |
54 std::ostream& operator<<(std::ostream& os, const CallICState& s); | 54 std::ostream& operator<<(std::ostream& os, const CallICState& s); |
55 | 55 |
56 | 56 |
57 class BinaryOpICState FINAL BASE_EMBEDDED { | 57 class BinaryOpICState final BASE_EMBEDDED { |
58 public: | 58 public: |
59 BinaryOpICState(Isolate* isolate, ExtraICState extra_ic_state); | 59 BinaryOpICState(Isolate* isolate, ExtraICState extra_ic_state); |
60 | 60 |
61 BinaryOpICState(Isolate* isolate, Token::Value op) | 61 BinaryOpICState(Isolate* isolate, Token::Value op) |
62 : op_(op), | 62 : op_(op), |
63 left_kind_(NONE), | 63 left_kind_(NONE), |
64 right_kind_(NONE), | 64 right_kind_(NONE), |
65 result_kind_(NONE), | 65 result_kind_(NONE), |
66 fixed_right_arg_(Nothing<int>()), | 66 fixed_right_arg_(Nothing<int>()), |
67 isolate_(isolate) { | 67 isolate_(isolate) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 static State NewInputState(State old_state, Handle<Object> value); | 188 static State NewInputState(State old_state, Handle<Object> value); |
189 | 189 |
190 static const char* GetStateName(CompareICState::State state); | 190 static const char* GetStateName(CompareICState::State state); |
191 | 191 |
192 static State TargetState(State old_state, State old_left, State old_right, | 192 static State TargetState(State old_state, State old_left, State old_right, |
193 Token::Value op, bool has_inlined_smi_code, | 193 Token::Value op, bool has_inlined_smi_code, |
194 Handle<Object> x, Handle<Object> y); | 194 Handle<Object> x, Handle<Object> y); |
195 }; | 195 }; |
196 | 196 |
197 | 197 |
198 class LoadICState FINAL BASE_EMBEDDED { | 198 class LoadICState final BASE_EMBEDDED { |
199 public: | 199 public: |
200 explicit LoadICState(ExtraICState extra_ic_state) : state_(extra_ic_state) {} | 200 explicit LoadICState(ExtraICState extra_ic_state) : state_(extra_ic_state) {} |
201 | 201 |
202 explicit LoadICState(ContextualMode mode) | 202 explicit LoadICState(ContextualMode mode) |
203 : state_(ContextualModeBits::encode(mode)) {} | 203 : state_(ContextualModeBits::encode(mode)) {} |
204 | 204 |
205 ExtraICState GetExtraICState() const { return state_; } | 205 ExtraICState GetExtraICState() const { return state_; } |
206 | 206 |
207 ContextualMode contextual_mode() const { | 207 ContextualMode contextual_mode() const { |
208 return ContextualModeBits::decode(state_); | 208 return ContextualModeBits::decode(state_); |
209 } | 209 } |
210 | 210 |
211 static ContextualMode GetContextualMode(ExtraICState state) { | 211 static ContextualMode GetContextualMode(ExtraICState state) { |
212 return LoadICState(state).contextual_mode(); | 212 return LoadICState(state).contextual_mode(); |
213 } | 213 } |
214 | 214 |
215 private: | 215 private: |
216 class ContextualModeBits : public BitField<ContextualMode, 0, 1> {}; | 216 class ContextualModeBits : public BitField<ContextualMode, 0, 1> {}; |
217 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); | 217 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); |
218 | 218 |
219 const ExtraICState state_; | 219 const ExtraICState state_; |
220 }; | 220 }; |
221 } | 221 } |
222 } | 222 } |
223 | 223 |
224 #endif // V8_IC_STATE_H_ | 224 #endif // V8_IC_STATE_H_ |
OLD | NEW |