Chromium Code Reviews| 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 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1341 return isolate()->stub_cache()->ComputeLoadGlobal( | 1341 return isolate()->stub_cache()->ComputeLoadGlobal( |
| 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 { |
|
Toon Verwaest
2013/09/24 15:37:38
Remove extra { .. }
| |
| 1352 if (name->Equals(isolate()->heap()->length_string())) { | 1352 // Use simple field loads for some well-known callback properties. |
| 1353 if (receiver->IsJSArray()) { | 1353 int object_offset; |
| 1354 PropertyIndex lengthIndex = PropertyIndex::NewHeaderIndex( | 1354 Handle<Map> map(receiver->map()); |
| 1355 JSArray::kLengthOffset / kPointerSize); | 1355 if (Accessors::IsJSObjectFieldAccessor(map, name, &object_offset)) { |
| 1356 PropertyIndex index = | |
| 1357 PropertyIndex::NewHeaderIndex(object_offset / kPointerSize); | |
| 1356 return isolate()->stub_cache()->ComputeLoadField( | 1358 return isolate()->stub_cache()->ComputeLoadField( |
| 1357 name, receiver, receiver, lengthIndex, Representation::Tagged()); | 1359 name, receiver, receiver, index, 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 } | 1360 } |
| 1364 } | 1361 } |
| 1362 | |
| 1363 Handle<Object> callback(lookup->GetCallbackObject(), isolate()); | |
| 1365 if (callback->IsExecutableAccessorInfo()) { | 1364 if (callback->IsExecutableAccessorInfo()) { |
| 1366 Handle<ExecutableAccessorInfo> info = | 1365 Handle<ExecutableAccessorInfo> info = |
| 1367 Handle<ExecutableAccessorInfo>::cast(callback); | 1366 Handle<ExecutableAccessorInfo>::cast(callback); |
| 1368 if (v8::ToCData<Address>(info->getter()) == 0) break; | 1367 if (v8::ToCData<Address>(info->getter()) == 0) break; |
| 1369 if (!info->IsCompatibleReceiver(*receiver)) break; | 1368 if (!info->IsCompatibleReceiver(*receiver)) break; |
| 1370 return isolate()->stub_cache()->ComputeLoadCallback( | 1369 return isolate()->stub_cache()->ComputeLoadCallback( |
| 1371 name, receiver, holder, info); | 1370 name, receiver, holder, info); |
| 1372 } else if (callback->IsAccessorPair()) { | 1371 } else if (callback->IsAccessorPair()) { |
| 1373 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter(), | 1372 Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter(), |
| 1374 isolate()); | 1373 isolate()); |
| (...skipping 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3163 #undef ADDR | 3162 #undef ADDR |
| 3164 }; | 3163 }; |
| 3165 | 3164 |
| 3166 | 3165 |
| 3167 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3166 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 3168 return IC_utilities[id]; | 3167 return IC_utilities[id]; |
| 3169 } | 3168 } |
| 3170 | 3169 |
| 3171 | 3170 |
| 3172 } } // namespace v8::internal | 3171 } } // namespace v8::internal |
| OLD | NEW |