| 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 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 return key; | 1226 return key; |
| 1227 } | 1227 } |
| 1228 | 1228 |
| 1229 | 1229 |
| 1230 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { | 1230 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { |
| 1231 Handle<Map> receiver_map(receiver->map(), isolate()); | 1231 Handle<Map> receiver_map(receiver->map(), isolate()); |
| 1232 MapHandleList target_receiver_maps; | 1232 MapHandleList target_receiver_maps; |
| 1233 TargetMaps(&target_receiver_maps); | 1233 TargetMaps(&target_receiver_maps); |
| 1234 | 1234 |
| 1235 if (target_receiver_maps.length() == 0) { | 1235 if (target_receiver_maps.length() == 0) { |
| 1236 return PropertyICCompiler::ComputeKeyedLoadMonomorphic(receiver_map); | 1236 return PropertyICCompiler::ComputeKeyedLoadMonomorphic(receiver_map, |
| 1237 extra_ic_state()); |
| 1237 } | 1238 } |
| 1238 | 1239 |
| 1239 // The first time a receiver is seen that is a transitioned version of the | 1240 // The first time a receiver is seen that is a transitioned version of the |
| 1240 // previous monomorphic receiver type, assume the new ElementsKind is the | 1241 // previous monomorphic receiver type, assume the new ElementsKind is the |
| 1241 // monomorphic type. This benefits global arrays that only transition | 1242 // monomorphic type. This benefits global arrays that only transition |
| 1242 // once, and all call sites accessing them are faster if they remain | 1243 // once, and all call sites accessing them are faster if they remain |
| 1243 // monomorphic. If this optimistic assumption is not true, the IC will | 1244 // monomorphic. If this optimistic assumption is not true, the IC will |
| 1244 // miss again and it will become polymorphic and support both the | 1245 // miss again and it will become polymorphic and support both the |
| 1245 // untransitioned and transitioned maps. | 1246 // untransitioned and transitioned maps. |
| 1246 if (state() == MONOMORPHIC && !receiver->IsString() && | 1247 if (state() == MONOMORPHIC && !receiver->IsString() && |
| 1247 IsMoreGeneralElementsKindTransition( | 1248 IsMoreGeneralElementsKindTransition( |
| 1248 target_receiver_maps.at(0)->elements_kind(), | 1249 target_receiver_maps.at(0)->elements_kind(), |
| 1249 Handle<JSObject>::cast(receiver)->GetElementsKind())) { | 1250 Handle<JSObject>::cast(receiver)->GetElementsKind())) { |
| 1250 return PropertyICCompiler::ComputeKeyedLoadMonomorphic(receiver_map); | 1251 return PropertyICCompiler::ComputeKeyedLoadMonomorphic(receiver_map, |
| 1252 extra_ic_state()); |
| 1251 } | 1253 } |
| 1252 | 1254 |
| 1253 DCHECK(state() != GENERIC); | 1255 DCHECK(state() != GENERIC); |
| 1254 | 1256 |
| 1255 // Determine the list of receiver maps that this call site has seen, | 1257 // Determine the list of receiver maps that this call site has seen, |
| 1256 // adding the map that was just encountered. | 1258 // adding the map that was just encountered. |
| 1257 if (!AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map)) { | 1259 if (!AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map)) { |
| 1258 // If the miss wasn't due to an unseen map, a polymorphic stub | 1260 // If the miss wasn't due to an unseen map, a polymorphic stub |
| 1259 // won't help, use the generic stub. | 1261 // won't help, use the generic stub. |
| 1260 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "same map added twice"); | 1262 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "same map added twice"); |
| 1261 return generic_stub(); | 1263 return generic_stub(); |
| 1262 } | 1264 } |
| 1263 | 1265 |
| 1264 // If the maximum number of receiver maps has been exceeded, use the generic | 1266 // If the maximum number of receiver maps has been exceeded, use the generic |
| 1265 // version of the IC. | 1267 // version of the IC. |
| 1266 if (target_receiver_maps.length() > kMaxKeyedPolymorphism) { | 1268 if (target_receiver_maps.length() > kMaxKeyedPolymorphism) { |
| 1267 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "max polymorph exceeded"); | 1269 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "max polymorph exceeded"); |
| 1268 return generic_stub(); | 1270 return generic_stub(); |
| 1269 } | 1271 } |
| 1270 | 1272 |
| 1271 return PropertyICCompiler::ComputeKeyedLoadPolymorphic(&target_receiver_maps); | 1273 return PropertyICCompiler::ComputeKeyedLoadPolymorphic(&target_receiver_maps, |
| 1274 extra_ic_state()); |
| 1272 } | 1275 } |
| 1273 | 1276 |
| 1274 | 1277 |
| 1275 MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object, | 1278 MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object, |
| 1276 Handle<Object> key) { | 1279 Handle<Object> key) { |
| 1277 if (MigrateDeprecated(object)) { | 1280 if (MigrateDeprecated(object)) { |
| 1278 Handle<Object> result; | 1281 Handle<Object> result; |
| 1279 ASSIGN_RETURN_ON_EXCEPTION( | 1282 ASSIGN_RETURN_ON_EXCEPTION( |
| 1280 isolate(), result, Runtime::GetObjectProperty(isolate(), object, key), | 1283 isolate(), result, Runtime::GetObjectProperty(isolate(), object, key), |
| 1281 Object); | 1284 Object); |
| (...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2781 static const Address IC_utilities[] = { | 2784 static const Address IC_utilities[] = { |
| 2782 #define ADDR(name) FUNCTION_ADDR(name), | 2785 #define ADDR(name) FUNCTION_ADDR(name), |
| 2783 IC_UTIL_LIST(ADDR) NULL | 2786 IC_UTIL_LIST(ADDR) NULL |
| 2784 #undef ADDR | 2787 #undef ADDR |
| 2785 }; | 2788 }; |
| 2786 | 2789 |
| 2787 | 2790 |
| 2788 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 2791 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
| 2789 } | 2792 } |
| 2790 } // namespace v8::internal | 2793 } // namespace v8::internal |
| OLD | NEW |