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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 Handle<Code> LoadIC::initialize_stub(Isolate* isolate, | 942 Handle<Code> LoadIC::initialize_stub(Isolate* isolate, |
943 ExtraICState extra_state) { | 943 ExtraICState extra_state) { |
944 if (FLAG_vector_ics) { | 944 if (FLAG_vector_ics) { |
945 return LoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode(); | 945 return LoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode(); |
946 } | 946 } |
947 | 947 |
948 return PropertyICCompiler::ComputeLoad(isolate, UNINITIALIZED, extra_state); | 948 return PropertyICCompiler::ComputeLoad(isolate, UNINITIALIZED, extra_state); |
949 } | 949 } |
950 | 950 |
951 | 951 |
| 952 Handle<Code> LoadIC::load_global(Isolate* isolate, Handle<GlobalObject> global, |
| 953 Handle<String> name) { |
| 954 Handle<ScriptContextTable> script_contexts( |
| 955 global->native_context()->script_context_table()); |
| 956 |
| 957 ScriptContextTable::LookupResult lookup_result; |
| 958 if (ScriptContextTable::Lookup(script_contexts, name, &lookup_result)) { |
| 959 return initialize_stub(isolate, LoadICState(CONTEXTUAL).GetExtraICState()); |
| 960 } |
| 961 |
| 962 Handle<Map> global_map(global->map()); |
| 963 Handle<Code> handler = PropertyHandlerCompiler::Find( |
| 964 name, global_map, Code::LOAD_IC, kCacheOnReceiver, Code::NORMAL); |
| 965 if (handler.is_null()) { |
| 966 LookupIterator it(global, name); |
| 967 if (!it.IsFound() || !it.GetHolder<JSObject>().is_identical_to(global) || |
| 968 it.state() != LookupIterator::DATA) { |
| 969 return initialize_stub(isolate, |
| 970 LoadICState(CONTEXTUAL).GetExtraICState()); |
| 971 } |
| 972 NamedLoadHandlerCompiler compiler(isolate, global_map, global, |
| 973 kCacheOnReceiver); |
| 974 Handle<PropertyCell> cell = it.GetPropertyCell(); |
| 975 handler = compiler.CompileLoadGlobal(cell, name, it.IsConfigurable()); |
| 976 Map::UpdateCodeCache(global_map, name, handler); |
| 977 } |
| 978 return PropertyICCompiler::ComputeMonomorphic( |
| 979 Code::LOAD_IC, name, handle(global->map()), handler, |
| 980 LoadICState(CONTEXTUAL).GetExtraICState()); |
| 981 } |
| 982 |
| 983 |
952 Handle<Code> LoadIC::initialize_stub_in_optimized_code( | 984 Handle<Code> LoadIC::initialize_stub_in_optimized_code( |
953 Isolate* isolate, ExtraICState extra_state, State initialization_state) { | 985 Isolate* isolate, ExtraICState extra_state, State initialization_state) { |
954 if (FLAG_vector_ics) { | 986 if (FLAG_vector_ics) { |
955 return VectorLoadStub(isolate, LoadICState(extra_state)).GetCode(); | 987 return VectorLoadStub(isolate, LoadICState(extra_state)).GetCode(); |
956 } | 988 } |
957 return PropertyICCompiler::ComputeLoad(isolate, initialization_state, | 989 return PropertyICCompiler::ComputeLoad(isolate, initialization_state, |
958 extra_state); | 990 extra_state); |
959 } | 991 } |
960 | 992 |
961 | 993 |
(...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3013 static const Address IC_utilities[] = { | 3045 static const Address IC_utilities[] = { |
3014 #define ADDR(name) FUNCTION_ADDR(name), | 3046 #define ADDR(name) FUNCTION_ADDR(name), |
3015 IC_UTIL_LIST(ADDR) NULL | 3047 IC_UTIL_LIST(ADDR) NULL |
3016 #undef ADDR | 3048 #undef ADDR |
3017 }; | 3049 }; |
3018 | 3050 |
3019 | 3051 |
3020 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 3052 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
3021 } | 3053 } |
3022 } // namespace v8::internal | 3054 } // namespace v8::internal |
OLD | NEW |