Commit 61a5962b authored by yangguo's avatar yangguo Committed by Commit bot

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}
parent 83321b09
...@@ -95,6 +95,8 @@ Code* IC::GetTargetAtAddress(Address address, ...@@ -95,6 +95,8 @@ Code* IC::GetTargetAtAddress(Address address,
void IC::SetTargetAtAddress(Address address, Code* target, void IC::SetTargetAtAddress(Address address, Code* target,
ConstantPoolArray* constant_pool) { ConstantPoolArray* constant_pool) {
if (AddressIsDeoptimizedCode(target->GetIsolate(), address)) return;
DCHECK(target->is_inline_cache_stub() || target->is_compare_ic_stub()); DCHECK(target->is_inline_cache_stub() || target->is_compare_ic_stub());
// Don't use this for load_ics when --vector-ics is turned on. // 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, ...@@ -212,12 +214,25 @@ Handle<Map> IC::GetICCacheHolder(Handle<Map> map, Isolate* isolate,
} }
inline Code* IC::get_host() { Code* IC::get_host() {
return isolate() return isolate()
->inner_pointer_to_code_cache() ->inner_pointer_to_code_cache()
->GetCacheEntry(address()) ->GetCacheEntry(address())
->code; ->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 } // namespace v8::internal
......
...@@ -89,6 +89,7 @@ const char* GetTransitionMarkModifier(KeyedAccessStoreMode mode) { ...@@ -89,6 +89,7 @@ const char* GetTransitionMarkModifier(KeyedAccessStoreMode mode) {
void IC::TraceIC(const char* type, Handle<Object> name) { void IC::TraceIC(const char* type, Handle<Object> name) {
if (FLAG_trace_ic) { if (FLAG_trace_ic) {
if (AddressIsDeoptimizedCode()) return;
State new_state = State new_state =
UseVector() ? nexus()->StateFromFeedback() : raw_target()->ic_state(); UseVector() ? nexus()->StateFromFeedback() : raw_target()->ic_state();
TraceIC(type, name, state(), new_state); TraceIC(type, name, state(), new_state);
...@@ -230,14 +231,6 @@ bool IC::AddressIsOptimizedCode() const { ...@@ -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) { static void LookupForRead(LookupIterator* it) {
for (; it->IsFound(); it->Next()) { for (; it->IsFound(); it->Next()) {
switch (it->state()) { switch (it->state()) {
......
...@@ -134,7 +134,9 @@ class IC { ...@@ -134,7 +134,9 @@ class IC {
Code* GetOriginalCode() const; Code* GetOriginalCode() const;
bool AddressIsOptimizedCode() const; bool AddressIsOptimizedCode() const;
bool AddressIsDeoptimizedCode() const; inline bool AddressIsDeoptimizedCode() const;
inline static bool AddressIsDeoptimizedCode(Isolate* isolate,
Address address);
// Set the call-site target. // Set the call-site target.
inline void set_target(Code* code); inline void set_target(Code* code);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment