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 { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 int const bit_field_; | 53 int const bit_field_; |
54 }; | 54 }; |
55 | 55 |
56 | 56 |
57 std::ostream& operator<<(std::ostream& os, const CallICState& s); | 57 std::ostream& operator<<(std::ostream& os, const CallICState& s); |
58 | 58 |
59 | 59 |
60 class BinaryOpICState final BASE_EMBEDDED { | 60 class BinaryOpICState final BASE_EMBEDDED { |
61 public: | 61 public: |
62 BinaryOpICState(Isolate* isolate, ExtraICState extra_ic_state); | 62 BinaryOpICState(Isolate* isolate, ExtraICState extra_ic_state); |
63 BinaryOpICState(Isolate* isolate, Token::Value op, Strength strength) | 63 BinaryOpICState(Isolate* isolate, Token::Value op) |
64 : op_(op), | 64 : op_(op), |
65 strong_(is_strong(strength)), | |
66 left_kind_(NONE), | 65 left_kind_(NONE), |
67 right_kind_(NONE), | 66 right_kind_(NONE), |
68 result_kind_(NONE), | 67 result_kind_(NONE), |
69 fixed_right_arg_(Nothing<int>()), | 68 fixed_right_arg_(Nothing<int>()), |
70 isolate_(isolate) { | 69 isolate_(isolate) { |
71 DCHECK_LE(FIRST_TOKEN, op); | 70 DCHECK_LE(FIRST_TOKEN, op); |
72 DCHECK_LE(op, LAST_TOKEN); | 71 DCHECK_LE(op, LAST_TOKEN); |
73 } | 72 } |
74 | 73 |
75 InlineCacheState GetICState() const { | 74 InlineCacheState GetICState() const { |
(...skipping 26 matching lines...) Expand all Loading... |
102 | 101 |
103 // Returns true if the IC _should_ create allocation mementos. | 102 // Returns true if the IC _should_ create allocation mementos. |
104 bool ShouldCreateAllocationMementos() const { | 103 bool ShouldCreateAllocationMementos() const { |
105 return FLAG_allocation_site_pretenuring && CouldCreateAllocationMementos(); | 104 return FLAG_allocation_site_pretenuring && CouldCreateAllocationMementos(); |
106 } | 105 } |
107 | 106 |
108 bool HasSideEffects() const { | 107 bool HasSideEffects() const { |
109 return Max(left_kind_, right_kind_) == GENERIC; | 108 return Max(left_kind_, right_kind_) == GENERIC; |
110 } | 109 } |
111 | 110 |
112 Strength strength() const { | |
113 return strong_ ? Strength::STRONG : Strength::WEAK; | |
114 } | |
115 | |
116 // Returns true if the IC should enable the inline smi code (i.e. if either | 111 // Returns true if the IC should enable the inline smi code (i.e. if either |
117 // parameter may be a smi). | 112 // parameter may be a smi). |
118 bool UseInlinedSmiCode() const { | 113 bool UseInlinedSmiCode() const { |
119 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_); | 114 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_); |
120 } | 115 } |
121 | 116 |
122 static const int FIRST_TOKEN = Token::BIT_OR; | 117 static const int FIRST_TOKEN = Token::BIT_OR; |
123 static const int LAST_TOKEN = Token::MOD; | 118 static const int LAST_TOKEN = Token::MOD; |
124 | 119 |
125 Token::Value op() const { return op_; } | 120 Token::Value op() const { return op_; } |
(...skipping 18 matching lines...) Expand all Loading... |
144 static Type* KindToType(Kind kind); | 139 static Type* KindToType(Kind kind); |
145 static bool KindMaybeSmi(Kind kind) { | 140 static bool KindMaybeSmi(Kind kind) { |
146 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; | 141 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; |
147 } | 142 } |
148 | 143 |
149 // We truncate the last bit of the token. | 144 // We truncate the last bit of the token. |
150 STATIC_ASSERT(LAST_TOKEN - FIRST_TOKEN < (1 << 4)); | 145 STATIC_ASSERT(LAST_TOKEN - FIRST_TOKEN < (1 << 4)); |
151 class OpField : public BitField<int, 0, 4> {}; | 146 class OpField : public BitField<int, 0, 4> {}; |
152 class ResultKindField : public BitField<Kind, 4, 3> {}; | 147 class ResultKindField : public BitField<Kind, 4, 3> {}; |
153 class LeftKindField : public BitField<Kind, 7, 3> {}; | 148 class LeftKindField : public BitField<Kind, 7, 3> {}; |
154 class StrengthField : public BitField<bool, 10, 1> {}; | |
155 // When fixed right arg is set, we don't need to store the right kind. | 149 // When fixed right arg is set, we don't need to store the right kind. |
156 // Thus the two fields can overlap. | 150 // Thus the two fields can overlap. |
157 class HasFixedRightArgField : public BitField<bool, 11, 1> {}; | 151 class HasFixedRightArgField : public BitField<bool, 10, 1> {}; |
158 class FixedRightArgValueField : public BitField<int, 12, 4> {}; | 152 class FixedRightArgValueField : public BitField<int, 11, 4> {}; |
159 class RightKindField : public BitField<Kind, 12, 3> {}; | 153 class RightKindField : public BitField<Kind, 11, 3> {}; |
160 | 154 |
161 Token::Value op_; | 155 Token::Value op_; |
162 bool strong_; | |
163 Kind left_kind_; | 156 Kind left_kind_; |
164 Kind right_kind_; | 157 Kind right_kind_; |
165 Kind result_kind_; | 158 Kind result_kind_; |
166 Maybe<int> fixed_right_arg_; | 159 Maybe<int> fixed_right_arg_; |
167 Isolate* isolate_; | 160 Isolate* isolate_; |
168 }; | 161 }; |
169 | 162 |
170 | 163 |
171 std::ostream& operator<<(std::ostream& os, const BinaryOpICState& s); | 164 std::ostream& operator<<(std::ostream& os, const BinaryOpICState& s); |
172 | 165 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 << LanguageModeState::kShift; | 263 << LanguageModeState::kShift; |
271 | 264 |
272 private: | 265 private: |
273 const ExtraICState state_; | 266 const ExtraICState state_; |
274 }; | 267 }; |
275 | 268 |
276 } // namespace internal | 269 } // namespace internal |
277 } // namespace v8 | 270 } // namespace v8 |
278 | 271 |
279 #endif // V8_IC_STATE_H_ | 272 #endif // V8_IC_STATE_H_ |
OLD | NEW |