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

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

Issue 1238503003: PPC: Debugger: use debug break slots to break at function exit. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « src/ppc/assembler-ppc.h ('k') | src/ppc/debug-ppc.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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "src/debug.h" 43 #include "src/debug.h"
44 44
45 45
46 namespace v8 { 46 namespace v8 {
47 namespace internal { 47 namespace internal {
48 48
49 49
50 bool CpuFeatures::SupportsCrankshaft() { return true; } 50 bool CpuFeatures::SupportsCrankshaft() { return true; }
51 51
52 52
53 void RelocInfo::apply(intptr_t delta, ICacheFlushMode icache_flush_mode) { 53 void RelocInfo::apply(intptr_t delta) {
54 // absolute code pointer inside code object moves with the code object. 54 // absolute code pointer inside code object moves with the code object.
55 if (IsInternalReference(rmode_)) { 55 if (IsInternalReference(rmode_)) {
56 // Jump table entry 56 // Jump table entry
57 Address target = Memory::Address_at(pc_); 57 Address target = Memory::Address_at(pc_);
58 Memory::Address_at(pc_) = target + delta; 58 Memory::Address_at(pc_) = target + delta;
59 } else { 59 } else {
60 // mov sequence 60 // mov sequence
61 DCHECK(IsInternalReferenceEncoded(rmode_)); 61 DCHECK(IsInternalReferenceEncoded(rmode_));
62 Address target = Assembler::target_address_at(pc_, host_); 62 Address target = Assembler::target_address_at(pc_, host_);
63 Assembler::set_target_address_at(pc_, host_, target + delta, 63 Assembler::set_target_address_at(pc_, host_, target + delta,
64 icache_flush_mode); 64 SKIP_ICACHE_FLUSH);
65 } 65 }
66 } 66 }
67 67
68 68
69 Address RelocInfo::target_internal_reference() { 69 Address RelocInfo::target_internal_reference() {
70 if (IsInternalReference(rmode_)) { 70 if (IsInternalReference(rmode_)) {
71 // Jump table entry 71 // Jump table entry
72 return Memory::Address_at(pc_); 72 return Memory::Address_at(pc_);
73 } else { 73 } else {
74 // mov sequence 74 // mov sequence
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 Assembler::set_target_address_at(pc_, host_, target, icache_flush_mode); 139 Assembler::set_target_address_at(pc_, host_, target, icache_flush_mode);
140 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL && 140 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL &&
141 IsCodeTarget(rmode_)) { 141 IsCodeTarget(rmode_)) {
142 Object* target_code = Code::GetCodeFromTargetAddress(target); 142 Object* target_code = Code::GetCodeFromTargetAddress(target);
143 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 143 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
144 host(), this, HeapObject::cast(target_code)); 144 host(), this, HeapObject::cast(target_code));
145 } 145 }
146 } 146 }
147 147
148 148
149 Address Assembler::break_address_from_return_address(Address pc) {
150 return target_address_from_return_address(pc);
151 }
152
153
154 Address Assembler::target_address_from_return_address(Address pc) { 149 Address Assembler::target_address_from_return_address(Address pc) {
155 // Returns the address of the call target from the return address that will 150 // Returns the address of the call target from the return address that will
156 // be returned to after a call. 151 // be returned to after a call.
157 // Call sequence is : 152 // Call sequence is :
158 // mov ip, @ call address 153 // mov ip, @ call address
159 // mtlr ip 154 // mtlr ip
160 // blrl 155 // blrl
161 // @ return address 156 // @ return address
162 int len; 157 int len;
163 ConstantPoolEntry::Access access; 158 ConstantPoolEntry::Access access;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 285
291 void RelocInfo::set_code_age_stub(Code* stub, 286 void RelocInfo::set_code_age_stub(Code* stub,
292 ICacheFlushMode icache_flush_mode) { 287 ICacheFlushMode icache_flush_mode) {
293 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 288 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
294 Assembler::set_target_address_at(pc_ + kCodeAgingTargetDelta, host_, 289 Assembler::set_target_address_at(pc_ + kCodeAgingTargetDelta, host_,
295 stub->instruction_start(), 290 stub->instruction_start(),
296 icache_flush_mode); 291 icache_flush_mode);
297 } 292 }
298 293
299 294
300 Address RelocInfo::call_address() { 295 Address RelocInfo::debug_call_address() {
301 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 296 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence());
302 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
303 // The pc_ offset of 0 assumes patched return sequence per
304 // BreakLocation::SetDebugBreakAtReturn(), or debug break
305 // slot per BreakLocation::SetDebugBreakAtSlot().
306 return Assembler::target_address_at(pc_, host_); 297 return Assembler::target_address_at(pc_, host_);
307 } 298 }
308 299
309 300
310 void RelocInfo::set_call_address(Address target) { 301 void RelocInfo::set_debug_call_address(Address target) {
311 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 302 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence());
312 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
313 Assembler::set_target_address_at(pc_, host_, target); 303 Assembler::set_target_address_at(pc_, host_, target);
314 if (host() != NULL) { 304 if (host() != NULL) {
315 Object* target_code = Code::GetCodeFromTargetAddress(target); 305 Object* target_code = Code::GetCodeFromTargetAddress(target);
316 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 306 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
317 host(), this, HeapObject::cast(target_code)); 307 host(), this, HeapObject::cast(target_code));
318 } 308 }
319 } 309 }
320 310
321 311
322 Object* RelocInfo::call_object() { return *call_object_address(); }
323
324
325 void RelocInfo::set_call_object(Object* target) {
326 *call_object_address() = target;
327 }
328
329
330 Object** RelocInfo::call_object_address() {
331 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
332 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
333 return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize);
334 }
335
336
337 void RelocInfo::WipeOut() { 312 void RelocInfo::WipeOut() {
338 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || 313 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
339 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || 314 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
340 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); 315 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_));
341 if (IsInternalReference(rmode_)) { 316 if (IsInternalReference(rmode_)) {
342 // Jump table entry 317 // Jump table entry
343 Memory::Address_at(pc_) = NULL; 318 Memory::Address_at(pc_) = NULL;
344 } else if (IsInternalReferenceEncoded(rmode_)) { 319 } else if (IsInternalReferenceEncoded(rmode_)) {
345 // mov sequence 320 // mov sequence
346 // Currently used only by deserializer, no need to flush. 321 // Currently used only by deserializer, no need to flush.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 visitor->VisitCodeTarget(this); 367 visitor->VisitCodeTarget(this);
393 } else if (mode == RelocInfo::CELL) { 368 } else if (mode == RelocInfo::CELL) {
394 visitor->VisitCell(this); 369 visitor->VisitCell(this);
395 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 370 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
396 visitor->VisitExternalReference(this); 371 visitor->VisitExternalReference(this);
397 } else if (mode == RelocInfo::INTERNAL_REFERENCE || 372 } else if (mode == RelocInfo::INTERNAL_REFERENCE ||
398 mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) { 373 mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) {
399 visitor->VisitInternalReference(this); 374 visitor->VisitInternalReference(this);
400 } else if (RelocInfo::IsCodeAgeSequence(mode)) { 375 } else if (RelocInfo::IsCodeAgeSequence(mode)) {
401 visitor->VisitCodeAgeSequence(this); 376 visitor->VisitCodeAgeSequence(this);
402 } else if (((RelocInfo::IsJSReturn(mode) && IsPatchedReturnSequence()) || 377 } else if (RelocInfo::IsDebugBreakSlot(mode) &&
403 (RelocInfo::IsDebugBreakSlot(mode) && 378 IsPatchedDebugBreakSlotSequence() &&
404 IsPatchedDebugBreakSlotSequence())) &&
405 isolate->debug()->has_break_points()) { 379 isolate->debug()->has_break_points()) {
406 visitor->VisitDebugTarget(this); 380 visitor->VisitDebugTarget(this);
407 } else if (IsRuntimeEntry(mode)) { 381 } else if (IsRuntimeEntry(mode)) {
408 visitor->VisitRuntimeEntry(this); 382 visitor->VisitRuntimeEntry(this);
409 } 383 }
410 } 384 }
411 385
412 386
413 template <typename StaticVisitor> 387 template <typename StaticVisitor>
414 void RelocInfo::Visit(Heap* heap) { 388 void RelocInfo::Visit(Heap* heap) {
415 RelocInfo::Mode mode = rmode(); 389 RelocInfo::Mode mode = rmode();
416 if (mode == RelocInfo::EMBEDDED_OBJECT) { 390 if (mode == RelocInfo::EMBEDDED_OBJECT) {
417 StaticVisitor::VisitEmbeddedPointer(heap, this); 391 StaticVisitor::VisitEmbeddedPointer(heap, this);
418 } else if (RelocInfo::IsCodeTarget(mode)) { 392 } else if (RelocInfo::IsCodeTarget(mode)) {
419 StaticVisitor::VisitCodeTarget(heap, this); 393 StaticVisitor::VisitCodeTarget(heap, this);
420 } else if (mode == RelocInfo::CELL) { 394 } else if (mode == RelocInfo::CELL) {
421 StaticVisitor::VisitCell(heap, this); 395 StaticVisitor::VisitCell(heap, this);
422 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 396 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
423 StaticVisitor::VisitExternalReference(this); 397 StaticVisitor::VisitExternalReference(this);
424 } else if (mode == RelocInfo::INTERNAL_REFERENCE || 398 } else if (mode == RelocInfo::INTERNAL_REFERENCE ||
425 mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) { 399 mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) {
426 StaticVisitor::VisitInternalReference(this); 400 StaticVisitor::VisitInternalReference(this);
427 } else if (RelocInfo::IsCodeAgeSequence(mode)) { 401 } else if (RelocInfo::IsCodeAgeSequence(mode)) {
428 StaticVisitor::VisitCodeAgeSequence(heap, this); 402 StaticVisitor::VisitCodeAgeSequence(heap, this);
429 } else if (heap->isolate()->debug()->has_break_points() && 403 } else if (heap->isolate()->debug()->has_break_points() &&
430 ((RelocInfo::IsJSReturn(mode) && IsPatchedReturnSequence()) || 404 RelocInfo::IsDebugBreakSlot(mode) &&
431 (RelocInfo::IsDebugBreakSlot(mode) && 405 IsPatchedDebugBreakSlotSequence()) {
432 IsPatchedDebugBreakSlotSequence()))) {
433 StaticVisitor::VisitDebugTarget(heap, this); 406 StaticVisitor::VisitDebugTarget(heap, this);
434 } else if (IsRuntimeEntry(mode)) { 407 } else if (IsRuntimeEntry(mode)) {
435 StaticVisitor::VisitRuntimeEntry(this); 408 StaticVisitor::VisitRuntimeEntry(this);
436 } 409 }
437 } 410 }
438 411
439 Operand::Operand(intptr_t immediate, RelocInfo::Mode rmode) { 412 Operand::Operand(intptr_t immediate, RelocInfo::Mode rmode) {
440 rm_ = no_reg; 413 rm_ = no_reg;
441 imm_ = immediate; 414 imm_ = immediate;
442 rmode_ = rmode; 415 rmode_ = rmode;
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 } 719 }
747 #endif 720 #endif
748 return; 721 return;
749 } 722 }
750 UNREACHABLE(); 723 UNREACHABLE();
751 } 724 }
752 } 725 }
753 } // namespace v8::internal 726 } // namespace v8::internal
754 727
755 #endif // V8_PPC_ASSEMBLER_PPC_INL_H_ 728 #endif // V8_PPC_ASSEMBLER_PPC_INL_H_
OLDNEW
« no previous file with comments | « src/ppc/assembler-ppc.h ('k') | src/ppc/debug-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698