OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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-feedback-vector.h" | 5 #include "src/type-feedback-vector.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/ic/ic.h" | 8 #include "src/ic/ic.h" |
9 #include "src/ic/ic-state.h" | 9 #include "src/ic/ic-state.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 } | 516 } |
517 | 517 |
518 CHECK(feedback == *TypeFeedbackVector::UninitializedSentinel(isolate)); | 518 CHECK(feedback == *TypeFeedbackVector::UninitializedSentinel(isolate)); |
519 return UNINITIALIZED; | 519 return UNINITIALIZED; |
520 } | 520 } |
521 | 521 |
522 | 522 |
523 int CallICNexus::ExtractCallCount() { | 523 int CallICNexus::ExtractCallCount() { |
524 Object* call_count = GetFeedbackExtra(); | 524 Object* call_count = GetFeedbackExtra(); |
525 if (call_count->IsSmi()) { | 525 if (call_count->IsSmi()) { |
526 int value = Smi::cast(call_count)->value() / 2; | 526 int value = Smi::cast(call_count)->value(); |
527 return value; | 527 return value; |
528 } | 528 } |
529 return -1; | 529 return -1; |
530 } | 530 } |
531 | 531 |
532 | 532 |
533 void CallICNexus::Clear(Code* host) { CallIC::Clear(GetIsolate(), host, this); } | 533 void CallICNexus::Clear(Code* host) { CallIC::Clear(GetIsolate(), host, this); } |
534 | 534 |
535 | 535 |
536 void CallICNexus::ConfigureMonomorphicArray() { | 536 void CallICNexus::ConfigureMonomorphicArray() { |
537 Object* feedback = GetFeedback(); | 537 Object* feedback = GetFeedback(); |
538 if (!feedback->IsAllocationSite()) { | 538 if (!feedback->IsAllocationSite()) { |
539 Handle<AllocationSite> new_site = | 539 Handle<AllocationSite> new_site = |
540 GetIsolate()->factory()->NewAllocationSite(); | 540 GetIsolate()->factory()->NewAllocationSite(); |
541 SetFeedback(*new_site); | 541 SetFeedback(*new_site); |
542 } | 542 } |
543 SetFeedbackExtra(Smi::FromInt(kCallCountIncrement), SKIP_WRITE_BARRIER); | 543 SetFeedbackExtra(Smi::FromInt(1), SKIP_WRITE_BARRIER); |
544 } | 544 } |
545 | 545 |
546 | 546 |
547 void CallICNexus::ConfigureMonomorphic(Handle<JSFunction> function) { | 547 void CallICNexus::ConfigureMonomorphic(Handle<JSFunction> function) { |
548 Handle<WeakCell> new_cell = GetIsolate()->factory()->NewWeakCell(function); | 548 Handle<WeakCell> new_cell = GetIsolate()->factory()->NewWeakCell(function); |
549 SetFeedback(*new_cell); | 549 SetFeedback(*new_cell); |
550 SetFeedbackExtra(Smi::FromInt(kCallCountIncrement), SKIP_WRITE_BARRIER); | 550 SetFeedbackExtra(Smi::FromInt(1), SKIP_WRITE_BARRIER); |
551 } | 551 } |
552 | 552 |
553 | 553 |
554 void CallICNexus::ConfigureMegamorphic() { | 554 void CallICNexus::ConfigureMegamorphic() { |
555 FeedbackNexus::ConfigureMegamorphic(); | 555 FeedbackNexus::ConfigureMegamorphic(); |
556 } | 556 } |
557 | 557 |
558 | 558 |
559 void CallICNexus::ConfigureMegamorphic(int call_count) { | 559 void CallICNexus::ConfigureMegamorphic(int call_count) { |
560 SetFeedback(*TypeFeedbackVector::MegamorphicSentinel(GetIsolate()), | 560 SetFeedback(*TypeFeedbackVector::MegamorphicSentinel(GetIsolate()), |
561 SKIP_WRITE_BARRIER); | 561 SKIP_WRITE_BARRIER); |
562 SetFeedbackExtra(Smi::FromInt(call_count * kCallCountIncrement), | 562 SetFeedbackExtra(Smi::FromInt(call_count), SKIP_WRITE_BARRIER); |
563 SKIP_WRITE_BARRIER); | |
564 } | 563 } |
565 | 564 |
566 | 565 |
567 void LoadICNexus::ConfigureMonomorphic(Handle<Map> receiver_map, | 566 void LoadICNexus::ConfigureMonomorphic(Handle<Map> receiver_map, |
568 Handle<Code> handler) { | 567 Handle<Code> handler) { |
569 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); | 568 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); |
570 SetFeedback(*cell); | 569 SetFeedback(*cell); |
571 SetFeedbackExtra(*handler); | 570 SetFeedbackExtra(*handler); |
572 } | 571 } |
573 | 572 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 | 887 |
889 IcCheckType KeyedStoreICNexus::GetKeyType() const { | 888 IcCheckType KeyedStoreICNexus::GetKeyType() const { |
890 Object* feedback = GetFeedback(); | 889 Object* feedback = GetFeedback(); |
891 if (feedback == *TypeFeedbackVector::MegamorphicSentinel(GetIsolate())) { | 890 if (feedback == *TypeFeedbackVector::MegamorphicSentinel(GetIsolate())) { |
892 return static_cast<IcCheckType>(Smi::cast(GetFeedbackExtra())->value()); | 891 return static_cast<IcCheckType>(Smi::cast(GetFeedbackExtra())->value()); |
893 } | 892 } |
894 return IsPropertyNameFeedback(feedback) ? PROPERTY : ELEMENT; | 893 return IsPropertyNameFeedback(feedback) ? PROPERTY : ELEMENT; |
895 } | 894 } |
896 } // namespace internal | 895 } // namespace internal |
897 } // namespace v8 | 896 } // namespace v8 |
OLD | NEW |