| 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/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/debug.h" | 10 #include "src/debug.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 __ bne(&convert_argument, cr0); | 226 __ bne(&convert_argument, cr0); |
| 227 __ mr(argument, r3); | 227 __ mr(argument, r3); |
| 228 __ IncrementCounter(counters->string_ctor_conversions(), 1, r6, r7); | 228 __ IncrementCounter(counters->string_ctor_conversions(), 1, r6, r7); |
| 229 __ b(&argument_is_string); | 229 __ b(&argument_is_string); |
| 230 | 230 |
| 231 // Invoke the conversion builtin and put the result into r5. | 231 // Invoke the conversion builtin and put the result into r5. |
| 232 __ bind(&convert_argument); | 232 __ bind(&convert_argument); |
| 233 __ push(function); // Preserve the function. | 233 __ push(function); // Preserve the function. |
| 234 __ IncrementCounter(counters->string_ctor_conversions(), 1, r6, r7); | 234 __ IncrementCounter(counters->string_ctor_conversions(), 1, r6, r7); |
| 235 { | 235 { |
| 236 FrameScope scope(masm, StackFrame::INTERNAL); | 236 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 237 __ push(r3); | 237 __ push(r3); |
| 238 __ InvokeBuiltin(Builtins::TO_STRING, CALL_FUNCTION); | 238 __ InvokeBuiltin(Builtins::TO_STRING, CALL_FUNCTION); |
| 239 } | 239 } |
| 240 __ pop(function); | 240 __ pop(function); |
| 241 __ mr(argument, r3); | 241 __ mr(argument, r3); |
| 242 __ b(&argument_is_string); | 242 __ b(&argument_is_string); |
| 243 | 243 |
| 244 // Load the empty string into r5, remove the receiver from the | 244 // Load the empty string into r5, remove the receiver from the |
| 245 // stack, and jump back to the case where the argument is a string. | 245 // stack, and jump back to the case where the argument is a string. |
| 246 __ bind(&no_arguments); | 246 __ bind(&no_arguments); |
| 247 __ LoadRoot(argument, Heap::kempty_stringRootIndex); | 247 __ LoadRoot(argument, Heap::kempty_stringRootIndex); |
| 248 __ Drop(1); | 248 __ Drop(1); |
| 249 __ b(&argument_is_string); | 249 __ b(&argument_is_string); |
| 250 | 250 |
| 251 // At this point the argument is already a string. Call runtime to | 251 // At this point the argument is already a string. Call runtime to |
| 252 // create a string wrapper. | 252 // create a string wrapper. |
| 253 __ bind(&gc_required); | 253 __ bind(&gc_required); |
| 254 __ IncrementCounter(counters->string_ctor_gc_required(), 1, r6, r7); | 254 __ IncrementCounter(counters->string_ctor_gc_required(), 1, r6, r7); |
| 255 { | 255 { |
| 256 FrameScope scope(masm, StackFrame::INTERNAL); | 256 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 257 __ push(argument); | 257 __ push(argument); |
| 258 __ CallRuntime(Runtime::kNewStringWrapper, 1); | 258 __ CallRuntime(Runtime::kNewStringWrapper, 1); |
| 259 } | 259 } |
| 260 __ Ret(); | 260 __ Ret(); |
| 261 } | 261 } |
| 262 | 262 |
| 263 | 263 |
| 264 static void CallRuntimePassFunction(MacroAssembler* masm, | 264 static void CallRuntimePassFunction(MacroAssembler* masm, |
| 265 Runtime::FunctionId function_id) { | 265 Runtime::FunctionId function_id) { |
| 266 FrameScope scope(masm, StackFrame::INTERNAL); | 266 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 267 // Push a copy of the function onto the stack. | 267 // Push a copy of the function onto the stack. |
| 268 // Push function as parameter to the runtime call. | 268 // Push function as parameter to the runtime call. |
| 269 __ Push(r4, r4); | 269 __ Push(r4, r4); |
| 270 | 270 |
| 271 __ CallRuntime(function_id, 1); | 271 __ CallRuntime(function_id, 1); |
| 272 // Restore reciever. | 272 // Restore reciever. |
| 273 __ Pop(r4); | 273 __ Pop(r4); |
| 274 } | 274 } |
| 275 | 275 |
| 276 | 276 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // -- sp[...]: constructor arguments | 347 // -- sp[...]: constructor arguments |
| 348 // ----------------------------------- | 348 // ----------------------------------- |
| 349 | 349 |
| 350 // Should never create mementos for api functions. | 350 // Should never create mementos for api functions. |
| 351 DCHECK(!is_api_function || !create_memento); | 351 DCHECK(!is_api_function || !create_memento); |
| 352 | 352 |
| 353 Isolate* isolate = masm->isolate(); | 353 Isolate* isolate = masm->isolate(); |
| 354 | 354 |
| 355 // Enter a construct frame. | 355 // Enter a construct frame. |
| 356 { | 356 { |
| 357 FrameScope scope(masm, StackFrame::CONSTRUCT); | 357 FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT); |
| 358 | 358 |
| 359 if (create_memento) { | 359 if (create_memento) { |
| 360 __ AssertUndefinedOrAllocationSite(r5, r7); | 360 __ AssertUndefinedOrAllocationSite(r5, r7); |
| 361 __ push(r5); | 361 __ push(r5); |
| 362 } | 362 } |
| 363 | 363 |
| 364 // Preserve the two incoming parameters on the stack. | 364 // Preserve the two incoming parameters on the stack. |
| 365 __ SmiTag(r3); | 365 __ SmiTag(r3); |
| 366 __ Push(r3, r4); | 366 __ Push(r3, r4); |
| 367 | 367 |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 // -- r5 : allocation site or undefined | 746 // -- r5 : allocation site or undefined |
| 747 // -- r6 : original constructor | 747 // -- r6 : original constructor |
| 748 // -- lr : return address | 748 // -- lr : return address |
| 749 // -- sp[...]: constructor arguments | 749 // -- sp[...]: constructor arguments |
| 750 // ----------------------------------- | 750 // ----------------------------------- |
| 751 | 751 |
| 752 // TODO(dslomov): support pretenuring | 752 // TODO(dslomov): support pretenuring |
| 753 CHECK(!FLAG_pretenuring_call_new); | 753 CHECK(!FLAG_pretenuring_call_new); |
| 754 | 754 |
| 755 { | 755 { |
| 756 FrameScope scope(masm, StackFrame::CONSTRUCT); | 756 FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT); |
| 757 | 757 |
| 758 // Smi-tagged arguments count. | 758 // Smi-tagged arguments count. |
| 759 __ mr(r7, r3); | 759 __ mr(r7, r3); |
| 760 __ SmiTag(r7, SetRC); | 760 __ SmiTag(r7, SetRC); |
| 761 | 761 |
| 762 // receiver is the hole. | 762 // receiver is the hole. |
| 763 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 763 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
| 764 | 764 |
| 765 // smi arguments count, new.target, receiver | 765 // smi arguments count, new.target, receiver |
| 766 __ Push(r7, r6, ip); | 766 __ Push(r7, r6, ip); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 } | 910 } |
| 911 | 911 |
| 912 | 912 |
| 913 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 913 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
| 914 CallRuntimePassFunction(masm, Runtime::kCompileLazy); | 914 CallRuntimePassFunction(masm, Runtime::kCompileLazy); |
| 915 GenerateTailCallToReturnedCode(masm); | 915 GenerateTailCallToReturnedCode(masm); |
| 916 } | 916 } |
| 917 | 917 |
| 918 | 918 |
| 919 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { | 919 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { |
| 920 FrameScope scope(masm, StackFrame::INTERNAL); | 920 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 921 // Push a copy of the function onto the stack. | 921 // Push a copy of the function onto the stack. |
| 922 // Push function as parameter to the runtime call. | 922 // Push function as parameter to the runtime call. |
| 923 __ Push(r4, r4); | 923 __ Push(r4, r4); |
| 924 // Whether to compile in a background thread. | 924 // Whether to compile in a background thread. |
| 925 __ LoadRoot( | 925 __ LoadRoot( |
| 926 r0, concurrent ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex); | 926 r0, concurrent ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex); |
| 927 __ push(r0); | 927 __ push(r0); |
| 928 | 928 |
| 929 __ CallRuntime(Runtime::kCompileOptimized, 2); | 929 __ CallRuntime(Runtime::kCompileOptimized, 2); |
| 930 // Restore receiver. | 930 // Restore receiver. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 | 1023 |
| 1024 | 1024 |
| 1025 void Builtins::Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm) { | 1025 void Builtins::Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm) { |
| 1026 GenerateMakeCodeYoungAgainCommon(masm); | 1026 GenerateMakeCodeYoungAgainCommon(masm); |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 | 1029 |
| 1030 static void Generate_NotifyStubFailureHelper(MacroAssembler* masm, | 1030 static void Generate_NotifyStubFailureHelper(MacroAssembler* masm, |
| 1031 SaveFPRegsMode save_doubles) { | 1031 SaveFPRegsMode save_doubles) { |
| 1032 { | 1032 { |
| 1033 FrameScope scope(masm, StackFrame::INTERNAL); | 1033 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 1034 | 1034 |
| 1035 // Preserve registers across notification, this is important for compiled | 1035 // Preserve registers across notification, this is important for compiled |
| 1036 // stubs that tail call the runtime on deopts passing their parameters in | 1036 // stubs that tail call the runtime on deopts passing their parameters in |
| 1037 // registers. | 1037 // registers. |
| 1038 __ MultiPush(kJSCallerSaved | kCalleeSaved); | 1038 __ MultiPush(kJSCallerSaved | kCalleeSaved); |
| 1039 // Pass the function and deoptimization type to the runtime system. | 1039 // Pass the function and deoptimization type to the runtime system. |
| 1040 __ CallRuntime(Runtime::kNotifyStubFailure, 0, save_doubles); | 1040 __ CallRuntime(Runtime::kNotifyStubFailure, 0, save_doubles); |
| 1041 __ MultiPop(kJSCallerSaved | kCalleeSaved); | 1041 __ MultiPop(kJSCallerSaved | kCalleeSaved); |
| 1042 } | 1042 } |
| 1043 | 1043 |
| 1044 __ addi(sp, sp, Operand(kPointerSize)); // Ignore state | 1044 __ addi(sp, sp, Operand(kPointerSize)); // Ignore state |
| 1045 __ blr(); // Jump to miss handler | 1045 __ blr(); // Jump to miss handler |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 | 1048 |
| 1049 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { | 1049 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { |
| 1050 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); | 1050 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 | 1053 |
| 1054 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { | 1054 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { |
| 1055 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); | 1055 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 | 1058 |
| 1059 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, | 1059 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
| 1060 Deoptimizer::BailoutType type) { | 1060 Deoptimizer::BailoutType type) { |
| 1061 { | 1061 { |
| 1062 FrameScope scope(masm, StackFrame::INTERNAL); | 1062 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 1063 // Pass the function and deoptimization type to the runtime system. | 1063 // Pass the function and deoptimization type to the runtime system. |
| 1064 __ LoadSmiLiteral(r3, Smi::FromInt(static_cast<int>(type))); | 1064 __ LoadSmiLiteral(r3, Smi::FromInt(static_cast<int>(type))); |
| 1065 __ push(r3); | 1065 __ push(r3); |
| 1066 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); | 1066 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); |
| 1067 } | 1067 } |
| 1068 | 1068 |
| 1069 // Get the full codegen state from the stack and untag it -> r9. | 1069 // Get the full codegen state from the stack and untag it -> r9. |
| 1070 __ LoadP(r9, MemOperand(sp, 0 * kPointerSize)); | 1070 __ LoadP(r9, MemOperand(sp, 0 * kPointerSize)); |
| 1071 __ SmiUntag(r9); | 1071 __ SmiUntag(r9); |
| 1072 // Switch on the state. | 1072 // Switch on the state. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1100 | 1100 |
| 1101 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { | 1101 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { |
| 1102 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); | 1102 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
| 1103 } | 1103 } |
| 1104 | 1104 |
| 1105 | 1105 |
| 1106 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1106 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1107 // Lookup the function in the JavaScript frame. | 1107 // Lookup the function in the JavaScript frame. |
| 1108 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1108 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1109 { | 1109 { |
| 1110 FrameScope scope(masm, StackFrame::INTERNAL); | 1110 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 1111 // Pass function as argument. | 1111 // Pass function as argument. |
| 1112 __ push(r3); | 1112 __ push(r3); |
| 1113 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); | 1113 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 // If the code object is null, just return to the unoptimized code. | 1116 // If the code object is null, just return to the unoptimized code. |
| 1117 Label skip; | 1117 Label skip; |
| 1118 __ CmpSmiLiteral(r3, Smi::FromInt(0), r0); | 1118 __ CmpSmiLiteral(r3, Smi::FromInt(0), r0); |
| 1119 __ bne(&skip); | 1119 __ bne(&skip); |
| 1120 __ Ret(); | 1120 __ Ret(); |
| 1121 | 1121 |
| 1122 __ bind(&skip); | 1122 __ bind(&skip); |
| 1123 | 1123 |
| 1124 // Load deoptimization data from the code object. | 1124 // Load deoptimization data from the code object. |
| 1125 // <deopt_data> = <code>[#deoptimization_data_offset] | 1125 // <deopt_data> = <code>[#deoptimization_data_offset] |
| 1126 __ LoadP(r4, FieldMemOperand(r3, Code::kDeoptimizationDataOffset)); | 1126 __ LoadP(r4, FieldMemOperand(r3, Code::kDeoptimizationDataOffset)); |
| 1127 | 1127 |
| 1128 { | 1128 { |
| 1129 ConstantPoolUnavailableScope constant_pool_unavailable(masm); |
| 1129 __ addi(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); // Code start | 1130 __ addi(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); // Code start |
| 1130 | 1131 |
| 1132 if (FLAG_enable_embedded_constant_pool) { |
| 1133 __ LoadTargetConstantPoolPointerRegister(r3); |
| 1134 } |
| 1135 |
| 1131 // Load the OSR entrypoint offset from the deoptimization data. | 1136 // Load the OSR entrypoint offset from the deoptimization data. |
| 1132 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset] | 1137 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset] |
| 1133 __ LoadP(r4, FieldMemOperand( | 1138 __ LoadP(r4, FieldMemOperand( |
| 1134 r4, FixedArray::OffsetOfElementAt( | 1139 r4, FixedArray::OffsetOfElementAt( |
| 1135 DeoptimizationInputData::kOsrPcOffsetIndex))); | 1140 DeoptimizationInputData::kOsrPcOffsetIndex))); |
| 1136 __ SmiUntag(r4); | 1141 __ SmiUntag(r4); |
| 1137 | 1142 |
| 1138 // Compute the target address = code start + osr_offset | 1143 // Compute the target address = code start + osr_offset |
| 1139 __ add(r0, r3, r4); | 1144 __ add(r0, r3, r4); |
| 1140 | 1145 |
| 1141 // And "return" to the OSR entry point of the function. | 1146 // And "return" to the OSR entry point of the function. |
| 1142 __ mtlr(r0); | 1147 __ mtlr(r0); |
| 1143 __ blr(); | 1148 __ blr(); |
| 1144 } | 1149 } |
| 1145 } | 1150 } |
| 1146 | 1151 |
| 1147 | 1152 |
| 1148 void Builtins::Generate_OsrAfterStackCheck(MacroAssembler* masm) { | 1153 void Builtins::Generate_OsrAfterStackCheck(MacroAssembler* masm) { |
| 1149 // We check the stack limit as indicator that recompilation might be done. | 1154 // We check the stack limit as indicator that recompilation might be done. |
| 1150 Label ok; | 1155 Label ok; |
| 1151 __ LoadRoot(ip, Heap::kStackLimitRootIndex); | 1156 __ LoadRoot(ip, Heap::kStackLimitRootIndex); |
| 1152 __ cmpl(sp, ip); | 1157 __ cmpl(sp, ip); |
| 1153 __ bge(&ok); | 1158 __ bge(&ok); |
| 1154 { | 1159 { |
| 1155 FrameScope scope(masm, StackFrame::INTERNAL); | 1160 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 1156 __ CallRuntime(Runtime::kStackGuard, 0); | 1161 __ CallRuntime(Runtime::kStackGuard, 0); |
| 1157 } | 1162 } |
| 1158 __ Jump(masm->isolate()->builtins()->OnStackReplacement(), | 1163 __ Jump(masm->isolate()->builtins()->OnStackReplacement(), |
| 1159 RelocInfo::CODE_TARGET); | 1164 RelocInfo::CODE_TARGET); |
| 1160 | 1165 |
| 1161 __ bind(&ok); | 1166 __ bind(&ok); |
| 1162 __ Ret(); | 1167 __ Ret(); |
| 1163 } | 1168 } |
| 1164 | 1169 |
| 1165 | 1170 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 __ beq(&use_global_proxy); | 1241 __ beq(&use_global_proxy); |
| 1237 | 1242 |
| 1238 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 1243 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 1239 __ CompareObjectType(r5, r6, r6, FIRST_SPEC_OBJECT_TYPE); | 1244 __ CompareObjectType(r5, r6, r6, FIRST_SPEC_OBJECT_TYPE); |
| 1240 __ bge(&shift_arguments); | 1245 __ bge(&shift_arguments); |
| 1241 | 1246 |
| 1242 __ bind(&convert_to_object); | 1247 __ bind(&convert_to_object); |
| 1243 | 1248 |
| 1244 { | 1249 { |
| 1245 // Enter an internal frame in order to preserve argument count. | 1250 // Enter an internal frame in order to preserve argument count. |
| 1246 FrameScope scope(masm, StackFrame::INTERNAL); | 1251 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 1247 __ SmiTag(r3); | 1252 __ SmiTag(r3); |
| 1248 __ Push(r3, r5); | 1253 __ Push(r3, r5); |
| 1249 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1254 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 1250 __ mr(r5, r3); | 1255 __ mr(r5, r3); |
| 1251 | 1256 |
| 1252 __ pop(r3); | 1257 __ pop(r3); |
| 1253 __ SmiUntag(r3); | 1258 __ SmiUntag(r3); |
| 1254 | 1259 |
| 1255 // Exit the internal frame. | 1260 // Exit the internal frame. |
| 1256 } | 1261 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 __ SmiUntag(r3); | 1430 __ SmiUntag(r3); |
| 1426 } | 1431 } |
| 1427 | 1432 |
| 1428 | 1433 |
| 1429 // Used by FunctionApply and ReflectApply | 1434 // Used by FunctionApply and ReflectApply |
| 1430 static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) { | 1435 static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) { |
| 1431 const int kFormalParameters = targetIsArgument ? 3 : 2; | 1436 const int kFormalParameters = targetIsArgument ? 3 : 2; |
| 1432 const int kStackSize = kFormalParameters + 1; | 1437 const int kStackSize = kFormalParameters + 1; |
| 1433 | 1438 |
| 1434 { | 1439 { |
| 1435 FrameScope frame_scope(masm, StackFrame::INTERNAL); | 1440 FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); |
| 1436 const int kArgumentsOffset = kFPOnStackSize + kPCOnStackSize; | 1441 const int kArgumentsOffset = kFPOnStackSize + kPCOnStackSize; |
| 1437 const int kReceiverOffset = kArgumentsOffset + kPointerSize; | 1442 const int kReceiverOffset = kArgumentsOffset + kPointerSize; |
| 1438 const int kFunctionOffset = kReceiverOffset + kPointerSize; | 1443 const int kFunctionOffset = kReceiverOffset + kPointerSize; |
| 1439 | 1444 |
| 1440 __ LoadP(r3, MemOperand(fp, kFunctionOffset)); // get the function | 1445 __ LoadP(r3, MemOperand(fp, kFunctionOffset)); // get the function |
| 1441 __ push(r3); | 1446 __ push(r3); |
| 1442 __ LoadP(r3, MemOperand(fp, kArgumentsOffset)); // get the args array | 1447 __ LoadP(r3, MemOperand(fp, kArgumentsOffset)); // get the args array |
| 1443 __ push(r3); | 1448 __ push(r3); |
| 1444 if (targetIsArgument) { | 1449 if (targetIsArgument) { |
| 1445 __ InvokeBuiltin(Builtins::REFLECT_APPLY_PREPARE, CALL_FUNCTION); | 1450 __ InvokeBuiltin(Builtins::REFLECT_APPLY_PREPARE, CALL_FUNCTION); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 __ addi(sp, sp, Operand(kStackSize * kPointerSize)); | 1559 __ addi(sp, sp, Operand(kStackSize * kPointerSize)); |
| 1555 __ blr(); | 1560 __ blr(); |
| 1556 } | 1561 } |
| 1557 | 1562 |
| 1558 | 1563 |
| 1559 static void Generate_ConstructHelper(MacroAssembler* masm) { | 1564 static void Generate_ConstructHelper(MacroAssembler* masm) { |
| 1560 const int kFormalParameters = 3; | 1565 const int kFormalParameters = 3; |
| 1561 const int kStackSize = kFormalParameters + 1; | 1566 const int kStackSize = kFormalParameters + 1; |
| 1562 | 1567 |
| 1563 { | 1568 { |
| 1564 FrameScope frame_scope(masm, StackFrame::INTERNAL); | 1569 FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); |
| 1565 const int kNewTargetOffset = kFPOnStackSize + kPCOnStackSize; | 1570 const int kNewTargetOffset = kFPOnStackSize + kPCOnStackSize; |
| 1566 const int kArgumentsOffset = kNewTargetOffset + kPointerSize; | 1571 const int kArgumentsOffset = kNewTargetOffset + kPointerSize; |
| 1567 const int kFunctionOffset = kArgumentsOffset + kPointerSize; | 1572 const int kFunctionOffset = kArgumentsOffset + kPointerSize; |
| 1568 | 1573 |
| 1569 // If newTarget is not supplied, set it to constructor | 1574 // If newTarget is not supplied, set it to constructor |
| 1570 Label validate_arguments; | 1575 Label validate_arguments; |
| 1571 __ LoadP(r3, MemOperand(fp, kNewTargetOffset)); | 1576 __ LoadP(r3, MemOperand(fp, kNewTargetOffset)); |
| 1572 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex); | 1577 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex); |
| 1573 __ bne(&validate_arguments); | 1578 __ bne(&validate_arguments); |
| 1574 __ LoadP(r3, MemOperand(fp, kFunctionOffset)); | 1579 __ LoadP(r3, MemOperand(fp, kFunctionOffset)); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1654 __ cmp(r8, r0); | 1659 __ cmp(r8, r0); |
| 1655 __ ble(stack_overflow); // Signed comparison. | 1660 __ ble(stack_overflow); // Signed comparison. |
| 1656 } | 1661 } |
| 1657 | 1662 |
| 1658 | 1663 |
| 1659 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { | 1664 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { |
| 1660 __ SmiTag(r3); | 1665 __ SmiTag(r3); |
| 1661 __ LoadSmiLiteral(r7, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 1666 __ LoadSmiLiteral(r7, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
| 1662 __ mflr(r0); | 1667 __ mflr(r0); |
| 1663 __ push(r0); | 1668 __ push(r0); |
| 1669 if (FLAG_enable_embedded_constant_pool) { |
| 1670 __ Push(fp, kConstantPoolRegister, r7, r4, r3); |
| 1671 } else { |
| 1664 __ Push(fp, r7, r4, r3); | 1672 __ Push(fp, r7, r4, r3); |
| 1673 } |
| 1665 __ addi(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp + | 1674 __ addi(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp + |
| 1666 kPointerSize)); | 1675 kPointerSize)); |
| 1667 } | 1676 } |
| 1668 | 1677 |
| 1669 | 1678 |
| 1670 static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) { | 1679 static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) { |
| 1671 // ----------- S t a t e ------------- | 1680 // ----------- S t a t e ------------- |
| 1672 // -- r3 : result being passed through | 1681 // -- r3 : result being passed through |
| 1673 // ----------------------------------- | 1682 // ----------------------------------- |
| 1674 // Get the number of arguments passed (as a smi), tear down the frame and | 1683 // Get the number of arguments passed (as a smi), tear down the frame and |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1803 __ bkpt(0); | 1812 __ bkpt(0); |
| 1804 } | 1813 } |
| 1805 } | 1814 } |
| 1806 | 1815 |
| 1807 | 1816 |
| 1808 #undef __ | 1817 #undef __ |
| 1809 } | 1818 } |
| 1810 } // namespace v8::internal | 1819 } // namespace v8::internal |
| 1811 | 1820 |
| 1812 #endif // V8_TARGET_ARCH_PPC | 1821 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |