| 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.h" | 8 #include "src/ic.h" |
| 9 | 9 |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 | 82 |
| 83 | 83 |
| 84 Code* IC::GetTargetAtAddress(Address address, | 84 Code* IC::GetTargetAtAddress(Address address, |
| 85 ConstantPoolArray* constant_pool) { | 85 ConstantPoolArray* constant_pool) { |
| 86 // Get the target address of the IC. | 86 // Get the target address of the IC. |
| 87 Address target = Assembler::target_address_at(address, constant_pool); | 87 Address target = Assembler::target_address_at(address, constant_pool); |
| 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 ASSERT(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, | 96 void IC::SetTargetAtAddress(Address address, |
| 97 Code* target, | 97 Code* target, |
| 98 ConstantPoolArray* constant_pool) { | 98 ConstantPoolArray* constant_pool) { |
| 99 ASSERT(target->is_inline_cache_stub() || target->is_compare_ic_stub()); | 99 DCHECK(target->is_inline_cache_stub() || target->is_compare_ic_stub()); |
| 100 Heap* heap = target->GetHeap(); | 100 Heap* heap = target->GetHeap(); |
| 101 Code* old_target = GetTargetAtAddress(address, constant_pool); | 101 Code* old_target = GetTargetAtAddress(address, constant_pool); |
| 102 #ifdef DEBUG | 102 #ifdef DEBUG |
| 103 // STORE_IC and KEYED_STORE_IC use Code::extra_ic_state() to mark | 103 // STORE_IC and KEYED_STORE_IC use Code::extra_ic_state() to mark |
| 104 // ICs as strict mode. The strict-ness of the IC must be preserved. | 104 // ICs as strict mode. The strict-ness of the IC must be preserved. |
| 105 if (old_target->kind() == Code::STORE_IC || | 105 if (old_target->kind() == Code::STORE_IC || |
| 106 old_target->kind() == Code::KEYED_STORE_IC) { | 106 old_target->kind() == Code::KEYED_STORE_IC) { |
| 107 ASSERT(StoreIC::GetStrictMode(old_target->extra_ic_state()) == | 107 DCHECK(StoreIC::GetStrictMode(old_target->extra_ic_state()) == |
| 108 StoreIC::GetStrictMode(target->extra_ic_state())); | 108 StoreIC::GetStrictMode(target->extra_ic_state())); |
| 109 } | 109 } |
| 110 #endif | 110 #endif |
| 111 Assembler::set_target_address_at( | 111 Assembler::set_target_address_at( |
| 112 address, constant_pool, target->instruction_start()); | 112 address, constant_pool, target->instruction_start()); |
| 113 if (heap->gc_state() == Heap::MARK_COMPACT) { | 113 if (heap->gc_state() == Heap::MARK_COMPACT) { |
| 114 heap->mark_compact_collector()->RecordCodeTargetPatch(address, target); | 114 heap->mark_compact_collector()->RecordCodeTargetPatch(address, target); |
| 115 } else { | 115 } else { |
| 116 heap->incremental_marking()->RecordCodeTargetPatch(address, target); | 116 heap->incremental_marking()->RecordCodeTargetPatch(address, target); |
| 117 } | 117 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 *flag = kCacheOnPrototype; | 164 *flag = kCacheOnPrototype; |
| 165 return handle(builtin_ctor->initial_map()); | 165 return handle(builtin_ctor->initial_map()); |
| 166 } | 166 } |
| 167 *flag = kCacheOnReceiver; | 167 *flag = kCacheOnReceiver; |
| 168 return TypeToMap(type, isolate); | 168 return TypeToMap(type, isolate); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } } // namespace v8::internal | 171 } } // namespace v8::internal |
| 172 | 172 |
| 173 #endif // V8_IC_INL_H_ | 173 #endif // V8_IC_INL_H_ |
| OLD | NEW |