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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm, | 104 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm, |
105 ExternalReference miss) { | 105 ExternalReference miss) { |
106 // Update the static counter each time a new code stub is generated. | 106 // Update the static counter each time a new code stub is generated. |
107 isolate()->counters()->code_stubs()->Increment(); | 107 isolate()->counters()->code_stubs()->Increment(); |
108 | 108 |
109 CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor(); | 109 CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor(); |
110 int param_count = descriptor.GetEnvironmentParameterCount(); | 110 int param_count = descriptor.GetEnvironmentParameterCount(); |
111 { | 111 { |
112 // Call the runtime system in a fresh internal frame. | 112 // Call the runtime system in a fresh internal frame. |
113 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 113 FrameScope scope(masm, StackFrame::INTERNAL); |
114 DCHECK(param_count == 0 || | 114 DCHECK(param_count == 0 || |
115 r3.is(descriptor.GetEnvironmentParameterRegister(param_count - 1))); | 115 r3.is(descriptor.GetEnvironmentParameterRegister(param_count - 1))); |
116 // Push arguments | 116 // Push arguments |
117 for (int i = 0; i < param_count; ++i) { | 117 for (int i = 0; i < param_count; ++i) { |
118 __ push(descriptor.GetEnvironmentParameterRegister(i)); | 118 __ push(descriptor.GetEnvironmentParameterRegister(i)); |
119 } | 119 } |
120 __ CallExternalReference(miss, param_count); | 120 __ CallExternalReference(miss, param_count); |
121 } | 121 } |
122 | 122 |
123 __ Ret(); | 123 __ Ret(); |
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 // __ lwz(r7, MemOperand(sp, offset_to_argv)); | 1177 // __ lwz(r7, MemOperand(sp, offset_to_argv)); |
1178 | 1178 |
1179 // Push a frame with special values setup to mark it as an entry frame. | 1179 // Push a frame with special values setup to mark it as an entry frame. |
1180 // r3: code entry | 1180 // r3: code entry |
1181 // r4: function | 1181 // r4: function |
1182 // r5: receiver | 1182 // r5: receiver |
1183 // r6: argc | 1183 // r6: argc |
1184 // r7: argv | 1184 // r7: argv |
1185 __ li(r0, Operand(-1)); // Push a bad frame pointer to fail if it is used. | 1185 __ li(r0, Operand(-1)); // Push a bad frame pointer to fail if it is used. |
1186 __ push(r0); | 1186 __ push(r0); |
1187 #if V8_OOL_CONSTANT_POOL | |
1188 __ mov(kConstantPoolRegister, | |
1189 Operand(isolate()->factory()->empty_constant_pool_array())); | |
1190 __ push(kConstantPoolRegister); | |
1191 #endif | |
1192 int marker = type(); | 1187 int marker = type(); |
1193 __ LoadSmiLiteral(r0, Smi::FromInt(marker)); | 1188 __ LoadSmiLiteral(r0, Smi::FromInt(marker)); |
1194 __ push(r0); | 1189 __ push(r0); |
1195 __ push(r0); | 1190 __ push(r0); |
1196 // Save copies of the top frame descriptor on the stack. | 1191 // Save copies of the top frame descriptor on the stack. |
1197 __ mov(r8, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); | 1192 __ mov(r8, Operand(ExternalReference(Isolate::kCEntryFPAddress, isolate()))); |
1198 __ LoadP(r0, MemOperand(r8)); | 1193 __ LoadP(r0, MemOperand(r8)); |
1199 __ push(r0); | 1194 __ push(r0); |
1200 | 1195 |
1201 // Set up frame pointer for the frame to be pushed. | 1196 // Set up frame pointer for the frame to be pushed. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 | 1324 |
1330 // Fixed register usage throughout the stub: | 1325 // Fixed register usage throughout the stub: |
1331 const Register object = r3; // Object (lhs). | 1326 const Register object = r3; // Object (lhs). |
1332 Register map = r6; // Map of the object. | 1327 Register map = r6; // Map of the object. |
1333 const Register function = r4; // Function (rhs). | 1328 const Register function = r4; // Function (rhs). |
1334 const Register prototype = r7; // Prototype of the function. | 1329 const Register prototype = r7; // Prototype of the function. |
1335 const Register inline_site = r9; | 1330 const Register inline_site = r9; |
1336 const Register scratch = r5; | 1331 const Register scratch = r5; |
1337 Register scratch3 = no_reg; | 1332 Register scratch3 = no_reg; |
1338 | 1333 |
1339 // delta = mov + unaligned LoadP + cmp + bne | 1334 // delta = mov + tagged LoadP + cmp + bne |
1340 #if V8_TARGET_ARCH_PPC64 | |
1341 const int32_t kDeltaToLoadBoolResult = | 1335 const int32_t kDeltaToLoadBoolResult = |
1342 (Assembler::kMovInstructions + 4) * Assembler::kInstrSize; | 1336 (Assembler::kMovInstructions + Assembler::kTaggedLoadInstructions + 2) * |
1343 #else | 1337 Assembler::kInstrSize; |
1344 const int32_t kDeltaToLoadBoolResult = | |
1345 (Assembler::kMovInstructions + 3) * Assembler::kInstrSize; | |
1346 #endif | |
1347 | 1338 |
1348 Label slow, loop, is_instance, is_not_instance, not_js_object; | 1339 Label slow, loop, is_instance, is_not_instance, not_js_object; |
1349 | 1340 |
1350 if (!HasArgsInRegisters()) { | 1341 if (!HasArgsInRegisters()) { |
1351 __ LoadP(object, MemOperand(sp, 1 * kPointerSize)); | 1342 __ LoadP(object, MemOperand(sp, 1 * kPointerSize)); |
1352 __ LoadP(function, MemOperand(sp, 0)); | 1343 __ LoadP(function, MemOperand(sp, 0)); |
1353 } | 1344 } |
1354 | 1345 |
1355 // Check that the left hand is a JS object and load map. | 1346 // Check that the left hand is a JS object and load map. |
1356 __ JumpIfSmi(object, ¬_js_object); | 1347 __ JumpIfSmi(object, ¬_js_object); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1496 | 1487 |
1497 // Slow-case. Tail call builtin. | 1488 // Slow-case. Tail call builtin. |
1498 __ bind(&slow); | 1489 __ bind(&slow); |
1499 if (!ReturnTrueFalseObject()) { | 1490 if (!ReturnTrueFalseObject()) { |
1500 if (HasArgsInRegisters()) { | 1491 if (HasArgsInRegisters()) { |
1501 __ Push(r3, r4); | 1492 __ Push(r3, r4); |
1502 } | 1493 } |
1503 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 1494 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
1504 } else { | 1495 } else { |
1505 { | 1496 { |
1506 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1497 FrameScope scope(masm, StackFrame::INTERNAL); |
1507 __ Push(r3, r4); | 1498 __ Push(r3, r4); |
1508 __ InvokeBuiltin(Builtins::INSTANCE_OF, CALL_FUNCTION); | 1499 __ InvokeBuiltin(Builtins::INSTANCE_OF, CALL_FUNCTION); |
1509 } | 1500 } |
1510 if (CpuFeatures::IsSupported(ISELECT)) { | 1501 if (CpuFeatures::IsSupported(ISELECT)) { |
1511 __ cmpi(r3, Operand::Zero()); | 1502 __ cmpi(r3, Operand::Zero()); |
1512 __ LoadRoot(r3, Heap::kTrueValueRootIndex); | 1503 __ LoadRoot(r3, Heap::kTrueValueRootIndex); |
1513 __ LoadRoot(r4, Heap::kFalseValueRootIndex); | 1504 __ LoadRoot(r4, Heap::kFalseValueRootIndex); |
1514 __ isel(eq, r3, r3, r4); | 1505 __ isel(eq, r3, r3, r4); |
1515 } else { | 1506 } else { |
1516 Label true_value, done; | 1507 Label true_value, done; |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2578 if (!FLAG_pretenuring_call_new) { | 2569 if (!FLAG_pretenuring_call_new) { |
2579 // Make sure the function is the Array() function. | 2570 // Make sure the function is the Array() function. |
2580 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r7); | 2571 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r7); |
2581 __ cmp(r4, r7); | 2572 __ cmp(r4, r7); |
2582 __ bne(¬_array_function); | 2573 __ bne(¬_array_function); |
2583 | 2574 |
2584 // The target function is the Array constructor, | 2575 // The target function is the Array constructor, |
2585 // Create an AllocationSite if we don't already have it, store it in the | 2576 // Create an AllocationSite if we don't already have it, store it in the |
2586 // slot. | 2577 // slot. |
2587 { | 2578 { |
2588 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 2579 FrameScope scope(masm, StackFrame::INTERNAL); |
2589 | 2580 |
2590 // Arguments register must be smi-tagged to call out. | 2581 // Arguments register must be smi-tagged to call out. |
2591 __ SmiTag(r3); | 2582 __ SmiTag(r3); |
2592 __ Push(r6, r5, r4, r3); | 2583 __ Push(r6, r5, r4, r3); |
2593 | 2584 |
2594 CreateAllocationSiteStub create_stub(masm->isolate()); | 2585 CreateAllocationSiteStub create_stub(masm->isolate()); |
2595 __ CallStub(&create_stub); | 2586 __ CallStub(&create_stub); |
2596 | 2587 |
2597 __ Pop(r6, r5, r4, r3); | 2588 __ Pop(r6, r5, r4, r3); |
2598 __ SmiUntag(r3); | 2589 __ SmiUntag(r3); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2664 __ li(r5, Operand::Zero()); | 2655 __ li(r5, Operand::Zero()); |
2665 __ GetBuiltinFunction(r4, Builtins::CALL_NON_FUNCTION); | 2656 __ GetBuiltinFunction(r4, Builtins::CALL_NON_FUNCTION); |
2666 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 2657 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
2667 RelocInfo::CODE_TARGET); | 2658 RelocInfo::CODE_TARGET); |
2668 } | 2659 } |
2669 | 2660 |
2670 | 2661 |
2671 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { | 2662 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { |
2672 // Wrap the receiver and patch it back onto the stack. | 2663 // Wrap the receiver and patch it back onto the stack. |
2673 { | 2664 { |
2674 FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); | 2665 FrameScope frame_scope(masm, StackFrame::INTERNAL); |
2675 __ Push(r4, r6); | 2666 __ Push(r4, r6); |
2676 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 2667 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
2677 __ pop(r4); | 2668 __ pop(r4); |
2678 } | 2669 } |
2679 __ StoreP(r3, MemOperand(sp, argc * kPointerSize), r0); | 2670 __ StoreP(r3, MemOperand(sp, argc * kPointerSize), r0); |
2680 __ b(cont); | 2671 __ b(cont); |
2681 } | 2672 } |
2682 | 2673 |
2683 | 2674 |
2684 static void CallFunctionNoFeedback(MacroAssembler* masm, int argc, | 2675 static void CallFunctionNoFeedback(MacroAssembler* masm, int argc, |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2981 // Update stats. | 2972 // Update stats. |
2982 __ LoadP(r7, FieldMemOperand(r5, with_types_offset)); | 2973 __ LoadP(r7, FieldMemOperand(r5, with_types_offset)); |
2983 __ AddSmiLiteral(r7, r7, Smi::FromInt(1), r0); | 2974 __ AddSmiLiteral(r7, r7, Smi::FromInt(1), r0); |
2984 __ StoreP(r7, FieldMemOperand(r5, with_types_offset), r0); | 2975 __ StoreP(r7, FieldMemOperand(r5, with_types_offset), r0); |
2985 | 2976 |
2986 // Store the function. Use a stub since we need a frame for allocation. | 2977 // Store the function. Use a stub since we need a frame for allocation. |
2987 // r5 - vector | 2978 // r5 - vector |
2988 // r6 - slot | 2979 // r6 - slot |
2989 // r4 - function | 2980 // r4 - function |
2990 { | 2981 { |
2991 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 2982 FrameScope scope(masm, StackFrame::INTERNAL); |
2992 CreateWeakCellStub create_stub(masm->isolate()); | 2983 CreateWeakCellStub create_stub(masm->isolate()); |
2993 __ Push(r4); | 2984 __ Push(r4); |
2994 __ CallStub(&create_stub); | 2985 __ CallStub(&create_stub); |
2995 __ Pop(r4); | 2986 __ Pop(r4); |
2996 } | 2987 } |
2997 | 2988 |
2998 __ b(&have_js_function); | 2989 __ b(&have_js_function); |
2999 | 2990 |
3000 // We are here because tracing is on or we encountered a MISS case we can't | 2991 // We are here because tracing is on or we encountered a MISS case we can't |
3001 // handle here. | 2992 // handle here. |
3002 __ bind(&miss); | 2993 __ bind(&miss); |
3003 GenerateMiss(masm); | 2994 GenerateMiss(masm); |
3004 | 2995 |
3005 // the slow case | 2996 // the slow case |
3006 __ bind(&slow_start); | 2997 __ bind(&slow_start); |
3007 // Check that the function is really a JavaScript function. | 2998 // Check that the function is really a JavaScript function. |
3008 // r4: pushed function (to be verified) | 2999 // r4: pushed function (to be verified) |
3009 __ JumpIfSmi(r4, &non_function); | 3000 __ JumpIfSmi(r4, &non_function); |
3010 | 3001 |
3011 // Goto slow case if we do not have a function. | 3002 // Goto slow case if we do not have a function. |
3012 __ CompareObjectType(r4, r7, r7, JS_FUNCTION_TYPE); | 3003 __ CompareObjectType(r4, r7, r7, JS_FUNCTION_TYPE); |
3013 __ bne(&slow); | 3004 __ bne(&slow); |
3014 __ b(&have_js_function); | 3005 __ b(&have_js_function); |
3015 } | 3006 } |
3016 | 3007 |
3017 | 3008 |
3018 void CallICStub::GenerateMiss(MacroAssembler* masm) { | 3009 void CallICStub::GenerateMiss(MacroAssembler* masm) { |
3019 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 3010 FrameScope scope(masm, StackFrame::INTERNAL); |
3020 | 3011 |
3021 // Push the function and feedback info. | 3012 // Push the function and feedback info. |
3022 __ Push(r4, r5, r6); | 3013 __ Push(r4, r5, r6); |
3023 | 3014 |
3024 // Call the entry. | 3015 // Call the entry. |
3025 IC::UtilityId id = GetICState() == DEFAULT ? IC::kCallIC_Miss | 3016 IC::UtilityId id = GetICState() == DEFAULT ? IC::kCallIC_Miss |
3026 : IC::kCallIC_Customization_Miss; | 3017 : IC::kCallIC_Customization_Miss; |
3027 | 3018 |
3028 ExternalReference miss = ExternalReference(IC_Utility(id), masm->isolate()); | 3019 ExternalReference miss = ExternalReference(IC_Utility(id), masm->isolate()); |
3029 __ CallExternalReference(miss, 3); | 3020 __ CallExternalReference(miss, 3); |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3967 GenerateMiss(masm); | 3958 GenerateMiss(masm); |
3968 } | 3959 } |
3969 | 3960 |
3970 | 3961 |
3971 void CompareICStub::GenerateMiss(MacroAssembler* masm) { | 3962 void CompareICStub::GenerateMiss(MacroAssembler* masm) { |
3972 { | 3963 { |
3973 // Call the runtime system in a fresh internal frame. | 3964 // Call the runtime system in a fresh internal frame. |
3974 ExternalReference miss = | 3965 ExternalReference miss = |
3975 ExternalReference(IC_Utility(IC::kCompareIC_Miss), isolate()); | 3966 ExternalReference(IC_Utility(IC::kCompareIC_Miss), isolate()); |
3976 | 3967 |
3977 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 3968 FrameScope scope(masm, StackFrame::INTERNAL); |
3978 __ Push(r4, r3); | 3969 __ Push(r4, r3); |
3979 __ Push(r4, r3); | 3970 __ Push(r4, r3); |
3980 __ LoadSmiLiteral(r0, Smi::FromInt(op())); | 3971 __ LoadSmiLiteral(r0, Smi::FromInt(op())); |
3981 __ push(r0); | 3972 __ push(r0); |
3982 __ CallExternalReference(miss, 3); | 3973 __ CallExternalReference(miss, 3); |
3983 // Compute the entry point of the rewritten stub. | 3974 // Compute the entry point of the rewritten stub. |
3984 __ addi(r5, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); | 3975 __ addi(r5, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); |
3985 // Restore registers. | 3976 // Restore registers. |
3986 __ Pop(r4, r3); | 3977 __ Pop(r4, r3); |
3987 } | 3978 } |
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5301 kStackUnwindSpace, NULL, | 5292 kStackUnwindSpace, NULL, |
5302 MemOperand(fp, 6 * kPointerSize), NULL); | 5293 MemOperand(fp, 6 * kPointerSize), NULL); |
5303 } | 5294 } |
5304 | 5295 |
5305 | 5296 |
5306 #undef __ | 5297 #undef __ |
5307 } | 5298 } |
5308 } // namespace v8::internal | 5299 } // namespace v8::internal |
5309 | 5300 |
5310 #endif // V8_TARGET_ARCH_PPC | 5301 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |