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