| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 } | 296 } |
| 297 __ Ret(); | 297 __ Ret(); |
| 298 } | 298 } |
| 299 | 299 |
| 300 | 300 |
| 301 static void CallRuntimePassFunction( | 301 static void CallRuntimePassFunction( |
| 302 MacroAssembler* masm, Runtime::FunctionId function_id) { | 302 MacroAssembler* masm, Runtime::FunctionId function_id) { |
| 303 FrameScope scope(masm, StackFrame::INTERNAL); | 303 FrameScope scope(masm, StackFrame::INTERNAL); |
| 304 // Push a copy of the function onto the stack. | 304 // Push a copy of the function onto the stack. |
| 305 // Push call kind information and function as parameter to the runtime call. | 305 // Push call kind information and function as parameter to the runtime call. |
| 306 __ Push(a1, t1, a1); | 306 __ Push(a1, a1); |
| 307 | 307 |
| 308 __ CallRuntime(function_id, 1); | 308 __ CallRuntime(function_id, 1); |
| 309 // Restore call kind information and receiver. | 309 // Restore call kind information and receiver. |
| 310 __ Pop(a1, t1); | 310 __ Pop(a1); |
| 311 } | 311 } |
| 312 | 312 |
| 313 | 313 |
| 314 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { | 314 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { |
| 315 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 315 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
| 316 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset)); | 316 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset)); |
| 317 __ Addu(at, a2, Operand(Code::kHeaderSize - kHeapObjectTag)); | 317 __ Addu(at, a2, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 318 __ Jump(at); | 318 __ Jump(at); |
| 319 } | 319 } |
| 320 | 320 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 __ Addu(a3, a3, Operand(-2)); | 622 __ Addu(a3, a3, Operand(-2)); |
| 623 __ Branch(&loop, greater_equal, a3, Operand(zero_reg)); | 623 __ Branch(&loop, greater_equal, a3, Operand(zero_reg)); |
| 624 | 624 |
| 625 // Call the function. | 625 // Call the function. |
| 626 // a0: number of arguments | 626 // a0: number of arguments |
| 627 // a1: constructor function | 627 // a1: constructor function |
| 628 if (is_api_function) { | 628 if (is_api_function) { |
| 629 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 629 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
| 630 Handle<Code> code = | 630 Handle<Code> code = |
| 631 masm->isolate()->builtins()->HandleApiCallConstruct(); | 631 masm->isolate()->builtins()->HandleApiCallConstruct(); |
| 632 ParameterCount expected(0); | 632 __ Call(code, RelocInfo::CODE_TARGET); |
| 633 __ InvokeCode(code, expected, expected, | |
| 634 RelocInfo::CODE_TARGET, CALL_FUNCTION, CALL_AS_METHOD); | |
| 635 } else { | 633 } else { |
| 636 ParameterCount actual(a0); | 634 ParameterCount actual(a0); |
| 637 __ InvokeFunction(a1, actual, CALL_FUNCTION, | 635 __ InvokeFunction(a1, actual, CALL_FUNCTION, NullCallWrapper()); |
| 638 NullCallWrapper(), CALL_AS_METHOD); | |
| 639 } | 636 } |
| 640 | 637 |
| 641 // Store offset of return address for deoptimizer. | 638 // Store offset of return address for deoptimizer. |
| 642 if (!is_api_function && !count_constructions) { | 639 if (!is_api_function && !count_constructions) { |
| 643 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); | 640 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); |
| 644 } | 641 } |
| 645 | 642 |
| 646 // Restore context from the frame. | 643 // Restore context from the frame. |
| 647 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 644 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 648 | 645 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 __ mov(a0, a3); | 758 __ mov(a0, a3); |
| 762 if (is_construct) { | 759 if (is_construct) { |
| 763 // No type feedback cell is available | 760 // No type feedback cell is available |
| 764 Handle<Object> undefined_sentinel( | 761 Handle<Object> undefined_sentinel( |
| 765 masm->isolate()->heap()->undefined_value(), masm->isolate()); | 762 masm->isolate()->heap()->undefined_value(), masm->isolate()); |
| 766 __ li(a2, Operand(undefined_sentinel)); | 763 __ li(a2, Operand(undefined_sentinel)); |
| 767 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); | 764 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); |
| 768 __ CallStub(&stub); | 765 __ CallStub(&stub); |
| 769 } else { | 766 } else { |
| 770 ParameterCount actual(a0); | 767 ParameterCount actual(a0); |
| 771 __ InvokeFunction(a1, actual, CALL_FUNCTION, | 768 __ InvokeFunction(a1, actual, CALL_FUNCTION, NullCallWrapper()); |
| 772 NullCallWrapper(), CALL_AS_METHOD); | |
| 773 } | 769 } |
| 774 | 770 |
| 775 // Leave internal frame. | 771 // Leave internal frame. |
| 776 } | 772 } |
| 777 | 773 |
| 778 __ Jump(ra); | 774 __ Jump(ra); |
| 779 } | 775 } |
| 780 | 776 |
| 781 | 777 |
| 782 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { | 778 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { |
| 783 Generate_JSEntryTrampolineHelper(masm, false); | 779 Generate_JSEntryTrampolineHelper(masm, false); |
| 784 } | 780 } |
| 785 | 781 |
| 786 | 782 |
| 787 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { | 783 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
| 788 Generate_JSEntryTrampolineHelper(masm, true); | 784 Generate_JSEntryTrampolineHelper(masm, true); |
| 789 } | 785 } |
| 790 | 786 |
| 791 | 787 |
| 792 void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) { | 788 void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) { |
| 793 CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized); | 789 CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized); |
| 794 GenerateTailCallToReturnedCode(masm); | 790 GenerateTailCallToReturnedCode(masm); |
| 795 } | 791 } |
| 796 | 792 |
| 797 | 793 |
| 798 static void CallCompileOptimized(MacroAssembler* masm, | 794 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { |
| 799 bool concurrent) { | |
| 800 FrameScope scope(masm, StackFrame::INTERNAL); | 795 FrameScope scope(masm, StackFrame::INTERNAL); |
| 801 // Push a copy of the function onto the stack. | 796 // Push a copy of the function onto the stack. |
| 802 // Push call kind information and function as parameter to the runtime call. | 797 // Push function as parameter to the runtime call. |
| 803 __ Push(a1, t1, a1); | 798 __ Push(a1, a1); |
| 804 // Whether to compile in a background thread. | 799 // Whether to compile in a background thread. |
| 805 __ Push(masm->isolate()->factory()->ToBoolean(concurrent)); | 800 __ Push(masm->isolate()->factory()->ToBoolean(concurrent)); |
| 806 | 801 |
| 807 __ CallRuntime(Runtime::kCompileOptimized, 2); | 802 __ CallRuntime(Runtime::kCompileOptimized, 2); |
| 808 // Restore call kind information and receiver. | 803 // Restore receiver. |
| 809 __ Pop(a1, t1); | 804 __ Pop(a1); |
| 810 } | 805 } |
| 811 | 806 |
| 812 | 807 |
| 813 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 808 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
| 814 CallCompileOptimized(masm, false); | 809 CallCompileOptimized(masm, false); |
| 815 GenerateTailCallToReturnedCode(masm); | 810 GenerateTailCallToReturnedCode(masm); |
| 816 } | 811 } |
| 817 | 812 |
| 818 | 813 |
| 819 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { | 814 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 __ sra(a0, a0, kSmiTagSize); // Un-tag. | 1102 __ sra(a0, a0, kSmiTagSize); // Un-tag. |
| 1108 // Leave internal frame. | 1103 // Leave internal frame. |
| 1109 } | 1104 } |
| 1110 // Restore the function to a1, and the flag to t0. | 1105 // Restore the function to a1, and the flag to t0. |
| 1111 __ sll(at, a0, kPointerSizeLog2); | 1106 __ sll(at, a0, kPointerSizeLog2); |
| 1112 __ addu(at, sp, at); | 1107 __ addu(at, sp, at); |
| 1113 __ lw(a1, MemOperand(at)); | 1108 __ lw(a1, MemOperand(at)); |
| 1114 __ li(t0, Operand(0, RelocInfo::NONE32)); | 1109 __ li(t0, Operand(0, RelocInfo::NONE32)); |
| 1115 __ Branch(&patch_receiver); | 1110 __ Branch(&patch_receiver); |
| 1116 | 1111 |
| 1117 // Use the global receiver object from the called function as the | |
| 1118 // receiver. | |
| 1119 __ bind(&use_global_receiver); | 1112 __ bind(&use_global_receiver); |
| 1120 __ lw(a2, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | 1113 __ lw(a2, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
| 1121 __ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalReceiverOffset)); | 1114 __ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalReceiverOffset)); |
| 1122 | 1115 |
| 1123 __ bind(&patch_receiver); | 1116 __ bind(&patch_receiver); |
| 1124 __ sll(at, a0, kPointerSizeLog2); | 1117 __ sll(at, a0, kPointerSizeLog2); |
| 1125 __ addu(a3, sp, at); | 1118 __ addu(a3, sp, at); |
| 1126 __ sw(a2, MemOperand(a3, -kPointerSize)); | 1119 __ sw(a2, MemOperand(a3, -kPointerSize)); |
| 1127 | 1120 |
| 1128 __ Branch(&shift_arguments); | 1121 __ Branch(&shift_arguments); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 | 1165 |
| 1173 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin, | 1166 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin, |
| 1174 // or a function proxy via CALL_FUNCTION_PROXY. | 1167 // or a function proxy via CALL_FUNCTION_PROXY. |
| 1175 // a0: actual number of arguments | 1168 // a0: actual number of arguments |
| 1176 // a1: function | 1169 // a1: function |
| 1177 // t0: call type (0: JS function, 1: function proxy, 2: non-function) | 1170 // t0: call type (0: JS function, 1: function proxy, 2: non-function) |
| 1178 { Label function, non_proxy; | 1171 { Label function, non_proxy; |
| 1179 __ Branch(&function, eq, t0, Operand(zero_reg)); | 1172 __ Branch(&function, eq, t0, Operand(zero_reg)); |
| 1180 // Expected number of arguments is 0 for CALL_NON_FUNCTION. | 1173 // Expected number of arguments is 0 for CALL_NON_FUNCTION. |
| 1181 __ mov(a2, zero_reg); | 1174 __ mov(a2, zero_reg); |
| 1182 __ SetCallKind(t1, CALL_AS_METHOD); | |
| 1183 __ Branch(&non_proxy, ne, t0, Operand(1)); | 1175 __ Branch(&non_proxy, ne, t0, Operand(1)); |
| 1184 | 1176 |
| 1185 __ push(a1); // Re-add proxy object as additional argument. | 1177 __ push(a1); // Re-add proxy object as additional argument. |
| 1186 __ Addu(a0, a0, Operand(1)); | 1178 __ Addu(a0, a0, Operand(1)); |
| 1187 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY); | 1179 __ GetBuiltinFunction(a1, Builtins::CALL_FUNCTION_PROXY); |
| 1188 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1180 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1189 RelocInfo::CODE_TARGET); | 1181 RelocInfo::CODE_TARGET); |
| 1190 | 1182 |
| 1191 __ bind(&non_proxy); | 1183 __ bind(&non_proxy); |
| 1192 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION); | 1184 __ GetBuiltinFunction(a1, Builtins::CALL_NON_FUNCTION); |
| 1193 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1185 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1194 RelocInfo::CODE_TARGET); | 1186 RelocInfo::CODE_TARGET); |
| 1195 __ bind(&function); | 1187 __ bind(&function); |
| 1196 } | 1188 } |
| 1197 | 1189 |
| 1198 // 5b. Get the code to call from the function and check that the number of | 1190 // 5b. Get the code to call from the function and check that the number of |
| 1199 // expected arguments matches what we're providing. If so, jump | 1191 // expected arguments matches what we're providing. If so, jump |
| 1200 // (tail-call) to the code in register edx without checking arguments. | 1192 // (tail-call) to the code in register edx without checking arguments. |
| 1201 // a0: actual number of arguments | 1193 // a0: actual number of arguments |
| 1202 // a1: function | 1194 // a1: function |
| 1203 __ lw(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 1195 __ lw(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
| 1204 __ lw(a2, | 1196 __ lw(a2, |
| 1205 FieldMemOperand(a3, SharedFunctionInfo::kFormalParameterCountOffset)); | 1197 FieldMemOperand(a3, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 1206 __ sra(a2, a2, kSmiTagSize); | 1198 __ sra(a2, a2, kSmiTagSize); |
| 1207 __ lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); | |
| 1208 __ SetCallKind(t1, CALL_AS_METHOD); | |
| 1209 // Check formal and actual parameter counts. | 1199 // Check formal and actual parameter counts. |
| 1210 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1200 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1211 RelocInfo::CODE_TARGET, ne, a2, Operand(a0)); | 1201 RelocInfo::CODE_TARGET, ne, a2, Operand(a0)); |
| 1212 | 1202 |
| 1203 __ lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
| 1213 ParameterCount expected(0); | 1204 ParameterCount expected(0); |
| 1214 __ InvokeCode(a3, expected, expected, JUMP_FUNCTION, | 1205 __ InvokeCode(a3, expected, expected, JUMP_FUNCTION, NullCallWrapper()); |
| 1215 NullCallWrapper(), CALL_AS_METHOD); | |
| 1216 } | 1206 } |
| 1217 | 1207 |
| 1218 | 1208 |
| 1219 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 1209 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
| 1220 const int kIndexOffset = | 1210 const int kIndexOffset = |
| 1221 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); | 1211 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); |
| 1222 const int kLimitOffset = | 1212 const int kLimitOffset = |
| 1223 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); | 1213 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); |
| 1224 const int kArgsOffset = 2 * kPointerSize; | 1214 const int kArgsOffset = 2 * kPointerSize; |
| 1225 const int kRecvOffset = 3 * kPointerSize; | 1215 const int kRecvOffset = 3 * kPointerSize; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 __ Branch(&push_receiver, ge, a1, Operand(FIRST_SPEC_OBJECT_TYPE)); | 1288 __ Branch(&push_receiver, ge, a1, Operand(FIRST_SPEC_OBJECT_TYPE)); |
| 1299 | 1289 |
| 1300 // Convert the receiver to a regular object. | 1290 // Convert the receiver to a regular object. |
| 1301 // a0: receiver | 1291 // a0: receiver |
| 1302 __ bind(&call_to_object); | 1292 __ bind(&call_to_object); |
| 1303 __ push(a0); | 1293 __ push(a0); |
| 1304 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1294 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 1305 __ mov(a0, v0); // Put object in a0 to match other paths to push_receiver. | 1295 __ mov(a0, v0); // Put object in a0 to match other paths to push_receiver. |
| 1306 __ Branch(&push_receiver); | 1296 __ Branch(&push_receiver); |
| 1307 | 1297 |
| 1308 // Use the current global receiver object as the receiver. | |
| 1309 __ bind(&use_global_receiver); | 1298 __ bind(&use_global_receiver); |
| 1310 __ lw(a0, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | 1299 __ lw(a0, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
| 1311 __ lw(a0, FieldMemOperand(a0, GlobalObject::kGlobalReceiverOffset)); | 1300 __ lw(a0, FieldMemOperand(a0, GlobalObject::kGlobalReceiverOffset)); |
| 1312 | 1301 |
| 1313 // Push the receiver. | 1302 // Push the receiver. |
| 1314 // a0: receiver | 1303 // a0: receiver |
| 1315 __ bind(&push_receiver); | 1304 __ bind(&push_receiver); |
| 1316 __ push(a0); | 1305 __ push(a0); |
| 1317 | 1306 |
| 1318 // Copy all arguments from the array to the stack. | 1307 // Copy all arguments from the array to the stack. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1335 __ lw(a0, MemOperand(fp, kIndexOffset)); | 1324 __ lw(a0, MemOperand(fp, kIndexOffset)); |
| 1336 __ Addu(a0, a0, Operand(1 << kSmiTagSize)); | 1325 __ Addu(a0, a0, Operand(1 << kSmiTagSize)); |
| 1337 __ sw(a0, MemOperand(fp, kIndexOffset)); | 1326 __ sw(a0, MemOperand(fp, kIndexOffset)); |
| 1338 | 1327 |
| 1339 // Test if the copy loop has finished copying all the elements from the | 1328 // Test if the copy loop has finished copying all the elements from the |
| 1340 // arguments object. | 1329 // arguments object. |
| 1341 __ bind(&entry); | 1330 __ bind(&entry); |
| 1342 __ lw(a1, MemOperand(fp, kLimitOffset)); | 1331 __ lw(a1, MemOperand(fp, kLimitOffset)); |
| 1343 __ Branch(&loop, ne, a0, Operand(a1)); | 1332 __ Branch(&loop, ne, a0, Operand(a1)); |
| 1344 | 1333 |
| 1345 // Invoke the function. | 1334 // Call the function. |
| 1346 Label call_proxy; | 1335 Label call_proxy; |
| 1347 ParameterCount actual(a0); | 1336 ParameterCount actual(a0); |
| 1348 __ sra(a0, a0, kSmiTagSize); | 1337 __ sra(a0, a0, kSmiTagSize); |
| 1349 __ lw(a1, MemOperand(fp, kFunctionOffset)); | 1338 __ lw(a1, MemOperand(fp, kFunctionOffset)); |
| 1350 __ GetObjectType(a1, a2, a2); | 1339 __ GetObjectType(a1, a2, a2); |
| 1351 __ Branch(&call_proxy, ne, a2, Operand(JS_FUNCTION_TYPE)); | 1340 __ Branch(&call_proxy, ne, a2, Operand(JS_FUNCTION_TYPE)); |
| 1352 | 1341 |
| 1353 __ InvokeFunction(a1, actual, CALL_FUNCTION, | 1342 __ InvokeFunction(a1, actual, CALL_FUNCTION, NullCallWrapper()); |
| 1354 NullCallWrapper(), CALL_AS_METHOD); | |
| 1355 | 1343 |
| 1356 frame_scope.GenerateLeaveFrame(); | 1344 frame_scope.GenerateLeaveFrame(); |
| 1357 __ Ret(USE_DELAY_SLOT); | 1345 __ Ret(USE_DELAY_SLOT); |
| 1358 __ Addu(sp, sp, Operand(3 * kPointerSize)); // In delay slot. | 1346 __ Addu(sp, sp, Operand(3 * kPointerSize)); // In delay slot. |
| 1359 | 1347 |
| 1360 // Invoke the function proxy. | 1348 // Call the function proxy. |
| 1361 __ bind(&call_proxy); | 1349 __ bind(&call_proxy); |
| 1362 __ push(a1); // Add function proxy as last argument. | 1350 __ push(a1); // Add function proxy as last argument. |
| 1363 __ Addu(a0, a0, Operand(1)); | 1351 __ Addu(a0, a0, Operand(1)); |
| 1364 __ li(a2, Operand(0, RelocInfo::NONE32)); | 1352 __ li(a2, Operand(0, RelocInfo::NONE32)); |
| 1365 __ SetCallKind(t1, CALL_AS_METHOD); | 1353 __ GetBuiltinFunction(a1, Builtins::CALL_FUNCTION_PROXY); |
| 1366 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY); | |
| 1367 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1354 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1368 RelocInfo::CODE_TARGET); | 1355 RelocInfo::CODE_TARGET); |
| 1369 // Tear down the internal frame and remove function, receiver and args. | 1356 // Tear down the internal frame and remove function, receiver and args. |
| 1370 } | 1357 } |
| 1371 | 1358 |
| 1372 __ Ret(USE_DELAY_SLOT); | 1359 __ Ret(USE_DELAY_SLOT); |
| 1373 __ Addu(sp, sp, Operand(3 * kPointerSize)); // In delay slot. | 1360 __ Addu(sp, sp, Operand(3 * kPointerSize)); // In delay slot. |
| 1374 } | 1361 } |
| 1375 | 1362 |
| 1376 | 1363 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1399 __ Addu(sp, sp, Operand(kPointerSize)); | 1386 __ Addu(sp, sp, Operand(kPointerSize)); |
| 1400 } | 1387 } |
| 1401 | 1388 |
| 1402 | 1389 |
| 1403 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 1390 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
| 1404 // State setup as expected by MacroAssembler::InvokePrologue. | 1391 // State setup as expected by MacroAssembler::InvokePrologue. |
| 1405 // ----------- S t a t e ------------- | 1392 // ----------- S t a t e ------------- |
| 1406 // -- a0: actual arguments count | 1393 // -- a0: actual arguments count |
| 1407 // -- a1: function (passed through to callee) | 1394 // -- a1: function (passed through to callee) |
| 1408 // -- a2: expected arguments count | 1395 // -- a2: expected arguments count |
| 1409 // -- a3: callee code entry | |
| 1410 // -- t1: call kind information | |
| 1411 // ----------------------------------- | 1396 // ----------------------------------- |
| 1412 | 1397 |
| 1413 Label invoke, dont_adapt_arguments; | 1398 Label invoke, dont_adapt_arguments; |
| 1414 | 1399 |
| 1415 Label enough, too_few; | 1400 Label enough, too_few; |
| 1401 __ lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
| 1416 __ Branch(&dont_adapt_arguments, eq, | 1402 __ Branch(&dont_adapt_arguments, eq, |
| 1417 a2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); | 1403 a2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); |
| 1418 // We use Uless as the number of argument should always be greater than 0. | 1404 // We use Uless as the number of argument should always be greater than 0. |
| 1419 __ Branch(&too_few, Uless, a0, Operand(a2)); | 1405 __ Branch(&too_few, Uless, a0, Operand(a2)); |
| 1420 | 1406 |
| 1421 { // Enough parameters: actual >= expected. | 1407 { // Enough parameters: actual >= expected. |
| 1422 // a0: actual number of arguments as a smi | 1408 // a0: actual number of arguments as a smi |
| 1423 // a1: function | 1409 // a1: function |
| 1424 // a2: expected number of arguments | 1410 // a2: expected number of arguments |
| 1425 // a3: code entry to call | 1411 // a3: code entry to call |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 __ bind(&dont_adapt_arguments); | 1504 __ bind(&dont_adapt_arguments); |
| 1519 __ Jump(a3); | 1505 __ Jump(a3); |
| 1520 } | 1506 } |
| 1521 | 1507 |
| 1522 | 1508 |
| 1523 #undef __ | 1509 #undef __ |
| 1524 | 1510 |
| 1525 } } // namespace v8::internal | 1511 } } // namespace v8::internal |
| 1526 | 1512 |
| 1527 #endif // V8_TARGET_ARCH_MIPS | 1513 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |