OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/interpreter/interpreter-assembler.h" | 5 #include "src/interpreter/interpreter-assembler.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <ostream> | 8 #include <ostream> |
9 | 9 |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 | 513 |
514 Node* InterpreterAssembler::IncrementCallCount(Node* type_feedback_vector, | 514 Node* InterpreterAssembler::IncrementCallCount(Node* type_feedback_vector, |
515 Node* slot_id) { | 515 Node* slot_id) { |
516 Comment("increment call count"); | 516 Comment("increment call count"); |
517 Node* call_count_slot = IntPtrAdd(slot_id, IntPtrConstant(1)); | 517 Node* call_count_slot = IntPtrAdd(slot_id, IntPtrConstant(1)); |
518 Node* call_count = | 518 Node* call_count = |
519 LoadFixedArrayElement(type_feedback_vector, call_count_slot); | 519 LoadFixedArrayElement(type_feedback_vector, call_count_slot); |
520 Node* new_count = SmiAdd(call_count, SmiTag(Int32Constant(1))); | 520 Node* new_count = SmiAdd(call_count, SmiTag(Int32Constant(1))); |
521 // Count is Smi, so we don't need a write barrier. | 521 // Count is Smi, so we don't need a write barrier. |
522 return StoreFixedArrayElement(type_feedback_vector, call_count_slot, | 522 return StoreFixedArrayElement(type_feedback_vector, call_count_slot, |
523 new_count, SKIP_WRITE_BARRIER); | 523 new_count, 0, SKIP_WRITE_BARRIER); |
524 } | 524 } |
525 | 525 |
526 Node* InterpreterAssembler::CallJSWithFeedback(Node* function, Node* context, | 526 Node* InterpreterAssembler::CallJSWithFeedback(Node* function, Node* context, |
527 Node* first_arg, Node* arg_count, | 527 Node* first_arg, Node* arg_count, |
528 Node* slot_id, | 528 Node* slot_id, |
529 Node* type_feedback_vector, | 529 Node* type_feedback_vector, |
530 TailCallMode tail_call_mode) { | 530 TailCallMode tail_call_mode) { |
531 // Static checks to assert it is safe to examine the type feedback element. | 531 // Static checks to assert it is safe to examine the type feedback element. |
532 // We don't know that we have a weak cell. We might have a private symbol | 532 // We don't know that we have a weak cell. We might have a private symbol |
533 // or an AllocationSite, but the memory is safe to examine. | 533 // or an AllocationSite, but the memory is safe to examine. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 } | 663 } |
664 | 664 |
665 Bind(&mark_megamorphic); | 665 Bind(&mark_megamorphic); |
666 { | 666 { |
667 // Mark it as a megamorphic. | 667 // Mark it as a megamorphic. |
668 // MegamorphicSentinel is created as a part of Heap::InitialObjects | 668 // MegamorphicSentinel is created as a part of Heap::InitialObjects |
669 // and will not move during a GC. So it is safe to skip write barrier. | 669 // and will not move during a GC. So it is safe to skip write barrier. |
670 DCHECK(Heap::RootIsImmortalImmovable(Heap::kmegamorphic_symbolRootIndex)); | 670 DCHECK(Heap::RootIsImmortalImmovable(Heap::kmegamorphic_symbolRootIndex)); |
671 StoreFixedArrayElement( | 671 StoreFixedArrayElement( |
672 type_feedback_vector, slot_id, | 672 type_feedback_vector, slot_id, |
673 HeapConstant(TypeFeedbackVector::MegamorphicSentinel(isolate())), | 673 HeapConstant(TypeFeedbackVector::MegamorphicSentinel(isolate())), 0, |
674 SKIP_WRITE_BARRIER); | 674 SKIP_WRITE_BARRIER); |
675 Goto(&call); | 675 Goto(&call); |
676 } | 676 } |
677 } | 677 } |
678 | 678 |
679 Bind(&call); | 679 Bind(&call); |
680 { | 680 { |
681 Comment("Increment call count and call using Call builtin"); | 681 Comment("Increment call count and call using Call builtin"); |
682 // Increment the call count. | 682 // Increment the call count. |
683 IncrementCallCount(type_feedback_vector, slot_id); | 683 IncrementCallCount(type_feedback_vector, slot_id); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 } | 830 } |
831 | 831 |
832 Bind(&mark_megamorphic); | 832 Bind(&mark_megamorphic); |
833 { | 833 { |
834 // MegamorphicSentinel is an immortal immovable object so | 834 // MegamorphicSentinel is an immortal immovable object so |
835 // write-barrier is not needed. | 835 // write-barrier is not needed. |
836 Comment("transition to megamorphic"); | 836 Comment("transition to megamorphic"); |
837 DCHECK(Heap::RootIsImmortalImmovable(Heap::kmegamorphic_symbolRootIndex)); | 837 DCHECK(Heap::RootIsImmortalImmovable(Heap::kmegamorphic_symbolRootIndex)); |
838 StoreFixedArrayElement( | 838 StoreFixedArrayElement( |
839 type_feedback_vector, slot_id, | 839 type_feedback_vector, slot_id, |
840 HeapConstant(TypeFeedbackVector::MegamorphicSentinel(isolate())), | 840 HeapConstant(TypeFeedbackVector::MegamorphicSentinel(isolate())), 0, |
841 SKIP_WRITE_BARRIER); | 841 SKIP_WRITE_BARRIER); |
842 Goto(&call_construct_function); | 842 Goto(&call_construct_function); |
843 } | 843 } |
844 } | 844 } |
845 | 845 |
846 Bind(&call_construct); | 846 Bind(&call_construct); |
847 { | 847 { |
848 Comment("call using callConstruct builtin"); | 848 Comment("call using callConstruct builtin"); |
849 Callable callable = CodeFactory::InterpreterPushArgsAndConstruct( | 849 Callable callable = CodeFactory::InterpreterPushArgsAndConstruct( |
850 isolate(), CallableType::kAny); | 850 isolate(), CallableType::kAny); |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 Goto(&loop); | 1330 Goto(&loop); |
1331 } | 1331 } |
1332 Bind(&done_loop); | 1332 Bind(&done_loop); |
1333 | 1333 |
1334 return array; | 1334 return array; |
1335 } | 1335 } |
1336 | 1336 |
1337 } // namespace interpreter | 1337 } // namespace interpreter |
1338 } // namespace internal | 1338 } // namespace internal |
1339 } // namespace v8 | 1339 } // namespace v8 |
OLD | NEW |