Commit 918aca7f authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

PPC/s390: [masm] Shortcut some indirect external reference loads

Port 13fc4a1b

Original Commit Message:

    External references located within the isolate can be loaded as a
    fixed offset from the root register. This avoids one load from memory
    over the default indirect method (which reads from the external
    reference table).

R=jgruber@chromium.org, joransiu@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I4a02973a0279517ab5247f4f9519b0e26168c444
Reviewed-on: https://chromium-review.googlesource.com/1097628Reviewed-by: 's avatarJoran Siu <joransiu@ca.ibm.com>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#53680}
parent bcf81513
......@@ -156,6 +156,15 @@ void TurboAssembler::LoadBuiltin(Register destination, int builtin_index) {
LoadP(destination, MemOperand(kRootRegister, roots_to_builtins_offset), r0);
}
void TurboAssembler::LoadRootRegisterOffset(Register destination,
intptr_t offset) {
if (offset == 0) {
mr(destination, kRootRegister);
} else {
addi(destination, kRootRegister, Operand(offset));
}
}
#endif // V8_EMBEDDED_BUILTINS
void MacroAssembler::JumpToJSEntry(Register target) {
......
......@@ -439,6 +439,7 @@ class TurboAssembler : public TurboAssemblerBase {
void LoadExternalReference(Register destination,
int reference_index) override;
void LoadBuiltin(Register destination, int builtin_index) override;
void LoadRootRegisterOffset(Register destination, intptr_t offset) override;
#endif // V8_EMBEDDED_BUILTINS
// Returns the size of a call in instructions. Note, the value returned is
......
......@@ -151,6 +151,18 @@ void TurboAssembler::LoadBuiltin(Register destination, int builtin_index) {
LoadP(destination, MemOperand(kRootRegister, roots_to_builtins_offset));
}
void TurboAssembler::LoadRootRegisterOffset(Register destination,
intptr_t offset) {
if (offset == 0) {
LoadRR(destination, kRootRegister);
} else if (is_uint12(offset)) {
la(destination, MemOperand(kRootRegister, offset));
} else {
DCHECK(is_int20(offset));
lay(destination, MemOperand(kRootRegister, offset));
}
}
#endif // V8_EMBEDDED_BUILTINS
void TurboAssembler::Jump(Register target, Condition cond) { b(cond, target); }
......
......@@ -182,6 +182,7 @@ class TurboAssembler : public TurboAssemblerBase {
void LoadExternalReference(Register destination,
int reference_index) override;
void LoadBuiltin(Register destination, int builtin_index) override;
void LoadRootRegisterOffset(Register destination, intptr_t offset) override;
#endif // V8_EMBEDDED_BUILTINS
// Returns the size of a call in instructions.
......
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