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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 bool RelocInfo::IsPatchedReturnSequence() { | 244 bool RelocInfo::IsPatchedReturnSequence() { |
245 return *pc_ == kCallOpcode; | 245 return *pc_ == kCallOpcode; |
246 } | 246 } |
247 | 247 |
248 | 248 |
249 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { | 249 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { |
250 return !Assembler::IsNop(pc()); | 250 return !Assembler::IsNop(pc()); |
251 } | 251 } |
252 | 252 |
253 | 253 |
254 void RelocInfo::Visit(ObjectVisitor* visitor) { | 254 void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) { |
255 RelocInfo::Mode mode = rmode(); | 255 RelocInfo::Mode mode = rmode(); |
256 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 256 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
257 visitor->VisitEmbeddedPointer(this); | 257 visitor->VisitEmbeddedPointer(this); |
258 CPU::FlushICache(pc_, sizeof(Address)); | 258 CPU::FlushICache(pc_, sizeof(Address)); |
259 } else if (RelocInfo::IsCodeTarget(mode)) { | 259 } else if (RelocInfo::IsCodeTarget(mode)) { |
260 visitor->VisitCodeTarget(this); | 260 visitor->VisitCodeTarget(this); |
261 } else if (mode == RelocInfo::CELL) { | 261 } else if (mode == RelocInfo::CELL) { |
262 visitor->VisitCell(this); | 262 visitor->VisitCell(this); |
263 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 263 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
264 visitor->VisitExternalReference(this); | 264 visitor->VisitExternalReference(this); |
265 CPU::FlushICache(pc_, sizeof(Address)); | 265 CPU::FlushICache(pc_, sizeof(Address)); |
266 } else if (RelocInfo::IsCodeAgeSequence(mode)) { | 266 } else if (RelocInfo::IsCodeAgeSequence(mode)) { |
267 visitor->VisitCodeAgeSequence(this); | 267 visitor->VisitCodeAgeSequence(this); |
268 #ifdef ENABLE_DEBUGGER_SUPPORT | 268 #ifdef ENABLE_DEBUGGER_SUPPORT |
269 // TODO(isolates): Get a cached isolate below. | |
270 } else if (((RelocInfo::IsJSReturn(mode) && | 269 } else if (((RelocInfo::IsJSReturn(mode) && |
271 IsPatchedReturnSequence()) || | 270 IsPatchedReturnSequence()) || |
272 (RelocInfo::IsDebugBreakSlot(mode) && | 271 (RelocInfo::IsDebugBreakSlot(mode) && |
273 IsPatchedDebugBreakSlotSequence())) && | 272 IsPatchedDebugBreakSlotSequence())) && |
274 Isolate::Current()->debug()->has_break_points()) { | 273 isolate->debug()->has_break_points()) { |
275 visitor->VisitDebugTarget(this); | 274 visitor->VisitDebugTarget(this); |
276 #endif | 275 #endif |
277 } else if (IsRuntimeEntry(mode)) { | 276 } else if (IsRuntimeEntry(mode)) { |
278 visitor->VisitRuntimeEntry(this); | 277 visitor->VisitRuntimeEntry(this); |
279 } | 278 } |
280 } | 279 } |
281 | 280 |
282 | 281 |
283 template<typename StaticVisitor> | 282 template<typename StaticVisitor> |
284 void RelocInfo::Visit(Heap* heap) { | 283 void RelocInfo::Visit(Heap* heap) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 } | 321 } |
323 | 322 |
324 | 323 |
325 Immediate::Immediate(Label* internal_offset) { | 324 Immediate::Immediate(Label* internal_offset) { |
326 x_ = reinterpret_cast<int32_t>(internal_offset); | 325 x_ = reinterpret_cast<int32_t>(internal_offset); |
327 rmode_ = RelocInfo::INTERNAL_REFERENCE; | 326 rmode_ = RelocInfo::INTERNAL_REFERENCE; |
328 } | 327 } |
329 | 328 |
330 | 329 |
331 Immediate::Immediate(Handle<Object> handle) { | 330 Immediate::Immediate(Handle<Object> handle) { |
332 #ifdef DEBUG | |
333 Isolate* isolate = Isolate::Current(); | |
334 #endif | |
335 AllowDeferredHandleDereference using_raw_address; | 331 AllowDeferredHandleDereference using_raw_address; |
336 // Verify all Objects referred by code are NOT in new space. | 332 // Verify all Objects referred by code are NOT in new space. |
337 Object* obj = *handle; | 333 Object* obj = *handle; |
338 ASSERT(!isolate->heap()->InNewSpace(obj)); | |
339 if (obj->IsHeapObject()) { | 334 if (obj->IsHeapObject()) { |
| 335 ASSERT(!HeapObject::cast(obj)->GetHeap()->InNewSpace(obj)); |
340 x_ = reinterpret_cast<intptr_t>(handle.location()); | 336 x_ = reinterpret_cast<intptr_t>(handle.location()); |
341 rmode_ = RelocInfo::EMBEDDED_OBJECT; | 337 rmode_ = RelocInfo::EMBEDDED_OBJECT; |
342 } else { | 338 } else { |
343 // no relocation needed | 339 // no relocation needed |
344 x_ = reinterpret_cast<intptr_t>(obj); | 340 x_ = reinterpret_cast<intptr_t>(obj); |
345 rmode_ = RelocInfo::NONE32; | 341 rmode_ = RelocInfo::NONE32; |
346 } | 342 } |
347 } | 343 } |
348 | 344 |
349 | 345 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 515 |
520 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 516 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
521 // [disp/r] | 517 // [disp/r] |
522 set_modrm(0, ebp); | 518 set_modrm(0, ebp); |
523 set_dispr(disp, rmode); | 519 set_dispr(disp, rmode); |
524 } | 520 } |
525 | 521 |
526 } } // namespace v8::internal | 522 } } // namespace v8::internal |
527 | 523 |
528 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 524 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
OLD | NEW |