Commit 38bec2ea authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[TurboFan] Don't generate reloc info for builtin calls at runtime

If a call to a builtin is generated at run-time (vs at snapshot time)
we don't need to tag the call/jump with relocation info, as the builtin
address will not change.

The only way to generate a builtin call at snapshot time is via

MacroAssembler::JumpToInstructionStream where we keep OFF_HEAP_TARGET.
The reloc info for builtin calls and jumps is set to NONE.

Bug: v8:6666
Change-Id: I9e8ad9f23481a2177e69352a56010084336402e7
Reviewed-on: https://chromium-review.googlesource.com/1105758
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53835}
parent c5dd9f40
...@@ -218,7 +218,10 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode, ...@@ -218,7 +218,10 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode,
Address entry = d.InstructionStartOfBuiltin(builtin_index); Address entry = d.InstructionStartOfBuiltin(builtin_index);
// Use ip directly instead of using UseScratchRegisterScope, as we do not // Use ip directly instead of using UseScratchRegisterScope, as we do not
// preserve scratch registers across calls. // preserve scratch registers across calls.
mov(ip, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); // RelocInfo is only necessary if generating code for the snapshot.
// Otherwise, the target address is immortal-immovable and never needs to
// be fixed up by GC (or deserialization).
mov(ip, Operand(entry, RelocInfo::NONE));
Jump(ip, cond); Jump(ip, cond);
return; return;
} }
...@@ -324,7 +327,10 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode, ...@@ -324,7 +327,10 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode,
Address entry = d.InstructionStartOfBuiltin(builtin_index); Address entry = d.InstructionStartOfBuiltin(builtin_index);
// Use ip directly instead of using UseScratchRegisterScope, as we do not // Use ip directly instead of using UseScratchRegisterScope, as we do not
// preserve scratch registers across calls. // preserve scratch registers across calls.
mov(ip, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); // RelocInfo is only necessary if generating code for the snapshot.
// Otherwise, the target address is immortal-immovable and never needs to
// be fixed up by GC (or deserialization).
mov(ip, Operand(entry, RelocInfo::NONE));
Call(ip, cond); Call(ip, cond);
return; return;
} }
......
...@@ -1974,7 +1974,10 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode, ...@@ -1974,7 +1974,10 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode,
Register scratch = temps.AcquireX(); Register scratch = temps.AcquireX();
EmbeddedData d = EmbeddedData::FromBlob(); EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin_index); Address entry = d.InstructionStartOfBuiltin(builtin_index);
Mov(scratch, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); // RelocInfo is only necessary if generating code for the snapshot.
// Otherwise, the target address is immortal-immovable and never needs to
// be fixed up by GC (or deserialization).
Mov(scratch, Operand(entry, RelocInfo::NONE));
Jump(scratch, cond); Jump(scratch, cond);
return; return;
} }
...@@ -2047,7 +2050,10 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode) { ...@@ -2047,7 +2050,10 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode) {
Register scratch = temps.AcquireX(); Register scratch = temps.AcquireX();
EmbeddedData d = EmbeddedData::FromBlob(); EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin_index); Address entry = d.InstructionStartOfBuiltin(builtin_index);
Mov(scratch, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); // RelocInfo is only necessary if generating code for the snapshot.
// Otherwise, the target address is immortal-immovable and never needs to
// be fixed up by GC (or deserialization).
Mov(scratch, Operand(entry, RelocInfo::NONE));
Call(scratch); Call(scratch);
return; return;
} }
......
...@@ -3779,7 +3779,10 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode, ...@@ -3779,7 +3779,10 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode,
CHECK_NE(builtin_index, Builtins::kNoBuiltinId); CHECK_NE(builtin_index, Builtins::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob(); EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin_index); Address entry = d.InstructionStartOfBuiltin(builtin_index);
li(t9, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); // RelocInfo is only necessary if generating code for the snapshot.
// Otherwise, the target address is immortal-immovable and never needs to
// be fixed up by GC (or deserialization).
li(t9, Operand(entry, RelocInfo::NONE));
Jump(t9, 0, cond, rs, rt, bd); Jump(t9, 0, cond, rs, rt, bd);
return; return;
} }
...@@ -3949,7 +3952,10 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode, ...@@ -3949,7 +3952,10 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode,
CHECK_NE(builtin_index, Builtins::kNoBuiltinId); CHECK_NE(builtin_index, Builtins::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob(); EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin_index); Address entry = d.InstructionStartOfBuiltin(builtin_index);
li(t9, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); // RelocInfo is only necessary if generating code for the snapshot.
// Otherwise, the target address is immortal-immovable and never needs to
// be fixed up by GC (or deserialization).
li(t9, Operand(entry, RelocInfo::NONE));
Call(t9, 0, cond, rs, rt, bd); Call(t9, 0, cond, rs, rt, bd);
return; return;
} }
......
...@@ -4210,7 +4210,10 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode, ...@@ -4210,7 +4210,10 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode,
CHECK_NE(builtin_index, Builtins::kNoBuiltinId); CHECK_NE(builtin_index, Builtins::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob(); EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin_index); Address entry = d.InstructionStartOfBuiltin(builtin_index);
li(t9, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); // RelocInfo is only necessary if generating code for the snapshot.
// Otherwise, the target address is immortal-immovable and never needs to
// be fixed up by GC (or deserialization).
li(t9, Operand(entry, RelocInfo::NONE));
Jump(t9, cond, rs, rt, bd); Jump(t9, cond, rs, rt, bd);
return; return;
} }
...@@ -4313,7 +4316,10 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode, ...@@ -4313,7 +4316,10 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode,
CHECK_NE(builtin_index, Builtins::kNoBuiltinId); CHECK_NE(builtin_index, Builtins::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob(); EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin_index); Address entry = d.InstructionStartOfBuiltin(builtin_index);
li(t9, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); // RelocInfo is only necessary if generating code for the snapshot.
// Otherwise, the target address is immortal-immovable and never needs to
// be fixed up by GC (or deserialization).
li(t9, Operand(entry, RelocInfo::NONE));
Call(t9, cond, rs, rt, bd); Call(t9, cond, rs, rt, bd);
return; return;
} }
......
...@@ -216,7 +216,10 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode, ...@@ -216,7 +216,10 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode,
Address entry = d.InstructionStartOfBuiltin(builtin_index); Address entry = d.InstructionStartOfBuiltin(builtin_index);
// Use ip directly instead of using UseScratchRegisterScope, as we do not // Use ip directly instead of using UseScratchRegisterScope, as we do not
// preserve scratch registers across calls. // preserve scratch registers across calls.
mov(ip, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); // RelocInfo is only necessary if generating code for the snapshot.
// Otherwise, the target address is immortal-immovable and never needs to
// be fixed up by GC (or deserialization).
mov(ip, Operand(entry, RelocInfo::NONE));
Label skip; Label skip;
if (cond != al) b(NegateCondition(cond), &skip, cr); if (cond != al) b(NegateCondition(cond), &skip, cr);
Jump(ip); Jump(ip);
...@@ -315,7 +318,10 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode, ...@@ -315,7 +318,10 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode,
Address entry = d.InstructionStartOfBuiltin(builtin_index); Address entry = d.InstructionStartOfBuiltin(builtin_index);
// Use ip directly instead of using UseScratchRegisterScope, as we do not // Use ip directly instead of using UseScratchRegisterScope, as we do not
// preserve scratch registers across calls. // preserve scratch registers across calls.
mov(ip, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); // RelocInfo is only necessary if generating code for the snapshot.
// Otherwise, the target address is immortal-immovable and never needs to
// be fixed up by GC (or deserialization).
mov(ip, Operand(entry, RelocInfo::NONE));
Label skip; Label skip;
if (cond != al) b(NegateCondition(cond), &skip); if (cond != al) b(NegateCondition(cond), &skip);
Call(ip); Call(ip);
......
...@@ -211,7 +211,10 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode, ...@@ -211,7 +211,10 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode,
Address entry = d.InstructionStartOfBuiltin(builtin_index); Address entry = d.InstructionStartOfBuiltin(builtin_index);
// Use ip directly instead of using UseScratchRegisterScope, as we do not // Use ip directly instead of using UseScratchRegisterScope, as we do not
// preserve scratch registers across calls. // preserve scratch registers across calls.
mov(ip, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); // RelocInfo is only necessary if generating code for the snapshot.
// Otherwise, the target address is immortal-immovable and never needs to
// be fixed up by GC (or deserialization).
mov(ip, Operand(entry, RelocInfo::NONE));
Jump(ip, cond); Jump(ip, cond);
return; return;
} }
...@@ -307,7 +310,10 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode, ...@@ -307,7 +310,10 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode,
Address entry = d.InstructionStartOfBuiltin(builtin_index); Address entry = d.InstructionStartOfBuiltin(builtin_index);
// Use ip directly instead of using UseScratchRegisterScope, as we do not // Use ip directly instead of using UseScratchRegisterScope, as we do not
// preserve scratch registers across calls. // preserve scratch registers across calls.
mov(ip, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); // RelocInfo is only necessary if generating code for the snapshot.
// Otherwise, the target address is immortal-immovable and never needs to
// be fixed up by GC (or deserialization).
mov(ip, Operand(entry, RelocInfo::NONE));
Call(ip); Call(ip);
return; return;
} }
......
...@@ -1547,7 +1547,10 @@ void TurboAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode, ...@@ -1547,7 +1547,10 @@ void TurboAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode,
CHECK_NE(builtin_index, Builtins::kNoBuiltinId); CHECK_NE(builtin_index, Builtins::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob(); EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin_index); Address entry = d.InstructionStartOfBuiltin(builtin_index);
Move(kScratchRegister, entry, RelocInfo::OFF_HEAP_TARGET); // RelocInfo is only necessary if generating code for the snapshot.
// Otherwise, the target address is immortal-immovable and never needs to
// be fixed up by GC (or deserialization).
Move(kScratchRegister, entry, RelocInfo::NONE);
jmp(kScratchRegister); jmp(kScratchRegister);
return; return;
} }
...@@ -1615,7 +1618,7 @@ void TurboAssembler::Call(Handle<Code> code_object, RelocInfo::Mode rmode) { ...@@ -1615,7 +1618,7 @@ void TurboAssembler::Call(Handle<Code> code_object, RelocInfo::Mode rmode) {
CHECK_NE(builtin_index, Builtins::kNoBuiltinId); CHECK_NE(builtin_index, Builtins::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob(); EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin_index); Address entry = d.InstructionStartOfBuiltin(builtin_index);
Move(kScratchRegister, entry, RelocInfo::OFF_HEAP_TARGET); Move(kScratchRegister, entry, RelocInfo::NONE);
call(kScratchRegister); call(kScratchRegister);
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment