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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_PPC | 7 #if V8_TARGET_ARCH_PPC |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm, | 105 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm, |
106 ExternalReference miss) { | 106 ExternalReference miss) { |
107 // Update the static counter each time a new code stub is generated. | 107 // Update the static counter each time a new code stub is generated. |
108 isolate()->counters()->code_stubs()->Increment(); | 108 isolate()->counters()->code_stubs()->Increment(); |
109 | 109 |
110 CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor(); | 110 CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor(); |
111 int param_count = descriptor.GetEnvironmentParameterCount(); | 111 int param_count = descriptor.GetEnvironmentParameterCount(); |
112 { | 112 { |
113 // Call the runtime system in a fresh internal frame. | 113 // Call the runtime system in a fresh internal frame. |
114 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 114 FrameScope scope(masm, StackFrame::INTERNAL); |
115 DCHECK(param_count == 0 || | 115 DCHECK(param_count == 0 || |
116 r3.is(descriptor.GetEnvironmentParameterRegister(param_count - 1))); | 116 r3.is(descriptor.GetEnvironmentParameterRegister(param_count - 1))); |
117 // Push arguments | 117 // Push arguments |
118 for (int i = 0; i < param_count; ++i) { | 118 for (int i = 0; i < param_count; ++i) { |
119 __ push(descriptor.GetEnvironmentParameterRegister(i)); | 119 __ push(descriptor.GetEnvironmentParameterRegister(i)); |
120 } | 120 } |
121 __ CallExternalReference(miss, param_count); | 121 __ CallExternalReference(miss, param_count); |
122 } | 122 } |
123 | 123 |
124 __ Ret(); | 124 __ Ret(); |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 | 1175 |
1176 // If the handler is a JS frame, restore the context to the frame. Note that | 1176 // If the handler is a JS frame, restore the context to the frame. Note that |
1177 // the context will be set to (cp == 0) for non-JS frames. | 1177 // the context will be set to (cp == 0) for non-JS frames. |
1178 Label skip; | 1178 Label skip; |
1179 __ cmpi(cp, Operand::Zero()); | 1179 __ cmpi(cp, Operand::Zero()); |
1180 __ beq(&skip); | 1180 __ beq(&skip); |
1181 __ StoreP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 1181 __ StoreP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
1182 __ bind(&skip); | 1182 __ bind(&skip); |
1183 | 1183 |
1184 // Compute the handler entry address and jump to it. | 1184 // Compute the handler entry address and jump to it. |
1185 ConstantPoolUnavailableScope constant_pool_unavailable(masm); | |
1186 __ mov(r4, Operand(pending_handler_code_address)); | 1185 __ mov(r4, Operand(pending_handler_code_address)); |
1187 __ LoadP(r4, MemOperand(r4)); | 1186 __ LoadP(r4, MemOperand(r4)); |
1188 __ mov(r5, Operand(pending_handler_offset_address)); | 1187 __ mov(r5, Operand(pending_handler_offset_address)); |
1189 __ LoadP(r5, MemOperand(r5)); | 1188 __ LoadP(r5, MemOperand(r5)); |
1190 __ addi(r4, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); // Code start | 1189 __ addi(r4, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); // Code start |
1191 if (FLAG_enable_embedded_constant_pool) { | |
1192 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r4); | |
1193 } | |
1194 __ add(ip, r4, r5); | 1190 __ add(ip, r4, r5); |
1195 __ Jump(ip); | 1191 __ Jump(ip); |
1196 } | 1192 } |
1197 | 1193 |
1198 | 1194 |
1199 void JSEntryStub::Generate(MacroAssembler* masm) { | 1195 void JSEntryStub::Generate(MacroAssembler* masm) { |
1200 // r3: code entry | 1196 // r3: code entry |
1201 // r4: function | 1197 // r4: function |
1202 // r5: receiver | 1198 // r5: receiver |
1203 // r6: argc | 1199 // r6: argc |
(...skipping 21 matching lines...) Expand all Loading... |
1225 // __ lwz(r7, MemOperand(sp, offset_to_argv)); | 1221 // __ lwz(r7, MemOperand(sp, offset_to_argv)); |
1226 | 1222 |
1227 // Push a frame with special values setup to mark it as an entry frame. | 1223 // Push a frame with special values setup to mark it as an entry frame. |
1228 // r3: code entry | 1224 // r3: code entry |
1229 // r4: function | 1225 // r4: function |
1230 // r5: receiver | 1226 // r5: receiver |
1231 // r6: argc | 1227 // r6: argc |
1232 // r7: argv | 1228 // r7: argv |
1233 __ li(r0, Operand(-1)); // Push a bad frame pointer to fail if it is used. | 1229 __ li(r0, Operand(-1)); // Push a bad frame pointer to fail if it is used. |
1234 __ push(r0); | 1230 __ push(r0); |
1235 if (FLAG_enable_embedded_constant_pool) { | |
1236 __ li(kConstantPoolRegister, Operand::Zero()); | |
1237 __ push(kConstantPoolRegister); | |
1238 } | |
1239 int marker = type(); | 1231 int marker = type(); |
1240 __ LoadSmiLiteral(r0, Smi::FromInt(marker)); | 1232 __ LoadSmiLiteral(r0, Smi::FromInt(marker)); |
1241 __ push(r0); | 1233 __ push(r0); |
1242 __ push(r0); | 1234 __ push(r0); |
1243 // Save copies of the top frame descriptor on the stack. | 1235 // Save copies of the top frame descriptor on the stack. |
1244 __ mov(r8, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 1236 __ mov(r8, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
1245 __ LoadP(r0, MemOperand(r8)); | 1237 __ LoadP(r0, MemOperand(r8)); |
1246 __ push(r0); | 1238 __ push(r0); |
1247 | 1239 |
1248 // Set up frame pointer for the frame to be pushed. | 1240 // Set up frame pointer for the frame to be pushed. |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1543 | 1535 |
1544 // Slow-case. Tail call builtin. | 1536 // Slow-case. Tail call builtin. |
1545 __ bind(&slow); | 1537 __ bind(&slow); |
1546 if (!ReturnTrueFalseObject()) { | 1538 if (!ReturnTrueFalseObject()) { |
1547 if (HasArgsInRegisters()) { | 1539 if (HasArgsInRegisters()) { |
1548 __ Push(r3, r4); | 1540 __ Push(r3, r4); |
1549 } | 1541 } |
1550 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 1542 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
1551 } else { | 1543 } else { |
1552 { | 1544 { |
1553 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1545 FrameScope scope(masm, StackFrame::INTERNAL); |
1554 __ Push(r3, r4); | 1546 __ Push(r3, r4); |
1555 __ InvokeBuiltin(Builtins::INSTANCE_OF, CALL_FUNCTION); | 1547 __ InvokeBuiltin(Builtins::INSTANCE_OF, CALL_FUNCTION); |
1556 } | 1548 } |
1557 if (CpuFeatures::IsSupported(ISELECT)) { | 1549 if (CpuFeatures::IsSupported(ISELECT)) { |
1558 __ cmpi(r3, Operand::Zero()); | 1550 __ cmpi(r3, Operand::Zero()); |
1559 __ LoadRoot(r3, Heap::kTrueValueRootIndex); | 1551 __ LoadRoot(r3, Heap::kTrueValueRootIndex); |
1560 __ LoadRoot(r4, Heap::kFalseValueRootIndex); | 1552 __ LoadRoot(r4, Heap::kFalseValueRootIndex); |
1561 __ isel(eq, r3, r3, r4); | 1553 __ isel(eq, r3, r3, r4); |
1562 } else { | 1554 } else { |
1563 Label true_value, done; | 1555 Label true_value, done; |
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2554 __ b(&check_underlying); // Go to (4). | 2546 __ b(&check_underlying); // Go to (4). |
2555 #endif // V8_INTERPRETED_REGEXP | 2547 #endif // V8_INTERPRETED_REGEXP |
2556 } | 2548 } |
2557 | 2549 |
2558 | 2550 |
2559 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { | 2551 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { |
2560 // r3 : number of arguments to the construct function | 2552 // r3 : number of arguments to the construct function |
2561 // r5 : Feedback vector | 2553 // r5 : Feedback vector |
2562 // r6 : slot in feedback vector (Smi) | 2554 // r6 : slot in feedback vector (Smi) |
2563 // r4 : the function to call | 2555 // r4 : the function to call |
2564 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 2556 FrameScope scope(masm, StackFrame::INTERNAL); |
2565 | 2557 |
2566 // Number-of-arguments register must be smi-tagged to call out. | 2558 // Number-of-arguments register must be smi-tagged to call out. |
2567 __ SmiTag(r3); | 2559 __ SmiTag(r3); |
2568 __ Push(r6, r5, r4, r3); | 2560 __ Push(r6, r5, r4, r3); |
2569 | 2561 |
2570 __ CallStub(stub); | 2562 __ CallStub(stub); |
2571 | 2563 |
2572 __ Pop(r6, r5, r4, r3); | 2564 __ Pop(r6, r5, r4, r3); |
2573 __ SmiUntag(r3); | 2565 __ SmiUntag(r3); |
2574 } | 2566 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2718 __ li(r5, Operand::Zero()); | 2710 __ li(r5, Operand::Zero()); |
2719 __ GetBuiltinFunction(r4, Builtins::CALL_NON_FUNCTION); | 2711 __ GetBuiltinFunction(r4, Builtins::CALL_NON_FUNCTION); |
2720 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 2712 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
2721 RelocInfo::CODE_TARGET); | 2713 RelocInfo::CODE_TARGET); |
2722 } | 2714 } |
2723 | 2715 |
2724 | 2716 |
2725 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { | 2717 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { |
2726 // Wrap the receiver and patch it back onto the stack. | 2718 // Wrap the receiver and patch it back onto the stack. |
2727 { | 2719 { |
2728 FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); | 2720 FrameScope frame_scope(masm, StackFrame::INTERNAL); |
2729 __ Push(r4, r6); | 2721 __ Push(r4, r6); |
2730 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 2722 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
2731 __ pop(r4); | 2723 __ pop(r4); |
2732 } | 2724 } |
2733 __ StoreP(r3, MemOperand(sp, argc * kPointerSize), r0); | 2725 __ StoreP(r3, MemOperand(sp, argc * kPointerSize), r0); |
2734 __ b(cont); | 2726 __ b(cont); |
2735 } | 2727 } |
2736 | 2728 |
2737 | 2729 |
2738 static void CallFunctionNoFeedback(MacroAssembler* masm, int argc, | 2730 static void CallFunctionNoFeedback(MacroAssembler* masm, int argc, |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3036 // Update stats. | 3028 // Update stats. |
3037 __ LoadP(r7, FieldMemOperand(r5, with_types_offset)); | 3029 __ LoadP(r7, FieldMemOperand(r5, with_types_offset)); |
3038 __ AddSmiLiteral(r7, r7, Smi::FromInt(1), r0); | 3030 __ AddSmiLiteral(r7, r7, Smi::FromInt(1), r0); |
3039 __ StoreP(r7, FieldMemOperand(r5, with_types_offset), r0); | 3031 __ StoreP(r7, FieldMemOperand(r5, with_types_offset), r0); |
3040 | 3032 |
3041 // Store the function. Use a stub since we need a frame for allocation. | 3033 // Store the function. Use a stub since we need a frame for allocation. |
3042 // r5 - vector | 3034 // r5 - vector |
3043 // r6 - slot | 3035 // r6 - slot |
3044 // r4 - function | 3036 // r4 - function |
3045 { | 3037 { |
3046 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 3038 FrameScope scope(masm, StackFrame::INTERNAL); |
3047 CreateWeakCellStub create_stub(masm->isolate()); | 3039 CreateWeakCellStub create_stub(masm->isolate()); |
3048 __ Push(r4); | 3040 __ Push(r4); |
3049 __ CallStub(&create_stub); | 3041 __ CallStub(&create_stub); |
3050 __ Pop(r4); | 3042 __ Pop(r4); |
3051 } | 3043 } |
3052 | 3044 |
3053 __ b(&have_js_function); | 3045 __ b(&have_js_function); |
3054 | 3046 |
3055 // We are here because tracing is on or we encountered a MISS case we can't | 3047 // We are here because tracing is on or we encountered a MISS case we can't |
3056 // handle here. | 3048 // handle here. |
3057 __ bind(&miss); | 3049 __ bind(&miss); |
3058 GenerateMiss(masm); | 3050 GenerateMiss(masm); |
3059 | 3051 |
3060 // the slow case | 3052 // the slow case |
3061 __ bind(&slow_start); | 3053 __ bind(&slow_start); |
3062 // Check that the function is really a JavaScript function. | 3054 // Check that the function is really a JavaScript function. |
3063 // r4: pushed function (to be verified) | 3055 // r4: pushed function (to be verified) |
3064 __ JumpIfSmi(r4, &non_function); | 3056 __ JumpIfSmi(r4, &non_function); |
3065 | 3057 |
3066 // Goto slow case if we do not have a function. | 3058 // Goto slow case if we do not have a function. |
3067 __ CompareObjectType(r4, r7, r7, JS_FUNCTION_TYPE); | 3059 __ CompareObjectType(r4, r7, r7, JS_FUNCTION_TYPE); |
3068 __ bne(&slow); | 3060 __ bne(&slow); |
3069 __ b(&have_js_function); | 3061 __ b(&have_js_function); |
3070 } | 3062 } |
3071 | 3063 |
3072 | 3064 |
3073 void CallICStub::GenerateMiss(MacroAssembler* masm) { | 3065 void CallICStub::GenerateMiss(MacroAssembler* masm) { |
3074 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 3066 FrameScope scope(masm, StackFrame::INTERNAL); |
3075 | 3067 |
3076 // Push the function and feedback info. | 3068 // Push the function and feedback info. |
3077 __ Push(r4, r5, r6); | 3069 __ Push(r4, r5, r6); |
3078 | 3070 |
3079 // Call the entry. | 3071 // Call the entry. |
3080 IC::UtilityId id = GetICState() == DEFAULT ? IC::kCallIC_Miss | 3072 IC::UtilityId id = GetICState() == DEFAULT ? IC::kCallIC_Miss |
3081 : IC::kCallIC_Customization_Miss; | 3073 : IC::kCallIC_Customization_Miss; |
3082 | 3074 |
3083 ExternalReference miss = ExternalReference(IC_Utility(id), masm->isolate()); | 3075 ExternalReference miss = ExternalReference(IC_Utility(id), masm->isolate()); |
3084 __ CallExternalReference(miss, 3); | 3076 __ CallExternalReference(miss, 3); |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4033 GenerateMiss(masm); | 4025 GenerateMiss(masm); |
4034 } | 4026 } |
4035 | 4027 |
4036 | 4028 |
4037 void CompareICStub::GenerateMiss(MacroAssembler* masm) { | 4029 void CompareICStub::GenerateMiss(MacroAssembler* masm) { |
4038 { | 4030 { |
4039 // Call the runtime system in a fresh internal frame. | 4031 // Call the runtime system in a fresh internal frame. |
4040 ExternalReference miss = | 4032 ExternalReference miss = |
4041 ExternalReference(IC_Utility(IC::kCompareIC_Miss), isolate()); | 4033 ExternalReference(IC_Utility(IC::kCompareIC_Miss), isolate()); |
4042 | 4034 |
4043 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 4035 FrameScope scope(masm, StackFrame::INTERNAL); |
4044 __ Push(r4, r3); | 4036 __ Push(r4, r3); |
4045 __ Push(r4, r3); | 4037 __ Push(r4, r3); |
4046 __ LoadSmiLiteral(r0, Smi::FromInt(op())); | 4038 __ LoadSmiLiteral(r0, Smi::FromInt(op())); |
4047 __ push(r0); | 4039 __ push(r0); |
4048 __ CallExternalReference(miss, 3); | 4040 __ CallExternalReference(miss, 3); |
4049 // Compute the entry point of the rewritten stub. | 4041 // Compute the entry point of the rewritten stub. |
4050 __ addi(r5, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); | 4042 __ addi(r5, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); |
4051 // Restore registers. | 4043 // Restore registers. |
4052 __ Pop(r4, r3); | 4044 __ Pop(r4, r3); |
4053 } | 4045 } |
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5664 kStackUnwindSpace, NULL, | 5656 kStackUnwindSpace, NULL, |
5665 MemOperand(fp, 6 * kPointerSize), NULL); | 5657 MemOperand(fp, 6 * kPointerSize), NULL); |
5666 } | 5658 } |
5667 | 5659 |
5668 | 5660 |
5669 #undef __ | 5661 #undef __ |
5670 } // namespace internal | 5662 } // namespace internal |
5671 } // namespace v8 | 5663 } // namespace v8 |
5672 | 5664 |
5673 #endif // V8_TARGET_ARCH_PPC | 5665 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |