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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 BinaryOpICState(Isolate* isolate, Token::Value op, LanguageMode language_mode) |
61 BinaryOpICState(Isolate* isolate, Token::Value op) | |
62 : op_(op), | 61 : op_(op), |
| 62 language_mode_(language_mode), |
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) { |
68 DCHECK_LE(FIRST_TOKEN, op); | 68 DCHECK_LE(FIRST_TOKEN, op); |
69 DCHECK_LE(op, LAST_TOKEN); | 69 DCHECK_LE(op, LAST_TOKEN); |
70 } | 70 } |
71 | 71 |
72 InlineCacheState GetICState() const { | 72 InlineCacheState GetICState() const { |
(...skipping 26 matching lines...) Expand all Loading... |
99 | 99 |
100 // Returns true if the IC _should_ create allocation mementos. | 100 // Returns true if the IC _should_ create allocation mementos. |
101 bool ShouldCreateAllocationMementos() const { | 101 bool ShouldCreateAllocationMementos() const { |
102 return FLAG_allocation_site_pretenuring && CouldCreateAllocationMementos(); | 102 return FLAG_allocation_site_pretenuring && CouldCreateAllocationMementos(); |
103 } | 103 } |
104 | 104 |
105 bool HasSideEffects() const { | 105 bool HasSideEffects() const { |
106 return Max(left_kind_, right_kind_) == GENERIC; | 106 return Max(left_kind_, right_kind_) == GENERIC; |
107 } | 107 } |
108 | 108 |
| 109 LanguageMode language_mode() const { |
| 110 return language_mode_; |
| 111 } |
| 112 |
109 // Returns true if the IC should enable the inline smi code (i.e. if either | 113 // Returns true if the IC should enable the inline smi code (i.e. if either |
110 // parameter may be a smi). | 114 // parameter may be a smi). |
111 bool UseInlinedSmiCode() const { | 115 bool UseInlinedSmiCode() const { |
112 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_); | 116 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_); |
113 } | 117 } |
114 | 118 |
115 static const int FIRST_TOKEN = Token::BIT_OR; | 119 static const int FIRST_TOKEN = Token::BIT_OR; |
116 static const int LAST_TOKEN = Token::MOD; | 120 static const int LAST_TOKEN = Token::MOD; |
117 | 121 |
118 Token::Value op() const { return op_; } | 122 Token::Value op() const { return op_; } |
(...skipping 21 matching lines...) Expand all Loading... |
140 } | 144 } |
141 | 145 |
142 // We truncate the last bit of the token. | 146 // We truncate the last bit of the token. |
143 STATIC_ASSERT(LAST_TOKEN - FIRST_TOKEN < (1 << 4)); | 147 STATIC_ASSERT(LAST_TOKEN - FIRST_TOKEN < (1 << 4)); |
144 class OpField : public BitField<int, 0, 4> {}; | 148 class OpField : public BitField<int, 0, 4> {}; |
145 class ResultKindField : public BitField<Kind, 4, 3> {}; | 149 class ResultKindField : public BitField<Kind, 4, 3> {}; |
146 class LeftKindField : public BitField<Kind, 7, 3> {}; | 150 class LeftKindField : public BitField<Kind, 7, 3> {}; |
147 // When fixed right arg is set, we don't need to store the right kind. | 151 // When fixed right arg is set, we don't need to store the right kind. |
148 // Thus the two fields can overlap. | 152 // Thus the two fields can overlap. |
149 class HasFixedRightArgField : public BitField<bool, 10, 1> {}; | 153 class HasFixedRightArgField : public BitField<bool, 10, 1> {}; |
150 class FixedRightArgValueField : public BitField<int, 11, 4> {}; | 154 class LanguageModeField : public BitField<LanguageMode, 11, 2> {}; |
151 class RightKindField : public BitField<Kind, 11, 3> {}; | 155 class FixedRightArgValueField : public BitField<int, 13, 4> {}; |
| 156 class RightKindField : public BitField<Kind, 13, 3> {}; |
152 | 157 |
153 Token::Value op_; | 158 Token::Value op_; |
| 159 LanguageMode language_mode_; |
154 Kind left_kind_; | 160 Kind left_kind_; |
155 Kind right_kind_; | 161 Kind right_kind_; |
156 Kind result_kind_; | 162 Kind result_kind_; |
157 Maybe<int> fixed_right_arg_; | 163 Maybe<int> fixed_right_arg_; |
158 Isolate* isolate_; | 164 Isolate* isolate_; |
159 }; | 165 }; |
160 | 166 |
161 | 167 |
162 std::ostream& operator<<(std::ostream& os, const BinaryOpICState& s); | 168 std::ostream& operator<<(std::ostream& os, const BinaryOpICState& s); |
163 | 169 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 private: | 221 private: |
216 class ContextualModeBits : public BitField<ContextualMode, 0, 1> {}; | 222 class ContextualModeBits : public BitField<ContextualMode, 0, 1> {}; |
217 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); | 223 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); |
218 | 224 |
219 const ExtraICState state_; | 225 const ExtraICState state_; |
220 }; | 226 }; |
221 } | 227 } |
222 } | 228 } |
223 | 229 |
224 #endif // V8_IC_STATE_H_ | 230 #endif // V8_IC_STATE_H_ |
OLD | NEW |