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

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

Issue 1233213002: MIPS: Debugger: use debug break slots to break at function exit. 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
OLDNEW
1 1
2 // Copyright (c) 1994-2006 Sun Microsystems Inc. 2 // Copyright (c) 1994-2006 Sun Microsystems Inc.
3 // All Rights Reserved. 3 // All Rights Reserved.
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // - Redistributions of source code must retain the above copyright notice, 9 // - Redistributions of source code must retain the above copyright notice,
10 // this list of conditions and the following disclaimer. 10 // this list of conditions and the following disclaimer.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 DCHECK(reg.is_valid()); 110 DCHECK(reg.is_valid());
111 DCHECK(!reg.is(kDoubleRegZero)); 111 DCHECK(!reg.is(kDoubleRegZero));
112 DCHECK(!reg.is(kLithiumScratchDouble)); 112 DCHECK(!reg.is(kLithiumScratchDouble));
113 return (reg.code() / 2); 113 return (reg.code() / 2);
114 } 114 }
115 115
116 116
117 // ----------------------------------------------------------------------------- 117 // -----------------------------------------------------------------------------
118 // RelocInfo. 118 // RelocInfo.
119 119
120 void RelocInfo::apply(intptr_t delta, ICacheFlushMode icache_flush_mode) { 120 void RelocInfo::apply(intptr_t delta) {
121 if (IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)) { 121 if (IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)) {
122 // Absolute code pointer inside code object moves with the code object. 122 // Absolute code pointer inside code object moves with the code object.
123 byte* p = reinterpret_cast<byte*>(pc_); 123 byte* p = reinterpret_cast<byte*>(pc_);
124 int count = Assembler::RelocateInternalReference(rmode_, p, delta); 124 int count = Assembler::RelocateInternalReference(rmode_, p, delta);
125 CpuFeatures::FlushICache(p, count * sizeof(uint32_t)); 125 CpuFeatures::FlushICache(p, count * sizeof(uint32_t));
126 } 126 }
127 } 127 }
128 128
129 129
130 Address RelocInfo::target_address() { 130 Address RelocInfo::target_address() {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 host(), this, HeapObject::cast(target_code)); 182 host(), this, HeapObject::cast(target_code));
183 } 183 }
184 } 184 }
185 185
186 186
187 Address Assembler::target_address_from_return_address(Address pc) { 187 Address Assembler::target_address_from_return_address(Address pc) {
188 return pc - kCallTargetAddressOffset; 188 return pc - kCallTargetAddressOffset;
189 } 189 }
190 190
191 191
192 Address Assembler::break_address_from_return_address(Address pc) {
193 return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
194 }
195
196
197 void Assembler::set_target_internal_reference_encoded_at(Address pc, 192 void Assembler::set_target_internal_reference_encoded_at(Address pc,
198 Address target) { 193 Address target) {
199 // Encoded internal references are j/jal instructions. 194 // Encoded internal references are j/jal instructions.
200 Instr instr = Assembler::instr_at(pc + 0 * Assembler::kInstrSize); 195 Instr instr = Assembler::instr_at(pc + 0 * Assembler::kInstrSize);
201 196
202 uint64_t imm28 = 197 uint64_t imm28 =
203 (reinterpret_cast<uint64_t>(target) & static_cast<uint64_t>(kImm28Mask)); 198 (reinterpret_cast<uint64_t>(target) & static_cast<uint64_t>(kImm28Mask));
204 199
205 instr &= ~kImm26Mask; 200 instr &= ~kImm26Mask;
206 uint64_t imm26 = imm28 >> 2; 201 uint64_t imm26 = imm28 >> 2;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 337
343 void RelocInfo::set_code_age_stub(Code* stub, 338 void RelocInfo::set_code_age_stub(Code* stub,
344 ICacheFlushMode icache_flush_mode) { 339 ICacheFlushMode icache_flush_mode) {
345 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 340 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
346 Assembler::set_target_address_at(pc_ + Assembler::kInstrSize, 341 Assembler::set_target_address_at(pc_ + Assembler::kInstrSize,
347 host_, 342 host_,
348 stub->instruction_start()); 343 stub->instruction_start());
349 } 344 }
350 345
351 346
352 Address RelocInfo::call_address() { 347 Address RelocInfo::debug_call_address() {
353 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
354 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
355 // The pc_ offset of 0 assumes mips patched return sequence per 348 // The pc_ offset of 0 assumes mips patched return sequence per
356 // debug-mips.cc BreakLocation::SetDebugBreakAtReturn(), or 349 // debug-mips.cc BreakLocation::SetDebugBreakAtReturn(), or
357 // debug break slot per BreakLocation::SetDebugBreakAtSlot(). 350 // debug break slot per BreakLocation::SetDebugBreakAtSlot().
351 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence());
358 return Assembler::target_address_at(pc_, host_); 352 return Assembler::target_address_at(pc_, host_);
359 } 353 }
360 354
361 355
362 void RelocInfo::set_call_address(Address target) { 356 void RelocInfo::set_debug_call_address(Address target) {
363 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 357 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence());
364 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
365 // The pc_ offset of 0 assumes mips patched return sequence per 358 // The pc_ offset of 0 assumes mips patched return sequence per
366 // debug-mips.cc BreakLocation::SetDebugBreakAtReturn(), or 359 // debug-mips.cc BreakLocation::SetDebugBreakAtReturn(), or
367 // debug break slot per BreakLocation::SetDebugBreakAtSlot(). 360 // debug break slot per BreakLocation::SetDebugBreakAtSlot().
paul.l... 2015/07/14 19:15:59 comment nit: remove ref to removed function SetDeb
balazs.kilvady 2015/07/14 19:30:22 Done.
368 Assembler::set_target_address_at(pc_, host_, target); 361 Assembler::set_target_address_at(pc_, host_, target);
369 if (host() != NULL) { 362 if (host() != NULL) {
370 Object* target_code = Code::GetCodeFromTargetAddress(target); 363 Object* target_code = Code::GetCodeFromTargetAddress(target);
371 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 364 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
372 host(), this, HeapObject::cast(target_code)); 365 host(), this, HeapObject::cast(target_code));
373 } 366 }
374 } 367 }
375 368
376 369
377 Object* RelocInfo::call_object() {
378 return *call_object_address();
379 }
380
381
382 Object** RelocInfo::call_object_address() {
383 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
384 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
385 return reinterpret_cast<Object**>(pc_ + 6 * Assembler::kInstrSize);
386 }
387
388
389 void RelocInfo::set_call_object(Object* target) {
390 *call_object_address() = target;
391 }
392
393
394 void RelocInfo::WipeOut() { 370 void RelocInfo::WipeOut() {
395 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || 371 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
396 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || 372 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
397 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); 373 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_));
398 if (IsInternalReference(rmode_)) { 374 if (IsInternalReference(rmode_)) {
399 Memory::Address_at(pc_) = NULL; 375 Memory::Address_at(pc_) = NULL;
400 } else if (IsInternalReferenceEncoded(rmode_)) { 376 } else if (IsInternalReferenceEncoded(rmode_)) {
401 Assembler::set_target_internal_reference_encoded_at(pc_, nullptr); 377 Assembler::set_target_internal_reference_encoded_at(pc_, nullptr);
402 } else { 378 } else {
403 Assembler::set_target_address_at(pc_, host_, NULL); 379 Assembler::set_target_address_at(pc_, host_, NULL);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 visitor->VisitCodeTarget(this); 411 visitor->VisitCodeTarget(this);
436 } else if (mode == RelocInfo::CELL) { 412 } else if (mode == RelocInfo::CELL) {
437 visitor->VisitCell(this); 413 visitor->VisitCell(this);
438 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 414 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
439 visitor->VisitExternalReference(this); 415 visitor->VisitExternalReference(this);
440 } else if (mode == RelocInfo::INTERNAL_REFERENCE || 416 } else if (mode == RelocInfo::INTERNAL_REFERENCE ||
441 mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) { 417 mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) {
442 visitor->VisitInternalReference(this); 418 visitor->VisitInternalReference(this);
443 } else if (RelocInfo::IsCodeAgeSequence(mode)) { 419 } else if (RelocInfo::IsCodeAgeSequence(mode)) {
444 visitor->VisitCodeAgeSequence(this); 420 visitor->VisitCodeAgeSequence(this);
445 } else if (((RelocInfo::IsJSReturn(mode) && 421 } else if (RelocInfo::IsDebugBreakSlot(mode) &&
446 IsPatchedReturnSequence()) || 422 IsPatchedDebugBreakSlotSequence() &&
447 (RelocInfo::IsDebugBreakSlot(mode) &&
448 IsPatchedDebugBreakSlotSequence())) &&
449 isolate->debug()->has_break_points()) { 423 isolate->debug()->has_break_points()) {
450 visitor->VisitDebugTarget(this); 424 visitor->VisitDebugTarget(this);
451 } else if (RelocInfo::IsRuntimeEntry(mode)) { 425 } else if (RelocInfo::IsRuntimeEntry(mode)) {
452 visitor->VisitRuntimeEntry(this); 426 visitor->VisitRuntimeEntry(this);
453 } 427 }
454 } 428 }
455 429
456 430
457 template<typename StaticVisitor> 431 template<typename StaticVisitor>
458 void RelocInfo::Visit(Heap* heap) { 432 void RelocInfo::Visit(Heap* heap) {
459 RelocInfo::Mode mode = rmode(); 433 RelocInfo::Mode mode = rmode();
460 if (mode == RelocInfo::EMBEDDED_OBJECT) { 434 if (mode == RelocInfo::EMBEDDED_OBJECT) {
461 StaticVisitor::VisitEmbeddedPointer(heap, this); 435 StaticVisitor::VisitEmbeddedPointer(heap, this);
462 } else if (RelocInfo::IsCodeTarget(mode)) { 436 } else if (RelocInfo::IsCodeTarget(mode)) {
463 StaticVisitor::VisitCodeTarget(heap, this); 437 StaticVisitor::VisitCodeTarget(heap, this);
464 } else if (mode == RelocInfo::CELL) { 438 } else if (mode == RelocInfo::CELL) {
465 StaticVisitor::VisitCell(heap, this); 439 StaticVisitor::VisitCell(heap, this);
466 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 440 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
467 StaticVisitor::VisitExternalReference(this); 441 StaticVisitor::VisitExternalReference(this);
468 } else if (mode == RelocInfo::INTERNAL_REFERENCE || 442 } else if (mode == RelocInfo::INTERNAL_REFERENCE ||
469 mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) { 443 mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) {
470 StaticVisitor::VisitInternalReference(this); 444 StaticVisitor::VisitInternalReference(this);
471 } else if (RelocInfo::IsCodeAgeSequence(mode)) { 445 } else if (RelocInfo::IsCodeAgeSequence(mode)) {
472 StaticVisitor::VisitCodeAgeSequence(heap, this); 446 StaticVisitor::VisitCodeAgeSequence(heap, this);
473 } else if (heap->isolate()->debug()->has_break_points() && 447 } else if (heap->isolate()->debug()->has_break_points() &&
474 ((RelocInfo::IsJSReturn(mode) && 448 RelocInfo::IsDebugBreakSlot(mode) &&
475 IsPatchedReturnSequence()) || 449 IsPatchedDebugBreakSlotSequence()) {
476 (RelocInfo::IsDebugBreakSlot(mode) &&
477 IsPatchedDebugBreakSlotSequence()))) {
478 StaticVisitor::VisitDebugTarget(heap, this); 450 StaticVisitor::VisitDebugTarget(heap, this);
479 } else if (RelocInfo::IsRuntimeEntry(mode)) { 451 } else if (RelocInfo::IsRuntimeEntry(mode)) {
480 StaticVisitor::VisitRuntimeEntry(this); 452 StaticVisitor::VisitRuntimeEntry(this);
481 } 453 }
482 } 454 }
483 455
484 456
485 // ----------------------------------------------------------------------------- 457 // -----------------------------------------------------------------------------
486 // Assembler. 458 // Assembler.
487 459
(...skipping 28 matching lines...) Expand all
516 } 488 }
517 *reinterpret_cast<uint64_t*>(pc_) = x; 489 *reinterpret_cast<uint64_t*>(pc_) = x;
518 pc_ += kInstrSize * 2; 490 pc_ += kInstrSize * 2;
519 CheckTrampolinePoolQuick(); 491 CheckTrampolinePoolQuick();
520 } 492 }
521 493
522 494
523 } } // namespace v8::internal 495 } } // namespace v8::internal
524 496
525 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ 497 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698