| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1350 if (v8::ToCData<Address>(info->getter()) == 0) break; | 1350 if (v8::ToCData<Address>(info->getter()) == 0) break; |
| 1351 if (!info->IsCompatibleReceiver(*receiver)) break; | 1351 if (!info->IsCompatibleReceiver(*receiver)) break; |
| 1352 return isolate()->stub_cache()->ComputeLoadCallback( | 1352 return isolate()->stub_cache()->ComputeLoadCallback( |
| 1353 name, receiver, holder, info); | 1353 name, receiver, holder, info); |
| 1354 } else if (callback->IsAccessorPair()) { | 1354 } else if (callback->IsAccessorPair()) { |
| 1355 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter(), | 1355 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter(), |
| 1356 isolate()); | 1356 isolate()); |
| 1357 if (!getter->IsJSFunction()) break; | 1357 if (!getter->IsJSFunction()) break; |
| 1358 if (holder->IsGlobalObject()) break; | 1358 if (holder->IsGlobalObject()) break; |
| 1359 if (!holder->HasFastProperties()) break; | 1359 if (!holder->HasFastProperties()) break; |
| 1360 Handle<JSFunction> function = Handle<JSFunction>::cast(getter); | |
| 1361 CallOptimization call_optimization(function); | |
| 1362 if (call_optimization.is_simple_api_call() && | |
| 1363 call_optimization.IsCompatibleReceiver(*receiver)) { | |
| 1364 return isolate()->stub_cache()->ComputeLoadCallback( | |
| 1365 name, receiver, holder, call_optimization); | |
| 1366 } | |
| 1367 return isolate()->stub_cache()->ComputeLoadViaGetter( | 1360 return isolate()->stub_cache()->ComputeLoadViaGetter( |
| 1368 name, receiver, holder, function); | 1361 name, receiver, holder, Handle<JSFunction>::cast(getter)); |
| 1369 } else if (receiver->IsJSArray() && | 1362 } else if (receiver->IsJSArray() && |
| 1370 name->Equals(isolate()->heap()->length_string())) { | 1363 name->Equals(isolate()->heap()->length_string())) { |
| 1371 PropertyIndex lengthIndex = | 1364 PropertyIndex lengthIndex = |
| 1372 PropertyIndex::NewHeaderIndex(JSArray::kLengthOffset / kPointerSize); | 1365 PropertyIndex::NewHeaderIndex(JSArray::kLengthOffset / kPointerSize); |
| 1373 return isolate()->stub_cache()->ComputeLoadField( | 1366 return isolate()->stub_cache()->ComputeLoadField( |
| 1374 name, receiver, holder, lengthIndex, Representation::Tagged()); | 1367 name, receiver, holder, lengthIndex, Representation::Tagged()); |
| 1375 } | 1368 } |
| 1376 // TODO(dcarney): Handle correctly. | 1369 // TODO(dcarney): Handle correctly. |
| 1377 if (callback->IsDeclaredAccessorInfo()) break; | 1370 if (callback->IsDeclaredAccessorInfo()) break; |
| 1378 ASSERT(callback->IsForeign()); | 1371 ASSERT(callback->IsForeign()); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1544 Handle<Object> constant(lookup->GetConstant(), isolate()); | 1537 Handle<Object> constant(lookup->GetConstant(), isolate()); |
| 1545 // TODO(2803): Don't compute a stub for cons strings because they cannot | 1538 // TODO(2803): Don't compute a stub for cons strings because they cannot |
| 1546 // be embedded into code. | 1539 // be embedded into code. |
| 1547 if (constant->IsConsString()) return Handle<Code>::null(); | 1540 if (constant->IsConsString()) return Handle<Code>::null(); |
| 1548 return isolate()->stub_cache()->ComputeKeyedLoadConstant( | 1541 return isolate()->stub_cache()->ComputeKeyedLoadConstant( |
| 1549 name, receiver, holder, constant); | 1542 name, receiver, holder, constant); |
| 1550 } | 1543 } |
| 1551 case CALLBACKS: { | 1544 case CALLBACKS: { |
| 1552 Handle<Object> callback_object(lookup->GetCallbackObject(), isolate()); | 1545 Handle<Object> callback_object(lookup->GetCallbackObject(), isolate()); |
| 1553 // TODO(dcarney): Handle DeclaredAccessorInfo correctly. | 1546 // TODO(dcarney): Handle DeclaredAccessorInfo correctly. |
| 1554 if (callback_object->IsExecutableAccessorInfo()) { | 1547 if (!callback_object->IsExecutableAccessorInfo()) break; |
| 1555 Handle<ExecutableAccessorInfo> callback = | 1548 Handle<ExecutableAccessorInfo> callback = |
| 1556 Handle<ExecutableAccessorInfo>::cast(callback_object); | 1549 Handle<ExecutableAccessorInfo>::cast(callback_object); |
| 1557 if (v8::ToCData<Address>(callback->getter()) == 0) break; | 1550 if (v8::ToCData<Address>(callback->getter()) == 0) break; |
| 1558 if (!callback->IsCompatibleReceiver(*receiver)) break; | 1551 if (!callback->IsCompatibleReceiver(*receiver)) break; |
| 1559 return isolate()->stub_cache()->ComputeKeyedLoadCallback( | 1552 return isolate()->stub_cache()->ComputeKeyedLoadCallback( |
| 1560 name, receiver, holder, callback); | 1553 name, receiver, holder, callback); |
| 1561 } else if (callback_object->IsAccessorPair()) { | |
| 1562 Handle<Object> getter( | |
| 1563 Handle<AccessorPair>::cast(callback_object)->getter(), | |
| 1564 isolate()); | |
| 1565 if (!getter->IsJSFunction()) break; | |
| 1566 if (holder->IsGlobalObject()) break; | |
| 1567 if (!holder->HasFastProperties()) break; | |
| 1568 Handle<JSFunction> function = Handle<JSFunction>::cast(getter); | |
| 1569 CallOptimization call_optimization(function); | |
| 1570 if (call_optimization.is_simple_api_call() && | |
| 1571 call_optimization.IsCompatibleReceiver(*receiver)) { | |
| 1572 return isolate()->stub_cache()->ComputeKeyedLoadCallback( | |
| 1573 name, receiver, holder, call_optimization); | |
| 1574 } | |
| 1575 } | |
| 1576 break; | |
| 1577 } | 1554 } |
| 1578 case INTERCEPTOR: | 1555 case INTERCEPTOR: |
| 1579 ASSERT(HasInterceptorGetter(lookup->holder())); | 1556 ASSERT(HasInterceptorGetter(lookup->holder())); |
| 1580 return isolate()->stub_cache()->ComputeKeyedLoadInterceptor( | 1557 return isolate()->stub_cache()->ComputeKeyedLoadInterceptor( |
| 1581 name, receiver, holder); | 1558 name, receiver, holder); |
| 1582 default: | 1559 default: |
| 1583 // Always rewrite to the generic case so that we do not | 1560 // Always rewrite to the generic case so that we do not |
| 1584 // repeatedly try to rewrite. | 1561 // repeatedly try to rewrite. |
| 1585 return generic_stub(); | 1562 return generic_stub(); |
| 1586 } | 1563 } |
| (...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3129 #undef ADDR | 3106 #undef ADDR |
| 3130 }; | 3107 }; |
| 3131 | 3108 |
| 3132 | 3109 |
| 3133 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3110 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 3134 return IC_utilities[id]; | 3111 return IC_utilities[id]; |
| 3135 } | 3112 } |
| 3136 | 3113 |
| 3137 | 3114 |
| 3138 } } // namespace v8::internal | 3115 } } // namespace v8::internal |
| OLD | NEW |