OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 217 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
218 if (IsCodeTarget(rmode_)) { | 218 if (IsCodeTarget(rmode_)) { |
219 return Assembler::target_address_at(pc_); | 219 return Assembler::target_address_at(pc_); |
220 } else { | 220 } else { |
221 return Memory::Address_at(pc_); | 221 return Memory::Address_at(pc_); |
222 } | 222 } |
223 } | 223 } |
224 | 224 |
225 | 225 |
226 Address RelocInfo::target_address_address() { | 226 Address RelocInfo::target_address_address() { |
227 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 227 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY |
| 228 || rmode_ == EMBEDDED_OBJECT |
| 229 || rmode_ == EXTERNAL_REFERENCE); |
228 return reinterpret_cast<Address>(pc_); | 230 return reinterpret_cast<Address>(pc_); |
229 } | 231 } |
230 | 232 |
231 | 233 |
232 int RelocInfo::target_address_size() { | 234 int RelocInfo::target_address_size() { |
233 if (IsCodedSpecially()) { | 235 if (IsCodedSpecially()) { |
234 return Assembler::kCallTargetSize; | 236 return Assembler::kCallTargetSize; |
235 } else { | 237 } else { |
236 return Assembler::kExternalTargetSize; | 238 return Assembler::kExternalTargetSize; |
237 } | 239 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 void RelocInfo::Visit(ObjectVisitor* visitor) { | 394 void RelocInfo::Visit(ObjectVisitor* visitor) { |
393 RelocInfo::Mode mode = rmode(); | 395 RelocInfo::Mode mode = rmode(); |
394 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 396 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
395 visitor->VisitEmbeddedPointer(this); | 397 visitor->VisitEmbeddedPointer(this); |
396 CPU::FlushICache(pc_, sizeof(Address)); | 398 CPU::FlushICache(pc_, sizeof(Address)); |
397 } else if (RelocInfo::IsCodeTarget(mode)) { | 399 } else if (RelocInfo::IsCodeTarget(mode)) { |
398 visitor->VisitCodeTarget(this); | 400 visitor->VisitCodeTarget(this); |
399 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { | 401 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { |
400 visitor->VisitGlobalPropertyCell(this); | 402 visitor->VisitGlobalPropertyCell(this); |
401 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 403 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
402 visitor->VisitExternalReference(target_reference_address()); | 404 visitor->VisitExternalReference(this); |
403 CPU::FlushICache(pc_, sizeof(Address)); | 405 CPU::FlushICache(pc_, sizeof(Address)); |
404 #ifdef ENABLE_DEBUGGER_SUPPORT | 406 #ifdef ENABLE_DEBUGGER_SUPPORT |
405 // TODO(isolates): Get a cached isolate below. | 407 // TODO(isolates): Get a cached isolate below. |
406 } else if (((RelocInfo::IsJSReturn(mode) && | 408 } else if (((RelocInfo::IsJSReturn(mode) && |
407 IsPatchedReturnSequence()) || | 409 IsPatchedReturnSequence()) || |
408 (RelocInfo::IsDebugBreakSlot(mode) && | 410 (RelocInfo::IsDebugBreakSlot(mode) && |
409 IsPatchedDebugBreakSlotSequence())) && | 411 IsPatchedDebugBreakSlotSequence())) && |
410 Isolate::Current()->debug()->has_break_points()) { | 412 Isolate::Current()->debug()->has_break_points()) { |
411 visitor->VisitDebugTarget(this); | 413 visitor->VisitDebugTarget(this); |
412 #endif | 414 #endif |
413 } else if (mode == RelocInfo::RUNTIME_ENTRY) { | 415 } else if (mode == RelocInfo::RUNTIME_ENTRY) { |
414 visitor->VisitRuntimeEntry(this); | 416 visitor->VisitRuntimeEntry(this); |
415 } | 417 } |
416 } | 418 } |
417 | 419 |
418 | 420 |
419 template<typename StaticVisitor> | 421 template<typename StaticVisitor> |
420 void RelocInfo::Visit(Heap* heap) { | 422 void RelocInfo::Visit(Heap* heap) { |
421 RelocInfo::Mode mode = rmode(); | 423 RelocInfo::Mode mode = rmode(); |
422 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 424 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
423 StaticVisitor::VisitEmbeddedPointer(heap, this); | 425 StaticVisitor::VisitEmbeddedPointer(heap, this); |
424 CPU::FlushICache(pc_, sizeof(Address)); | 426 CPU::FlushICache(pc_, sizeof(Address)); |
425 } else if (RelocInfo::IsCodeTarget(mode)) { | 427 } else if (RelocInfo::IsCodeTarget(mode)) { |
426 StaticVisitor::VisitCodeTarget(heap, this); | 428 StaticVisitor::VisitCodeTarget(heap, this); |
427 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { | 429 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { |
428 StaticVisitor::VisitGlobalPropertyCell(heap, this); | 430 StaticVisitor::VisitGlobalPropertyCell(heap, this); |
429 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 431 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
430 StaticVisitor::VisitExternalReference(target_reference_address()); | 432 StaticVisitor::VisitExternalReference(this); |
431 CPU::FlushICache(pc_, sizeof(Address)); | 433 CPU::FlushICache(pc_, sizeof(Address)); |
432 #ifdef ENABLE_DEBUGGER_SUPPORT | 434 #ifdef ENABLE_DEBUGGER_SUPPORT |
433 } else if (heap->isolate()->debug()->has_break_points() && | 435 } else if (heap->isolate()->debug()->has_break_points() && |
434 ((RelocInfo::IsJSReturn(mode) && | 436 ((RelocInfo::IsJSReturn(mode) && |
435 IsPatchedReturnSequence()) || | 437 IsPatchedReturnSequence()) || |
436 (RelocInfo::IsDebugBreakSlot(mode) && | 438 (RelocInfo::IsDebugBreakSlot(mode) && |
437 IsPatchedDebugBreakSlotSequence()))) { | 439 IsPatchedDebugBreakSlotSequence()))) { |
438 StaticVisitor::VisitDebugTarget(heap, this); | 440 StaticVisitor::VisitDebugTarget(heap, this); |
439 #endif | 441 #endif |
440 } else if (mode == RelocInfo::RUNTIME_ENTRY) { | 442 } else if (mode == RelocInfo::RUNTIME_ENTRY) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 ASSERT(len_ == 1 || len_ == 2); | 479 ASSERT(len_ == 1 || len_ == 2); |
478 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 480 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
479 *p = disp; | 481 *p = disp; |
480 len_ += sizeof(int32_t); | 482 len_ += sizeof(int32_t); |
481 } | 483 } |
482 | 484 |
483 | 485 |
484 } } // namespace v8::internal | 486 } } // namespace v8::internal |
485 | 487 |
486 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 488 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
OLD | NEW |