| 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/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 // Don't use this for load_ics when --vector-ics is turned on. | 100 // Don't use this for load_ics when --vector-ics is turned on. |
| 101 DCHECK(!(FLAG_vector_ics && target->is_inline_cache_stub()) || | 101 DCHECK(!(FLAG_vector_ics && target->is_inline_cache_stub()) || |
| 102 (target->kind() != Code::LOAD_IC && | 102 (target->kind() != Code::LOAD_IC && |
| 103 target->kind() != Code::KEYED_LOAD_IC)); | 103 target->kind() != Code::KEYED_LOAD_IC)); |
| 104 | 104 |
| 105 Heap* heap = target->GetHeap(); | 105 Heap* heap = target->GetHeap(); |
| 106 Code* old_target = GetTargetAtAddress(address, constant_pool); | 106 Code* old_target = GetTargetAtAddress(address, constant_pool); |
| 107 #ifdef DEBUG | 107 #ifdef DEBUG |
| 108 // STORE_IC and KEYED_STORE_IC use Code::extra_ic_state() to mark | 108 // STORE_IC and KEYED_STORE_IC use Code::extra_ic_state() to mark |
| 109 // ICs as strict mode. The strict-ness of the IC must be preserved. | 109 // ICs as language mode. The language mode of the IC must be preserved. |
| 110 if (old_target->kind() == Code::STORE_IC || | 110 if (old_target->kind() == Code::STORE_IC || |
| 111 old_target->kind() == Code::KEYED_STORE_IC) { | 111 old_target->kind() == Code::KEYED_STORE_IC) { |
| 112 DCHECK(StoreIC::GetStrictMode(old_target->extra_ic_state()) == | 112 DCHECK(StoreIC::GetLanguageMode(old_target->extra_ic_state()) == |
| 113 StoreIC::GetStrictMode(target->extra_ic_state())); | 113 StoreIC::GetLanguageMode(target->extra_ic_state())); |
| 114 } | 114 } |
| 115 #endif | 115 #endif |
| 116 Assembler::set_target_address_at(address, constant_pool, | 116 Assembler::set_target_address_at(address, constant_pool, |
| 117 target->instruction_start()); | 117 target->instruction_start()); |
| 118 if (heap->gc_state() == Heap::MARK_COMPACT) { | 118 if (heap->gc_state() == Heap::MARK_COMPACT) { |
| 119 heap->mark_compact_collector()->RecordCodeTargetPatch(address, target); | 119 heap->mark_compact_collector()->RecordCodeTargetPatch(address, target); |
| 120 } else { | 120 } else { |
| 121 heap->incremental_marking()->RecordCodeTargetPatch(address, target); | 121 heap->incremental_marking()->RecordCodeTargetPatch(address, target); |
| 122 } | 122 } |
| 123 PostPatching(address, target, old_target); | 123 PostPatching(address, target, old_target); |
| 124 } | 124 } |
| 125 | 125 |
| 126 | 126 |
| 127 void IC::set_target(Code* code) { | 127 void IC::set_target(Code* code) { |
| 128 SetTargetAtAddress(address(), code, constant_pool()); | 128 SetTargetAtAddress(address(), code, constant_pool()); |
| 129 target_set_ = true; | 129 target_set_ = true; |
| 130 } | 130 } |
| 131 | 131 |
| 132 | 132 |
| 133 void LoadIC::set_target(Code* code) { | 133 void LoadIC::set_target(Code* code) { |
| 134 // The contextual mode must be preserved across IC patching. | 134 // The contextual mode must be preserved across IC patching. |
| 135 DCHECK(LoadICState::GetContextualMode(code->extra_ic_state()) == | 135 DCHECK(LoadICState::GetContextualMode(code->extra_ic_state()) == |
| 136 LoadICState::GetContextualMode(target()->extra_ic_state())); | 136 LoadICState::GetContextualMode(target()->extra_ic_state())); |
| 137 | 137 |
| 138 IC::set_target(code); | 138 IC::set_target(code); |
| 139 } | 139 } |
| 140 | 140 |
| 141 | 141 |
| 142 void StoreIC::set_target(Code* code) { | 142 void StoreIC::set_target(Code* code) { |
| 143 // Strict mode must be preserved across IC patching. | 143 // Language mode must be preserved across IC patching. |
| 144 DCHECK(GetStrictMode(code->extra_ic_state()) == | 144 DCHECK(GetLanguageMode(code->extra_ic_state()) == |
| 145 GetStrictMode(target()->extra_ic_state())); | 145 GetLanguageMode(target()->extra_ic_state())); |
| 146 IC::set_target(code); | 146 IC::set_target(code); |
| 147 } | 147 } |
| 148 | 148 |
| 149 | 149 |
| 150 void KeyedStoreIC::set_target(Code* code) { | 150 void KeyedStoreIC::set_target(Code* code) { |
| 151 // Strict mode must be preserved across IC patching. | 151 // Language mode must be preserved across IC patching. |
| 152 DCHECK(GetStrictMode(code->extra_ic_state()) == strict_mode()); | 152 DCHECK(GetLanguageMode(code->extra_ic_state()) == language_mode()); |
| 153 IC::set_target(code); | 153 IC::set_target(code); |
| 154 } | 154 } |
| 155 | 155 |
| 156 | 156 |
| 157 Code* IC::raw_target() const { | 157 Code* IC::raw_target() const { |
| 158 return GetTargetAtAddress(address(), constant_pool()); | 158 return GetTargetAtAddress(address(), constant_pool()); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void IC::UpdateTarget() { target_ = handle(raw_target(), isolate_); } | 161 void IC::UpdateTarget() { target_ = handle(raw_target(), isolate_); } |
| 162 | 162 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 inline Code* IC::get_host() { | 214 inline Code* IC::get_host() { |
| 215 return isolate() | 215 return isolate() |
| 216 ->inner_pointer_to_code_cache() | 216 ->inner_pointer_to_code_cache() |
| 217 ->GetCacheEntry(address()) | 217 ->GetCacheEntry(address()) |
| 218 ->code; | 218 ->code; |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 } // namespace v8::internal | 221 } // namespace v8::internal |
| 222 | 222 |
| 223 #endif // V8_IC_INL_H_ | 223 #endif // V8_IC_INL_H_ |
| OLD | NEW |