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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 // oldSP->prev SP | 1082 // oldSP->prev SP |
1083 // LK | 1083 // LK |
1084 // <parameters on stack> | 1084 // <parameters on stack> |
1085 | 1085 |
1086 // Prior to calling EnterExitFrame, we've got a bunch of parameters | 1086 // Prior to calling EnterExitFrame, we've got a bunch of parameters |
1087 // on the stack that we need to wrap a real frame around.. so first | 1087 // on the stack that we need to wrap a real frame around.. so first |
1088 // we reserve a slot for LK and push the previous SP which is captured | 1088 // we reserve a slot for LK and push the previous SP which is captured |
1089 // in the fp register (r31) | 1089 // in the fp register (r31) |
1090 // Then - we buy a new frame | 1090 // Then - we buy a new frame |
1091 | 1091 |
1092 void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) { | 1092 void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space, |
| 1093 StackFrame::Type frame_type) { |
| 1094 DCHECK(frame_type == StackFrame::EXIT || |
| 1095 frame_type == StackFrame::BUILTIN_EXIT); |
1093 // Set up the frame structure on the stack. | 1096 // Set up the frame structure on the stack. |
1094 DCHECK_EQ(2 * kPointerSize, ExitFrameConstants::kCallerSPDisplacement); | 1097 DCHECK_EQ(2 * kPointerSize, ExitFrameConstants::kCallerSPDisplacement); |
1095 DCHECK_EQ(1 * kPointerSize, ExitFrameConstants::kCallerPCOffset); | 1098 DCHECK_EQ(1 * kPointerSize, ExitFrameConstants::kCallerPCOffset); |
1096 DCHECK_EQ(0 * kPointerSize, ExitFrameConstants::kCallerFPOffset); | 1099 DCHECK_EQ(0 * kPointerSize, ExitFrameConstants::kCallerFPOffset); |
1097 DCHECK(stack_space > 0); | 1100 DCHECK(stack_space > 0); |
1098 | 1101 |
1099 // This is an opportunity to build a frame to wrap | 1102 // This is an opportunity to build a frame to wrap |
1100 // all of the pushes that have happened inside of V8 | 1103 // all of the pushes that have happened inside of V8 |
1101 // since we were called from C code | 1104 // since we were called from C code |
1102 | 1105 |
1103 LoadSmiLiteral(ip, Smi::FromInt(StackFrame::EXIT)); | 1106 LoadSmiLiteral(ip, Smi::FromInt(frame_type)); |
1104 PushCommonFrame(ip); | 1107 PushCommonFrame(ip); |
1105 // Reserve room for saved entry sp and code object. | 1108 // Reserve room for saved entry sp and code object. |
1106 subi(sp, fp, Operand(ExitFrameConstants::kFixedFrameSizeFromFp)); | 1109 subi(sp, fp, Operand(ExitFrameConstants::kFixedFrameSizeFromFp)); |
1107 | 1110 |
1108 if (emit_debug_code()) { | 1111 if (emit_debug_code()) { |
1109 li(r8, Operand::Zero()); | 1112 li(r8, Operand::Zero()); |
1110 StoreP(r8, MemOperand(fp, ExitFrameConstants::kSPOffset)); | 1113 StoreP(r8, MemOperand(fp, ExitFrameConstants::kSPOffset)); |
1111 } | 1114 } |
1112 if (FLAG_enable_embedded_constant_pool) { | 1115 if (FLAG_enable_embedded_constant_pool) { |
1113 StoreP(kConstantPoolRegister, | 1116 StoreP(kConstantPoolRegister, |
(...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2747 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { | 2750 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { |
2748 const Runtime::Function* function = Runtime::FunctionForId(fid); | 2751 const Runtime::Function* function = Runtime::FunctionForId(fid); |
2749 DCHECK_EQ(1, function->result_size); | 2752 DCHECK_EQ(1, function->result_size); |
2750 if (function->nargs >= 0) { | 2753 if (function->nargs >= 0) { |
2751 mov(r3, Operand(function->nargs)); | 2754 mov(r3, Operand(function->nargs)); |
2752 } | 2755 } |
2753 JumpToExternalReference(ExternalReference(fid, isolate())); | 2756 JumpToExternalReference(ExternalReference(fid, isolate())); |
2754 } | 2757 } |
2755 | 2758 |
2756 | 2759 |
2757 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin) { | 2760 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin, |
| 2761 bool builtin_exit_frame) { |
2758 mov(r4, Operand(builtin)); | 2762 mov(r4, Operand(builtin)); |
2759 CEntryStub stub(isolate(), 1); | 2763 CEntryStub stub(isolate(), 1, kDontSaveFPRegs, kArgvOnStack, |
| 2764 builtin_exit_frame); |
2760 Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 2765 Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
2761 } | 2766 } |
2762 | 2767 |
2763 | 2768 |
2764 void MacroAssembler::SetCounter(StatsCounter* counter, int value, | 2769 void MacroAssembler::SetCounter(StatsCounter* counter, int value, |
2765 Register scratch1, Register scratch2) { | 2770 Register scratch1, Register scratch2) { |
2766 if (FLAG_native_code_counters && counter->Enabled()) { | 2771 if (FLAG_native_code_counters && counter->Enabled()) { |
2767 mov(scratch1, Operand(value)); | 2772 mov(scratch1, Operand(value)); |
2768 mov(scratch2, Operand(ExternalReference(counter))); | 2773 mov(scratch2, Operand(ExternalReference(counter))); |
2769 stw(scratch1, MemOperand(scratch2)); | 2774 stw(scratch1, MemOperand(scratch2)); |
(...skipping 2097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4867 } | 4872 } |
4868 if (mag.shift > 0) srawi(result, result, mag.shift); | 4873 if (mag.shift > 0) srawi(result, result, mag.shift); |
4869 ExtractBit(r0, dividend, 31); | 4874 ExtractBit(r0, dividend, 31); |
4870 add(result, result, r0); | 4875 add(result, result, r0); |
4871 } | 4876 } |
4872 | 4877 |
4873 } // namespace internal | 4878 } // namespace internal |
4874 } // namespace v8 | 4879 } // namespace v8 |
4875 | 4880 |
4876 #endif // V8_TARGET_ARCH_PPC | 4881 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |