OLD | NEW |
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/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 Code* result = Code::GetCodeFromTargetAddress(target); | 47 Code* result = Code::GetCodeFromTargetAddress(target); |
48 DCHECK(result->is_inline_cache_stub()); | 48 DCHECK(result->is_inline_cache_stub()); |
49 return result; | 49 return result; |
50 } | 50 } |
51 | 51 |
52 | 52 |
53 void IC::SetTargetAtAddress(Address address, Code* target, | 53 void IC::SetTargetAtAddress(Address address, Code* target, |
54 Address constant_pool) { | 54 Address constant_pool) { |
55 if (AddressIsDeoptimizedCode(target->GetIsolate(), address)) return; | 55 if (AddressIsDeoptimizedCode(target->GetIsolate(), address)) return; |
56 | 56 |
57 DCHECK(target->is_inline_cache_stub() || target->is_compare_ic_stub()); | 57 // Only these three old-style ICs still do code patching. |
58 | 58 DCHECK(target->is_binary_op_stub() || target->is_compare_ic_stub() || |
59 DCHECK(!target->is_inline_cache_stub() || | 59 target->is_to_boolean_ic_stub()); |
60 (target->kind() != Code::LOAD_IC && | |
61 target->kind() != Code::KEYED_LOAD_IC && | |
62 target->kind() != Code::STORE_IC && | |
63 target->kind() != Code::KEYED_STORE_IC)); | |
64 | 60 |
65 Heap* heap = target->GetHeap(); | 61 Heap* heap = target->GetHeap(); |
66 Code* old_target = GetTargetAtAddress(address, constant_pool); | 62 Code* old_target = GetTargetAtAddress(address, constant_pool); |
67 #ifdef DEBUG | 63 |
68 // STORE_IC and KEYED_STORE_IC use Code::extra_ic_state() to mark | |
69 // ICs as language mode. The language mode of the IC must be preserved. | |
70 if (old_target->kind() == Code::STORE_IC || | |
71 old_target->kind() == Code::KEYED_STORE_IC) { | |
72 DCHECK(StoreICState::GetLanguageMode(old_target->extra_ic_state()) == | |
73 StoreICState::GetLanguageMode(target->extra_ic_state())); | |
74 } | |
75 #endif | |
76 Assembler::set_target_address_at(heap->isolate(), address, constant_pool, | 64 Assembler::set_target_address_at(heap->isolate(), address, constant_pool, |
77 target->instruction_start()); | 65 target->instruction_start()); |
78 if (heap->gc_state() == Heap::MARK_COMPACT) { | 66 if (heap->gc_state() == Heap::MARK_COMPACT) { |
79 heap->mark_compact_collector()->RecordCodeTargetPatch(address, target); | 67 heap->mark_compact_collector()->RecordCodeTargetPatch(address, target); |
80 } else { | 68 } else { |
81 heap->incremental_marking()->RecordCodeTargetPatch(address, target); | 69 heap->incremental_marking()->RecordCodeTargetPatch(address, target); |
82 } | 70 } |
83 PostPatching(address, target, old_target); | 71 PostPatching(address, target, old_target); |
84 } | 72 } |
85 | 73 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 bool IC::AddressIsDeoptimizedCode(Isolate* isolate, Address address) { | 136 bool IC::AddressIsDeoptimizedCode(Isolate* isolate, Address address) { |
149 Code* host = | 137 Code* host = |
150 isolate->inner_pointer_to_code_cache()->GetCacheEntry(address)->code; | 138 isolate->inner_pointer_to_code_cache()->GetCacheEntry(address)->code; |
151 return (host->kind() == Code::OPTIMIZED_FUNCTION && | 139 return (host->kind() == Code::OPTIMIZED_FUNCTION && |
152 host->marked_for_deoptimization()); | 140 host->marked_for_deoptimization()); |
153 } | 141 } |
154 } // namespace internal | 142 } // namespace internal |
155 } // namespace v8 | 143 } // namespace v8 |
156 | 144 |
157 #endif // V8_IC_INL_H_ | 145 #endif // V8_IC_INL_H_ |
OLD | NEW |