| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); |
| 284 CollectReceiverTypes(&nexus, name, flags, receiver_types); | 284 CollectReceiverTypes(isolate()->load_stub_cache(), &nexus, name, flags, |
| 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 Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC); | 310 Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC); |
| 310 CollectReceiverTypes(slot, name, flags, receiver_types); | 311 CollectReceiverTypes(isolate()->store_stub_cache(), slot, name, flags, |
| 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 | 331 void TypeFeedbackOracle::CollectReceiverTypes(StubCache* stub_cache, |
| 330 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorSlot slot, | 332 FeedbackVectorSlot slot, |
| 331 Handle<Name> name, | 333 Handle<Name> name, |
| 332 Code::Flags flags, | 334 Code::Flags flags, |
| 333 SmallMapList* types) { | 335 SmallMapList* types) { |
| 334 StoreICNexus nexus(feedback_vector_, slot); | 336 StoreICNexus nexus(feedback_vector_, slot); |
| 335 CollectReceiverTypes(&nexus, name, flags, types); | 337 CollectReceiverTypes(stub_cache, &nexus, name, flags, types); |
| 336 } | 338 } |
| 337 | 339 |
| 338 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackNexus* nexus, | 340 void TypeFeedbackOracle::CollectReceiverTypes(StubCache* stub_cache, |
| 341 FeedbackNexus* nexus, |
| 339 Handle<Name> name, | 342 Handle<Name> name, |
| 340 Code::Flags flags, | 343 Code::Flags flags, |
| 341 SmallMapList* types) { | 344 SmallMapList* types) { |
| 342 if (FLAG_collect_megamorphic_maps_from_stub_cache && | 345 if (FLAG_collect_megamorphic_maps_from_stub_cache && |
| 343 nexus->ic_state() == MEGAMORPHIC) { | 346 nexus->ic_state() == MEGAMORPHIC) { |
| 344 types->Reserve(4, zone()); | 347 types->Reserve(4, zone()); |
| 345 isolate()->stub_cache()->CollectMatchingMaps( | 348 stub_cache->CollectMatchingMaps(types, name, flags, native_context_, |
| 346 types, name, flags, native_context_, zone()); | 349 zone()); |
| 347 } else { | 350 } else { |
| 348 CollectReceiverTypes(nexus, types); | 351 CollectReceiverTypes(nexus, types); |
| 349 } | 352 } |
| 350 } | 353 } |
| 351 | 354 |
| 352 | 355 |
| 353 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorSlot slot, | 356 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorSlot slot, |
| 354 SmallMapList* types) { | 357 SmallMapList* types) { |
| 355 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot); | 358 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot); |
| 356 if (kind == FeedbackVectorSlotKind::STORE_IC) { | 359 if (kind == FeedbackVectorSlotKind::STORE_IC) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 // Dictionary has been allocated with sufficient size for all elements. | 470 // Dictionary has been allocated with sufficient size for all elements. |
| 468 DisallowHeapAllocation no_need_to_resize_dictionary; | 471 DisallowHeapAllocation no_need_to_resize_dictionary; |
| 469 HandleScope scope(isolate()); | 472 HandleScope scope(isolate()); |
| 470 USE(UnseededNumberDictionary::AtNumberPut( | 473 USE(UnseededNumberDictionary::AtNumberPut( |
| 471 dictionary_, IdToKey(ast_id), handle(target, isolate()))); | 474 dictionary_, IdToKey(ast_id), handle(target, isolate()))); |
| 472 } | 475 } |
| 473 | 476 |
| 474 | 477 |
| 475 } // namespace internal | 478 } // namespace internal |
| 476 } // namespace v8 | 479 } // namespace v8 |
| OLD | NEW |