OLD | NEW |
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 are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 visitor->VisitPointer(target_object_address()); | 197 visitor->VisitPointer(target_object_address()); |
198 CPU::FlushICache(pc_, sizeof(Address)); | 198 CPU::FlushICache(pc_, sizeof(Address)); |
199 } else if (RelocInfo::IsCodeTarget(mode)) { | 199 } else if (RelocInfo::IsCodeTarget(mode)) { |
200 visitor->VisitCodeTarget(this); | 200 visitor->VisitCodeTarget(this); |
201 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { | 201 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { |
202 visitor->VisitGlobalPropertyCell(this); | 202 visitor->VisitGlobalPropertyCell(this); |
203 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 203 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
204 visitor->VisitExternalReference(target_reference_address()); | 204 visitor->VisitExternalReference(target_reference_address()); |
205 CPU::FlushICache(pc_, sizeof(Address)); | 205 CPU::FlushICache(pc_, sizeof(Address)); |
206 #ifdef ENABLE_DEBUGGER_SUPPORT | 206 #ifdef ENABLE_DEBUGGER_SUPPORT |
207 } else if (Debug::has_break_points() && | 207 // TODO(isolates): Get a cached isolate below. |
208 ((RelocInfo::IsJSReturn(mode) && | 208 } else if (((RelocInfo::IsJSReturn(mode) && |
209 IsPatchedReturnSequence()) || | 209 IsPatchedReturnSequence()) || |
210 (RelocInfo::IsDebugBreakSlot(mode) && | 210 (RelocInfo::IsDebugBreakSlot(mode) && |
211 IsPatchedDebugBreakSlotSequence()))) { | 211 IsPatchedDebugBreakSlotSequence())) && |
| 212 Isolate::Current()->debug()->has_break_points()) { |
212 visitor->VisitDebugTarget(this); | 213 visitor->VisitDebugTarget(this); |
213 #endif | 214 #endif |
214 } else if (mode == RelocInfo::RUNTIME_ENTRY) { | 215 } else if (mode == RelocInfo::RUNTIME_ENTRY) { |
215 visitor->VisitRuntimeEntry(this); | 216 visitor->VisitRuntimeEntry(this); |
216 } | 217 } |
217 } | 218 } |
218 | 219 |
219 | 220 |
220 template<typename StaticVisitor> | 221 template<typename StaticVisitor> |
221 void RelocInfo::Visit() { | 222 void RelocInfo::Visit(Heap* heap) { |
222 RelocInfo::Mode mode = rmode(); | 223 RelocInfo::Mode mode = rmode(); |
223 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 224 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
224 StaticVisitor::VisitPointer(target_object_address()); | 225 StaticVisitor::VisitPointer(heap, target_object_address()); |
225 CPU::FlushICache(pc_, sizeof(Address)); | 226 CPU::FlushICache(pc_, sizeof(Address)); |
226 } else if (RelocInfo::IsCodeTarget(mode)) { | 227 } else if (RelocInfo::IsCodeTarget(mode)) { |
227 StaticVisitor::VisitCodeTarget(this); | 228 StaticVisitor::VisitCodeTarget(this); |
228 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { | 229 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { |
229 StaticVisitor::VisitGlobalPropertyCell(this); | 230 StaticVisitor::VisitGlobalPropertyCell(this); |
230 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 231 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
231 StaticVisitor::VisitExternalReference(target_reference_address()); | 232 StaticVisitor::VisitExternalReference(target_reference_address()); |
232 CPU::FlushICache(pc_, sizeof(Address)); | 233 CPU::FlushICache(pc_, sizeof(Address)); |
233 #ifdef ENABLE_DEBUGGER_SUPPORT | 234 #ifdef ENABLE_DEBUGGER_SUPPORT |
234 } else if (Debug::has_break_points() && | 235 } else if (heap->isolate()->debug()->has_break_points() && |
235 ((RelocInfo::IsJSReturn(mode) && | 236 ((RelocInfo::IsJSReturn(mode) && |
236 IsPatchedReturnSequence()) || | 237 IsPatchedReturnSequence()) || |
237 (RelocInfo::IsDebugBreakSlot(mode) && | 238 (RelocInfo::IsDebugBreakSlot(mode) && |
238 IsPatchedDebugBreakSlotSequence()))) { | 239 IsPatchedDebugBreakSlotSequence()))) { |
239 StaticVisitor::VisitDebugTarget(this); | 240 StaticVisitor::VisitDebugTarget(this); |
240 #endif | 241 #endif |
241 } else if (mode == RelocInfo::RUNTIME_ENTRY) { | 242 } else if (mode == RelocInfo::RUNTIME_ENTRY) { |
242 StaticVisitor::VisitRuntimeEntry(this); | 243 StaticVisitor::VisitRuntimeEntry(this); |
243 } | 244 } |
244 } | 245 } |
(...skipping 14 matching lines...) Expand all Loading... |
259 | 260 |
260 Immediate::Immediate(Label* internal_offset) { | 261 Immediate::Immediate(Label* internal_offset) { |
261 x_ = reinterpret_cast<int32_t>(internal_offset); | 262 x_ = reinterpret_cast<int32_t>(internal_offset); |
262 rmode_ = RelocInfo::INTERNAL_REFERENCE; | 263 rmode_ = RelocInfo::INTERNAL_REFERENCE; |
263 } | 264 } |
264 | 265 |
265 | 266 |
266 Immediate::Immediate(Handle<Object> handle) { | 267 Immediate::Immediate(Handle<Object> handle) { |
267 // Verify all Objects referred by code are NOT in new space. | 268 // Verify all Objects referred by code are NOT in new space. |
268 Object* obj = *handle; | 269 Object* obj = *handle; |
269 ASSERT(!Heap::InNewSpace(obj)); | 270 ASSERT(!HEAP->InNewSpace(obj)); |
270 if (obj->IsHeapObject()) { | 271 if (obj->IsHeapObject()) { |
271 x_ = reinterpret_cast<intptr_t>(handle.location()); | 272 x_ = reinterpret_cast<intptr_t>(handle.location()); |
272 rmode_ = RelocInfo::EMBEDDED_OBJECT; | 273 rmode_ = RelocInfo::EMBEDDED_OBJECT; |
273 } else { | 274 } else { |
274 // no relocation needed | 275 // no relocation needed |
275 x_ = reinterpret_cast<intptr_t>(obj); | 276 x_ = reinterpret_cast<intptr_t>(obj); |
276 rmode_ = RelocInfo::NONE; | 277 rmode_ = RelocInfo::NONE; |
277 } | 278 } |
278 } | 279 } |
279 | 280 |
(...skipping 12 matching lines...) Expand all Loading... |
292 | 293 |
293 void Assembler::emit(uint32_t x) { | 294 void Assembler::emit(uint32_t x) { |
294 *reinterpret_cast<uint32_t*>(pc_) = x; | 295 *reinterpret_cast<uint32_t*>(pc_) = x; |
295 pc_ += sizeof(uint32_t); | 296 pc_ += sizeof(uint32_t); |
296 } | 297 } |
297 | 298 |
298 | 299 |
299 void Assembler::emit(Handle<Object> handle) { | 300 void Assembler::emit(Handle<Object> handle) { |
300 // Verify all Objects referred by code are NOT in new space. | 301 // Verify all Objects referred by code are NOT in new space. |
301 Object* obj = *handle; | 302 Object* obj = *handle; |
302 ASSERT(!Heap::InNewSpace(obj)); | 303 ASSERT(!HEAP->InNewSpace(obj)); |
303 if (obj->IsHeapObject()) { | 304 if (obj->IsHeapObject()) { |
304 emit(reinterpret_cast<intptr_t>(handle.location()), | 305 emit(reinterpret_cast<intptr_t>(handle.location()), |
305 RelocInfo::EMBEDDED_OBJECT); | 306 RelocInfo::EMBEDDED_OBJECT); |
306 } else { | 307 } else { |
307 // no relocation needed | 308 // no relocation needed |
308 emit(reinterpret_cast<intptr_t>(obj)); | 309 emit(reinterpret_cast<intptr_t>(obj)); |
309 } | 310 } |
310 } | 311 } |
311 | 312 |
312 | 313 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 | 421 |
421 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 422 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
422 // [disp/r] | 423 // [disp/r] |
423 set_modrm(0, ebp); | 424 set_modrm(0, ebp); |
424 set_dispr(disp, rmode); | 425 set_dispr(disp, rmode); |
425 } | 426 } |
426 | 427 |
427 } } // namespace v8::internal | 428 } } // namespace v8::internal |
428 | 429 |
429 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 430 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
OLD | NEW |