Do not patch IC in deoptimized code.

R=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/1152243002

Cr-Commit-Position: refs/heads/master@{#28607}
This commit is contained in:
yangguo 2015-05-25 23:56:15 -07:00 committed by Commit bot
parent 83321b09ed
commit 61a5962bd3
3 changed files with 20 additions and 10 deletions

View File

@ -95,6 +95,8 @@ Code* IC::GetTargetAtAddress(Address address,
void IC::SetTargetAtAddress(Address address, Code* target,
ConstantPoolArray* constant_pool) {
if (AddressIsDeoptimizedCode(target->GetIsolate(), address)) return;
DCHECK(target->is_inline_cache_stub() || target->is_compare_ic_stub());
// Don't use this for load_ics when --vector-ics is turned on.
@ -212,12 +214,25 @@ Handle<Map> IC::GetICCacheHolder(Handle<Map> map, Isolate* isolate,
}
inline Code* IC::get_host() {
Code* IC::get_host() {
return isolate()
->inner_pointer_to_code_cache()
->GetCacheEntry(address())
->code;
}
bool IC::AddressIsDeoptimizedCode() const {
return AddressIsDeoptimizedCode(isolate(), address());
}
bool IC::AddressIsDeoptimizedCode(Isolate* isolate, Address address) {
Code* host =
isolate->inner_pointer_to_code_cache()->GetCacheEntry(address)->code;
return (host->kind() == Code::OPTIMIZED_FUNCTION &&
host->marked_for_deoptimization());
}
}
} // namespace v8::internal

View File

@ -89,6 +89,7 @@ const char* GetTransitionMarkModifier(KeyedAccessStoreMode mode) {
void IC::TraceIC(const char* type, Handle<Object> name) {
if (FLAG_trace_ic) {
if (AddressIsDeoptimizedCode()) return;
State new_state =
UseVector() ? nexus()->StateFromFeedback() : raw_target()->ic_state();
TraceIC(type, name, state(), new_state);
@ -230,14 +231,6 @@ bool IC::AddressIsOptimizedCode() const {
}
bool IC::AddressIsDeoptimizedCode() const {
Code* host =
isolate()->inner_pointer_to_code_cache()->GetCacheEntry(address())->code;
return host->kind() == Code::OPTIMIZED_FUNCTION &&
host->marked_for_deoptimization();
}
static void LookupForRead(LookupIterator* it) {
for (; it->IsFound(); it->Next()) {
switch (it->state()) {

View File

@ -134,7 +134,9 @@ class IC {
Code* GetOriginalCode() const;
bool AddressIsOptimizedCode() const;
bool AddressIsDeoptimizedCode() const;
inline bool AddressIsDeoptimizedCode() const;
inline static bool AddressIsDeoptimizedCode(Isolate* isolate,
Address address);
// Set the call-site target.
inline void set_target(Code* code);