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

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

Issue 1487973002: [turbofan] Add binary operation hints for javascript operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 bool UseInlinedSmiCode() const { 113 bool UseInlinedSmiCode() const {
114 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_); 114 return KindMaybeSmi(left_kind_) || KindMaybeSmi(right_kind_);
115 } 115 }
116 116
117 static const int FIRST_TOKEN = Token::BIT_OR; 117 static const int FIRST_TOKEN = Token::BIT_OR;
118 static const int LAST_TOKEN = Token::MOD; 118 static const int LAST_TOKEN = Token::MOD;
119 119
120 Token::Value op() const { return op_; } 120 Token::Value op() const { return op_; }
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(Zone* zone) const { return KindToType(left_kind_, zone); } 123 Type* GetLeftType() const { return KindToType(left_kind_); }
124 Type* GetRightType(Zone* zone) const { return KindToType(right_kind_, zone); } 124 Type* GetRightType() const { return KindToType(right_kind_); }
125 Type* GetResultType(Zone* zone) 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 private: 131 private:
132 friend std::ostream& operator<<(std::ostream& os, const BinaryOpICState& s); 132 friend std::ostream& operator<<(std::ostream& os, const BinaryOpICState& s);
133 133
134 enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC }; 134 enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC };
135 135
136 Kind UpdateKind(Handle<Object> object, Kind kind) const; 136 Kind UpdateKind(Handle<Object> object, Kind kind) const;
137 137
138 static const char* KindToString(Kind kind); 138 static const char* KindToString(Kind kind);
139 static Type* KindToType(Kind kind, Zone* zone); 139 static Type* KindToType(Kind kind);
140 static bool KindMaybeSmi(Kind kind) { 140 static bool KindMaybeSmi(Kind kind) {
141 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; 141 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC;
142 } 142 }
143 143
144 // We truncate the last bit of the token. 144 // We truncate the last bit of the token.
145 STATIC_ASSERT(LAST_TOKEN - FIRST_TOKEN < (1 << 4)); 145 STATIC_ASSERT(LAST_TOKEN - FIRST_TOKEN < (1 << 4));
146 class OpField : public BitField<int, 0, 4> {}; 146 class OpField : public BitField<int, 0, 4> {};
147 class ResultKindField : public BitField<Kind, 4, 3> {}; 147 class ResultKindField : public BitField<Kind, 4, 3> {};
148 class LeftKindField : public BitField<Kind, 7, 3> {}; 148 class LeftKindField : public BitField<Kind, 7, 3> {};
149 class StrengthField : public BitField<bool, 10, 1> {}; 149 class StrengthField : public BitField<bool, 10, 1> {};
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 << LanguageModeState::kShift; 265 << LanguageModeState::kShift;
266 266
267 private: 267 private:
268 const ExtraICState state_; 268 const ExtraICState state_;
269 }; 269 };
270 270
271 } // namespace internal 271 } // namespace internal
272 } // namespace v8 272 } // namespace v8
273 273
274 #endif // V8_IC_STATE_H_ 274 #endif // V8_IC_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698