| 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/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 if (FLAG_vector_ics) { | 937 if (FLAG_vector_ics) { |
| 938 return LoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode(); | 938 return LoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode(); |
| 939 } | 939 } |
| 940 | 940 |
| 941 return PropertyICCompiler::ComputeLoad(isolate, UNINITIALIZED, extra_state); | 941 return PropertyICCompiler::ComputeLoad(isolate, UNINITIALIZED, extra_state); |
| 942 } | 942 } |
| 943 | 943 |
| 944 | 944 |
| 945 Handle<Code> LoadIC::initialize_stub_in_optimized_code( | 945 Handle<Code> LoadIC::initialize_stub_in_optimized_code( |
| 946 Isolate* isolate, ExtraICState extra_state, State initialization_state) { | 946 Isolate* isolate, ExtraICState extra_state, State initialization_state) { |
| 947 DCHECK(initialization_state == UNINITIALIZED || | |
| 948 initialization_state == PREMONOMORPHIC || | |
| 949 initialization_state == MEGAMORPHIC); | |
| 950 if (FLAG_vector_ics) { | 947 if (FLAG_vector_ics) { |
| 951 return VectorLoadStub(isolate, LoadICState(extra_state)).GetCode(); | 948 return VectorLoadStub(isolate, LoadICState(extra_state)).GetCode(); |
| 952 } | 949 } |
| 953 return PropertyICCompiler::ComputeLoad(isolate, initialization_state, | 950 return PropertyICCompiler::ComputeLoad(isolate, initialization_state, |
| 954 extra_state); | 951 extra_state); |
| 955 } | 952 } |
| 956 | 953 |
| 957 | 954 |
| 958 Handle<Code> KeyedLoadIC::initialize_stub(Isolate* isolate) { | 955 Handle<Code> KeyedLoadIC::initialize_stub(Isolate* isolate) { |
| 959 if (FLAG_vector_ics) { | 956 if (FLAG_vector_ics) { |
| 960 return KeyedLoadICTrampolineStub(isolate).GetCode(); | 957 return KeyedLoadICTrampolineStub(isolate).GetCode(); |
| 961 } | 958 } |
| 962 | 959 |
| 963 return isolate->builtins()->KeyedLoadIC_Initialize(); | 960 return isolate->builtins()->KeyedLoadIC_Initialize(); |
| 964 } | 961 } |
| 965 | 962 |
| 966 | 963 |
| 967 Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code(Isolate* isolate) { | 964 Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code( |
| 965 Isolate* isolate, State initialization_state) { |
| 968 if (FLAG_vector_ics) { | 966 if (FLAG_vector_ics) { |
| 969 return VectorKeyedLoadStub(isolate).GetCode(); | 967 return VectorKeyedLoadStub(isolate).GetCode(); |
| 970 } | 968 } |
| 971 return initialize_stub(isolate); | 969 switch (initialization_state) { |
| 970 case UNINITIALIZED: |
| 971 return isolate->builtins()->KeyedLoadIC_Initialize(); |
| 972 case PREMONOMORPHIC: |
| 973 return isolate->builtins()->KeyedLoadIC_PreMonomorphic(); |
| 974 case MEGAMORPHIC: |
| 975 return isolate->builtins()->KeyedLoadIC_Megamorphic(); |
| 976 default: |
| 977 UNREACHABLE(); |
| 978 } |
| 979 return Handle<Code>(); |
| 972 } | 980 } |
| 973 | 981 |
| 974 | 982 |
| 983 Handle<Code> KeyedStoreIC::initialize_stub(Isolate* isolate, |
| 984 LanguageMode language_mode, |
| 985 State initialization_state) { |
| 986 switch (initialization_state) { |
| 987 case UNINITIALIZED: |
| 988 return is_strict(language_mode) |
| 989 ? isolate->builtins()->KeyedStoreIC_Initialize_Strict() |
| 990 : isolate->builtins()->KeyedStoreIC_Initialize(); |
| 991 case PREMONOMORPHIC: |
| 992 return is_strict(language_mode) |
| 993 ? isolate->builtins()->KeyedStoreIC_PreMonomorphic_Strict() |
| 994 : isolate->builtins()->KeyedStoreIC_PreMonomorphic(); |
| 995 case MEGAMORPHIC: |
| 996 return is_strict(language_mode) |
| 997 ? isolate->builtins()->KeyedStoreIC_Megamorphic_Strict() |
| 998 : isolate->builtins()->KeyedStoreIC_Megamorphic(); |
| 999 default: |
| 1000 UNREACHABLE(); |
| 1001 } |
| 1002 return Handle<Code>(); |
| 1003 } |
| 1004 |
| 1005 |
| 975 Handle<Code> LoadIC::megamorphic_stub() { | 1006 Handle<Code> LoadIC::megamorphic_stub() { |
| 976 if (kind() == Code::LOAD_IC) { | 1007 if (kind() == Code::LOAD_IC) { |
| 977 MegamorphicLoadStub stub(isolate(), LoadICState(extra_ic_state())); | 1008 MegamorphicLoadStub stub(isolate(), LoadICState(extra_ic_state())); |
| 978 return stub.GetCode(); | 1009 return stub.GetCode(); |
| 979 } else { | 1010 } else { |
| 980 DCHECK_EQ(Code::KEYED_LOAD_IC, kind()); | 1011 DCHECK_EQ(Code::KEYED_LOAD_IC, kind()); |
| 981 return KeyedLoadIC::ChooseMegamorphicStub(isolate()); | 1012 return KeyedLoadIC::ChooseMegamorphicStub(isolate()); |
| 982 } | 1013 } |
| 983 } | 1014 } |
| 984 | 1015 |
| (...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2967 static const Address IC_utilities[] = { | 2998 static const Address IC_utilities[] = { |
| 2968 #define ADDR(name) FUNCTION_ADDR(name), | 2999 #define ADDR(name) FUNCTION_ADDR(name), |
| 2969 IC_UTIL_LIST(ADDR) NULL | 3000 IC_UTIL_LIST(ADDR) NULL |
| 2970 #undef ADDR | 3001 #undef ADDR |
| 2971 }; | 3002 }; |
| 2972 | 3003 |
| 2973 | 3004 |
| 2974 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 3005 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
| 2975 } | 3006 } |
| 2976 } // namespace v8::internal | 3007 } // namespace v8::internal |
| OLD | NEW |