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 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 name, receiver, global, cell, lookup->IsDontDelete()); | 1342 name, receiver, global, cell, lookup->IsDontDelete()); |
1343 } | 1343 } |
1344 // There is only one shared stub for loading normalized | 1344 // There is only one shared stub for loading normalized |
1345 // properties. It does not traverse the prototype chain, so the | 1345 // properties. It does not traverse the prototype chain, so the |
1346 // property must be found in the receiver for the stub to be | 1346 // property must be found in the receiver for the stub to be |
1347 // applicable. | 1347 // applicable. |
1348 if (!holder.is_identical_to(receiver)) break; | 1348 if (!holder.is_identical_to(receiver)) break; |
1349 return isolate()->stub_cache()->ComputeLoadNormal(name, receiver); | 1349 return isolate()->stub_cache()->ComputeLoadNormal(name, receiver); |
1350 case CALLBACKS: { | 1350 case CALLBACKS: { |
1351 Handle<Object> callback(lookup->GetCallbackObject(), isolate()); | 1351 Handle<Object> callback(lookup->GetCallbackObject(), isolate()); |
| 1352 if (name->Equals(isolate()->heap()->length_string())) { |
| 1353 if (receiver->IsJSArray()) { |
| 1354 PropertyIndex lengthIndex = PropertyIndex::NewHeaderIndex( |
| 1355 JSArray::kLengthOffset / kPointerSize); |
| 1356 return isolate()->stub_cache()->ComputeLoadField( |
| 1357 name, receiver, receiver, lengthIndex, Representation::Tagged()); |
| 1358 } else if (receiver->IsJSTypedArray()) { |
| 1359 PropertyIndex lengthIndex = PropertyIndex::NewHeaderIndex( |
| 1360 JSTypedArray::kLengthOffset / kPointerSize); |
| 1361 return isolate()->stub_cache()->ComputeLoadField( |
| 1362 name, receiver, receiver, lengthIndex, Representation::Tagged()); |
| 1363 } |
| 1364 } |
1352 if (callback->IsExecutableAccessorInfo()) { | 1365 if (callback->IsExecutableAccessorInfo()) { |
1353 Handle<ExecutableAccessorInfo> info = | 1366 Handle<ExecutableAccessorInfo> info = |
1354 Handle<ExecutableAccessorInfo>::cast(callback); | 1367 Handle<ExecutableAccessorInfo>::cast(callback); |
1355 if (v8::ToCData<Address>(info->getter()) == 0) break; | 1368 if (v8::ToCData<Address>(info->getter()) == 0) break; |
1356 if (!info->IsCompatibleReceiver(*receiver)) break; | 1369 if (!info->IsCompatibleReceiver(*receiver)) break; |
1357 return isolate()->stub_cache()->ComputeLoadCallback( | 1370 return isolate()->stub_cache()->ComputeLoadCallback( |
1358 name, receiver, holder, info); | 1371 name, receiver, holder, info); |
1359 } else if (callback->IsAccessorPair()) { | 1372 } else if (callback->IsAccessorPair()) { |
1360 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter(), | 1373 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter(), |
1361 isolate()); | 1374 isolate()); |
1362 if (!getter->IsJSFunction()) break; | 1375 if (!getter->IsJSFunction()) break; |
1363 if (holder->IsGlobalObject()) break; | 1376 if (holder->IsGlobalObject()) break; |
1364 if (!holder->HasFastProperties()) break; | 1377 if (!holder->HasFastProperties()) break; |
1365 Handle<JSFunction> function = Handle<JSFunction>::cast(getter); | 1378 Handle<JSFunction> function = Handle<JSFunction>::cast(getter); |
1366 CallOptimization call_optimization(function); | 1379 CallOptimization call_optimization(function); |
1367 if (call_optimization.is_simple_api_call() && | 1380 if (call_optimization.is_simple_api_call() && |
1368 call_optimization.IsCompatibleReceiver(*receiver)) { | 1381 call_optimization.IsCompatibleReceiver(*receiver)) { |
1369 return isolate()->stub_cache()->ComputeLoadCallback( | 1382 return isolate()->stub_cache()->ComputeLoadCallback( |
1370 name, receiver, holder, call_optimization); | 1383 name, receiver, holder, call_optimization); |
1371 } | 1384 } |
1372 return isolate()->stub_cache()->ComputeLoadViaGetter( | 1385 return isolate()->stub_cache()->ComputeLoadViaGetter( |
1373 name, receiver, holder, function); | 1386 name, receiver, holder, function); |
1374 } else if (receiver->IsJSArray() && | |
1375 name->Equals(isolate()->heap()->length_string())) { | |
1376 PropertyIndex lengthIndex = PropertyIndex::NewHeaderIndex( | |
1377 JSArray::kLengthOffset / kPointerSize); | |
1378 return isolate()->stub_cache()->ComputeLoadField( | |
1379 name, receiver, holder, lengthIndex, Representation::Tagged()); | |
1380 } | 1387 } |
1381 // TODO(dcarney): Handle correctly. | 1388 // TODO(dcarney): Handle correctly. |
1382 if (callback->IsDeclaredAccessorInfo()) break; | 1389 if (callback->IsDeclaredAccessorInfo()) break; |
1383 ASSERT(callback->IsForeign()); | 1390 ASSERT(callback->IsForeign()); |
1384 // No IC support for old-style native accessors. | 1391 // No IC support for old-style native accessors. |
1385 break; | 1392 break; |
1386 } | 1393 } |
1387 case INTERCEPTOR: | 1394 case INTERCEPTOR: |
1388 ASSERT(HasInterceptorGetter(*holder)); | 1395 ASSERT(HasInterceptorGetter(*holder)); |
1389 return isolate()->stub_cache()->ComputeLoadInterceptor( | 1396 return isolate()->stub_cache()->ComputeLoadInterceptor( |
(...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3156 #undef ADDR | 3163 #undef ADDR |
3157 }; | 3164 }; |
3158 | 3165 |
3159 | 3166 |
3160 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3167 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
3161 return IC_utilities[id]; | 3168 return IC_utilities[id]; |
3162 } | 3169 } |
3163 | 3170 |
3164 | 3171 |
3165 } } // namespace v8::internal | 3172 } } // namespace v8::internal |
OLD | NEW |