Chromium Code Reviews

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

Issue 1030353003: Enable constant pool support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 30 matching lines...)
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 ConstantPoolArray* IC::constant_pool() const { 51 Address IC::constant_pool() const {
52 if (!FLAG_enable_ool_constant_pool) { 52 if (!FLAG_enable_ool_constant_pool && !FLAG_enable_embedded_constant_pool) {
53 return NULL; 53 return NULL;
54 } else { 54 } else {
55 Handle<ConstantPoolArray> result = raw_constant_pool_; 55 Address constant_pool = 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 *result; 59 if (!debug->has_break_points()) return constant_pool;
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, raw_constant_pool()))) { 65 Assembler::target_address_at(target, 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 *result; 70 return constant_pool;
71 } 71 }
72 } 72 }
73 73
74 74
75 ConstantPoolArray* IC::raw_constant_pool() const { 75 void IC::set_raw_constant_pool(Address* constant_pool, Isolate* isolate) {
76 DCHECK(FLAG_enable_ool_constant_pool || FLAG_enable_embedded_constant_pool);
76 if (FLAG_enable_ool_constant_pool) { 77 if (FLAG_enable_ool_constant_pool) {
78 raw_constant_pool_handle_ = handle(
79 ConstantPoolArray::cast(reinterpret_cast<Object*>(*constant_pool)),
80 isolate);
81 } else if (FLAG_enable_embedded_constant_pool) {
82 raw_constant_pool_ = constant_pool;
83 }
84 }
85
86 Address IC::raw_constant_pool() const {
87 if (FLAG_enable_ool_constant_pool) {
88 return reinterpret_cast<Address>(*raw_constant_pool_handle_);
89 } else if (FLAG_enable_embedded_constant_pool) {
77 return *raw_constant_pool_; 90 return *raw_constant_pool_;
78 } else { 91 } else {
79 return NULL; 92 return NULL;
80 } 93 }
81 } 94 }
82 95
83 96
84 Code* IC::GetTargetAtAddress(Address address, 97 Code* IC::GetTargetAtAddress(Address address, Address constant_pool) {
85 ConstantPoolArray* constant_pool) {
86 // Get the target address of the IC. 98 // Get the target address of the IC.
87 Address target = Assembler::target_address_at(address, constant_pool); 99 Address target = Assembler::target_address_at(address, constant_pool);
88 // Convert target address to the code object. Code::GetCodeFromTargetAddress 100 // Convert target address to the code object. Code::GetCodeFromTargetAddress
89 // is safe for use during GC where the map might be marked. 101 // is safe for use during GC where the map might be marked.
90 Code* result = Code::GetCodeFromTargetAddress(target); 102 Code* result = Code::GetCodeFromTargetAddress(target);
91 DCHECK(result->is_inline_cache_stub()); 103 DCHECK(result->is_inline_cache_stub());
92 return result; 104 return result;
93 } 105 }
94 106
95 107
96 void IC::SetTargetAtAddress(Address address, Code* target, 108 void IC::SetTargetAtAddress(Address address, Code* target,
97 ConstantPoolArray* constant_pool) { 109 Address constant_pool) {
98 DCHECK(target->is_inline_cache_stub() || target->is_compare_ic_stub()); 110 DCHECK(target->is_inline_cache_stub() || target->is_compare_ic_stub());
99 111
100 // Don't use this for load_ics when --vector-ics is turned on. 112 // Don't use this for load_ics when --vector-ics is turned on.
101 DCHECK(!(FLAG_vector_ics && target->is_inline_cache_stub()) || 113 DCHECK(!(FLAG_vector_ics && target->is_inline_cache_stub()) ||
102 (target->kind() != Code::LOAD_IC && 114 (target->kind() != Code::LOAD_IC &&
103 target->kind() != Code::KEYED_LOAD_IC)); 115 target->kind() != Code::KEYED_LOAD_IC));
104 116
105 Heap* heap = target->GetHeap(); 117 Heap* heap = target->GetHeap();
106 Code* old_target = GetTargetAtAddress(address, constant_pool); 118 Code* old_target = GetTargetAtAddress(address, constant_pool);
107 #ifdef DEBUG 119 #ifdef DEBUG
(...skipping 106 matching lines...)
214 inline Code* IC::get_host() { 226 inline Code* IC::get_host() {
215 return isolate() 227 return isolate()
216 ->inner_pointer_to_code_cache() 228 ->inner_pointer_to_code_cache()
217 ->GetCacheEntry(address()) 229 ->GetCacheEntry(address())
218 ->code; 230 ->code;
219 } 231 }
220 } 232 }
221 } // namespace v8::internal 233 } // namespace v8::internal
222 234
223 #endif // V8_IC_INL_H_ 235 #endif // V8_IC_INL_H_
OLDNEW

Powered by Google App Engine