Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/ic/ic-state.h

Issue 1144183004: [strong] Refactor ObjectStrength into a replacement for strong boolean args (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cl feedback and rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ic/ic.cc ('k') | src/ic/ic-state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 const CallType call_type_; 49 const CallType call_type_;
50 }; 50 };
51 51
52 52
53 std::ostream& operator<<(std::ostream& os, const CallICState& s); 53 std::ostream& operator<<(std::ostream& os, const CallICState& s);
54 54
55 55
56 class BinaryOpICState final BASE_EMBEDDED { 56 class BinaryOpICState final BASE_EMBEDDED {
57 public: 57 public:
58 BinaryOpICState(Isolate* isolate, ExtraICState extra_ic_state); 58 BinaryOpICState(Isolate* isolate, ExtraICState extra_ic_state);
59 BinaryOpICState(Isolate* isolate, Token::Value op, LanguageMode language_mode) 59 BinaryOpICState(Isolate* isolate, Token::Value op, Strength strength)
60 : op_(op), 60 : op_(op),
61 strong_(is_strong(language_mode)), 61 strong_(is_strong(strength)),
62 left_kind_(NONE), 62 left_kind_(NONE),
63 right_kind_(NONE), 63 right_kind_(NONE),
64 result_kind_(NONE), 64 result_kind_(NONE),
65 fixed_right_arg_(Nothing<int>()), 65 fixed_right_arg_(Nothing<int>()),
66 isolate_(isolate) { 66 isolate_(isolate) {
67 DCHECK_LE(FIRST_TOKEN, op); 67 DCHECK_LE(FIRST_TOKEN, op);
68 DCHECK_LE(op, LAST_TOKEN); 68 DCHECK_LE(op, LAST_TOKEN);
69 } 69 }
70 70
71 InlineCacheState GetICState() const { 71 InlineCacheState GetICState() const {
(...skipping 26 matching lines...) Expand all
98 98
99 // Returns true if the IC _should_ create allocation mementos. 99 // Returns true if the IC _should_ create allocation mementos.
100 bool ShouldCreateAllocationMementos() const { 100 bool ShouldCreateAllocationMementos() const {
101 return FLAG_allocation_site_pretenuring && CouldCreateAllocationMementos(); 101 return FLAG_allocation_site_pretenuring && CouldCreateAllocationMementos();
102 } 102 }
103 103
104 bool HasSideEffects() const { 104 bool HasSideEffects() const {
105 return Max(left_kind_, right_kind_) == GENERIC; 105 return Max(left_kind_, right_kind_) == GENERIC;
106 } 106 }
107 107
108 LanguageMode language_mode() const { 108 Strength strength() const {
109 return strong_ ? LanguageMode::STRONG : LanguageMode::SLOPPY; 109 return strong_ ? Strength::STRONG : Strength::WEAK;
110 } 110 }
111 111
112 // Returns true if the IC should enable the inline smi code (i.e. if either 112 // Returns true if the IC should enable the inline smi code (i.e. if either
113 // parameter may be a smi). 113 // parameter may be a smi).
114 bool UseInlinedSmiCode() const { 114 bool UseInlinedSmiCode() const {
115 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_); 115 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_);
116 } 116 }
117 117
118 static const int FIRST_TOKEN = Token::BIT_OR; 118 static const int FIRST_TOKEN = Token::BIT_OR;
119 static const int LAST_TOKEN = Token::MOD; 119 static const int LAST_TOKEN = Token::MOD;
(...skipping 20 matching lines...) Expand all
140 static Type* KindToType(Kind kind, Zone* zone); 140 static Type* KindToType(Kind kind, Zone* zone);
141 static bool KindMaybeSmi(Kind kind) { 141 static bool KindMaybeSmi(Kind kind) {
142 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; 142 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC;
143 } 143 }
144 144
145 // We truncate the last bit of the token. 145 // We truncate the last bit of the token.
146 STATIC_ASSERT(LAST_TOKEN - FIRST_TOKEN < (1 << 4)); 146 STATIC_ASSERT(LAST_TOKEN - FIRST_TOKEN < (1 << 4));
147 class OpField : public BitField<int, 0, 4> {}; 147 class OpField : public BitField<int, 0, 4> {};
148 class ResultKindField : public BitField<Kind, 4, 3> {}; 148 class ResultKindField : public BitField<Kind, 4, 3> {};
149 class LeftKindField : public BitField<Kind, 7, 3> {}; 149 class LeftKindField : public BitField<Kind, 7, 3> {};
150 class StrongField : public BitField<bool, 10, 1> {}; 150 class StrengthField : public BitField<bool, 10, 1> {};
151 // 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.
152 // Thus the two fields can overlap. 152 // Thus the two fields can overlap.
153 class HasFixedRightArgField : public BitField<bool, 11, 1> {}; 153 class HasFixedRightArgField : public BitField<bool, 11, 1> {};
154 class FixedRightArgValueField : public BitField<int, 12, 4> {}; 154 class FixedRightArgValueField : public BitField<int, 12, 4> {};
155 class RightKindField : public BitField<Kind, 12, 3> {}; 155 class RightKindField : public BitField<Kind, 12, 3> {};
156 156
157 Token::Value op_; 157 Token::Value op_;
158 bool strong_; 158 bool strong_;
159 Kind left_kind_; 159 Kind left_kind_;
160 Kind right_kind_; 160 Kind right_kind_;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 static const ExtraICState kStrictModeState = STRICT 250 static const ExtraICState kStrictModeState = STRICT
251 << LanguageModeState::kShift; 251 << LanguageModeState::kShift;
252 252
253 private: 253 private:
254 const ExtraICState state_; 254 const ExtraICState state_;
255 }; 255 };
256 } 256 }
257 } 257 }
258 258
259 #endif // V8_IC_STATE_H_ 259 #endif // V8_IC_STATE_H_
OLDNEW
« no previous file with comments | « src/ic/ic.cc ('k') | src/ic/ic-state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698