PPC: Disable CP on builtins

Also updated LoadConstantPoolPointerRegisterFromCodeTargetAddress
to add instruction size to the new constant_pool_offset.

Bug: v8:11036
Change-Id: Ib92a1b0606c60f82628d3e63ade54b312e4cf196
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2508691
Commit-Queue: Junliang Yan <junyan@redhat.com>
Reviewed-by: Milad Fa <mfarazma@redhat.com>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70929}
This commit is contained in:
Junliang Yan 2020-11-02 11:44:56 -05:00 committed by Commit Bot
parent 5d122bdc59
commit 37a38eba65
2 changed files with 13 additions and 1 deletions

View File

@ -240,7 +240,9 @@ class V8_EXPORT_PRIVATE AssemblerBase : public Malloced {
bool is_constant_pool_available() const {
if (FLAG_enable_embedded_constant_pool) {
return constant_pool_available_;
// We need to disable constant pool here for embeded builtins
// because the metadata section is not adjacent to instructions
return constant_pool_available_ && !options().isolate_independent_code;
} else {
// Embedded constant pool not supported on this architecture.
UNREACHABLE();

View File

@ -1053,10 +1053,16 @@ void TurboAssembler::ShiftRightAlgPair(Register dst_low, Register dst_high,
void TurboAssembler::LoadConstantPoolPointerRegisterFromCodeTargetAddress(
Register code_target_address) {
// Builtins do not use the constant pool (see is_constant_pool_available).
STATIC_ASSERT(Code::kOnHeapBodyIsContiguous);
lwz(r0, MemOperand(code_target_address,
Code::kInstructionSizeOffset - Code::kHeaderSize));
lwz(kConstantPoolRegister,
MemOperand(code_target_address,
Code::kConstantPoolOffsetOffset - Code::kHeaderSize));
add(kConstantPoolRegister, kConstantPoolRegister, code_target_address);
add(kConstantPoolRegister, kConstantPoolRegister, r0);
}
void TurboAssembler::LoadPC(Register dst) {
@ -1072,6 +1078,10 @@ void TurboAssembler::ComputeCodeStartAddress(Register dst) {
}
void TurboAssembler::LoadConstantPoolPointerRegister() {
//
// Builtins do not use the constant pool (see is_constant_pool_available).
STATIC_ASSERT(Code::kOnHeapBodyIsContiguous);
LoadPC(kConstantPoolRegister);
int32_t delta = -pc_offset() + 4;
add_label_offset(kConstantPoolRegister, kConstantPoolRegister,