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 #include "src/type-info.h" | 5 #include "src/type-info.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 return all_strings; | 273 return all_strings; |
274 } | 274 } |
275 | 275 |
276 | 276 |
277 void TypeFeedbackOracle::PropertyReceiverTypes(FeedbackVectorSlot slot, | 277 void TypeFeedbackOracle::PropertyReceiverTypes(FeedbackVectorSlot slot, |
278 Handle<Name> name, | 278 Handle<Name> name, |
279 SmallMapList* receiver_types) { | 279 SmallMapList* receiver_types) { |
280 receiver_types->Clear(); | 280 receiver_types->Clear(); |
281 if (!slot.IsInvalid()) { | 281 if (!slot.IsInvalid()) { |
282 LoadICNexus nexus(feedback_vector_, slot); | 282 LoadICNexus nexus(feedback_vector_, slot); |
283 CollectReceiverTypes(isolate()->load_stub_cache(), &nexus, name, | 283 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); |
| 284 CollectReceiverTypes(isolate()->load_stub_cache(), &nexus, name, flags, |
284 receiver_types); | 285 receiver_types); |
285 } | 286 } |
286 } | 287 } |
287 | 288 |
288 | 289 |
289 void TypeFeedbackOracle::KeyedPropertyReceiverTypes( | 290 void TypeFeedbackOracle::KeyedPropertyReceiverTypes( |
290 FeedbackVectorSlot slot, SmallMapList* receiver_types, bool* is_string, | 291 FeedbackVectorSlot slot, SmallMapList* receiver_types, bool* is_string, |
291 IcCheckType* key_type) { | 292 IcCheckType* key_type) { |
292 receiver_types->Clear(); | 293 receiver_types->Clear(); |
293 if (slot.IsInvalid()) { | 294 if (slot.IsInvalid()) { |
294 *is_string = false; | 295 *is_string = false; |
295 *key_type = ELEMENT; | 296 *key_type = ELEMENT; |
296 } else { | 297 } else { |
297 KeyedLoadICNexus nexus(feedback_vector_, slot); | 298 KeyedLoadICNexus nexus(feedback_vector_, slot); |
298 CollectReceiverTypes(&nexus, receiver_types); | 299 CollectReceiverTypes(&nexus, receiver_types); |
299 *is_string = HasOnlyStringMaps(receiver_types); | 300 *is_string = HasOnlyStringMaps(receiver_types); |
300 *key_type = nexus.GetKeyType(); | 301 *key_type = nexus.GetKeyType(); |
301 } | 302 } |
302 } | 303 } |
303 | 304 |
304 | 305 |
305 void TypeFeedbackOracle::AssignmentReceiverTypes(FeedbackVectorSlot slot, | 306 void TypeFeedbackOracle::AssignmentReceiverTypes(FeedbackVectorSlot slot, |
306 Handle<Name> name, | 307 Handle<Name> name, |
307 SmallMapList* receiver_types) { | 308 SmallMapList* receiver_types) { |
308 receiver_types->Clear(); | 309 receiver_types->Clear(); |
309 CollectReceiverTypes(isolate()->store_stub_cache(), slot, name, | 310 Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC); |
| 311 CollectReceiverTypes(isolate()->store_stub_cache(), slot, name, flags, |
310 receiver_types); | 312 receiver_types); |
311 } | 313 } |
312 | 314 |
313 | 315 |
314 void TypeFeedbackOracle::KeyedAssignmentReceiverTypes( | 316 void TypeFeedbackOracle::KeyedAssignmentReceiverTypes( |
315 FeedbackVectorSlot slot, SmallMapList* receiver_types, | 317 FeedbackVectorSlot slot, SmallMapList* receiver_types, |
316 KeyedAccessStoreMode* store_mode, IcCheckType* key_type) { | 318 KeyedAccessStoreMode* store_mode, IcCheckType* key_type) { |
317 receiver_types->Clear(); | 319 receiver_types->Clear(); |
318 CollectReceiverTypes(slot, receiver_types); | 320 CollectReceiverTypes(slot, receiver_types); |
319 GetStoreModeAndKeyType(slot, store_mode, key_type); | 321 GetStoreModeAndKeyType(slot, store_mode, key_type); |
320 } | 322 } |
321 | 323 |
322 | 324 |
323 void TypeFeedbackOracle::CountReceiverTypes(FeedbackVectorSlot slot, | 325 void TypeFeedbackOracle::CountReceiverTypes(FeedbackVectorSlot slot, |
324 SmallMapList* receiver_types) { | 326 SmallMapList* receiver_types) { |
325 receiver_types->Clear(); | 327 receiver_types->Clear(); |
326 if (!slot.IsInvalid()) CollectReceiverTypes(slot, receiver_types); | 328 if (!slot.IsInvalid()) CollectReceiverTypes(slot, receiver_types); |
327 } | 329 } |
328 | 330 |
329 void TypeFeedbackOracle::CollectReceiverTypes(StubCache* stub_cache, | 331 void TypeFeedbackOracle::CollectReceiverTypes(StubCache* stub_cache, |
330 FeedbackVectorSlot slot, | 332 FeedbackVectorSlot slot, |
331 Handle<Name> name, | 333 Handle<Name> name, |
| 334 Code::Flags flags, |
332 SmallMapList* types) { | 335 SmallMapList* types) { |
333 StoreICNexus nexus(feedback_vector_, slot); | 336 StoreICNexus nexus(feedback_vector_, slot); |
334 CollectReceiverTypes(stub_cache, &nexus, name, types); | 337 CollectReceiverTypes(stub_cache, &nexus, name, flags, types); |
335 } | 338 } |
336 | 339 |
337 void TypeFeedbackOracle::CollectReceiverTypes(StubCache* stub_cache, | 340 void TypeFeedbackOracle::CollectReceiverTypes(StubCache* stub_cache, |
338 FeedbackNexus* nexus, | 341 FeedbackNexus* nexus, |
339 Handle<Name> name, | 342 Handle<Name> name, |
| 343 Code::Flags flags, |
340 SmallMapList* types) { | 344 SmallMapList* types) { |
341 if (FLAG_collect_megamorphic_maps_from_stub_cache && | 345 if (FLAG_collect_megamorphic_maps_from_stub_cache && |
342 nexus->ic_state() == MEGAMORPHIC) { | 346 nexus->ic_state() == MEGAMORPHIC) { |
343 types->Reserve(4, zone()); | 347 types->Reserve(4, zone()); |
344 stub_cache->CollectMatchingMaps(types, name, native_context_, zone()); | 348 stub_cache->CollectMatchingMaps(types, name, flags, native_context_, |
| 349 zone()); |
345 } else { | 350 } else { |
346 CollectReceiverTypes(nexus, types); | 351 CollectReceiverTypes(nexus, types); |
347 } | 352 } |
348 } | 353 } |
349 | 354 |
350 | 355 |
351 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorSlot slot, | 356 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorSlot slot, |
352 SmallMapList* types) { | 357 SmallMapList* types) { |
353 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot); | 358 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot); |
354 if (kind == FeedbackVectorSlotKind::STORE_IC) { | 359 if (kind == FeedbackVectorSlotKind::STORE_IC) { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 // Dictionary has been allocated with sufficient size for all elements. | 470 // Dictionary has been allocated with sufficient size for all elements. |
466 DisallowHeapAllocation no_need_to_resize_dictionary; | 471 DisallowHeapAllocation no_need_to_resize_dictionary; |
467 HandleScope scope(isolate()); | 472 HandleScope scope(isolate()); |
468 USE(UnseededNumberDictionary::AtNumberPut( | 473 USE(UnseededNumberDictionary::AtNumberPut( |
469 dictionary_, IdToKey(ast_id), handle(target, isolate()))); | 474 dictionary_, IdToKey(ast_id), handle(target, isolate()))); |
470 } | 475 } |
471 | 476 |
472 | 477 |
473 } // namespace internal | 478 } // namespace internal |
474 } // namespace v8 | 479 } // namespace v8 |
OLD | NEW |