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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 private: | 45 private: |
46 class ArgcBits : public BitField<int, 0, Code::kArgumentsBits> {}; | 46 class ArgcBits : public BitField<int, 0, Code::kArgumentsBits> {}; |
47 class CallTypeBits : public BitField<CallType, Code::kArgumentsBits, 1> {}; | 47 class CallTypeBits : public BitField<CallType, Code::kArgumentsBits, 1> {}; |
48 | 48 |
49 const int argc_; | 49 const int argc_; |
50 const CallType call_type_; | 50 const CallType call_type_; |
51 }; | 51 }; |
52 | 52 |
53 | 53 |
54 OStream& operator<<(OStream& os, const CallICState& s); | 54 std::ostream& operator<<(std::ostream& os, const CallICState& s); |
55 | 55 |
56 | 56 |
57 // Mode to overwrite BinaryExpression values. | 57 // Mode to overwrite BinaryExpression values. |
58 enum OverwriteMode { NO_OVERWRITE, OVERWRITE_LEFT, OVERWRITE_RIGHT }; | 58 enum OverwriteMode { NO_OVERWRITE, OVERWRITE_LEFT, OVERWRITE_RIGHT }; |
59 | 59 |
60 class BinaryOpICState FINAL BASE_EMBEDDED { | 60 class BinaryOpICState FINAL BASE_EMBEDDED { |
61 public: | 61 public: |
62 BinaryOpICState(Isolate* isolate, ExtraICState extra_ic_state); | 62 BinaryOpICState(Isolate* isolate, ExtraICState extra_ic_state); |
63 | 63 |
64 BinaryOpICState(Isolate* isolate, Token::Value op, OverwriteMode mode) | 64 BinaryOpICState(Isolate* isolate, Token::Value op, OverwriteMode mode) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 Type* GetLeftType(Zone* zone) const { return KindToType(left_kind_, zone); } | 133 Type* GetLeftType(Zone* zone) const { return KindToType(left_kind_, zone); } |
134 Type* GetRightType(Zone* zone) const { return KindToType(right_kind_, zone); } | 134 Type* GetRightType(Zone* zone) const { return KindToType(right_kind_, zone); } |
135 Type* GetResultType(Zone* zone) const; | 135 Type* GetResultType(Zone* zone) const; |
136 | 136 |
137 void Update(Handle<Object> left, Handle<Object> right, Handle<Object> result); | 137 void Update(Handle<Object> left, Handle<Object> right, Handle<Object> result); |
138 | 138 |
139 Isolate* isolate() const { return isolate_; } | 139 Isolate* isolate() const { return isolate_; } |
140 | 140 |
141 private: | 141 private: |
142 friend OStream& operator<<(OStream& os, const BinaryOpICState& s); | 142 friend std::ostream& operator<<(std::ostream& os, const BinaryOpICState& s); |
143 | 143 |
144 enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC }; | 144 enum Kind { NONE, SMI, INT32, NUMBER, STRING, GENERIC }; |
145 | 145 |
146 Kind UpdateKind(Handle<Object> object, Kind kind) const; | 146 Kind UpdateKind(Handle<Object> object, Kind kind) const; |
147 | 147 |
148 static const char* KindToString(Kind kind); | 148 static const char* KindToString(Kind kind); |
149 static Type* KindToType(Kind kind, Zone* zone); | 149 static Type* KindToType(Kind kind, Zone* zone); |
150 static bool KindMaybeSmi(Kind kind) { | 150 static bool KindMaybeSmi(Kind kind) { |
151 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; | 151 return (kind >= SMI && kind <= NUMBER) || kind == GENERIC; |
152 } | 152 } |
(...skipping 13 matching lines...) Expand all Loading... |
166 Token::Value op_; | 166 Token::Value op_; |
167 OverwriteMode mode_; | 167 OverwriteMode mode_; |
168 Kind left_kind_; | 168 Kind left_kind_; |
169 Kind right_kind_; | 169 Kind right_kind_; |
170 Kind result_kind_; | 170 Kind result_kind_; |
171 Maybe<int> fixed_right_arg_; | 171 Maybe<int> fixed_right_arg_; |
172 Isolate* isolate_; | 172 Isolate* isolate_; |
173 }; | 173 }; |
174 | 174 |
175 | 175 |
176 OStream& operator<<(OStream& os, const BinaryOpICState& s); | 176 std::ostream& operator<<(std::ostream& os, const BinaryOpICState& s); |
177 | 177 |
178 | 178 |
179 class CompareICState { | 179 class CompareICState { |
180 public: | 180 public: |
181 // The type/state lattice is defined by the following inequations: | 181 // The type/state lattice is defined by the following inequations: |
182 // UNINITIALIZED < ... | 182 // UNINITIALIZED < ... |
183 // ... < GENERIC | 183 // ... < GENERIC |
184 // SMI < NUMBER | 184 // SMI < NUMBER |
185 // INTERNALIZED_STRING < STRING | 185 // INTERNALIZED_STRING < STRING |
186 // KNOWN_OBJECT < OBJECT | 186 // KNOWN_OBJECT < OBJECT |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 private: | 229 private: |
230 class ContextualModeBits : public BitField<ContextualMode, 0, 1> {}; | 230 class ContextualModeBits : public BitField<ContextualMode, 0, 1> {}; |
231 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); | 231 STATIC_ASSERT(static_cast<int>(NOT_CONTEXTUAL) == 0); |
232 | 232 |
233 const ExtraICState state_; | 233 const ExtraICState state_; |
234 }; | 234 }; |
235 } | 235 } |
236 } | 236 } |
237 | 237 |
238 #endif // V8_IC_STATE_H_ | 238 #endif // V8_IC_STATE_H_ |
OLD | NEW |