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

Unified Diff: src/a64/full-codegen-a64.cc

Issue 154523002: A64: Fix code patching (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: updates Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/a64/full-codegen-a64.cc
diff --git a/src/a64/full-codegen-a64.cc b/src/a64/full-codegen-a64.cc
index e06c01295cb7b4f62f4192c29b71f77d11915797..c396c78878e1aaa917bec03c69fd411518679204 100644
--- a/src/a64/full-codegen-a64.cc
+++ b/src/a64/full-codegen-a64.cc
@@ -4957,9 +4957,12 @@ void BackEdgeTable::PatchAt(Code* unoptimized_code,
// .. .. .. .. b.pl ok
// .. .. .. .. ldr x16, pc+<interrupt stub address>
// .. .. .. .. blr x16
+ // ... more instructions.
// ok-label
- // Jump offset is 4 instructions.
- patcher.b(4 * kInstructionSize, pl);
+ // Jump offset is 6 instructions.
+ ASSERT(Instruction::Cast(branch_address)
+ ->IsNop(Assembler::INTERRUPT_CODE_NOP));
+ patcher.b(6, pl);
break;
case ON_STACK_REPLACEMENT:
case OSR_AFTER_STACK_CHECK:
@@ -4967,13 +4970,37 @@ void BackEdgeTable::PatchAt(Code* unoptimized_code,
// .. .. .. .. mov x0, x0 (NOP)
// .. .. .. .. ldr x16, pc+<on-stack replacement address>
// .. .. .. .. blr x16
+ ASSERT(Instruction::Cast(branch_address)->IsCondBranchImm());
+ ASSERT(Instruction::Cast(branch_address)->ImmPCOffset() ==
+ 6 * kInstructionSize);
patcher.nop(Assembler::INTERRUPT_CODE_NOP);
break;
}
// Replace the call address.
Instruction* load = Instruction::Cast(pc)->preceding(2);
- Address interrupt_address_pointer = pc + load->ImmPCOffset();
+ Address interrupt_address_pointer =
+ reinterpret_cast<Address>(load) + load->ImmPCOffset();
+ ASSERT((Memory::uint64_at(interrupt_address_pointer) ==
+ reinterpret_cast<uint64_t>(unoptimized_code->GetIsolate()
+ ->builtins()
+ ->OnStackReplacement()
+ ->entry())) ||
+ (Memory::uint64_at(interrupt_address_pointer) ==
+ reinterpret_cast<uint64_t>(unoptimized_code->GetIsolate()
+ ->builtins()
+ ->InterruptCheck()
+ ->entry())) ||
+ (Memory::uint64_at(interrupt_address_pointer) ==
+ reinterpret_cast<uint64_t>(unoptimized_code->GetIsolate()
+ ->builtins()
+ ->OsrAfterStackCheck()
+ ->entry())) ||
+ (Memory::uint64_at(interrupt_address_pointer) ==
+ reinterpret_cast<uint64_t>(unoptimized_code->GetIsolate()
+ ->builtins()
+ ->OnStackReplacement()
+ ->entry())));
Memory::uint64_at(interrupt_address_pointer) =
reinterpret_cast<uint64_t>(replacement_code->entry());
@@ -4993,7 +5020,8 @@ BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState(
if (jump_or_nop->IsNop(Assembler::INTERRUPT_CODE_NOP)) {
Instruction* load = Instruction::Cast(pc)->preceding(2);
- uint64_t entry = Memory::uint64_at(pc + load->ImmPCOffset());
+ uint64_t entry = Memory::uint64_at(reinterpret_cast<Address>(load) +
+ load->ImmPCOffset());
if (entry == reinterpret_cast<uint64_t>(
isolate->builtins()->OnStackReplacement()->entry())) {
return ON_STACK_REPLACEMENT;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698