| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 bool was_uninitialized = | 433 bool was_uninitialized = |
| 434 old_state == UNINITIALIZED || old_state == PREMONOMORPHIC; | 434 old_state == UNINITIALIZED || old_state == PREMONOMORPHIC; |
| 435 bool is_uninitialized = | 435 bool is_uninitialized = |
| 436 new_state == UNINITIALIZED || new_state == PREMONOMORPHIC; | 436 new_state == UNINITIALIZED || new_state == PREMONOMORPHIC; |
| 437 return (was_uninitialized && !is_uninitialized) ? 1 : | 437 return (was_uninitialized && !is_uninitialized) ? 1 : |
| 438 (!was_uninitialized && is_uninitialized) ? -1 : 0; | 438 (!was_uninitialized && is_uninitialized) ? -1 : 0; |
| 439 } | 439 } |
| 440 | 440 |
| 441 | 441 |
| 442 void IC::PostPatching(Address address, Code* target, Code* old_target) { | 442 void IC::PostPatching(Address address, Code* target, Code* old_target) { |
| 443 if (FLAG_type_info_threshold == 0 && !FLAG_watch_ic_patching) { | |
| 444 return; | |
| 445 } | |
| 446 Isolate* isolate = target->GetHeap()->isolate(); | 443 Isolate* isolate = target->GetHeap()->isolate(); |
| 447 Code* host = isolate-> | 444 Code* host = isolate-> |
| 448 inner_pointer_to_code_cache()->GetCacheEntry(address)->code; | 445 inner_pointer_to_code_cache()->GetCacheEntry(address)->code; |
| 449 if (host->kind() != Code::FUNCTION) return; | 446 if (host->kind() != Code::FUNCTION) return; |
| 450 | 447 |
| 451 if (FLAG_type_info_threshold > 0 && | 448 if (FLAG_type_info_threshold > 0 && |
| 452 old_target->is_inline_cache_stub() && | 449 old_target->is_inline_cache_stub() && |
| 453 target->is_inline_cache_stub()) { | 450 target->is_inline_cache_stub()) { |
| 454 int delta = ComputeTypeInfoCountDelta(old_target->ic_state(), | 451 int delta = ComputeTypeInfoCountDelta(old_target->ic_state(), |
| 455 target->ic_state()); | 452 target->ic_state()); |
| 456 // Not all Code objects have TypeFeedbackInfo. | 453 // Not all Code objects have TypeFeedbackInfo. |
| 457 if (host->type_feedback_info()->IsTypeFeedbackInfo() && delta != 0) { | 454 if (host->type_feedback_info()->IsTypeFeedbackInfo() && delta != 0) { |
| 458 TypeFeedbackInfo* info = | 455 TypeFeedbackInfo* info = |
| 459 TypeFeedbackInfo::cast(host->type_feedback_info()); | 456 TypeFeedbackInfo::cast(host->type_feedback_info()); |
| 460 info->change_ic_with_type_info_count(delta); | 457 info->change_ic_with_type_info_count(delta); |
| 461 } | 458 } |
| 462 } | 459 } |
| 463 if (host->type_feedback_info()->IsTypeFeedbackInfo()) { | 460 if (host->type_feedback_info()->IsTypeFeedbackInfo()) { |
| 464 TypeFeedbackInfo* info = | 461 TypeFeedbackInfo* info = |
| 465 TypeFeedbackInfo::cast(host->type_feedback_info()); | 462 TypeFeedbackInfo::cast(host->type_feedback_info()); |
| 466 info->change_own_type_change_checksum(); | 463 info->change_own_type_change_checksum(); |
| 467 } | 464 } |
| 468 if (FLAG_watch_ic_patching) { | 465 host->set_profiler_ticks(0); |
| 469 host->set_profiler_ticks(0); | 466 isolate->runtime_profiler()->NotifyICChanged(); |
| 470 isolate->runtime_profiler()->NotifyICChanged(); | |
| 471 } | |
| 472 // TODO(2029): When an optimized function is patched, it would | 467 // TODO(2029): When an optimized function is patched, it would |
| 473 // be nice to propagate the corresponding type information to its | 468 // be nice to propagate the corresponding type information to its |
| 474 // unoptimized version for the benefit of later inlining. | 469 // unoptimized version for the benefit of later inlining. |
| 475 } | 470 } |
| 476 | 471 |
| 477 | 472 |
| 478 void IC::Clear(Isolate* isolate, Address address) { | 473 void IC::Clear(Isolate* isolate, Address address) { |
| 479 Code* target = GetTargetAtAddress(address); | 474 Code* target = GetTargetAtAddress(address); |
| 480 | 475 |
| 481 // Don't clear debug break inline cache as it will remove the break point. | 476 // Don't clear debug break inline cache as it will remove the break point. |
| (...skipping 2661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3143 #undef ADDR | 3138 #undef ADDR |
| 3144 }; | 3139 }; |
| 3145 | 3140 |
| 3146 | 3141 |
| 3147 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3142 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 3148 return IC_utilities[id]; | 3143 return IC_utilities[id]; |
| 3149 } | 3144 } |
| 3150 | 3145 |
| 3151 | 3146 |
| 3152 } } // namespace v8::internal | 3147 } } // namespace v8::internal |
| OLD | NEW |