Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: src/ic/ic-inl.h

Issue 1152243002: Do not patch IC in deoptimized code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove unused declaration Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ic/ic.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_IC_INL_H_ 5 #ifndef V8_IC_INL_H_
6 #define V8_IC_INL_H_ 6 #define V8_IC_INL_H_
7 7
8 #include "src/ic/ic.h" 8 #include "src/ic/ic.h"
9 9
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // Convert target address to the code object. Code::GetCodeFromTargetAddress 88 // Convert target address to the code object. Code::GetCodeFromTargetAddress
89 // is safe for use during GC where the map might be marked. 89 // is safe for use during GC where the map might be marked.
90 Code* result = Code::GetCodeFromTargetAddress(target); 90 Code* result = Code::GetCodeFromTargetAddress(target);
91 DCHECK(result->is_inline_cache_stub()); 91 DCHECK(result->is_inline_cache_stub());
92 return result; 92 return result;
93 } 93 }
94 94
95 95
96 void IC::SetTargetAtAddress(Address address, Code* target, 96 void IC::SetTargetAtAddress(Address address, Code* target,
97 ConstantPoolArray* constant_pool) { 97 ConstantPoolArray* constant_pool) {
98 if (AddressIsDeoptimizedCode(target->GetIsolate(), address)) return;
99
98 DCHECK(target->is_inline_cache_stub() || target->is_compare_ic_stub()); 100 DCHECK(target->is_inline_cache_stub() || target->is_compare_ic_stub());
99 101
100 // Don't use this for load_ics when --vector-ics is turned on. 102 // Don't use this for load_ics when --vector-ics is turned on.
101 DCHECK(!target->is_inline_cache_stub() || 103 DCHECK(!target->is_inline_cache_stub() ||
102 (target->kind() != Code::LOAD_IC && 104 (target->kind() != Code::LOAD_IC &&
103 target->kind() != Code::KEYED_LOAD_IC)); 105 target->kind() != Code::KEYED_LOAD_IC));
104 106
105 Heap* heap = target->GetHeap(); 107 Heap* heap = target->GetHeap();
106 Code* old_target = GetTargetAtAddress(address, constant_pool); 108 Code* old_target = GetTargetAtAddress(address, constant_pool);
107 #ifdef DEBUG 109 #ifdef DEBUG
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 JSFunction* builtin_ctor = GetRootConstructor(*map, native_context); 207 JSFunction* builtin_ctor = GetRootConstructor(*map, native_context);
206 if (builtin_ctor != NULL) { 208 if (builtin_ctor != NULL) {
207 *flag = kCacheOnPrototype; 209 *flag = kCacheOnPrototype;
208 return handle(builtin_ctor->initial_map()); 210 return handle(builtin_ctor->initial_map());
209 } 211 }
210 *flag = kCacheOnReceiver; 212 *flag = kCacheOnReceiver;
211 return map; 213 return map;
212 } 214 }
213 215
214 216
215 inline Code* IC::get_host() { 217 Code* IC::get_host() {
216 return isolate() 218 return isolate()
217 ->inner_pointer_to_code_cache() 219 ->inner_pointer_to_code_cache()
218 ->GetCacheEntry(address()) 220 ->GetCacheEntry(address())
219 ->code; 221 ->code;
220 } 222 }
223
224
225 bool IC::AddressIsDeoptimizedCode() const {
226 return AddressIsDeoptimizedCode(isolate(), address());
227 }
228
229
230 bool IC::AddressIsDeoptimizedCode(Isolate* isolate, Address address) {
231 Code* host =
232 isolate->inner_pointer_to_code_cache()->GetCacheEntry(address)->code;
233 return (host->kind() == Code::OPTIMIZED_FUNCTION &&
234 host->marked_for_deoptimization());
235 }
221 } 236 }
222 } // namespace v8::internal 237 } // namespace v8::internal
223 238
224 #endif // V8_IC_INL_H_ 239 #endif // V8_IC_INL_H_
OLDNEW
« no previous file with comments | « src/ic/ic.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698