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

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

Issue 112863002: Merge bleeding_edge 18021:18297 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/token.h ('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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 }; 211 };
212 212
213 213
214 enum StringStubFeedback { 214 enum StringStubFeedback {
215 DEFAULT_STRING_STUB = 0, 215 DEFAULT_STRING_STUB = 0,
216 STRING_INDEX_OUT_OF_BOUNDS = 1 216 STRING_INDEX_OUT_OF_BOUNDS = 1
217 }; 217 };
218 218
219 219
220 // Forward declarations. 220 // Forward declarations.
221 // TODO(rossberg): these should all go away eventually.
222 class Assignment;
223 class Call;
224 class CallNew;
225 class CaseClause;
226 class CompilationInfo; 221 class CompilationInfo;
227 class CountOperation;
228 class Expression;
229 class ForInStatement;
230 class ICStub; 222 class ICStub;
231 class Property;
232 class SmallMapList; 223 class SmallMapList;
233 class ObjectLiteral;
234 class ObjectLiteralProperty;
235 224
236 225
237 class TypeFeedbackOracle: public ZoneObject { 226 class TypeFeedbackOracle: public ZoneObject {
238 public: 227 public:
239 TypeFeedbackOracle(Handle<Code> code, 228 TypeFeedbackOracle(Handle<Code> code,
240 Handle<Context> native_context, 229 Handle<Context> native_context,
241 Isolate* isolate, 230 Isolate* isolate,
242 Zone* zone); 231 Zone* zone);
243 232
244 bool LoadIsMonomorphicNormal(Property* expr); 233 bool LoadIsMonomorphicNormal(TypeFeedbackId id);
245 bool LoadIsUninitialized(Property* expr); 234 bool LoadIsUninitialized(TypeFeedbackId id);
246 bool LoadIsPreMonomorphic(Property* expr); 235 bool LoadIsPreMonomorphic(TypeFeedbackId id);
247 bool LoadIsPolymorphic(Property* expr); 236 bool LoadIsPolymorphic(TypeFeedbackId id);
248 bool StoreIsUninitialized(TypeFeedbackId ast_id); 237 bool StoreIsUninitialized(TypeFeedbackId id);
249 bool StoreIsMonomorphicNormal(TypeFeedbackId ast_id); 238 bool StoreIsMonomorphicNormal(TypeFeedbackId id);
250 bool StoreIsPreMonomorphic(TypeFeedbackId ast_id); 239 bool StoreIsPreMonomorphic(TypeFeedbackId id);
251 bool StoreIsKeyedPolymorphic(TypeFeedbackId ast_id); 240 bool StoreIsKeyedPolymorphic(TypeFeedbackId id);
252 bool CallIsMonomorphic(Call* expr); 241 bool CallIsMonomorphic(TypeFeedbackId aid);
253 bool KeyedArrayCallIsHoley(Call* expr); 242 bool KeyedArrayCallIsHoley(TypeFeedbackId id);
254 bool CallNewIsMonomorphic(CallNew* expr); 243 bool CallNewIsMonomorphic(TypeFeedbackId id);
255 bool ObjectLiteralStoreIsMonomorphic(ObjectLiteralProperty* prop); 244 bool ObjectLiteralStoreIsMonomorphic(TypeFeedbackId id);
256 245
257 // TODO(1571) We can't use ForInStatement::ForInType as the return value due 246 // TODO(1571) We can't use ForInStatement::ForInType as the return value due
258 // to various cycles in our headers. 247 // to various cycles in our headers.
259 byte ForInType(ForInStatement* expr); 248 // TODO(rossberg): once all oracle access is removed from ast.cc, it should
249 // be possible.
250 byte ForInType(TypeFeedbackId id);
260 251
261 Handle<Map> LoadMonomorphicReceiverType(Property* expr); 252 Handle<Map> LoadMonomorphicReceiverType(TypeFeedbackId id);
262 Handle<Map> StoreMonomorphicReceiverType(TypeFeedbackId id); 253 Handle<Map> StoreMonomorphicReceiverType(TypeFeedbackId id);
263 254
264 KeyedAccessStoreMode GetStoreMode(TypeFeedbackId ast_id); 255 KeyedAccessStoreMode GetStoreMode(TypeFeedbackId id);
265 256
266 void LoadReceiverTypes(Property* expr, 257 void LoadReceiverTypes(TypeFeedbackId id,
267 Handle<String> name, 258 Handle<String> name,
268 SmallMapList* types); 259 SmallMapList* types);
269 void StoreReceiverTypes(Assignment* expr, 260 void StoreReceiverTypes(TypeFeedbackId id,
270 Handle<String> name, 261 Handle<String> name,
271 SmallMapList* types); 262 SmallMapList* types);
272 void CallReceiverTypes(Call* expr, 263 void CallReceiverTypes(TypeFeedbackId id,
273 Handle<String> name, 264 Handle<String> name,
265 int arity,
274 CallKind call_kind, 266 CallKind call_kind,
275 SmallMapList* types); 267 SmallMapList* types);
276 void CollectKeyedReceiverTypes(TypeFeedbackId ast_id, 268 void CollectKeyedReceiverTypes(TypeFeedbackId id,
277 SmallMapList* types); 269 SmallMapList* types);
278 void CollectPolymorphicStoreReceiverTypes(TypeFeedbackId ast_id, 270 void CollectPolymorphicStoreReceiverTypes(TypeFeedbackId id,
279 SmallMapList* types); 271 SmallMapList* types);
280 272
273 void PropertyReceiverTypes(TypeFeedbackId id,
274 Handle<String> name,
275 SmallMapList* receiver_types,
276 bool* is_prototype);
277 void KeyedPropertyReceiverTypes(TypeFeedbackId id,
278 SmallMapList* receiver_types,
279 bool* is_string);
280 void AssignmentReceiverTypes(TypeFeedbackId id,
281 Handle<String> name,
282 SmallMapList* receiver_types);
283 void KeyedAssignmentReceiverTypes(TypeFeedbackId id,
284 SmallMapList* receiver_types,
285 KeyedAccessStoreMode* store_mode);
286 void CountReceiverTypes(TypeFeedbackId id,
287 SmallMapList* receiver_types);
288
281 static bool CanRetainOtherContext(Map* map, Context* native_context); 289 static bool CanRetainOtherContext(Map* map, Context* native_context);
282 static bool CanRetainOtherContext(JSFunction* function, 290 static bool CanRetainOtherContext(JSFunction* function,
283 Context* native_context); 291 Context* native_context);
284 292
285 void CollectPolymorphicMaps(Handle<Code> code, SmallMapList* types); 293 void CollectPolymorphicMaps(Handle<Code> code, SmallMapList* types);
286 294
287 CheckType GetCallCheckType(Call* expr); 295 CheckType GetCallCheckType(TypeFeedbackId id);
288 Handle<JSFunction> GetCallTarget(Call* expr); 296 Handle<JSFunction> GetCallTarget(TypeFeedbackId id);
289 Handle<JSFunction> GetCallNewTarget(CallNew* expr); 297 Handle<JSFunction> GetCallNewTarget(TypeFeedbackId id);
290 Handle<Cell> GetCallNewAllocationInfoCell(CallNew* expr); 298 Handle<Cell> GetCallNewAllocationInfoCell(TypeFeedbackId id);
291 299
292 Handle<Map> GetObjectLiteralStoreMap(ObjectLiteralProperty* prop); 300 Handle<Map> GetObjectLiteralStoreMap(TypeFeedbackId id);
293 301
294 bool LoadIsBuiltin(Property* expr, Builtins::Name id); 302 bool LoadIsBuiltin(TypeFeedbackId id, Builtins::Name builtin_id);
295 bool LoadIsStub(Property* expr, ICStub* stub); 303 bool LoadIsStub(TypeFeedbackId id, ICStub* stub);
296 304
297 // TODO(1571) We can't use ToBooleanStub::Types as the return value because 305 // TODO(1571) We can't use ToBooleanStub::Types as the return value because
298 // of various cycles in our headers. Death to tons of implementations in 306 // of various cycles in our headers. Death to tons of implementations in
299 // headers!! :-P 307 // headers!! :-P
300 byte ToBooleanTypes(TypeFeedbackId id); 308 byte ToBooleanTypes(TypeFeedbackId id);
301 309
302 // Get type information for arithmetic operations and compares. 310 // Get type information for arithmetic operations and compares.
303 void BinaryType(TypeFeedbackId id, 311 void BinaryType(TypeFeedbackId id,
304 Handle<Type>* left, 312 Handle<Type>* left,
305 Handle<Type>* right, 313 Handle<Type>* right,
306 Handle<Type>* result, 314 Handle<Type>* result,
307 Maybe<int>* fixed_right_arg, 315 Maybe<int>* fixed_right_arg,
308 Token::Value operation); 316 Token::Value operation);
309 317
310 void CompareType(TypeFeedbackId id, 318 void CompareType(TypeFeedbackId id,
311 Handle<Type>* left, 319 Handle<Type>* left,
312 Handle<Type>* right, 320 Handle<Type>* right,
313 Handle<Type>* combined); 321 Handle<Type>* combined);
314 322
323 Handle<Type> CountType(TypeFeedbackId id);
324
315 Handle<Type> ClauseType(TypeFeedbackId id); 325 Handle<Type> ClauseType(TypeFeedbackId id);
316 326
317 Handle<Type> IncrementType(CountOperation* expr);
318
319 Zone* zone() const { return zone_; } 327 Zone* zone() const { return zone_; }
320 Isolate* isolate() const { return isolate_; } 328 Isolate* isolate() const { return isolate_; }
321 329
322 private: 330 private:
323 void CollectReceiverTypes(TypeFeedbackId ast_id, 331 void CollectReceiverTypes(TypeFeedbackId id,
324 Handle<String> name, 332 Handle<String> name,
325 Code::Flags flags, 333 Code::Flags flags,
326 SmallMapList* types); 334 SmallMapList* types);
327 335
328 void SetInfo(TypeFeedbackId ast_id, Object* target); 336 void SetInfo(TypeFeedbackId id, Object* target);
329 337
330 void BuildDictionary(Handle<Code> code); 338 void BuildDictionary(Handle<Code> code);
331 void GetRelocInfos(Handle<Code> code, ZoneList<RelocInfo>* infos); 339 void GetRelocInfos(Handle<Code> code, ZoneList<RelocInfo>* infos);
332 void CreateDictionary(Handle<Code> code, ZoneList<RelocInfo>* infos); 340 void CreateDictionary(Handle<Code> code, ZoneList<RelocInfo>* infos);
333 void RelocateRelocInfos(ZoneList<RelocInfo>* infos, 341 void RelocateRelocInfos(ZoneList<RelocInfo>* infos,
334 byte* old_start, 342 byte* old_start,
335 byte* new_start); 343 byte* new_start);
336 void ProcessRelocInfos(ZoneList<RelocInfo>* infos); 344 void ProcessRelocInfos(ZoneList<RelocInfo>* infos);
337 void ProcessTypeFeedbackCells(Handle<Code> code); 345 void ProcessTypeFeedbackCells(Handle<Code> code);
338 346
339 // Returns an element from the backing store. Returns undefined if 347 // Returns an element from the backing store. Returns undefined if
340 // there is no information. 348 // there is no information.
341 Handle<Object> GetInfo(TypeFeedbackId ast_id); 349 Handle<Object> GetInfo(TypeFeedbackId id);
342 350
343 // Return the cell that contains type feedback. 351 // Return the cell that contains type feedback.
344 Handle<Cell> GetInfoCell(TypeFeedbackId ast_id); 352 Handle<Cell> GetInfoCell(TypeFeedbackId id);
345 353
346 private: 354 private:
347 Handle<Context> native_context_; 355 Handle<Context> native_context_;
348 Isolate* isolate_; 356 Isolate* isolate_;
349 Zone* zone_; 357 Zone* zone_;
350 Handle<UnseededNumberDictionary> dictionary_; 358 Handle<UnseededNumberDictionary> dictionary_;
351 359
352 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); 360 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle);
353 }; 361 };
354 362
355 } } // namespace v8::internal 363 } } // namespace v8::internal
356 364
357 #endif // V8_TYPE_INFO_H_ 365 #endif // V8_TYPE_INFO_H_
OLDNEW
« no previous file with comments | « src/token.h ('k') | src/type-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698