| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <assert.h> // For assert | 5 #include <assert.h> // For assert |
| 6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
| 7 | 7 |
| 8 #if V8_TARGET_ARCH_PPC | 8 #if V8_TARGET_ARCH_PPC |
| 9 | 9 |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 3069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3080 | 3080 |
| 3081 void MacroAssembler::CallCFunction(Register function, int num_arguments) { | 3081 void MacroAssembler::CallCFunction(Register function, int num_arguments) { |
| 3082 CallCFunction(function, num_arguments, 0); | 3082 CallCFunction(function, num_arguments, 0); |
| 3083 } | 3083 } |
| 3084 | 3084 |
| 3085 | 3085 |
| 3086 void MacroAssembler::CallCFunctionHelper(Register function, | 3086 void MacroAssembler::CallCFunctionHelper(Register function, |
| 3087 int num_reg_arguments, | 3087 int num_reg_arguments, |
| 3088 int num_double_arguments) { | 3088 int num_double_arguments) { |
| 3089 DCHECK(has_frame()); | 3089 DCHECK(has_frame()); |
| 3090 // Just call directly. The function called cannot cause a GC, or | 3090 |
| 3091 // allow preemption, so the return address in the link register | 3091 // Just call directly. The function called cannot cause a GC, or |
| 3092 // stays correct. | 3092 // allow preemption, so the return address in the link register |
| 3093 // stays correct. |
| 3093 Register dest = function; | 3094 Register dest = function; |
| 3094 #if ABI_USES_FUNCTION_DESCRIPTORS && !defined(USE_SIMULATOR) | 3095 if (ABI_USES_FUNCTION_DESCRIPTORS) { |
| 3095 // AIX uses a function descriptor. When calling C code be aware | 3096 // AIX/PPC64BE Linux uses a function descriptor. When calling C code be |
| 3096 // of this descriptor and pick up values from it | 3097 // aware of this descriptor and pick up values from it |
| 3097 LoadP(ToRegister(ABI_TOC_REGISTER), MemOperand(function, kPointerSize)); | 3098 LoadP(ToRegister(ABI_TOC_REGISTER), MemOperand(function, kPointerSize)); |
| 3098 LoadP(ip, MemOperand(function, 0)); | 3099 LoadP(ip, MemOperand(function, 0)); |
| 3099 dest = ip; | 3100 dest = ip; |
| 3100 #elif ABI_CALL_VIA_IP | 3101 } else if (ABI_CALL_VIA_IP) { |
| 3101 Move(ip, function); | 3102 Move(ip, function); |
| 3102 dest = ip; | 3103 dest = ip; |
| 3103 #endif | 3104 } |
| 3104 | 3105 |
| 3105 Call(dest); | 3106 Call(dest); |
| 3106 | 3107 |
| 3107 // Remove frame bought in PrepareCallCFunction | 3108 // Remove frame bought in PrepareCallCFunction |
| 3108 int stack_passed_arguments = | 3109 int stack_passed_arguments = |
| 3109 CalculateStackPassedWords(num_reg_arguments, num_double_arguments); | 3110 CalculateStackPassedWords(num_reg_arguments, num_double_arguments); |
| 3110 int stack_space = kNumRequiredStackFrameSlots + stack_passed_arguments; | 3111 int stack_space = kNumRequiredStackFrameSlots + stack_passed_arguments; |
| 3111 if (ActivationFrameAlignment() > kPointerSize) { | 3112 if (ActivationFrameAlignment() > kPointerSize) { |
| 3112 LoadP(sp, MemOperand(sp, stack_space * kPointerSize)); | 3113 LoadP(sp, MemOperand(sp, stack_space * kPointerSize)); |
| 3113 } else { | 3114 } else { |
| (...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4325 } | 4326 } |
| 4326 if (mag.shift > 0) srawi(result, result, mag.shift); | 4327 if (mag.shift > 0) srawi(result, result, mag.shift); |
| 4327 ExtractBit(r0, dividend, 31); | 4328 ExtractBit(r0, dividend, 31); |
| 4328 add(result, result, r0); | 4329 add(result, result, r0); |
| 4329 } | 4330 } |
| 4330 | 4331 |
| 4331 } // namespace internal | 4332 } // namespace internal |
| 4332 } // namespace v8 | 4333 } // namespace v8 |
| 4333 | 4334 |
| 4334 #endif // V8_TARGET_ARCH_PPC | 4335 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |