OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 18 matching lines...) Expand all Loading... |
29 #define V8_TYPE_INFO_H_ | 29 #define V8_TYPE_INFO_H_ |
30 | 30 |
31 #include "globals.h" | 31 #include "globals.h" |
32 #include "zone.h" | 32 #include "zone.h" |
33 #include "zone-inl.h" | 33 #include "zone-inl.h" |
34 | 34 |
35 namespace v8 { | 35 namespace v8 { |
36 namespace internal { | 36 namespace internal { |
37 | 37 |
38 // Unknown | 38 // Unknown |
39 // | | | 39 // | \____________ |
40 // | \--------------| | 40 // | | |
41 // Primitive Non-primitive | 41 // Primitive Non-primitive |
42 // | \--------| | | 42 // | \_______ | |
43 // Number String | | 43 // | | | |
44 // / | | | | 44 // Number String | |
45 // Double Integer32 | / | 45 // / \ | | |
46 // | | / / | 46 // Double Integer32 | / |
47 // | Smi / / | 47 // | | / / |
48 // | | / / | 48 // | Smi / / |
49 // | | / / | 49 // | | / __/ |
50 // Uninitialized.--/ | 50 // Uninitialized. |
51 | 51 |
52 class TypeInfo { | 52 class TypeInfo { |
53 public: | 53 public: |
54 TypeInfo() : type_(kUninitialized) { } | 54 TypeInfo() : type_(kUninitialized) { } |
55 | 55 |
56 static TypeInfo Unknown() { return TypeInfo(kUnknown); } | 56 static TypeInfo Unknown() { return TypeInfo(kUnknown); } |
57 // We know it's a primitive type. | 57 // We know it's a primitive type. |
58 static TypeInfo Primitive() { return TypeInfo(kPrimitive); } | 58 static TypeInfo Primitive() { return TypeInfo(kPrimitive); } |
59 // We know it's a number of some sort. | 59 // We know it's a number of some sort. |
60 static TypeInfo Number() { return TypeInfo(kNumber); } | 60 static TypeInfo Number() { return TypeInfo(kNumber); } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 Handle<JSObject> GetPrototypeForPrimitiveCheck(CheckType check); | 256 Handle<JSObject> GetPrototypeForPrimitiveCheck(CheckType check); |
257 | 257 |
258 bool LoadIsBuiltin(Property* expr, Builtins::Name id); | 258 bool LoadIsBuiltin(Property* expr, Builtins::Name id); |
259 | 259 |
260 // Get type information for arithmetic operations and compares. | 260 // Get type information for arithmetic operations and compares. |
261 TypeInfo BinaryType(BinaryOperation* expr); | 261 TypeInfo BinaryType(BinaryOperation* expr); |
262 TypeInfo CompareType(CompareOperation* expr); | 262 TypeInfo CompareType(CompareOperation* expr); |
263 TypeInfo SwitchType(CaseClause* clause); | 263 TypeInfo SwitchType(CaseClause* clause); |
264 | 264 |
265 private: | 265 private: |
266 ZoneMapList* CollectReceiverTypes(int position, | 266 ZoneMapList* CollectReceiverTypes(unsigned ast_id, |
267 Handle<String> name, | 267 Handle<String> name, |
268 Code::Flags flags); | 268 Code::Flags flags); |
269 | 269 |
270 void SetInfo(int position, Object* target); | 270 void SetInfo(unsigned ast_id, Object* target); |
271 | 271 |
272 void PopulateMap(Handle<Code> code); | 272 void PopulateMap(Handle<Code> code); |
273 | 273 |
274 void CollectPositions(Code* code, | 274 void CollectIds(Code* code, |
275 List<int>* code_positions, | 275 List<int>* code_positions, |
276 List<int>* source_positions); | 276 List<unsigned>* ast_ids); |
277 | 277 |
278 // Returns an element from the backing store. Returns undefined if | 278 // Returns an element from the backing store. Returns undefined if |
279 // there is no information. | 279 // there is no information. |
280 Handle<Object> GetInfo(int pos); | 280 Handle<Object> GetInfo(unsigned ast_id); |
281 | 281 |
282 Handle<Context> global_context_; | 282 Handle<Context> global_context_; |
283 Handle<NumberDictionary> dictionary_; | 283 Handle<NumberDictionary> dictionary_; |
284 | 284 |
285 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); | 285 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); |
286 }; | 286 }; |
287 | 287 |
288 } } // namespace v8::internal | 288 } } // namespace v8::internal |
289 | 289 |
290 #endif // V8_TYPE_INFO_H_ | 290 #endif // V8_TYPE_INFO_H_ |
OLD | NEW |