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

Side by Side Diff: src/type-info.h

Issue 16361015: Migrate Compare ICs to new type rep (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/type-info.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 12 matching lines...) Expand all
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_TYPE_INFO_H_ 28 #ifndef V8_TYPE_INFO_H_
29 #define V8_TYPE_INFO_H_ 29 #define V8_TYPE_INFO_H_
30 30
31 #include "allocation.h" 31 #include "allocation.h"
32 #include "globals.h" 32 #include "globals.h"
33 #include "types.h"
33 #include "zone-inl.h" 34 #include "zone-inl.h"
34 35
35 namespace v8 { 36 namespace v8 {
36 namespace internal { 37 namespace internal {
37 38
38 const int kMaxKeyedPolymorphism = 4; 39 const int kMaxKeyedPolymorphism = 4;
39 40
40 // Unknown 41 // Unknown
41 // | \____________ 42 // | \____________
42 // | | 43 // | |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 const DoubleRepresentation minus_zero(-0.0); 107 const DoubleRepresentation minus_zero(-0.0);
107 DoubleRepresentation rep(value); 108 DoubleRepresentation rep(value);
108 if (rep.bits == minus_zero.bits) return false; 109 if (rep.bits == minus_zero.bits) return false;
109 if (value >= kMinInt && value <= kMaxInt && 110 if (value >= kMinInt && value <= kMaxInt &&
110 value == static_cast<int32_t>(value)) { 111 value == static_cast<int32_t>(value)) {
111 return true; 112 return true;
112 } 113 }
113 return false; 114 return false;
114 } 115 }
115 116
116 static TypeInfo TypeFromValue(Handle<Object> value); 117 static TypeInfo FromValue(Handle<Object> value);
117 118
118 bool Equals(const TypeInfo& other) { 119 bool Equals(const TypeInfo& other) {
119 return type_ == other.type_; 120 return type_ == other.type_;
120 } 121 }
121 122
122 inline bool IsUnknown() { 123 inline bool IsUnknown() {
123 ASSERT(type_ != kUninitialized); 124 ASSERT(type_ != kUninitialized);
124 return type_ == kUnknown; 125 return type_ == kUnknown;
125 } 126 }
126 127
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 }; 211 };
211 212
212 213
213 enum StringStubFeedback { 214 enum StringStubFeedback {
214 DEFAULT_STRING_STUB = 0, 215 DEFAULT_STRING_STUB = 0,
215 STRING_INDEX_OUT_OF_BOUNDS = 1 216 STRING_INDEX_OUT_OF_BOUNDS = 1
216 }; 217 };
217 218
218 219
219 // Forward declarations. 220 // Forward declarations.
221 // TODO(rossberg): these should all go away eventually.
220 class Assignment; 222 class Assignment;
221 class BinaryOperation; 223 class BinaryOperation;
222 class Call; 224 class Call;
223 class CallNew; 225 class CallNew;
224 class CaseClause; 226 class CaseClause;
225 class CompareOperation;
226 class CompilationInfo; 227 class CompilationInfo;
227 class CountOperation; 228 class CountOperation;
228 class Expression; 229 class Expression;
229 class ForInStatement; 230 class ForInStatement;
230 class ICStub; 231 class ICStub;
231 class Property; 232 class Property;
232 class SmallMapList; 233 class SmallMapList;
233 class UnaryOperation; 234 class UnaryOperation;
234 class ObjectLiteral; 235 class ObjectLiteral;
235 class ObjectLiteralProperty; 236 class ObjectLiteralProperty;
(...skipping 14 matching lines...) Expand all
250 bool CallIsMonomorphic(Call* expr); 251 bool CallIsMonomorphic(Call* expr);
251 bool CallNewIsMonomorphic(CallNew* expr); 252 bool CallNewIsMonomorphic(CallNew* expr);
252 bool ObjectLiteralStoreIsMonomorphic(ObjectLiteralProperty* prop); 253 bool ObjectLiteralStoreIsMonomorphic(ObjectLiteralProperty* prop);
253 254
254 // TODO(1571) We can't use ForInStatement::ForInType as the return value due 255 // TODO(1571) We can't use ForInStatement::ForInType as the return value due
255 // to various cycles in our headers. 256 // to various cycles in our headers.
256 byte ForInType(ForInStatement* expr); 257 byte ForInType(ForInStatement* expr);
257 258
258 Handle<Map> LoadMonomorphicReceiverType(Property* expr); 259 Handle<Map> LoadMonomorphicReceiverType(Property* expr);
259 Handle<Map> StoreMonomorphicReceiverType(TypeFeedbackId id); 260 Handle<Map> StoreMonomorphicReceiverType(TypeFeedbackId id);
260 Handle<Map> CompareNilMonomorphicReceiverType(CompareOperation* expr);
261 261
262 KeyedAccessStoreMode GetStoreMode(TypeFeedbackId ast_id); 262 KeyedAccessStoreMode GetStoreMode(TypeFeedbackId ast_id);
263 263
264 void LoadReceiverTypes(Property* expr, 264 void LoadReceiverTypes(Property* expr,
265 Handle<String> name, 265 Handle<String> name,
266 SmallMapList* types); 266 SmallMapList* types);
267 void StoreReceiverTypes(Assignment* expr, 267 void StoreReceiverTypes(Assignment* expr,
268 Handle<String> name, 268 Handle<String> name,
269 SmallMapList* types); 269 SmallMapList* types);
270 void CallReceiverTypes(Call* expr, 270 void CallReceiverTypes(Call* expr,
(...skipping 15 matching lines...) Expand all
286 Handle<Cell> GetCallNewAllocationInfoCell(CallNew* expr); 286 Handle<Cell> GetCallNewAllocationInfoCell(CallNew* expr);
287 287
288 Handle<Map> GetObjectLiteralStoreMap(ObjectLiteralProperty* prop); 288 Handle<Map> GetObjectLiteralStoreMap(ObjectLiteralProperty* prop);
289 289
290 bool LoadIsBuiltin(Property* expr, Builtins::Name id); 290 bool LoadIsBuiltin(Property* expr, Builtins::Name id);
291 bool LoadIsStub(Property* expr, ICStub* stub); 291 bool LoadIsStub(Property* expr, ICStub* stub);
292 292
293 // TODO(1571) We can't use ToBooleanStub::Types as the return value because 293 // TODO(1571) We can't use ToBooleanStub::Types as the return value because
294 // of various cycles in our headers. Death to tons of implementations in 294 // of various cycles in our headers. Death to tons of implementations in
295 // headers!! :-P 295 // headers!! :-P
296 byte ToBooleanTypes(TypeFeedbackId ast_id); 296 byte ToBooleanTypes(TypeFeedbackId id);
297
298 // TODO(1571) We can't use CompareNilICStub::Types as the return value because
299 // of various cylces in our headers. Death to tons of implementations in
300 // headers!! :-P
301 byte CompareNilTypes(CompareOperation* expr);
302 297
303 // Get type information for arithmetic operations and compares. 298 // Get type information for arithmetic operations and compares.
304 TypeInfo UnaryType(UnaryOperation* expr); 299 TypeInfo UnaryType(UnaryOperation* expr);
305 void BinaryType(BinaryOperation* expr, 300 void BinaryType(BinaryOperation* expr,
306 TypeInfo* left, 301 TypeInfo* left,
307 TypeInfo* right, 302 TypeInfo* right,
308 TypeInfo* result, 303 TypeInfo* result,
309 bool* has_fixed_right_arg, 304 bool* has_fixed_right_arg,
310 int* fixed_right_arg_value); 305 int* fixed_right_arg_value);
311 void CompareType(CompareOperation* expr, 306
312 TypeInfo* left_type, 307 void CompareTypes(TypeFeedbackId id,
313 TypeInfo* right_type, 308 Handle<Type>* left_type,
314 TypeInfo* overall_type); 309 Handle<Type>* right_type,
315 Handle<Map> GetCompareMap(CompareOperation* expr); 310 Handle<Type>* overall_type,
316 TypeInfo SwitchType(CaseClause* clause); 311 Handle<Type>* compare_nil_type);
312
313 Handle<Type> ClauseType(TypeFeedbackId id);
314
317 TypeInfo IncrementType(CountOperation* expr); 315 TypeInfo IncrementType(CountOperation* expr);
318 316
319 Zone* zone() const { return zone_; } 317 Zone* zone() const { return zone_; }
320 Isolate* isolate() const { return isolate_; } 318 Isolate* isolate() const { return isolate_; }
321 319
322 private: 320 private:
323 void CollectReceiverTypes(TypeFeedbackId ast_id, 321 void CollectReceiverTypes(TypeFeedbackId ast_id,
324 Handle<String> name, 322 Handle<String> name,
325 Code::Flags flags, 323 Code::Flags flags,
326 SmallMapList* types); 324 SmallMapList* types);
(...skipping 21 matching lines...) Expand all
348 Isolate* isolate_; 346 Isolate* isolate_;
349 Zone* zone_; 347 Zone* zone_;
350 Handle<UnseededNumberDictionary> dictionary_; 348 Handle<UnseededNumberDictionary> dictionary_;
351 349
352 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); 350 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle);
353 }; 351 };
354 352
355 } } // namespace v8::internal 353 } } // namespace v8::internal
356 354
357 #endif // V8_TYPE_INFO_H_ 355 #endif // V8_TYPE_INFO_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/type-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698