| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 | 1197 |
| 1198 return object->GetProperty(*object, &lookup, *name, &attr); | 1198 return object->GetProperty(*object, &lookup, *name, &attr); |
| 1199 } | 1199 } |
| 1200 | 1200 |
| 1201 // Do not use ICs for objects that require access checks (including | 1201 // Do not use ICs for objects that require access checks (including |
| 1202 // the global object). | 1202 // the global object). |
| 1203 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded(); | 1203 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded(); |
| 1204 | 1204 |
| 1205 if (use_ic) { | 1205 if (use_ic) { |
| 1206 Code* stub = generic_stub(); | 1206 Code* stub = generic_stub(); |
| 1207 if (state == UNINITIALIZED) { | 1207 if (object->IsString() && key->IsNumber()) { |
| 1208 if (object->IsString() && key->IsNumber()) { | 1208 stub = string_stub(); |
| 1209 stub = string_stub(); | 1209 } else if (object->IsJSObject()) { |
| 1210 } else if (object->IsJSObject()) { | 1210 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
| 1211 Handle<JSObject> receiver = Handle<JSObject>::cast(object); | 1211 if (receiver->HasExternalArrayElements()) { |
| 1212 if (receiver->HasExternalArrayElements()) { | 1212 MaybeObject* probe = |
| 1213 MaybeObject* probe = | |
| 1214 StubCache::ComputeKeyedLoadOrStoreExternalArray(*receiver, false); | 1213 StubCache::ComputeKeyedLoadOrStoreExternalArray(*receiver, false); |
| 1215 stub = | 1214 stub = |
| 1216 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked()); | 1215 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked()); |
| 1217 } else if (receiver->HasPixelElements()) { | 1216 } else if (receiver->HasIndexedInterceptor()) { |
| 1218 stub = pixel_array_stub(); | 1217 stub = indexed_interceptor_stub(); |
| 1219 } else if (receiver->HasIndexedInterceptor()) { | 1218 } else if (state == UNINITIALIZED && |
| 1220 stub = indexed_interceptor_stub(); | 1219 key->IsSmi() && |
| 1221 } else if (key->IsSmi() && | 1220 receiver->map()->has_fast_elements()) { |
| 1222 receiver->map()->has_fast_elements()) { | 1221 MaybeObject* probe = StubCache::ComputeKeyedLoadSpecialized(*receiver); |
| 1223 MaybeObject* probe = | 1222 stub = |
| 1224 StubCache::ComputeKeyedLoadSpecialized(*receiver); | |
| 1225 stub = | |
| 1226 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked()); | 1223 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked()); |
| 1227 } | |
| 1228 } | 1224 } |
| 1229 } | 1225 } |
| 1230 if (stub != NULL) set_target(stub); | 1226 if (stub != NULL) set_target(stub); |
| 1231 | 1227 |
| 1232 #ifdef DEBUG | 1228 #ifdef DEBUG |
| 1233 TraceIC("KeyedLoadIC", key, state, target()); | 1229 TraceIC("KeyedLoadIC", key, state, target()); |
| 1234 #endif // DEBUG | 1230 #endif // DEBUG |
| 1235 | 1231 |
| 1236 // For JSObjects with fast elements that are not value wrappers | 1232 // For JSObjects with fast elements that are not value wrappers |
| 1237 // and that do not have indexed interceptors, we initialize the | 1233 // and that do not have indexed interceptors, we initialize the |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2249 #undef ADDR | 2245 #undef ADDR |
| 2250 }; | 2246 }; |
| 2251 | 2247 |
| 2252 | 2248 |
| 2253 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2249 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 2254 return IC_utilities[id]; | 2250 return IC_utilities[id]; |
| 2255 } | 2251 } |
| 2256 | 2252 |
| 2257 | 2253 |
| 2258 } } // namespace v8::internal | 2254 } } // namespace v8::internal |
| OLD | NEW |