| 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/ic/ic.h" | 5 #include "src/ic/ic.h" |
| 6 | 6 |
| 7 #include <iostream> | 7 #include <iostream> |
| 8 | 8 |
| 9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
| 10 #include "src/api-arguments-inl.h" | 10 #include "src/api-arguments-inl.h" |
| (...skipping 2618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2629 | 2629 |
| 2630 // ---------------------------------------------------------------------------- | 2630 // ---------------------------------------------------------------------------- |
| 2631 // Static IC stub generators. | 2631 // Static IC stub generators. |
| 2632 // | 2632 // |
| 2633 | 2633 |
| 2634 // Used from ic-<arch>.cc. | 2634 // Used from ic-<arch>.cc. |
| 2635 RUNTIME_FUNCTION(Runtime_CallIC_Miss) { | 2635 RUNTIME_FUNCTION(Runtime_CallIC_Miss) { |
| 2636 HandleScope scope(isolate); | 2636 HandleScope scope(isolate); |
| 2637 DCHECK_EQ(3, args.length()); | 2637 DCHECK_EQ(3, args.length()); |
| 2638 // Runtime functions don't follow the IC's calling convention. | 2638 // Runtime functions don't follow the IC's calling convention. |
| 2639 Handle<Object> function = args.at<Object>(0); | 2639 Handle<Object> function = args.at(0); |
| 2640 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(1); | 2640 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(1); |
| 2641 Handle<Smi> slot = args.at<Smi>(2); | 2641 Handle<Smi> slot = args.at<Smi>(2); |
| 2642 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); | 2642 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); |
| 2643 CallICNexus nexus(vector, vector_slot); | 2643 CallICNexus nexus(vector, vector_slot); |
| 2644 CallIC ic(isolate, &nexus); | 2644 CallIC ic(isolate, &nexus); |
| 2645 ic.HandleMiss(function); | 2645 ic.HandleMiss(function); |
| 2646 return *function; | 2646 return *function; |
| 2647 } | 2647 } |
| 2648 | 2648 |
| 2649 | 2649 |
| 2650 // Used from ic-<arch>.cc. | 2650 // Used from ic-<arch>.cc. |
| 2651 RUNTIME_FUNCTION(Runtime_LoadIC_Miss) { | 2651 RUNTIME_FUNCTION(Runtime_LoadIC_Miss) { |
| 2652 HandleScope scope(isolate); | 2652 HandleScope scope(isolate); |
| 2653 DCHECK_EQ(4, args.length()); | 2653 DCHECK_EQ(4, args.length()); |
| 2654 // Runtime functions don't follow the IC's calling convention. | 2654 // Runtime functions don't follow the IC's calling convention. |
| 2655 Handle<Object> receiver = args.at<Object>(0); | 2655 Handle<Object> receiver = args.at(0); |
| 2656 Handle<Name> key = args.at<Name>(1); | 2656 Handle<Name> key = args.at<Name>(1); |
| 2657 Handle<Smi> slot = args.at<Smi>(2); | 2657 Handle<Smi> slot = args.at<Smi>(2); |
| 2658 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); | 2658 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); |
| 2659 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); | 2659 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); |
| 2660 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the | 2660 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the |
| 2661 // LoadIC miss handler if the handler misses. Since the vector Nexus is | 2661 // LoadIC miss handler if the handler misses. Since the vector Nexus is |
| 2662 // set up outside the IC, handle that here. | 2662 // set up outside the IC, handle that here. |
| 2663 FeedbackVectorSlotKind kind = vector->GetKind(vector_slot); | 2663 FeedbackVectorSlotKind kind = vector->GetKind(vector_slot); |
| 2664 if (kind == FeedbackVectorSlotKind::LOAD_IC) { | 2664 if (kind == FeedbackVectorSlotKind::LOAD_IC) { |
| 2665 LoadICNexus nexus(vector, vector_slot); | 2665 LoadICNexus nexus(vector, vector_slot); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2742 } | 2742 } |
| 2743 } | 2743 } |
| 2744 return *result; | 2744 return *result; |
| 2745 } | 2745 } |
| 2746 | 2746 |
| 2747 // Used from ic-<arch>.cc | 2747 // Used from ic-<arch>.cc |
| 2748 RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) { | 2748 RUNTIME_FUNCTION(Runtime_KeyedLoadIC_Miss) { |
| 2749 HandleScope scope(isolate); | 2749 HandleScope scope(isolate); |
| 2750 DCHECK_EQ(4, args.length()); | 2750 DCHECK_EQ(4, args.length()); |
| 2751 // Runtime functions don't follow the IC's calling convention. | 2751 // Runtime functions don't follow the IC's calling convention. |
| 2752 Handle<Object> receiver = args.at<Object>(0); | 2752 Handle<Object> receiver = args.at(0); |
| 2753 Handle<Object> key = args.at<Object>(1); | 2753 Handle<Object> key = args.at(1); |
| 2754 Handle<Smi> slot = args.at<Smi>(2); | 2754 Handle<Smi> slot = args.at<Smi>(2); |
| 2755 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); | 2755 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); |
| 2756 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); | 2756 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); |
| 2757 KeyedLoadICNexus nexus(vector, vector_slot); | 2757 KeyedLoadICNexus nexus(vector, vector_slot); |
| 2758 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); | 2758 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
| 2759 ic.UpdateState(receiver, key); | 2759 ic.UpdateState(receiver, key); |
| 2760 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); | 2760 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); |
| 2761 } | 2761 } |
| 2762 | 2762 |
| 2763 | 2763 |
| 2764 RUNTIME_FUNCTION(Runtime_KeyedLoadIC_MissFromStubFailure) { | 2764 RUNTIME_FUNCTION(Runtime_KeyedLoadIC_MissFromStubFailure) { |
| 2765 HandleScope scope(isolate); | 2765 HandleScope scope(isolate); |
| 2766 typedef LoadWithVectorDescriptor Descriptor; | 2766 typedef LoadWithVectorDescriptor Descriptor; |
| 2767 DCHECK_EQ(Descriptor::kParameterCount, args.length()); | 2767 DCHECK_EQ(Descriptor::kParameterCount, args.length()); |
| 2768 Handle<Object> receiver = args.at<Object>(Descriptor::kReceiver); | 2768 Handle<Object> receiver = args.at(Descriptor::kReceiver); |
| 2769 Handle<Object> key = args.at<Object>(Descriptor::kName); | 2769 Handle<Object> key = args.at(Descriptor::kName); |
| 2770 Handle<Smi> slot = args.at<Smi>(Descriptor::kSlot); | 2770 Handle<Smi> slot = args.at<Smi>(Descriptor::kSlot); |
| 2771 Handle<TypeFeedbackVector> vector = | 2771 Handle<TypeFeedbackVector> vector = |
| 2772 args.at<TypeFeedbackVector>(Descriptor::kVector); | 2772 args.at<TypeFeedbackVector>(Descriptor::kVector); |
| 2773 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); | 2773 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); |
| 2774 KeyedLoadICNexus nexus(vector, vector_slot); | 2774 KeyedLoadICNexus nexus(vector, vector_slot); |
| 2775 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 2775 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
| 2776 ic.UpdateState(receiver, key); | 2776 ic.UpdateState(receiver, key); |
| 2777 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); | 2777 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); |
| 2778 } | 2778 } |
| 2779 | 2779 |
| 2780 | 2780 |
| 2781 // Used from ic-<arch>.cc. | 2781 // Used from ic-<arch>.cc. |
| 2782 RUNTIME_FUNCTION(Runtime_StoreIC_Miss) { | 2782 RUNTIME_FUNCTION(Runtime_StoreIC_Miss) { |
| 2783 HandleScope scope(isolate); | 2783 HandleScope scope(isolate); |
| 2784 DCHECK_EQ(5, args.length()); | 2784 DCHECK_EQ(5, args.length()); |
| 2785 // Runtime functions don't follow the IC's calling convention. | 2785 // Runtime functions don't follow the IC's calling convention. |
| 2786 Handle<Object> value = args.at<Object>(0); | 2786 Handle<Object> value = args.at(0); |
| 2787 Handle<Smi> slot = args.at<Smi>(1); | 2787 Handle<Smi> slot = args.at<Smi>(1); |
| 2788 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(2); | 2788 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(2); |
| 2789 Handle<Object> receiver = args.at<Object>(3); | 2789 Handle<Object> receiver = args.at(3); |
| 2790 Handle<Name> key = args.at<Name>(4); | 2790 Handle<Name> key = args.at<Name>(4); |
| 2791 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); | 2791 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); |
| 2792 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::STORE_IC) { | 2792 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::STORE_IC) { |
| 2793 StoreICNexus nexus(vector, vector_slot); | 2793 StoreICNexus nexus(vector, vector_slot); |
| 2794 StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); | 2794 StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
| 2795 ic.UpdateState(receiver, key); | 2795 ic.UpdateState(receiver, key); |
| 2796 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); | 2796 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); |
| 2797 } else { | 2797 } else { |
| 2798 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, | 2798 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, |
| 2799 vector->GetKind(vector_slot)); | 2799 vector->GetKind(vector_slot)); |
| 2800 KeyedStoreICNexus nexus(vector, vector_slot); | 2800 KeyedStoreICNexus nexus(vector, vector_slot); |
| 2801 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); | 2801 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
| 2802 ic.UpdateState(receiver, key); | 2802 ic.UpdateState(receiver, key); |
| 2803 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); | 2803 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); |
| 2804 } | 2804 } |
| 2805 } | 2805 } |
| 2806 | 2806 |
| 2807 | 2807 |
| 2808 // Used from ic-<arch>.cc. | 2808 // Used from ic-<arch>.cc. |
| 2809 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) { | 2809 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) { |
| 2810 HandleScope scope(isolate); | 2810 HandleScope scope(isolate); |
| 2811 DCHECK_EQ(5, args.length()); | 2811 DCHECK_EQ(5, args.length()); |
| 2812 // Runtime functions don't follow the IC's calling convention. | 2812 // Runtime functions don't follow the IC's calling convention. |
| 2813 Handle<Object> value = args.at<Object>(0); | 2813 Handle<Object> value = args.at(0); |
| 2814 Handle<Smi> slot = args.at<Smi>(1); | 2814 Handle<Smi> slot = args.at<Smi>(1); |
| 2815 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(2); | 2815 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(2); |
| 2816 Handle<Object> receiver = args.at<Object>(3); | 2816 Handle<Object> receiver = args.at(3); |
| 2817 Handle<Object> key = args.at<Object>(4); | 2817 Handle<Object> key = args.at(4); |
| 2818 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); | 2818 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); |
| 2819 KeyedStoreICNexus nexus(vector, vector_slot); | 2819 KeyedStoreICNexus nexus(vector, vector_slot); |
| 2820 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); | 2820 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
| 2821 ic.UpdateState(receiver, key); | 2821 ic.UpdateState(receiver, key); |
| 2822 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); | 2822 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); |
| 2823 } | 2823 } |
| 2824 | 2824 |
| 2825 | 2825 |
| 2826 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Slow) { | 2826 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Slow) { |
| 2827 HandleScope scope(isolate); | 2827 HandleScope scope(isolate); |
| 2828 DCHECK_EQ(5, args.length()); | 2828 DCHECK_EQ(5, args.length()); |
| 2829 // Runtime functions don't follow the IC's calling convention. | 2829 // Runtime functions don't follow the IC's calling convention. |
| 2830 Handle<Object> value = args.at<Object>(0); | 2830 Handle<Object> value = args.at(0); |
| 2831 // slot and vector parameters are not used. | 2831 // slot and vector parameters are not used. |
| 2832 Handle<Object> object = args.at<Object>(3); | 2832 Handle<Object> object = args.at(3); |
| 2833 Handle<Object> key = args.at<Object>(4); | 2833 Handle<Object> key = args.at(4); |
| 2834 LanguageMode language_mode; | 2834 LanguageMode language_mode; |
| 2835 KeyedStoreICNexus nexus(isolate); | 2835 KeyedStoreICNexus nexus(isolate); |
| 2836 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); | 2836 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
| 2837 language_mode = ic.language_mode(); | 2837 language_mode = ic.language_mode(); |
| 2838 RETURN_RESULT_OR_FAILURE( | 2838 RETURN_RESULT_OR_FAILURE( |
| 2839 isolate, | 2839 isolate, |
| 2840 Runtime::SetObjectProperty(isolate, object, key, value, language_mode)); | 2840 Runtime::SetObjectProperty(isolate, object, key, value, language_mode)); |
| 2841 } | 2841 } |
| 2842 | 2842 |
| 2843 | 2843 |
| 2844 RUNTIME_FUNCTION(Runtime_ElementsTransitionAndStoreIC_Miss) { | 2844 RUNTIME_FUNCTION(Runtime_ElementsTransitionAndStoreIC_Miss) { |
| 2845 HandleScope scope(isolate); | 2845 HandleScope scope(isolate); |
| 2846 // Runtime functions don't follow the IC's calling convention. | 2846 // Runtime functions don't follow the IC's calling convention. |
| 2847 Handle<Object> object = args.at<Object>(0); | 2847 Handle<Object> object = args.at(0); |
| 2848 Handle<Object> key = args.at<Object>(1); | 2848 Handle<Object> key = args.at(1); |
| 2849 Handle<Object> value = args.at<Object>(2); | 2849 Handle<Object> value = args.at(2); |
| 2850 Handle<Map> map = args.at<Map>(3); | 2850 Handle<Map> map = args.at<Map>(3); |
| 2851 LanguageMode language_mode; | 2851 LanguageMode language_mode; |
| 2852 KeyedStoreICNexus nexus(isolate); | 2852 KeyedStoreICNexus nexus(isolate); |
| 2853 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); | 2853 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
| 2854 language_mode = ic.language_mode(); | 2854 language_mode = ic.language_mode(); |
| 2855 if (object->IsJSObject()) { | 2855 if (object->IsJSObject()) { |
| 2856 JSObject::TransitionElementsKind(Handle<JSObject>::cast(object), | 2856 JSObject::TransitionElementsKind(Handle<JSObject>::cast(object), |
| 2857 map->elements_kind()); | 2857 map->elements_kind()); |
| 2858 } | 2858 } |
| 2859 RETURN_RESULT_OR_FAILURE( | 2859 RETURN_RESULT_OR_FAILURE( |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2988 } | 2988 } |
| 2989 | 2989 |
| 2990 return result; | 2990 return result; |
| 2991 } | 2991 } |
| 2992 | 2992 |
| 2993 | 2993 |
| 2994 RUNTIME_FUNCTION(Runtime_BinaryOpIC_Miss) { | 2994 RUNTIME_FUNCTION(Runtime_BinaryOpIC_Miss) { |
| 2995 HandleScope scope(isolate); | 2995 HandleScope scope(isolate); |
| 2996 DCHECK_EQ(2, args.length()); | 2996 DCHECK_EQ(2, args.length()); |
| 2997 typedef BinaryOpDescriptor Descriptor; | 2997 typedef BinaryOpDescriptor Descriptor; |
| 2998 Handle<Object> left = args.at<Object>(Descriptor::kLeft); | 2998 Handle<Object> left = args.at(Descriptor::kLeft); |
| 2999 Handle<Object> right = args.at<Object>(Descriptor::kRight); | 2999 Handle<Object> right = args.at(Descriptor::kRight); |
| 3000 BinaryOpIC ic(isolate); | 3000 BinaryOpIC ic(isolate); |
| 3001 RETURN_RESULT_OR_FAILURE( | 3001 RETURN_RESULT_OR_FAILURE( |
| 3002 isolate, ic.Transition(Handle<AllocationSite>::null(), left, right)); | 3002 isolate, ic.Transition(Handle<AllocationSite>::null(), left, right)); |
| 3003 } | 3003 } |
| 3004 | 3004 |
| 3005 | 3005 |
| 3006 RUNTIME_FUNCTION(Runtime_BinaryOpIC_MissWithAllocationSite) { | 3006 RUNTIME_FUNCTION(Runtime_BinaryOpIC_MissWithAllocationSite) { |
| 3007 HandleScope scope(isolate); | 3007 HandleScope scope(isolate); |
| 3008 DCHECK_EQ(3, args.length()); | 3008 DCHECK_EQ(3, args.length()); |
| 3009 typedef BinaryOpWithAllocationSiteDescriptor Descriptor; | 3009 typedef BinaryOpWithAllocationSiteDescriptor Descriptor; |
| 3010 Handle<AllocationSite> allocation_site = | 3010 Handle<AllocationSite> allocation_site = |
| 3011 args.at<AllocationSite>(Descriptor::kAllocationSite); | 3011 args.at<AllocationSite>(Descriptor::kAllocationSite); |
| 3012 Handle<Object> left = args.at<Object>(Descriptor::kLeft); | 3012 Handle<Object> left = args.at(Descriptor::kLeft); |
| 3013 Handle<Object> right = args.at<Object>(Descriptor::kRight); | 3013 Handle<Object> right = args.at(Descriptor::kRight); |
| 3014 BinaryOpIC ic(isolate); | 3014 BinaryOpIC ic(isolate); |
| 3015 RETURN_RESULT_OR_FAILURE(isolate, | 3015 RETURN_RESULT_OR_FAILURE(isolate, |
| 3016 ic.Transition(allocation_site, left, right)); | 3016 ic.Transition(allocation_site, left, right)); |
| 3017 } | 3017 } |
| 3018 | 3018 |
| 3019 Code* CompareIC::GetRawUninitialized(Isolate* isolate, Token::Value op) { | 3019 Code* CompareIC::GetRawUninitialized(Isolate* isolate, Token::Value op) { |
| 3020 CompareICStub stub(isolate, op, CompareICState::UNINITIALIZED, | 3020 CompareICStub stub(isolate, op, CompareICState::UNINITIALIZED, |
| 3021 CompareICState::UNINITIALIZED, | 3021 CompareICState::UNINITIALIZED, |
| 3022 CompareICState::UNINITIALIZED); | 3022 CompareICState::UNINITIALIZED); |
| 3023 Code* code = NULL; | 3023 Code* code = NULL; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3086 | 3086 |
| 3087 return *new_target; | 3087 return *new_target; |
| 3088 } | 3088 } |
| 3089 | 3089 |
| 3090 | 3090 |
| 3091 // Used from CompareICStub::GenerateMiss in code-stubs-<arch>.cc. | 3091 // Used from CompareICStub::GenerateMiss in code-stubs-<arch>.cc. |
| 3092 RUNTIME_FUNCTION(Runtime_CompareIC_Miss) { | 3092 RUNTIME_FUNCTION(Runtime_CompareIC_Miss) { |
| 3093 HandleScope scope(isolate); | 3093 HandleScope scope(isolate); |
| 3094 DCHECK(args.length() == 3); | 3094 DCHECK(args.length() == 3); |
| 3095 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2))); | 3095 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2))); |
| 3096 return ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); | 3096 return ic.UpdateCaches(args.at(0), args.at(1)); |
| 3097 } | 3097 } |
| 3098 | 3098 |
| 3099 | 3099 |
| 3100 RUNTIME_FUNCTION(Runtime_Unreachable) { | 3100 RUNTIME_FUNCTION(Runtime_Unreachable) { |
| 3101 UNREACHABLE(); | 3101 UNREACHABLE(); |
| 3102 CHECK(false); | 3102 CHECK(false); |
| 3103 return isolate->heap()->undefined_value(); | 3103 return isolate->heap()->undefined_value(); |
| 3104 } | 3104 } |
| 3105 | 3105 |
| 3106 | 3106 |
| 3107 Handle<Object> ToBooleanIC::ToBoolean(Handle<Object> object) { | 3107 Handle<Object> ToBooleanIC::ToBoolean(Handle<Object> object) { |
| 3108 ToBooleanICStub stub(isolate(), extra_ic_state()); | 3108 ToBooleanICStub stub(isolate(), extra_ic_state()); |
| 3109 bool to_boolean_value = stub.UpdateStatus(object); | 3109 bool to_boolean_value = stub.UpdateStatus(object); |
| 3110 Handle<Code> code = stub.GetCode(); | 3110 Handle<Code> code = stub.GetCode(); |
| 3111 set_target(*code); | 3111 set_target(*code); |
| 3112 return isolate()->factory()->ToBoolean(to_boolean_value); | 3112 return isolate()->factory()->ToBoolean(to_boolean_value); |
| 3113 } | 3113 } |
| 3114 | 3114 |
| 3115 | 3115 |
| 3116 RUNTIME_FUNCTION(Runtime_ToBooleanIC_Miss) { | 3116 RUNTIME_FUNCTION(Runtime_ToBooleanIC_Miss) { |
| 3117 DCHECK(args.length() == 1); | 3117 DCHECK(args.length() == 1); |
| 3118 HandleScope scope(isolate); | 3118 HandleScope scope(isolate); |
| 3119 Handle<Object> object = args.at<Object>(0); | 3119 Handle<Object> object = args.at(0); |
| 3120 ToBooleanIC ic(isolate); | 3120 ToBooleanIC ic(isolate); |
| 3121 return *ic.ToBoolean(object); | 3121 return *ic.ToBoolean(object); |
| 3122 } | 3122 } |
| 3123 | 3123 |
| 3124 | 3124 |
| 3125 RUNTIME_FUNCTION(Runtime_StoreCallbackProperty) { | 3125 RUNTIME_FUNCTION(Runtime_StoreCallbackProperty) { |
| 3126 Handle<JSObject> receiver = args.at<JSObject>(0); | 3126 Handle<JSObject> receiver = args.at<JSObject>(0); |
| 3127 Handle<JSObject> holder = args.at<JSObject>(1); | 3127 Handle<JSObject> holder = args.at<JSObject>(1); |
| 3128 Handle<HeapObject> callback_or_cell = args.at<HeapObject>(2); | 3128 Handle<HeapObject> callback_or_cell = args.at<HeapObject>(2); |
| 3129 Handle<Name> name = args.at<Name>(3); | 3129 Handle<Name> name = args.at<Name>(3); |
| 3130 Handle<Object> value = args.at<Object>(4); | 3130 Handle<Object> value = args.at(4); |
| 3131 CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 5); | 3131 CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 5); |
| 3132 HandleScope scope(isolate); | 3132 HandleScope scope(isolate); |
| 3133 | 3133 |
| 3134 if (V8_UNLIKELY(FLAG_runtime_stats)) { | 3134 if (V8_UNLIKELY(FLAG_runtime_stats)) { |
| 3135 RETURN_RESULT_OR_FAILURE( | 3135 RETURN_RESULT_OR_FAILURE( |
| 3136 isolate, Runtime::SetObjectProperty(isolate, receiver, name, value, | 3136 isolate, Runtime::SetObjectProperty(isolate, receiver, name, value, |
| 3137 language_mode)); | 3137 language_mode)); |
| 3138 } | 3138 } |
| 3139 | 3139 |
| 3140 Handle<AccessorInfo> callback( | 3140 Handle<AccessorInfo> callback( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3164 * but doesn't search the prototype chain. | 3164 * but doesn't search the prototype chain. |
| 3165 * | 3165 * |
| 3166 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't | 3166 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't |
| 3167 * provide any value for the given name. | 3167 * provide any value for the given name. |
| 3168 */ | 3168 */ |
| 3169 RUNTIME_FUNCTION(Runtime_LoadPropertyWithInterceptorOnly) { | 3169 RUNTIME_FUNCTION(Runtime_LoadPropertyWithInterceptorOnly) { |
| 3170 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); | 3170 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); |
| 3171 Handle<Name> name = | 3171 Handle<Name> name = |
| 3172 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); | 3172 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); |
| 3173 Handle<Object> receiver = | 3173 Handle<Object> receiver = |
| 3174 args.at<Object>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); | 3174 args.at(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); |
| 3175 Handle<JSObject> holder = | 3175 Handle<JSObject> holder = |
| 3176 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); | 3176 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); |
| 3177 HandleScope scope(isolate); | 3177 HandleScope scope(isolate); |
| 3178 | 3178 |
| 3179 if (!receiver->IsJSReceiver()) { | 3179 if (!receiver->IsJSReceiver()) { |
| 3180 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 3180 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 3181 isolate, receiver, Object::ConvertReceiver(isolate, receiver)); | 3181 isolate, receiver, Object::ConvertReceiver(isolate, receiver)); |
| 3182 } | 3182 } |
| 3183 | 3183 |
| 3184 InterceptorInfo* interceptor = holder->GetNamedInterceptor(); | 3184 InterceptorInfo* interceptor = holder->GetNamedInterceptor(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3200 /** | 3200 /** |
| 3201 * Loads a property with an interceptor performing post interceptor | 3201 * Loads a property with an interceptor performing post interceptor |
| 3202 * lookup if interceptor failed. | 3202 * lookup if interceptor failed. |
| 3203 */ | 3203 */ |
| 3204 RUNTIME_FUNCTION(Runtime_LoadPropertyWithInterceptor) { | 3204 RUNTIME_FUNCTION(Runtime_LoadPropertyWithInterceptor) { |
| 3205 HandleScope scope(isolate); | 3205 HandleScope scope(isolate); |
| 3206 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); | 3206 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); |
| 3207 Handle<Name> name = | 3207 Handle<Name> name = |
| 3208 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); | 3208 args.at<Name>(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex); |
| 3209 Handle<Object> receiver = | 3209 Handle<Object> receiver = |
| 3210 args.at<Object>(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); | 3210 args.at(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex); |
| 3211 Handle<JSObject> holder = | 3211 Handle<JSObject> holder = |
| 3212 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); | 3212 args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex); |
| 3213 | 3213 |
| 3214 if (!receiver->IsJSReceiver()) { | 3214 if (!receiver->IsJSReceiver()) { |
| 3215 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 3215 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 3216 isolate, receiver, Object::ConvertReceiver(isolate, receiver)); | 3216 isolate, receiver, Object::ConvertReceiver(isolate, receiver)); |
| 3217 } | 3217 } |
| 3218 | 3218 |
| 3219 InterceptorInfo* interceptor = holder->GetNamedInterceptor(); | 3219 InterceptorInfo* interceptor = holder->GetNamedInterceptor(); |
| 3220 PropertyCallbackArguments arguments(isolate, interceptor->data(), *receiver, | 3220 PropertyCallbackArguments arguments(isolate, interceptor->data(), *receiver, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3256 } | 3256 } |
| 3257 | 3257 |
| 3258 | 3258 |
| 3259 RUNTIME_FUNCTION(Runtime_StorePropertyWithInterceptor) { | 3259 RUNTIME_FUNCTION(Runtime_StorePropertyWithInterceptor) { |
| 3260 HandleScope scope(isolate); | 3260 HandleScope scope(isolate); |
| 3261 DCHECK(args.length() == 3); | 3261 DCHECK(args.length() == 3); |
| 3262 StoreICNexus nexus(isolate); | 3262 StoreICNexus nexus(isolate); |
| 3263 StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); | 3263 StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
| 3264 Handle<JSObject> receiver = args.at<JSObject>(0); | 3264 Handle<JSObject> receiver = args.at<JSObject>(0); |
| 3265 Handle<Name> name = args.at<Name>(1); | 3265 Handle<Name> name = args.at<Name>(1); |
| 3266 Handle<Object> value = args.at<Object>(2); | 3266 Handle<Object> value = args.at(2); |
| 3267 | 3267 |
| 3268 DCHECK(receiver->HasNamedInterceptor()); | 3268 DCHECK(receiver->HasNamedInterceptor()); |
| 3269 InterceptorInfo* interceptor = receiver->GetNamedInterceptor(); | 3269 InterceptorInfo* interceptor = receiver->GetNamedInterceptor(); |
| 3270 DCHECK(!interceptor->non_masking()); | 3270 DCHECK(!interceptor->non_masking()); |
| 3271 PropertyCallbackArguments arguments(isolate, interceptor->data(), *receiver, | 3271 PropertyCallbackArguments arguments(isolate, interceptor->data(), *receiver, |
| 3272 *receiver, Object::DONT_THROW); | 3272 *receiver, Object::DONT_THROW); |
| 3273 | 3273 |
| 3274 v8::GenericNamedPropertySetterCallback setter = | 3274 v8::GenericNamedPropertySetterCallback setter = |
| 3275 v8::ToCData<v8::GenericNamedPropertySetterCallback>( | 3275 v8::ToCData<v8::GenericNamedPropertySetterCallback>( |
| 3276 interceptor->setter()); | 3276 interceptor->setter()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3317 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); | 3317 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); |
| 3318 it.Next(); | 3318 it.Next(); |
| 3319 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 3319 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
| 3320 Object::GetProperty(&it)); | 3320 Object::GetProperty(&it)); |
| 3321 } | 3321 } |
| 3322 | 3322 |
| 3323 return *result; | 3323 return *result; |
| 3324 } | 3324 } |
| 3325 } // namespace internal | 3325 } // namespace internal |
| 3326 } // namespace v8 | 3326 } // namespace v8 |
| OLD | NEW |