| 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 BinaryOpICState(Isolate* isolate, Token::Value op, LanguageMode language_mode) | 60 BinaryOpICState(Isolate* isolate, Token::Value op, Strength strength) |
| 61 : op_(op), | 61 : op_(op), |
| 62 strong_(is_strong(language_mode)), | 62 strong_(is_strong(strength)), |
| 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 { | 109 Strength strength() const { |
| 110 return strong_ ? LanguageMode::STRONG : LanguageMode::SLOPPY; | 110 return strong_ ? Strength::FIRM : Strength::WEAK; |
| 111 } | 111 } |
| 112 | 112 |
| 113 // 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 |
| 114 // parameter may be a smi). | 114 // parameter may be a smi). |
| 115 bool UseInlinedSmiCode() const { | 115 bool UseInlinedSmiCode() const { |
| 116 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_); | 116 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_); |
| 117 } | 117 } |
| 118 | 118 |
| 119 static const int FIRST_TOKEN = Token::BIT_OR; | 119 static const int FIRST_TOKEN = Token::BIT_OR; |
| 120 static const int LAST_TOKEN = Token::MOD; | 120 static const int LAST_TOKEN = Token::MOD; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 141 static Type* KindToType(Kind kind, Zone* zone); | 141 static Type* KindToType(Kind kind, Zone* zone); |
| 142 static bool KindMaybeSmi(Kind kind) { | 142 static bool KindMaybeSmi(Kind kind) { |
| 143 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; | 143 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; |
| 144 } | 144 } |
| 145 | 145 |
| 146 // We truncate the last bit of the token. | 146 // We truncate the last bit of the token. |
| 147 STATIC_ASSERT(LAST_TOKEN - FIRST_TOKEN < (1 << 4)); | 147 STATIC_ASSERT(LAST_TOKEN - FIRST_TOKEN < (1 << 4)); |
| 148 class OpField : public BitField<int, 0, 4> {}; | 148 class OpField : public BitField<int, 0, 4> {}; |
| 149 class ResultKindField : public BitField<Kind, 4, 3> {}; | 149 class ResultKindField : public BitField<Kind, 4, 3> {}; |
| 150 class LeftKindField : public BitField<Kind, 7, 3> {}; | 150 class LeftKindField : public BitField<Kind, 7, 3> {}; |
| 151 class StrongField : public BitField<bool, 10, 1> {}; | 151 class StrengthField : public BitField<bool, 10, 1> {}; |
| 152 // When fixed right arg is set, we don't need to store the right kind. | 152 // When fixed right arg is set, we don't need to store the right kind. |
| 153 // Thus the two fields can overlap. | 153 // Thus the two fields can overlap. |
| 154 class HasFixedRightArgField : public BitField<bool, 11, 1> {}; | 154 class HasFixedRightArgField : public BitField<bool, 11, 1> {}; |
| 155 class FixedRightArgValueField : public BitField<int, 12, 4> {}; | 155 class FixedRightArgValueField : public BitField<int, 12, 4> {}; |
| 156 class RightKindField : public BitField<Kind, 12, 3> {}; | 156 class RightKindField : public BitField<Kind, 12, 3> {}; |
| 157 | 157 |
| 158 Token::Value op_; | 158 Token::Value op_; |
| 159 bool strong_; | 159 bool strong_; |
| 160 Kind left_kind_; | 160 Kind left_kind_; |
| 161 Kind right_kind_; | 161 Kind right_kind_; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 static const ExtraICState kStrictModeState = STRICT | 251 static const ExtraICState kStrictModeState = STRICT |
| 252 << LanguageModeState::kShift; | 252 << LanguageModeState::kShift; |
| 253 | 253 |
| 254 private: | 254 private: |
| 255 const ExtraICState state_; | 255 const ExtraICState state_; |
| 256 }; | 256 }; |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 | 259 |
| 260 #endif // V8_IC_STATE_H_ | 260 #endif // V8_IC_STATE_H_ |
| OLD | NEW |