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

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

Issue 2228983002: [turbofan] Simplify BinaryOperationHints and CompareOperationHints. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compile for realz Created 4 years, 4 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/compiler/type-hints.cc ('k') | test/cctest/compiler/test-js-typed-lowering.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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } 121 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; }
122 122
123 Type* GetLeftType() const { return KindToType(left_kind_); } 123 Type* GetLeftType() const { return KindToType(left_kind_); }
124 Type* GetRightType() const { return KindToType(right_kind_); } 124 Type* GetRightType() const { return KindToType(right_kind_); }
125 Type* GetResultType() const; 125 Type* GetResultType() const;
126 126
127 void Update(Handle<Object> left, Handle<Object> right, Handle<Object> result); 127 void Update(Handle<Object> left, Handle<Object> right, Handle<Object> result);
128 128
129 Isolate* isolate() const { return isolate_; } 129 Isolate* isolate() const { return isolate_; }
130 130
131 enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC };
132 Kind kind() const {
133 return KindGeneralize(KindGeneralize(left_kind_, right_kind_),
134 result_kind_);
135 }
136
131 private: 137 private:
132 friend std::ostream& operator<<(std::ostream& os, const BinaryOpICState& s); 138 friend std::ostream& operator<<(std::ostream& os, const BinaryOpICState& s);
133 139
134 enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC };
135
136 Kind UpdateKind(Handle<Object> object, Kind kind) const; 140 Kind UpdateKind(Handle<Object> object, Kind kind) const;
137 141
138 static const char* KindToString(Kind kind); 142 static const char* KindToString(Kind kind);
139 static Type* KindToType(Kind kind); 143 static Type* KindToType(Kind kind);
140 static bool KindMaybeSmi(Kind kind) { 144 static bool KindMaybeSmi(Kind kind) {
141 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; 145 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC;
142 } 146 }
147 static bool KindLessGeneralThan(Kind kind1, Kind kind2) {
148 if (kind1 == NONE) return true;
149 if (kind1 == kind2) return true;
150 if (kind2 == GENERIC) return true;
151 if (kind2 == STRING) return false;
152 return kind1 <= kind2;
153 }
154 static Kind KindGeneralize(Kind kind1, Kind kind2) {
155 if (KindLessGeneralThan(kind1, kind2)) return kind2;
156 if (KindLessGeneralThan(kind2, kind1)) return kind1;
157 return GENERIC;
158 }
143 159
144 // We truncate the last bit of the token. 160 // We truncate the last bit of the token.
145 STATIC_ASSERT(LAST_TOKEN - FIRST_TOKEN < (1 << 4)); 161 STATIC_ASSERT(LAST_TOKEN - FIRST_TOKEN < (1 << 4));
146 class OpField : public BitField<int, 0, 4> {}; 162 class OpField : public BitField<int, 0, 4> {};
147 class ResultKindField : public BitField<Kind, 4, 3> {}; 163 class ResultKindField : public BitField<Kind, 4, 3> {};
148 class LeftKindField : public BitField<Kind, 7, 3> {}; 164 class LeftKindField : public BitField<Kind, 7, 3> {};
149 // When fixed right arg is set, we don't need to store the right kind. 165 // When fixed right arg is set, we don't need to store the right kind.
150 // Thus the two fields can overlap. 166 // Thus the two fields can overlap.
151 class HasFixedRightArgField : public BitField<bool, 10, 1> {}; 167 class HasFixedRightArgField : public BitField<bool, 10, 1> {};
152 class FixedRightArgValueField : public BitField<int, 11, 4> {}; 168 class FixedRightArgValueField : public BitField<int, 11, 4> {};
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 << LanguageModeState::kShift; 266 << LanguageModeState::kShift;
251 267
252 private: 268 private:
253 const ExtraICState state_; 269 const ExtraICState state_;
254 }; 270 };
255 271
256 } // namespace internal 272 } // namespace internal
257 } // namespace v8 273 } // namespace v8
258 274
259 #endif // V8_IC_STATE_H_ 275 #endif // V8_IC_STATE_H_
OLDNEW
« no previous file with comments | « src/compiler/type-hints.cc ('k') | test/cctest/compiler/test-js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698