Index: src/ppc/code-stubs-ppc.cc |
diff --git a/src/ppc/code-stubs-ppc.cc b/src/ppc/code-stubs-ppc.cc |
index 7e4533ddcc3451fe3dc01aa7bf0d23994b4f1c10..82a4553e7c468c8bfd0caa814595365bde1dd934 100644 |
--- a/src/ppc/code-stubs-ppc.cc |
+++ b/src/ppc/code-stubs-ppc.cc |
@@ -1089,15 +1089,15 @@ void CEntryStub::Generate(MacroAssembler* masm) { |
__ mov(isolate_reg, Operand(ExternalReference::isolate_address(isolate()))); |
Register target = r15; |
-#if ABI_USES_FUNCTION_DESCRIPTORS && !defined(USE_SIMULATOR) |
- // Native AIX/PPC64 Linux use a function descriptor. |
- __ LoadP(ToRegister(ABI_TOC_REGISTER), MemOperand(r15, kPointerSize)); |
- __ LoadP(ip, MemOperand(r15, 0)); // Instruction address |
- target = ip; |
-#elif ABI_CALL_VIA_IP |
- __ Move(ip, r15); |
- target = ip; |
-#endif |
+ if (ABI_USES_FUNCTION_DESCRIPTORS) { |
+ // AIX/PPC64BE Linux use a function descriptor. |
+ __ LoadP(ToRegister(ABI_TOC_REGISTER), MemOperand(r15, kPointerSize)); |
+ __ LoadP(ip, MemOperand(r15, 0)); // Instruction address |
+ target = ip; |
+ } else if (ABI_CALL_VIA_IP) { |
+ __ Move(ip, r15); |
+ target = ip; |
+ } |
// To let the GC traverse the return address of the exit frames, we need to |
// know where the return address is. The CEntryStub is unmovable, so |
@@ -2251,16 +2251,6 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { |
// Locate the code entry and call it. |
__ addi(code, code, Operand(Code::kHeaderSize - kHeapObjectTag)); |
- |
-#if ABI_USES_FUNCTION_DESCRIPTORS && defined(USE_SIMULATOR) |
- // Even Simulated AIX/PPC64 Linux uses a function descriptor for the |
- // RegExp routine. Extract the instruction address here since |
- // DirectCEntryStub::GenerateCall will not do it for calls out to |
- // what it thinks is C code compiled for the simulator/host |
- // platform. |
- __ LoadP(code, MemOperand(code, 0)); // Instruction address |
-#endif |
- |
DirectCEntryStub stub(isolate()); |
stub.GenerateCall(masm, code); |
@@ -3816,15 +3806,15 @@ void DirectCEntryStub::Generate(MacroAssembler* masm) { |
void DirectCEntryStub::GenerateCall(MacroAssembler* masm, Register target) { |
-#if ABI_USES_FUNCTION_DESCRIPTORS && !defined(USE_SIMULATOR) |
- // Native AIX/PPC64 Linux use a function descriptor. |
- __ LoadP(ToRegister(ABI_TOC_REGISTER), MemOperand(target, kPointerSize)); |
- __ LoadP(ip, MemOperand(target, 0)); // Instruction address |
-#else |
- // ip needs to be set for DirectCEentryStub::Generate, and also |
- // for ABI_CALL_VIA_IP. |
- __ Move(ip, target); |
-#endif |
+ if (ABI_USES_FUNCTION_DESCRIPTORS) { |
+ // AIX/PPC64BE Linux use a function descriptor. |
+ __ LoadP(ToRegister(ABI_TOC_REGISTER), MemOperand(target, kPointerSize)); |
+ __ LoadP(ip, MemOperand(target, 0)); // Instruction address |
+ } else { |
+ // ip needs to be set for DirectCEentryStub::Generate, and also |
+ // for ABI_CALL_VIA_IP. |
+ __ Move(ip, target); |
+ } |
intptr_t code = reinterpret_cast<intptr_t>(GetCode().location()); |
__ mov(r0, Operand(code, RelocInfo::CODE_TARGET)); |
@@ -4787,34 +4777,32 @@ void ProfileEntryHookStub::Generate(MacroAssembler* masm) { |
#if !defined(USE_SIMULATOR) |
uintptr_t entry_hook = |
reinterpret_cast<uintptr_t>(isolate()->function_entry_hook()); |
- __ mov(ip, Operand(entry_hook)); |
+#else |
+ // Under the simulator we need to indirect the entry hook through a |
+ // trampoline function at a known address. |
+ ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline)); |
+ ExternalReference entry_hook = ExternalReference( |
+ &dispatcher, ExternalReference::BUILTIN_CALL, isolate()); |
-#if ABI_USES_FUNCTION_DESCRIPTORS |
- // Function descriptor |
- __ LoadP(ToRegister(ABI_TOC_REGISTER), MemOperand(ip, kPointerSize)); |
- __ LoadP(ip, MemOperand(ip, 0)); |
-#elif ABI_CALL_VIA_IP |
-// ip set above, so nothing to do. |
+ // It additionally takes an isolate as a third parameter |
+ __ mov(r5, Operand(ExternalReference::isolate_address(isolate()))); |
#endif |
+ __ mov(ip, Operand(entry_hook)); |
+ |
+ if (ABI_USES_FUNCTION_DESCRIPTORS) { |
+ __ LoadP(ToRegister(ABI_TOC_REGISTER), MemOperand(ip, kPointerSize)); |
+ __ LoadP(ip, MemOperand(ip, 0)); |
+ } |
+ // ip set above, so nothing more to do for ABI_CALL_VIA_IP. |
+ |
// PPC LINUX ABI: |
__ li(r0, Operand::Zero()); |
__ StorePU(r0, MemOperand(sp, -kNumRequiredStackFrameSlots * kPointerSize)); |
-#else |
- // Under the simulator we need to indirect the entry hook through a |
- // trampoline function at a known address. |
- // It additionally takes an isolate as a third parameter |
- __ mov(r5, Operand(ExternalReference::isolate_address(isolate()))); |
- ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline)); |
- __ mov(ip, Operand(ExternalReference( |
- &dispatcher, ExternalReference::BUILTIN_CALL, isolate()))); |
-#endif |
__ Call(ip); |
-#if !defined(USE_SIMULATOR) |
__ addi(sp, sp, Operand(kNumRequiredStackFrameSlots * kPointerSize)); |
-#endif |
// Restore the stack pointer if needed. |
if (frame_alignment > kPointerSize) { |
@@ -5604,6 +5592,9 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) { |
// ----------------------------------- |
Register api_function_address = ApiGetterDescriptor::function_address(); |
+ int arg0Slot = 0; |
+ int accessorInfoSlot = 0; |
+ int apiStackSpace = 0; |
DCHECK(api_function_address.is(r5)); |
__ mr(r3, sp); // r0 = Handle<Name> |
@@ -5621,29 +5612,29 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) { |
// [0] space for DirectCEntryStub's LR save |
// [1] copy of Handle (first arg) |
// [2] AccessorInfo& |
-#if ABI_PASSES_HANDLES_IN_REGS |
- const int kAccessorInfoSlot = kStackFrameExtraParamSlot + 1; |
- const int kApiStackSpace = 2; |
-#else |
- const int kArg0Slot = kStackFrameExtraParamSlot + 1; |
- const int kAccessorInfoSlot = kArg0Slot + 1; |
- const int kApiStackSpace = 3; |
-#endif |
+ if (ABI_PASSES_HANDLES_IN_REGS) { |
+ accessorInfoSlot = kStackFrameExtraParamSlot + 1; |
+ apiStackSpace = 2; |
+ } else { |
+ arg0Slot = kStackFrameExtraParamSlot + 1; |
+ accessorInfoSlot = arg0Slot + 1; |
+ apiStackSpace = 3; |
+ } |
FrameScope frame_scope(masm, StackFrame::MANUAL); |
- __ EnterExitFrame(false, kApiStackSpace); |
+ __ EnterExitFrame(false, apiStackSpace); |
-#if !ABI_PASSES_HANDLES_IN_REGS |
- // pass 1st arg by reference |
- __ StoreP(r3, MemOperand(sp, kArg0Slot * kPointerSize)); |
- __ addi(r3, sp, Operand(kArg0Slot * kPointerSize)); |
-#endif |
+ if (!ABI_PASSES_HANDLES_IN_REGS) { |
+ // pass 1st arg by reference |
+ __ StoreP(r3, MemOperand(sp, arg0Slot * kPointerSize)); |
+ __ addi(r3, sp, Operand(arg0Slot * kPointerSize)); |
+ } |
// Create PropertyAccessorInfo instance on the stack above the exit frame with |
// r4 (internal::Object** args_) as the data. |
- __ StoreP(r4, MemOperand(sp, kAccessorInfoSlot * kPointerSize)); |
+ __ StoreP(r4, MemOperand(sp, accessorInfoSlot * kPointerSize)); |
// r4 = AccessorInfo& |
- __ addi(r4, sp, Operand(kAccessorInfoSlot * kPointerSize)); |
+ __ addi(r4, sp, Operand(accessorInfoSlot * kPointerSize)); |
const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; |