| 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 case Code::TO_BOOLEAN_IC: | 396 case Code::TO_BOOLEAN_IC: |
| 397 // Clearing these is tricky and does not | 397 // Clearing these is tricky and does not |
| 398 // make any performance difference. | 398 // make any performance difference. |
| 399 return; | 399 return; |
| 400 default: UNREACHABLE(); | 400 default: UNREACHABLE(); |
| 401 } | 401 } |
| 402 } | 402 } |
| 403 | 403 |
| 404 | 404 |
| 405 void CallICBase::Clear(Address address, Code* target) { | 405 void CallICBase::Clear(Address address, Code* target) { |
| 406 if (target->ic_state() == UNINITIALIZED) return; | 406 if (IsCleared(target)) return; |
| 407 bool contextual = CallICBase::Contextual::decode(target->extra_ic_state()); | 407 bool contextual = CallICBase::Contextual::decode(target->extra_ic_state()); |
| 408 Code* code = | 408 Code* code = |
| 409 target->GetIsolate()->stub_cache()->FindCallInitialize( | 409 target->GetIsolate()->stub_cache()->FindCallInitialize( |
| 410 target->arguments_count(), | 410 target->arguments_count(), |
| 411 contextual ? RelocInfo::CODE_TARGET_CONTEXT : RelocInfo::CODE_TARGET, | 411 contextual ? RelocInfo::CODE_TARGET_CONTEXT : RelocInfo::CODE_TARGET, |
| 412 target->kind()); | 412 target->kind()); |
| 413 SetTargetAtAddress(address, code); | 413 SetTargetAtAddress(address, code); |
| 414 } | 414 } |
| 415 | 415 |
| 416 | 416 |
| 417 void KeyedLoadIC::Clear(Isolate* isolate, Address address, Code* target) { | 417 void KeyedLoadIC::Clear(Isolate* isolate, Address address, Code* target) { |
| 418 if (target->ic_state() == UNINITIALIZED) return; | 418 if (IsCleared(target)) return; |
| 419 // Make sure to also clear the map used in inline fast cases. If we | 419 // Make sure to also clear the map used in inline fast cases. If we |
| 420 // do not clear these maps, cached code can keep objects alive | 420 // do not clear these maps, cached code can keep objects alive |
| 421 // through the embedded maps. | 421 // through the embedded maps. |
| 422 SetTargetAtAddress(address, *initialize_stub(isolate)); | 422 SetTargetAtAddress(address, *pre_monomorphic_stub(isolate)); |
| 423 } | 423 } |
| 424 | 424 |
| 425 | 425 |
| 426 void LoadIC::Clear(Isolate* isolate, Address address, Code* target) { | 426 void LoadIC::Clear(Isolate* isolate, Address address, Code* target) { |
| 427 if (target->ic_state() == UNINITIALIZED) return; | 427 if (IsCleared(target)) return; |
| 428 SetTargetAtAddress(address, *initialize_stub(isolate)); | 428 SetTargetAtAddress(address, *pre_monomorphic_stub(isolate)); |
| 429 } | 429 } |
| 430 | 430 |
| 431 | 431 |
| 432 void StoreIC::Clear(Isolate* isolate, Address address, Code* target) { | 432 void StoreIC::Clear(Isolate* isolate, Address address, Code* target) { |
| 433 if (target->ic_state() == UNINITIALIZED) return; | 433 if (IsCleared(target)) return; |
| 434 SetTargetAtAddress(address, | 434 SetTargetAtAddress(address, |
| 435 (Code::GetStrictMode(target->extra_ic_state()) == kStrictMode) | 435 (Code::GetStrictMode(target->extra_ic_state()) == kStrictMode) |
| 436 ? *initialize_stub_strict(isolate) | 436 ? *pre_monomorphic_stub_strict(isolate) |
| 437 : *initialize_stub(isolate)); | 437 : *pre_monomorphic_stub(isolate)); |
| 438 } | 438 } |
| 439 | 439 |
| 440 | 440 |
| 441 void KeyedStoreIC::Clear(Isolate* isolate, Address address, Code* target) { | 441 void KeyedStoreIC::Clear(Isolate* isolate, Address address, Code* target) { |
| 442 if (target->ic_state() == UNINITIALIZED) return; | 442 if (IsCleared(target)) return; |
| 443 SetTargetAtAddress(address, | 443 SetTargetAtAddress(address, |
| 444 (Code::GetStrictMode(target->extra_ic_state()) == kStrictMode) | 444 (Code::GetStrictMode(target->extra_ic_state()) == kStrictMode) |
| 445 ? *initialize_stub_strict(isolate) | 445 ? *pre_monomorphic_stub_strict(isolate) |
| 446 : *initialize_stub(isolate)); | 446 : *pre_monomorphic_stub(isolate)); |
| 447 } | 447 } |
| 448 | 448 |
| 449 | 449 |
| 450 void CompareIC::Clear(Isolate* isolate, Address address, Code* target) { | 450 void CompareIC::Clear(Isolate* isolate, Address address, Code* target) { |
| 451 ASSERT(target->major_key() == CodeStub::CompareIC); | 451 ASSERT(target->major_key() == CodeStub::CompareIC); |
| 452 CompareIC::State handler_state; | 452 CompareIC::State handler_state; |
| 453 Token::Value op; | 453 Token::Value op; |
| 454 ICCompareStub::DecodeMinorKey(target->stub_info(), NULL, NULL, | 454 ICCompareStub::DecodeMinorKey(target->stub_info(), NULL, NULL, |
| 455 &handler_state, &op); | 455 &handler_state, &op); |
| 456 // Only clear CompareICs that can retain objects. | 456 // Only clear CompareICs that can retain objects. |
| (...skipping 884 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 { |
| 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 |