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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 196 |
197 | 197 |
198 enum StringStubFeedback { | 198 enum StringStubFeedback { |
199 DEFAULT_STRING_STUB = 0, | 199 DEFAULT_STRING_STUB = 0, |
200 STRING_INDEX_OUT_OF_BOUNDS = 1 | 200 STRING_INDEX_OUT_OF_BOUNDS = 1 |
201 }; | 201 }; |
202 | 202 |
203 | 203 |
204 // Forward declarations. | 204 // Forward declarations. |
205 class Assignment; | 205 class Assignment; |
206 class UnaryOperation; | |
207 class BinaryOperation; | 206 class BinaryOperation; |
208 class Call; | 207 class Call; |
| 208 class CaseClause; |
209 class CompareOperation; | 209 class CompareOperation; |
| 210 class CompilationInfo; |
210 class CountOperation; | 211 class CountOperation; |
211 class CompilationInfo; | |
212 class Property; | 212 class Property; |
213 class CaseClause; | 213 class SmallMapList; |
| 214 class UnaryOperation; |
| 215 |
214 | 216 |
215 class TypeFeedbackOracle BASE_EMBEDDED { | 217 class TypeFeedbackOracle BASE_EMBEDDED { |
216 public: | 218 public: |
217 TypeFeedbackOracle(Handle<Code> code, Handle<Context> global_context); | 219 TypeFeedbackOracle(Handle<Code> code, Handle<Context> global_context); |
218 | 220 |
219 bool LoadIsMonomorphicNormal(Property* expr); | 221 bool LoadIsMonomorphicNormal(Property* expr); |
220 bool LoadIsMegamorphicWithTypeInfo(Property* expr); | 222 bool LoadIsMegamorphicWithTypeInfo(Property* expr); |
221 bool StoreIsMonomorphicNormal(Expression* expr); | 223 bool StoreIsMonomorphicNormal(Expression* expr); |
222 bool StoreIsMegamorphicWithTypeInfo(Expression* expr); | 224 bool StoreIsMegamorphicWithTypeInfo(Expression* expr); |
223 bool CallIsMonomorphic(Call* expr); | 225 bool CallIsMonomorphic(Call* expr); |
224 | 226 |
225 Handle<Map> LoadMonomorphicReceiverType(Property* expr); | 227 Handle<Map> LoadMonomorphicReceiverType(Property* expr); |
226 Handle<Map> StoreMonomorphicReceiverType(Expression* expr); | 228 Handle<Map> StoreMonomorphicReceiverType(Expression* expr); |
227 | 229 |
228 ZoneMapList* LoadReceiverTypes(Property* expr, Handle<String> name); | 230 void LoadReceiverTypes(Property* expr, |
229 ZoneMapList* StoreReceiverTypes(Assignment* expr, Handle<String> name); | 231 Handle<String> name, |
230 ZoneMapList* CallReceiverTypes(Call* expr, | 232 SmallMapList* types); |
231 Handle<String> name, | 233 void StoreReceiverTypes(Assignment* expr, |
232 CallKind call_kind); | 234 Handle<String> name, |
| 235 SmallMapList* types); |
| 236 void CallReceiverTypes(Call* expr, |
| 237 Handle<String> name, |
| 238 CallKind call_kind, |
| 239 SmallMapList* types); |
233 void CollectKeyedReceiverTypes(unsigned ast_id, | 240 void CollectKeyedReceiverTypes(unsigned ast_id, |
234 ZoneMapList* types); | 241 SmallMapList* types); |
235 | 242 |
236 CheckType GetCallCheckType(Call* expr); | 243 CheckType GetCallCheckType(Call* expr); |
237 Handle<JSObject> GetPrototypeForPrimitiveCheck(CheckType check); | 244 Handle<JSObject> GetPrototypeForPrimitiveCheck(CheckType check); |
238 | 245 |
239 bool LoadIsBuiltin(Property* expr, Builtins::Name id); | 246 bool LoadIsBuiltin(Property* expr, Builtins::Name id); |
240 | 247 |
241 // TODO(1571) We can't use ToBooleanStub::Types as the return value because | 248 // TODO(1571) We can't use ToBooleanStub::Types as the return value because |
242 // of various cylces in our headers. Death to tons of implementations in | 249 // of various cylces in our headers. Death to tons of implementations in |
243 // headers!! :-P | 250 // headers!! :-P |
244 byte ToBooleanTypes(unsigned ast_id); | 251 byte ToBooleanTypes(unsigned ast_id); |
245 | 252 |
246 // Get type information for arithmetic operations and compares. | 253 // Get type information for arithmetic operations and compares. |
247 TypeInfo UnaryType(UnaryOperation* expr); | 254 TypeInfo UnaryType(UnaryOperation* expr); |
248 TypeInfo BinaryType(BinaryOperation* expr); | 255 TypeInfo BinaryType(BinaryOperation* expr); |
249 TypeInfo CompareType(CompareOperation* expr); | 256 TypeInfo CompareType(CompareOperation* expr); |
250 bool IsSymbolCompare(CompareOperation* expr); | 257 bool IsSymbolCompare(CompareOperation* expr); |
251 TypeInfo SwitchType(CaseClause* clause); | 258 TypeInfo SwitchType(CaseClause* clause); |
252 TypeInfo IncrementType(CountOperation* expr); | 259 TypeInfo IncrementType(CountOperation* expr); |
253 | 260 |
254 private: | 261 private: |
255 ZoneMapList* CollectReceiverTypes(unsigned ast_id, | 262 void CollectReceiverTypes(unsigned ast_id, |
256 Handle<String> name, | 263 Handle<String> name, |
257 Code::Flags flags); | 264 Code::Flags flags, |
| 265 SmallMapList* types); |
258 | 266 |
259 void SetInfo(unsigned ast_id, Object* target); | 267 void SetInfo(unsigned ast_id, Object* target); |
260 | 268 |
261 void BuildDictionary(Handle<Code> code); | 269 void BuildDictionary(Handle<Code> code); |
262 void GetRelocInfos(Handle<Code> code, ZoneList<RelocInfo>* infos); | 270 void GetRelocInfos(Handle<Code> code, ZoneList<RelocInfo>* infos); |
263 void CreateDictionary(Handle<Code> code, ZoneList<RelocInfo>* infos); | 271 void CreateDictionary(Handle<Code> code, ZoneList<RelocInfo>* infos); |
264 void RelocateRelocInfos(ZoneList<RelocInfo>* infos, | 272 void RelocateRelocInfos(ZoneList<RelocInfo>* infos, |
265 byte* old_start, | 273 byte* old_start, |
266 byte* new_start); | 274 byte* new_start); |
267 void ProcessRelocInfos(ZoneList<RelocInfo>* infos); | 275 void ProcessRelocInfos(ZoneList<RelocInfo>* infos); |
268 void ProcessTarget(unsigned ast_id, Code* target); | 276 void ProcessTarget(unsigned ast_id, Code* target); |
269 | 277 |
270 // Returns an element from the backing store. Returns undefined if | 278 // Returns an element from the backing store. Returns undefined if |
271 // there is no information. | 279 // there is no information. |
272 Handle<Object> GetInfo(unsigned ast_id); | 280 Handle<Object> GetInfo(unsigned ast_id); |
273 | 281 |
274 Handle<Context> global_context_; | 282 Handle<Context> global_context_; |
275 Handle<NumberDictionary> dictionary_; | 283 Handle<NumberDictionary> dictionary_; |
276 | 284 |
277 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); | 285 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); |
278 }; | 286 }; |
279 | 287 |
280 } } // namespace v8::internal | 288 } } // namespace v8::internal |
281 | 289 |
282 #endif // V8_TYPE_INFO_H_ | 290 #endif // V8_TYPE_INFO_H_ |
OLD | NEW |