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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 // Use specialized code for getting prototype of functions. | 591 // Use specialized code for getting prototype of functions. |
592 if (object->IsJSFunction() && | 592 if (object->IsJSFunction() && |
593 String::Equals(isolate()->factory()->prototype_string(), name) && | 593 String::Equals(isolate()->factory()->prototype_string(), name) && |
594 Handle<JSFunction>::cast(object)->should_have_prototype()) { | 594 Handle<JSFunction>::cast(object)->should_have_prototype()) { |
595 Handle<Code> stub; | 595 Handle<Code> stub; |
596 if (state() == UNINITIALIZED) { | 596 if (state() == UNINITIALIZED) { |
597 stub = pre_monomorphic_stub(); | 597 stub = pre_monomorphic_stub(); |
598 } else if (state() == PREMONOMORPHIC) { | 598 } else if (state() == PREMONOMORPHIC) { |
599 FunctionPrototypeStub function_prototype_stub(isolate(), kind()); | 599 FunctionPrototypeStub function_prototype_stub(isolate(), kind()); |
600 stub = function_prototype_stub.GetCode(); | 600 stub = function_prototype_stub.GetCode(); |
601 } else if (state() != MEGAMORPHIC) { | 601 } else if (!FLAG_compiled_keyed_generic_loads && state() != MEGAMORPHIC) { |
602 ASSERT(state() != GENERIC); | 602 ASSERT(state() != GENERIC); |
603 stub = megamorphic_stub(); | 603 stub = megamorphic_stub(); |
| 604 } else if (FLAG_compiled_keyed_generic_loads && state() != GENERIC) { |
| 605 stub = generic_stub(); |
604 } | 606 } |
605 if (!stub.is_null()) { | 607 if (!stub.is_null()) { |
606 set_target(*stub); | 608 set_target(*stub); |
607 if (FLAG_trace_ic) PrintF("[LoadIC : +#prototype /function]\n"); | 609 if (FLAG_trace_ic) PrintF("[LoadIC : +#prototype /function]\n"); |
608 } | 610 } |
609 return Accessors::FunctionGetPrototype(Handle<JSFunction>::cast(object)); | 611 return Accessors::FunctionGetPrototype(Handle<JSFunction>::cast(object)); |
610 } | 612 } |
611 } | 613 } |
612 | 614 |
613 // Check if the name is trivially convertible to an index and get | 615 // Check if the name is trivially convertible to an index and get |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 case PREMONOMORPHIC: | 816 case PREMONOMORPHIC: |
815 case MONOMORPHIC_PROTOTYPE_FAILURE: | 817 case MONOMORPHIC_PROTOTYPE_FAILURE: |
816 UpdateMonomorphicIC(type, code, name); | 818 UpdateMonomorphicIC(type, code, name); |
817 break; | 819 break; |
818 case MONOMORPHIC: // Fall through. | 820 case MONOMORPHIC: // Fall through. |
819 case POLYMORPHIC: | 821 case POLYMORPHIC: |
820 if (!target()->is_keyed_stub()) { | 822 if (!target()->is_keyed_stub()) { |
821 if (UpdatePolymorphicIC(type, name, code)) break; | 823 if (UpdatePolymorphicIC(type, name, code)) break; |
822 CopyICToMegamorphicCache(name); | 824 CopyICToMegamorphicCache(name); |
823 } | 825 } |
| 826 if (FLAG_compiled_keyed_generic_loads && (kind() == Code::LOAD_IC)) { |
| 827 set_target(*generic_stub()); |
| 828 break; |
| 829 } |
824 set_target(*megamorphic_stub()); | 830 set_target(*megamorphic_stub()); |
825 // Fall through. | 831 // Fall through. |
826 case MEGAMORPHIC: | 832 case MEGAMORPHIC: |
827 UpdateMegamorphicCache(*type, *name, *code); | 833 UpdateMegamorphicCache(*type, *name, *code); |
828 break; | 834 break; |
829 case DEBUG_STUB: | 835 case DEBUG_STUB: |
830 break; | 836 break; |
831 case GENERIC: | 837 case GENERIC: |
832 UNREACHABLE(); | 838 UNREACHABLE(); |
833 break; | 839 break; |
(...skipping 11 matching lines...) Expand all Loading... |
845 ExtraICState extra_state) { | 851 ExtraICState extra_state) { |
846 return isolate->stub_cache()->ComputeLoad(PREMONOMORPHIC, extra_state); | 852 return isolate->stub_cache()->ComputeLoad(PREMONOMORPHIC, extra_state); |
847 } | 853 } |
848 | 854 |
849 | 855 |
850 Handle<Code> LoadIC::megamorphic_stub() { | 856 Handle<Code> LoadIC::megamorphic_stub() { |
851 return isolate()->stub_cache()->ComputeLoad(MEGAMORPHIC, extra_ic_state()); | 857 return isolate()->stub_cache()->ComputeLoad(MEGAMORPHIC, extra_ic_state()); |
852 } | 858 } |
853 | 859 |
854 | 860 |
| 861 Handle<Code> LoadIC::generic_stub() const { |
| 862 return KeyedLoadGenericElementStub(isolate()).GetCode(); |
| 863 } |
| 864 |
| 865 |
855 Handle<Code> LoadIC::SimpleFieldLoad(FieldIndex index) { | 866 Handle<Code> LoadIC::SimpleFieldLoad(FieldIndex index) { |
856 if (kind() == Code::LOAD_IC) { | 867 if (kind() == Code::LOAD_IC) { |
857 LoadFieldStub stub(isolate(), index); | 868 LoadFieldStub stub(isolate(), index); |
858 return stub.GetCode(); | 869 return stub.GetCode(); |
859 } else { | 870 } else { |
860 KeyedLoadFieldStub stub(isolate(), index); | 871 KeyedLoadFieldStub stub(isolate(), index); |
861 return stub.GetCode(); | 872 return stub.GetCode(); |
862 } | 873 } |
863 } | 874 } |
864 | 875 |
(...skipping 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3073 #undef ADDR | 3084 #undef ADDR |
3074 }; | 3085 }; |
3075 | 3086 |
3076 | 3087 |
3077 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3088 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
3078 return IC_utilities[id]; | 3089 return IC_utilities[id]; |
3079 } | 3090 } |
3080 | 3091 |
3081 | 3092 |
3082 } } // namespace v8::internal | 3093 } } // namespace v8::internal |
OLD | NEW |