Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: src/arm/assembler-arm-inl.h

Issue 8139027: Version 3.6.5 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/builtins-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 71
72 int RelocInfo::target_address_size() { 72 int RelocInfo::target_address_size() {
73 return Assembler::kExternalTargetSize; 73 return Assembler::kExternalTargetSize;
74 } 74 }
75 75
76 76
77 void RelocInfo::set_target_address(Address target) { 77 void RelocInfo::set_target_address(Address target) {
78 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); 78 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
79 Assembler::set_target_address_at(pc_, target); 79 Assembler::set_target_address_at(pc_, target);
80 if (host() != NULL && IsCodeTarget(rmode_)) {
81 Object* target_code = Code::GetCodeFromTargetAddress(target);
82 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
83 host(), this, HeapObject::cast(target_code));
84 }
80 } 85 }
81 86
82 87
83 Object* RelocInfo::target_object() { 88 Object* RelocInfo::target_object() {
84 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 89 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
85 return Memory::Object_at(Assembler::target_address_address_at(pc_)); 90 return Memory::Object_at(Assembler::target_address_address_at(pc_));
86 } 91 }
87 92
88 93
89 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { 94 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
90 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 95 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
91 return Memory::Object_Handle_at(Assembler::target_address_address_at(pc_)); 96 return Memory::Object_Handle_at(Assembler::target_address_address_at(pc_));
92 } 97 }
93 98
94 99
95 Object** RelocInfo::target_object_address() { 100 Object** RelocInfo::target_object_address() {
96 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 101 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
97 return reinterpret_cast<Object**>(Assembler::target_address_address_at(pc_)); 102 return reinterpret_cast<Object**>(Assembler::target_address_address_at(pc_));
98 } 103 }
99 104
100 105
101 void RelocInfo::set_target_object(Object* target) { 106 void RelocInfo::set_target_object(Object* target) {
102 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 107 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
103 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target)); 108 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target));
109 if (host() != NULL && target->IsHeapObject()) {
110 host()->GetHeap()->incremental_marking()->RecordWrite(
111 host(), &Memory::Object_at(pc_), HeapObject::cast(target));
112 }
104 } 113 }
105 114
106 115
107 Address* RelocInfo::target_reference_address() { 116 Address* RelocInfo::target_reference_address() {
108 ASSERT(rmode_ == EXTERNAL_REFERENCE); 117 ASSERT(rmode_ == EXTERNAL_REFERENCE);
109 return reinterpret_cast<Address*>(Assembler::target_address_address_at(pc_)); 118 return reinterpret_cast<Address*>(Assembler::target_address_address_at(pc_));
110 } 119 }
111 120
112 121
113 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { 122 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() {
(...skipping 10 matching lines...) Expand all
124 Object* object = HeapObject::FromAddress( 133 Object* object = HeapObject::FromAddress(
125 address - JSGlobalPropertyCell::kValueOffset); 134 address - JSGlobalPropertyCell::kValueOffset);
126 return reinterpret_cast<JSGlobalPropertyCell*>(object); 135 return reinterpret_cast<JSGlobalPropertyCell*>(object);
127 } 136 }
128 137
129 138
130 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) { 139 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) {
131 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); 140 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
132 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; 141 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset;
133 Memory::Address_at(pc_) = address; 142 Memory::Address_at(pc_) = address;
143 if (host() != NULL) {
144 // TODO(1550) We are passing NULL as a slot because cell can never be on
145 // evacuation candidate.
146 host()->GetHeap()->incremental_marking()->RecordWrite(
147 host(), NULL, cell);
148 }
134 } 149 }
135 150
136 151
137 Address RelocInfo::call_address() { 152 Address RelocInfo::call_address() {
138 // The 2 instructions offset assumes patched debug break slot or return 153 // The 2 instructions offset assumes patched debug break slot or return
139 // sequence. 154 // sequence.
140 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 155 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
141 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 156 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
142 return Memory::Address_at(pc_ + 2 * Assembler::kInstrSize); 157 return Memory::Address_at(pc_ + 2 * Assembler::kInstrSize);
143 } 158 }
144 159
145 160
146 void RelocInfo::set_call_address(Address target) { 161 void RelocInfo::set_call_address(Address target) {
147 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 162 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
148 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 163 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
149 Memory::Address_at(pc_ + 2 * Assembler::kInstrSize) = target; 164 Memory::Address_at(pc_ + 2 * Assembler::kInstrSize) = target;
165 if (host() != NULL) {
166 Object* target_code = Code::GetCodeFromTargetAddress(target);
167 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
168 host(), this, HeapObject::cast(target_code));
169 }
150 } 170 }
151 171
152 172
153 Object* RelocInfo::call_object() { 173 Object* RelocInfo::call_object() {
154 return *call_object_address(); 174 return *call_object_address();
155 } 175 }
156 176
157 177
158 void RelocInfo::set_call_object(Object* target) { 178 void RelocInfo::set_call_object(Object* target) {
159 *call_object_address() = target; 179 *call_object_address() = target;
(...skipping 28 matching lines...) Expand all
188 208
189 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { 209 bool RelocInfo::IsPatchedDebugBreakSlotSequence() {
190 Instr current_instr = Assembler::instr_at(pc_); 210 Instr current_instr = Assembler::instr_at(pc_);
191 return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP); 211 return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP);
192 } 212 }
193 213
194 214
195 void RelocInfo::Visit(ObjectVisitor* visitor) { 215 void RelocInfo::Visit(ObjectVisitor* visitor) {
196 RelocInfo::Mode mode = rmode(); 216 RelocInfo::Mode mode = rmode();
197 if (mode == RelocInfo::EMBEDDED_OBJECT) { 217 if (mode == RelocInfo::EMBEDDED_OBJECT) {
198 visitor->VisitPointer(target_object_address()); 218 visitor->VisitEmbeddedPointer(host(), target_object_address());
199 } else if (RelocInfo::IsCodeTarget(mode)) { 219 } else if (RelocInfo::IsCodeTarget(mode)) {
200 visitor->VisitCodeTarget(this); 220 visitor->VisitCodeTarget(this);
201 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { 221 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) {
202 visitor->VisitGlobalPropertyCell(this); 222 visitor->VisitGlobalPropertyCell(this);
203 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 223 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
204 visitor->VisitExternalReference(target_reference_address()); 224 visitor->VisitExternalReference(target_reference_address());
205 #ifdef ENABLE_DEBUGGER_SUPPORT 225 #ifdef ENABLE_DEBUGGER_SUPPORT
206 // TODO(isolates): Get a cached isolate below. 226 // TODO(isolates): Get a cached isolate below.
207 } else if (((RelocInfo::IsJSReturn(mode) && 227 } else if (((RelocInfo::IsJSReturn(mode) &&
208 IsPatchedReturnSequence()) || 228 IsPatchedReturnSequence()) ||
209 (RelocInfo::IsDebugBreakSlot(mode) && 229 (RelocInfo::IsDebugBreakSlot(mode) &&
210 IsPatchedDebugBreakSlotSequence())) && 230 IsPatchedDebugBreakSlotSequence())) &&
211 Isolate::Current()->debug()->has_break_points()) { 231 Isolate::Current()->debug()->has_break_points()) {
212 visitor->VisitDebugTarget(this); 232 visitor->VisitDebugTarget(this);
213 #endif 233 #endif
214 } else if (mode == RelocInfo::RUNTIME_ENTRY) { 234 } else if (mode == RelocInfo::RUNTIME_ENTRY) {
215 visitor->VisitRuntimeEntry(this); 235 visitor->VisitRuntimeEntry(this);
216 } 236 }
217 } 237 }
218 238
219 239
220 template<typename StaticVisitor> 240 template<typename StaticVisitor>
221 void RelocInfo::Visit(Heap* heap) { 241 void RelocInfo::Visit(Heap* heap) {
222 RelocInfo::Mode mode = rmode(); 242 RelocInfo::Mode mode = rmode();
223 if (mode == RelocInfo::EMBEDDED_OBJECT) { 243 if (mode == RelocInfo::EMBEDDED_OBJECT) {
224 StaticVisitor::VisitPointer(heap, target_object_address()); 244 StaticVisitor::VisitEmbeddedPointer(heap, host(), target_object_address());
225 } else if (RelocInfo::IsCodeTarget(mode)) { 245 } else if (RelocInfo::IsCodeTarget(mode)) {
226 StaticVisitor::VisitCodeTarget(heap, this); 246 StaticVisitor::VisitCodeTarget(heap, this);
227 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { 247 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) {
228 StaticVisitor::VisitGlobalPropertyCell(heap, this); 248 StaticVisitor::VisitGlobalPropertyCell(heap, this);
229 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 249 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
230 StaticVisitor::VisitExternalReference(target_reference_address()); 250 StaticVisitor::VisitExternalReference(target_reference_address());
231 #ifdef ENABLE_DEBUGGER_SUPPORT 251 #ifdef ENABLE_DEBUGGER_SUPPORT
232 } else if (heap->isolate()->debug()->has_break_points() && 252 } else if (heap->isolate()->debug()->has_break_points() &&
233 ((RelocInfo::IsJSReturn(mode) && 253 ((RelocInfo::IsJSReturn(mode) &&
234 IsPatchedReturnSequence()) || 254 IsPatchedReturnSequence()) ||
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 // CPU::FlushICache(pc, sizeof(target)); 364 // CPU::FlushICache(pc, sizeof(target));
345 // However, on ARM, no instruction was actually patched by the assignment 365 // However, on ARM, no instruction was actually patched by the assignment
346 // above; the target address is not part of an instruction, it is patched in 366 // above; the target address is not part of an instruction, it is patched in
347 // the constant pool and is read via a data access; the instruction accessing 367 // the constant pool and is read via a data access; the instruction accessing
348 // this address in the constant pool remains unchanged. 368 // this address in the constant pool remains unchanged.
349 } 369 }
350 370
351 } } // namespace v8::internal 371 } } // namespace v8::internal
352 372
353 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ 373 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/builtins-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698