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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 PatchInlinedStore(address, Heap::fixed_array_map()); | 360 PatchInlinedStore(address, Heap::fixed_array_map()); |
361 } | 361 } |
362 | 362 |
363 | 363 |
364 void KeyedStoreIC::Clear(Address address, Code* target) { | 364 void KeyedStoreIC::Clear(Address address, Code* target) { |
365 if (target->ic_state() == UNINITIALIZED) return; | 365 if (target->ic_state() == UNINITIALIZED) return; |
366 SetTargetAtAddress(address, initialize_stub()); | 366 SetTargetAtAddress(address, initialize_stub()); |
367 } | 367 } |
368 | 368 |
369 | 369 |
| 370 Code* KeyedLoadIC::external_array_stub(JSObject::ElementsKind elements_kind) { |
| 371 switch (elements_kind) { |
| 372 case JSObject::EXTERNAL_BYTE_ELEMENTS: |
| 373 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalByteArray); |
| 374 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 375 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalUnsignedByteArray); |
| 376 case JSObject::EXTERNAL_SHORT_ELEMENTS: |
| 377 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalShortArray); |
| 378 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 379 return Builtins::builtin( |
| 380 Builtins::KeyedLoadIC_ExternalUnsignedShortArray); |
| 381 case JSObject::EXTERNAL_INT_ELEMENTS: |
| 382 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalIntArray); |
| 383 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 384 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalUnsignedIntArray); |
| 385 case JSObject::EXTERNAL_FLOAT_ELEMENTS: |
| 386 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalFloatArray); |
| 387 default: |
| 388 UNREACHABLE(); |
| 389 return NULL; |
| 390 } |
| 391 } |
| 392 |
| 393 |
| 394 Code* KeyedStoreIC::external_array_stub(JSObject::ElementsKind elements_kind) { |
| 395 switch (elements_kind) { |
| 396 case JSObject::EXTERNAL_BYTE_ELEMENTS: |
| 397 return Builtins::builtin(Builtins::KeyedStoreIC_ExternalByteArray); |
| 398 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 399 return Builtins::builtin( |
| 400 Builtins::KeyedStoreIC_ExternalUnsignedByteArray); |
| 401 case JSObject::EXTERNAL_SHORT_ELEMENTS: |
| 402 return Builtins::builtin(Builtins::KeyedStoreIC_ExternalShortArray); |
| 403 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 404 return Builtins::builtin( |
| 405 Builtins::KeyedStoreIC_ExternalUnsignedShortArray); |
| 406 case JSObject::EXTERNAL_INT_ELEMENTS: |
| 407 return Builtins::builtin(Builtins::KeyedStoreIC_ExternalIntArray); |
| 408 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 409 return Builtins::builtin(Builtins::KeyedStoreIC_ExternalUnsignedIntArray); |
| 410 case JSObject::EXTERNAL_FLOAT_ELEMENTS: |
| 411 return Builtins::builtin(Builtins::KeyedStoreIC_ExternalFloatArray); |
| 412 default: |
| 413 UNREACHABLE(); |
| 414 return NULL; |
| 415 } |
| 416 } |
| 417 |
| 418 |
370 static bool HasInterceptorGetter(JSObject* object) { | 419 static bool HasInterceptorGetter(JSObject* object) { |
371 return !object->GetNamedInterceptor()->getter()->IsUndefined(); | 420 return !object->GetNamedInterceptor()->getter()->IsUndefined(); |
372 } | 421 } |
373 | 422 |
374 | 423 |
375 static void LookupForRead(Object* object, | 424 static void LookupForRead(Object* object, |
376 String* name, | 425 String* name, |
377 LookupResult* lookup) { | 426 LookupResult* lookup) { |
378 AssertNoAllocation no_gc; // pointers must stay valid | 427 AssertNoAllocation no_gc; // pointers must stay valid |
379 | 428 |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 // the global object). | 1236 // the global object). |
1188 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded(); | 1237 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded(); |
1189 | 1238 |
1190 if (use_ic) { | 1239 if (use_ic) { |
1191 Code* stub = generic_stub(); | 1240 Code* stub = generic_stub(); |
1192 if (object->IsString() && key->IsNumber()) { | 1241 if (object->IsString() && key->IsNumber()) { |
1193 stub = string_stub(); | 1242 stub = string_stub(); |
1194 } else if (object->IsJSObject()) { | 1243 } else if (object->IsJSObject()) { |
1195 Handle<JSObject> receiver = Handle<JSObject>::cast(object); | 1244 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
1196 if (receiver->HasExternalArrayElements()) { | 1245 if (receiver->HasExternalArrayElements()) { |
1197 MaybeObject* probe = | 1246 stub = external_array_stub(receiver->GetElementsKind()); |
1198 StubCache::ComputeKeyedLoadOrStoreExternalArray(*receiver, false); | |
1199 stub = | |
1200 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked()); | |
1201 } else if (receiver->HasIndexedInterceptor()) { | 1247 } else if (receiver->HasIndexedInterceptor()) { |
1202 stub = indexed_interceptor_stub(); | 1248 stub = indexed_interceptor_stub(); |
1203 } else if (state == UNINITIALIZED && | 1249 } else if (state == UNINITIALIZED && |
1204 key->IsSmi() && | 1250 key->IsSmi() && |
1205 receiver->map()->has_fast_elements()) { | 1251 receiver->map()->has_fast_elements()) { |
1206 MaybeObject* probe = StubCache::ComputeKeyedLoadSpecialized(*receiver); | 1252 MaybeObject* probe = StubCache::ComputeKeyedLoadSpecialized(*receiver); |
1207 stub = | 1253 stub = |
1208 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked()); | 1254 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked()); |
1209 } | 1255 } |
1210 } | 1256 } |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 // Do not use ICs for objects that require access checks (including | 1629 // Do not use ICs for objects that require access checks (including |
1584 // the global object). | 1630 // the global object). |
1585 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded(); | 1631 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded(); |
1586 ASSERT(!(use_ic && object->IsJSGlobalProxy())); | 1632 ASSERT(!(use_ic && object->IsJSGlobalProxy())); |
1587 | 1633 |
1588 if (use_ic) { | 1634 if (use_ic) { |
1589 Code* stub = generic_stub(); | 1635 Code* stub = generic_stub(); |
1590 if (object->IsJSObject()) { | 1636 if (object->IsJSObject()) { |
1591 Handle<JSObject> receiver = Handle<JSObject>::cast(object); | 1637 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
1592 if (receiver->HasExternalArrayElements()) { | 1638 if (receiver->HasExternalArrayElements()) { |
1593 MaybeObject* probe = | 1639 stub = external_array_stub(receiver->GetElementsKind()); |
1594 StubCache::ComputeKeyedLoadOrStoreExternalArray(*receiver, true); | |
1595 stub = | |
1596 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked()); | |
1597 } else if (state == UNINITIALIZED && | 1640 } else if (state == UNINITIALIZED && |
1598 key->IsSmi() && | 1641 key->IsSmi() && |
1599 receiver->map()->has_fast_elements()) { | 1642 receiver->map()->has_fast_elements()) { |
1600 MaybeObject* probe = StubCache::ComputeKeyedStoreSpecialized(*receiver); | 1643 MaybeObject* probe = StubCache::ComputeKeyedStoreSpecialized(*receiver); |
1601 stub = | 1644 stub = |
1602 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked()); | 1645 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked()); |
1603 } | 1646 } |
1604 } | 1647 } |
1605 if (stub != NULL) set_target(stub); | 1648 if (stub != NULL) set_target(stub); |
1606 } | 1649 } |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2230 #undef ADDR | 2273 #undef ADDR |
2231 }; | 2274 }; |
2232 | 2275 |
2233 | 2276 |
2234 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2277 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2235 return IC_utilities[id]; | 2278 return IC_utilities[id]; |
2236 } | 2279 } |
2237 | 2280 |
2238 | 2281 |
2239 } } // namespace v8::internal | 2282 } } // namespace v8::internal |
OLD | NEW |