| 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 FrameScope scope(masm, StackFrame::INTERNAL); | 114 FrameAndConstantPoolScope 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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 | 1157 |
| 1158 // If the handler is a JS frame, restore the context to the frame. Note that | 1158 // If the handler is a JS frame, restore the context to the frame. Note that |
| 1159 // the context will be set to (cp == 0) for non-JS frames. | 1159 // the context will be set to (cp == 0) for non-JS frames. |
| 1160 Label skip; | 1160 Label skip; |
| 1161 __ cmpi(cp, Operand::Zero()); | 1161 __ cmpi(cp, Operand::Zero()); |
| 1162 __ beq(&skip); | 1162 __ beq(&skip); |
| 1163 __ StoreP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 1163 __ StoreP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1164 __ bind(&skip); | 1164 __ bind(&skip); |
| 1165 | 1165 |
| 1166 // Compute the handler entry address and jump to it. | 1166 // Compute the handler entry address and jump to it. |
| 1167 ConstantPoolUnavailableScope constant_pool_unavailable(masm); |
| 1167 __ mov(r4, Operand(pending_handler_code_address)); | 1168 __ mov(r4, Operand(pending_handler_code_address)); |
| 1168 __ LoadP(r4, MemOperand(r4)); | 1169 __ LoadP(r4, MemOperand(r4)); |
| 1169 __ mov(r5, Operand(pending_handler_offset_address)); | 1170 __ mov(r5, Operand(pending_handler_offset_address)); |
| 1170 __ LoadP(r5, MemOperand(r5)); | 1171 __ LoadP(r5, MemOperand(r5)); |
| 1171 __ addi(r4, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); // Code start | 1172 __ addi(r4, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); // Code start |
| 1173 if (FLAG_enable_embedded_constant_pool) { |
| 1174 __ LoadTargetConstantPoolPointerRegister(r4); |
| 1175 } |
| 1172 __ add(ip, r4, r5); | 1176 __ add(ip, r4, r5); |
| 1173 __ Jump(ip); | 1177 __ Jump(ip); |
| 1174 } | 1178 } |
| 1175 | 1179 |
| 1176 | 1180 |
| 1177 void JSEntryStub::Generate(MacroAssembler* masm) { | 1181 void JSEntryStub::Generate(MacroAssembler* masm) { |
| 1178 // r3: code entry | 1182 // r3: code entry |
| 1179 // r4: function | 1183 // r4: function |
| 1180 // r5: receiver | 1184 // r5: receiver |
| 1181 // r6: argc | 1185 // r6: argc |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1203 // __ lwz(r7, MemOperand(sp, offset_to_argv)); | 1207 // __ lwz(r7, MemOperand(sp, offset_to_argv)); |
| 1204 | 1208 |
| 1205 // Push a frame with special values setup to mark it as an entry frame. | 1209 // Push a frame with special values setup to mark it as an entry frame. |
| 1206 // r3: code entry | 1210 // r3: code entry |
| 1207 // r4: function | 1211 // r4: function |
| 1208 // r5: receiver | 1212 // r5: receiver |
| 1209 // r6: argc | 1213 // r6: argc |
| 1210 // r7: argv | 1214 // r7: argv |
| 1211 __ li(r0, Operand(-1)); // Push a bad frame pointer to fail if it is used. | 1215 __ li(r0, Operand(-1)); // Push a bad frame pointer to fail if it is used. |
| 1212 __ push(r0); | 1216 __ push(r0); |
| 1217 if (FLAG_enable_embedded_constant_pool) { |
| 1218 __ li(kConstantPoolRegister, Operand::Zero()); |
| 1219 __ push(kConstantPoolRegister); |
| 1220 } |
| 1213 int marker = type(); | 1221 int marker = type(); |
| 1214 __ LoadSmiLiteral(r0, Smi::FromInt(marker)); | 1222 __ LoadSmiLiteral(r0, Smi::FromInt(marker)); |
| 1215 __ push(r0); | 1223 __ push(r0); |
| 1216 __ push(r0); | 1224 __ push(r0); |
| 1217 // Save copies of the top frame descriptor on the stack. | 1225 // Save copies of the top frame descriptor on the stack. |
| 1218 __ mov(r8, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 1226 __ mov(r8, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
| 1219 __ LoadP(r0, MemOperand(r8)); | 1227 __ LoadP(r0, MemOperand(r8)); |
| 1220 __ push(r0); | 1228 __ push(r0); |
| 1221 | 1229 |
| 1222 // Set up frame pointer for the frame to be pushed. | 1230 // Set up frame pointer for the frame to be pushed. |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 | 1525 |
| 1518 // Slow-case. Tail call builtin. | 1526 // Slow-case. Tail call builtin. |
| 1519 __ bind(&slow); | 1527 __ bind(&slow); |
| 1520 if (!ReturnTrueFalseObject()) { | 1528 if (!ReturnTrueFalseObject()) { |
| 1521 if (HasArgsInRegisters()) { | 1529 if (HasArgsInRegisters()) { |
| 1522 __ Push(r3, r4); | 1530 __ Push(r3, r4); |
| 1523 } | 1531 } |
| 1524 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 1532 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 1525 } else { | 1533 } else { |
| 1526 { | 1534 { |
| 1527 FrameScope scope(masm, StackFrame::INTERNAL); | 1535 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 1528 __ Push(r3, r4); | 1536 __ Push(r3, r4); |
| 1529 __ InvokeBuiltin(Builtins::INSTANCE_OF, CALL_FUNCTION); | 1537 __ InvokeBuiltin(Builtins::INSTANCE_OF, CALL_FUNCTION); |
| 1530 } | 1538 } |
| 1531 if (CpuFeatures::IsSupported(ISELECT)) { | 1539 if (CpuFeatures::IsSupported(ISELECT)) { |
| 1532 __ cmpi(r3, Operand::Zero()); | 1540 __ cmpi(r3, Operand::Zero()); |
| 1533 __ LoadRoot(r3, Heap::kTrueValueRootIndex); | 1541 __ LoadRoot(r3, Heap::kTrueValueRootIndex); |
| 1534 __ LoadRoot(r4, Heap::kFalseValueRootIndex); | 1542 __ LoadRoot(r4, Heap::kFalseValueRootIndex); |
| 1535 __ isel(eq, r3, r3, r4); | 1543 __ isel(eq, r3, r3, r4); |
| 1536 } else { | 1544 } else { |
| 1537 Label true_value, done; | 1545 Label true_value, done; |
| (...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2529 __ b(&check_underlying); // Go to (4). | 2537 __ b(&check_underlying); // Go to (4). |
| 2530 #endif // V8_INTERPRETED_REGEXP | 2538 #endif // V8_INTERPRETED_REGEXP |
| 2531 } | 2539 } |
| 2532 | 2540 |
| 2533 | 2541 |
| 2534 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { | 2542 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { |
| 2535 // r3 : number of arguments to the construct function | 2543 // r3 : number of arguments to the construct function |
| 2536 // r5 : Feedback vector | 2544 // r5 : Feedback vector |
| 2537 // r6 : slot in feedback vector (Smi) | 2545 // r6 : slot in feedback vector (Smi) |
| 2538 // r4 : the function to call | 2546 // r4 : the function to call |
| 2539 FrameScope scope(masm, StackFrame::INTERNAL); | 2547 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 2540 | 2548 |
| 2541 // Number-of-arguments register must be smi-tagged to call out. | 2549 // Number-of-arguments register must be smi-tagged to call out. |
| 2542 __ SmiTag(r3); | 2550 __ SmiTag(r3); |
| 2543 __ Push(r6, r5, r4, r3); | 2551 __ Push(r6, r5, r4, r3); |
| 2544 | 2552 |
| 2545 __ CallStub(stub); | 2553 __ CallStub(stub); |
| 2546 | 2554 |
| 2547 __ Pop(r6, r5, r4, r3); | 2555 __ Pop(r6, r5, r4, r3); |
| 2548 __ SmiUntag(r3); | 2556 __ SmiUntag(r3); |
| 2549 } | 2557 } |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2693 __ li(r5, Operand::Zero()); | 2701 __ li(r5, Operand::Zero()); |
| 2694 __ GetBuiltinFunction(r4, Builtins::CALL_NON_FUNCTION); | 2702 __ GetBuiltinFunction(r4, Builtins::CALL_NON_FUNCTION); |
| 2695 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 2703 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 2696 RelocInfo::CODE_TARGET); | 2704 RelocInfo::CODE_TARGET); |
| 2697 } | 2705 } |
| 2698 | 2706 |
| 2699 | 2707 |
| 2700 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { | 2708 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { |
| 2701 // Wrap the receiver and patch it back onto the stack. | 2709 // Wrap the receiver and patch it back onto the stack. |
| 2702 { | 2710 { |
| 2703 FrameScope frame_scope(masm, StackFrame::INTERNAL); | 2711 FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); |
| 2704 __ Push(r4, r6); | 2712 __ Push(r4, r6); |
| 2705 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 2713 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 2706 __ pop(r4); | 2714 __ pop(r4); |
| 2707 } | 2715 } |
| 2708 __ StoreP(r3, MemOperand(sp, argc * kPointerSize), r0); | 2716 __ StoreP(r3, MemOperand(sp, argc * kPointerSize), r0); |
| 2709 __ b(cont); | 2717 __ b(cont); |
| 2710 } | 2718 } |
| 2711 | 2719 |
| 2712 | 2720 |
| 2713 static void CallFunctionNoFeedback(MacroAssembler* masm, int argc, | 2721 static void CallFunctionNoFeedback(MacroAssembler* masm, int argc, |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3011 // Update stats. | 3019 // Update stats. |
| 3012 __ LoadP(r7, FieldMemOperand(r5, with_types_offset)); | 3020 __ LoadP(r7, FieldMemOperand(r5, with_types_offset)); |
| 3013 __ AddSmiLiteral(r7, r7, Smi::FromInt(1), r0); | 3021 __ AddSmiLiteral(r7, r7, Smi::FromInt(1), r0); |
| 3014 __ StoreP(r7, FieldMemOperand(r5, with_types_offset), r0); | 3022 __ StoreP(r7, FieldMemOperand(r5, with_types_offset), r0); |
| 3015 | 3023 |
| 3016 // Store the function. Use a stub since we need a frame for allocation. | 3024 // Store the function. Use a stub since we need a frame for allocation. |
| 3017 // r5 - vector | 3025 // r5 - vector |
| 3018 // r6 - slot | 3026 // r6 - slot |
| 3019 // r4 - function | 3027 // r4 - function |
| 3020 { | 3028 { |
| 3021 FrameScope scope(masm, StackFrame::INTERNAL); | 3029 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 3022 CreateWeakCellStub create_stub(masm->isolate()); | 3030 CreateWeakCellStub create_stub(masm->isolate()); |
| 3023 __ Push(r4); | 3031 __ Push(r4); |
| 3024 __ CallStub(&create_stub); | 3032 __ CallStub(&create_stub); |
| 3025 __ Pop(r4); | 3033 __ Pop(r4); |
| 3026 } | 3034 } |
| 3027 | 3035 |
| 3028 __ b(&have_js_function); | 3036 __ b(&have_js_function); |
| 3029 | 3037 |
| 3030 // We are here because tracing is on or we encountered a MISS case we can't | 3038 // We are here because tracing is on or we encountered a MISS case we can't |
| 3031 // handle here. | 3039 // handle here. |
| 3032 __ bind(&miss); | 3040 __ bind(&miss); |
| 3033 GenerateMiss(masm); | 3041 GenerateMiss(masm); |
| 3034 | 3042 |
| 3035 // the slow case | 3043 // the slow case |
| 3036 __ bind(&slow_start); | 3044 __ bind(&slow_start); |
| 3037 // Check that the function is really a JavaScript function. | 3045 // Check that the function is really a JavaScript function. |
| 3038 // r4: pushed function (to be verified) | 3046 // r4: pushed function (to be verified) |
| 3039 __ JumpIfSmi(r4, &non_function); | 3047 __ JumpIfSmi(r4, &non_function); |
| 3040 | 3048 |
| 3041 // Goto slow case if we do not have a function. | 3049 // Goto slow case if we do not have a function. |
| 3042 __ CompareObjectType(r4, r7, r7, JS_FUNCTION_TYPE); | 3050 __ CompareObjectType(r4, r7, r7, JS_FUNCTION_TYPE); |
| 3043 __ bne(&slow); | 3051 __ bne(&slow); |
| 3044 __ b(&have_js_function); | 3052 __ b(&have_js_function); |
| 3045 } | 3053 } |
| 3046 | 3054 |
| 3047 | 3055 |
| 3048 void CallICStub::GenerateMiss(MacroAssembler* masm) { | 3056 void CallICStub::GenerateMiss(MacroAssembler* masm) { |
| 3049 FrameScope scope(masm, StackFrame::INTERNAL); | 3057 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 3050 | 3058 |
| 3051 // Push the function and feedback info. | 3059 // Push the function and feedback info. |
| 3052 __ Push(r4, r5, r6); | 3060 __ Push(r4, r5, r6); |
| 3053 | 3061 |
| 3054 // Call the entry. | 3062 // Call the entry. |
| 3055 IC::UtilityId id = GetICState() == DEFAULT ? IC::kCallIC_Miss | 3063 IC::UtilityId id = GetICState() == DEFAULT ? IC::kCallIC_Miss |
| 3056 : IC::kCallIC_Customization_Miss; | 3064 : IC::kCallIC_Customization_Miss; |
| 3057 | 3065 |
| 3058 ExternalReference miss = ExternalReference(IC_Utility(id), masm->isolate()); | 3066 ExternalReference miss = ExternalReference(IC_Utility(id), masm->isolate()); |
| 3059 __ CallExternalReference(miss, 3); | 3067 __ CallExternalReference(miss, 3); |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4008 GenerateMiss(masm); | 4016 GenerateMiss(masm); |
| 4009 } | 4017 } |
| 4010 | 4018 |
| 4011 | 4019 |
| 4012 void CompareICStub::GenerateMiss(MacroAssembler* masm) { | 4020 void CompareICStub::GenerateMiss(MacroAssembler* masm) { |
| 4013 { | 4021 { |
| 4014 // Call the runtime system in a fresh internal frame. | 4022 // Call the runtime system in a fresh internal frame. |
| 4015 ExternalReference miss = | 4023 ExternalReference miss = |
| 4016 ExternalReference(IC_Utility(IC::kCompareIC_Miss), isolate()); | 4024 ExternalReference(IC_Utility(IC::kCompareIC_Miss), isolate()); |
| 4017 | 4025 |
| 4018 FrameScope scope(masm, StackFrame::INTERNAL); | 4026 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 4019 __ Push(r4, r3); | 4027 __ Push(r4, r3); |
| 4020 __ Push(r4, r3); | 4028 __ Push(r4, r3); |
| 4021 __ LoadSmiLiteral(r0, Smi::FromInt(op())); | 4029 __ LoadSmiLiteral(r0, Smi::FromInt(op())); |
| 4022 __ push(r0); | 4030 __ push(r0); |
| 4023 __ CallExternalReference(miss, 3); | 4031 __ CallExternalReference(miss, 3); |
| 4024 // Compute the entry point of the rewritten stub. | 4032 // Compute the entry point of the rewritten stub. |
| 4025 __ addi(r5, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); | 4033 __ addi(r5, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 4026 // Restore registers. | 4034 // Restore registers. |
| 4027 __ Pop(r4, r3); | 4035 __ Pop(r4, r3); |
| 4028 } | 4036 } |
| (...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5589 kStackUnwindSpace, NULL, | 5597 kStackUnwindSpace, NULL, |
| 5590 MemOperand(fp, 6 * kPointerSize), NULL); | 5598 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5591 } | 5599 } |
| 5592 | 5600 |
| 5593 | 5601 |
| 5594 #undef __ | 5602 #undef __ |
| 5595 } | 5603 } |
| 5596 } // namespace v8::internal | 5604 } // namespace v8::internal |
| 5597 | 5605 |
| 5598 #endif // V8_TARGET_ARCH_PPC | 5606 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |