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 30 matching lines...) Expand all Loading... |
41 // the call which has been overwritten by the DebugBreakXXX resides | 41 // the call which has been overwritten by the DebugBreakXXX resides |
42 // and the place where the inline cache system should look. | 42 // and the place where the inline cache system should look. |
43 return result + delta; | 43 return result + delta; |
44 } else { | 44 } else { |
45 // No break point here just return the address of the call. | 45 // No break point here just return the address of the call. |
46 return result; | 46 return result; |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 | 50 |
51 Address IC::constant_pool() const { | 51 ConstantPoolArray* IC::constant_pool() const { |
52 if (!FLAG_enable_embedded_constant_pool) { | 52 if (!FLAG_enable_ool_constant_pool) { |
53 return NULL; | 53 return NULL; |
54 } else { | 54 } else { |
55 Address constant_pool = raw_constant_pool(); | 55 Handle<ConstantPoolArray> result = raw_constant_pool_; |
56 Debug* debug = isolate()->debug(); | 56 Debug* debug = isolate()->debug(); |
57 // First check if any break points are active if not just return the | 57 // First check if any break points are active if not just return the |
58 // original constant pool. | 58 // original constant pool. |
59 if (!debug->has_break_points()) return constant_pool; | 59 if (!debug->has_break_points()) return *result; |
60 | 60 |
61 // At least one break point is active perform additional test to ensure that | 61 // At least one break point is active perform additional test to ensure that |
62 // break point locations are updated correctly. | 62 // break point locations are updated correctly. |
63 Address target = Assembler::target_address_from_return_address(pc()); | 63 Address target = Assembler::target_address_from_return_address(pc()); |
64 if (debug->IsDebugBreak( | 64 if (debug->IsDebugBreak( |
65 Assembler::target_address_at(target, constant_pool))) { | 65 Assembler::target_address_at(target, raw_constant_pool()))) { |
66 // If the call site is a call to debug break then we want to return the | 66 // If the call site is a call to debug break then we want to return the |
67 // constant pool for the original code instead of the breakpointed code. | 67 // constant pool for the original code instead of the breakpointed code. |
68 return GetOriginalCode()->constant_pool(); | 68 return GetOriginalCode()->constant_pool(); |
69 } | 69 } |
70 return constant_pool; | 70 return *result; |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 Address IC::raw_constant_pool() const { | 75 ConstantPoolArray* IC::raw_constant_pool() const { |
76 if (FLAG_enable_embedded_constant_pool) { | 76 if (FLAG_enable_ool_constant_pool) { |
77 return *constant_pool_address_; | 77 return *raw_constant_pool_; |
78 } else { | 78 } else { |
79 return NULL; | 79 return NULL; |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 | 83 |
84 Code* IC::GetTargetAtAddress(Address address, Address constant_pool) { | 84 Code* IC::GetTargetAtAddress(Address address, |
| 85 ConstantPoolArray* constant_pool) { |
85 // Get the target address of the IC. | 86 // Get the target address of the IC. |
86 Address target = Assembler::target_address_at(address, constant_pool); | 87 Address target = Assembler::target_address_at(address, constant_pool); |
87 // Convert target address to the code object. Code::GetCodeFromTargetAddress | 88 // Convert target address to the code object. Code::GetCodeFromTargetAddress |
88 // 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. |
89 Code* result = Code::GetCodeFromTargetAddress(target); | 90 Code* result = Code::GetCodeFromTargetAddress(target); |
90 DCHECK(result->is_inline_cache_stub()); | 91 DCHECK(result->is_inline_cache_stub()); |
91 return result; | 92 return result; |
92 } | 93 } |
93 | 94 |
94 | 95 |
95 void IC::SetTargetAtAddress(Address address, Code* target, | 96 void IC::SetTargetAtAddress(Address address, Code* target, |
96 Address constant_pool) { | 97 ConstantPoolArray* constant_pool) { |
97 if (AddressIsDeoptimizedCode(target->GetIsolate(), address)) return; | 98 if (AddressIsDeoptimizedCode(target->GetIsolate(), address)) return; |
98 | 99 |
99 DCHECK(target->is_inline_cache_stub() || target->is_compare_ic_stub()); | 100 DCHECK(target->is_inline_cache_stub() || target->is_compare_ic_stub()); |
100 | 101 |
101 // 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. |
102 DCHECK(!target->is_inline_cache_stub() || | 103 DCHECK(!target->is_inline_cache_stub() || |
103 (target->kind() != Code::LOAD_IC && | 104 (target->kind() != Code::LOAD_IC && |
104 target->kind() != Code::KEYED_LOAD_IC)); | 105 target->kind() != Code::KEYED_LOAD_IC)); |
105 | 106 |
106 Heap* heap = target->GetHeap(); | 107 Heap* heap = target->GetHeap(); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 bool IC::AddressIsDeoptimizedCode(Isolate* isolate, Address address) { | 230 bool IC::AddressIsDeoptimizedCode(Isolate* isolate, Address address) { |
230 Code* host = | 231 Code* host = |
231 isolate->inner_pointer_to_code_cache()->GetCacheEntry(address)->code; | 232 isolate->inner_pointer_to_code_cache()->GetCacheEntry(address)->code; |
232 return (host->kind() == Code::OPTIMIZED_FUNCTION && | 233 return (host->kind() == Code::OPTIMIZED_FUNCTION && |
233 host->marked_for_deoptimization()); | 234 host->marked_for_deoptimization()); |
234 } | 235 } |
235 } | 236 } |
236 } // namespace v8::internal | 237 } // namespace v8::internal |
237 | 238 |
238 #endif // V8_IC_INL_H_ | 239 #endif // V8_IC_INL_H_ |
OLD | NEW |