| 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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 __ sub(r3, r3, Operand(2), SetCC); | 601 __ sub(r3, r3, Operand(2), SetCC); |
| 602 __ b(ge, &loop); | 602 __ b(ge, &loop); |
| 603 | 603 |
| 604 // Call the function. | 604 // Call the function. |
| 605 // r0: number of arguments | 605 // r0: number of arguments |
| 606 // r1: constructor function | 606 // r1: constructor function |
| 607 if (is_api_function) { | 607 if (is_api_function) { |
| 608 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 608 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 609 Handle<Code> code = | 609 Handle<Code> code = |
| 610 masm->isolate()->builtins()->HandleApiCallConstruct(); | 610 masm->isolate()->builtins()->HandleApiCallConstruct(); |
| 611 ParameterCount expected(0); | 611 __ SetCallKind(r5, CALL_AS_METHOD); |
| 612 __ InvokeCode(code, expected, expected, | 612 __ Call(code, RelocInfo::CODE_TARGET); |
| 613 RelocInfo::CODE_TARGET, CALL_FUNCTION, CALL_AS_METHOD); | |
| 614 } else { | 613 } else { |
| 615 ParameterCount actual(r0); | 614 ParameterCount actual(r0); |
| 616 __ InvokeFunction(r1, actual, CALL_FUNCTION, | 615 __ InvokeFunction(r1, actual, CALL_FUNCTION, |
| 617 NullCallWrapper(), CALL_AS_METHOD); | 616 NullCallWrapper(), CALL_AS_METHOD); |
| 618 } | 617 } |
| 619 | 618 |
| 620 // Store offset of return address for deoptimizer. | 619 // Store offset of return address for deoptimizer. |
| 621 if (!is_api_function && !count_constructions) { | 620 if (!is_api_function && !count_constructions) { |
| 622 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); | 621 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); |
| 623 } | 622 } |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1138 __ tst(r4, r4); | 1137 __ tst(r4, r4); |
| 1139 __ b(eq, &function); | 1138 __ b(eq, &function); |
| 1140 // Expected number of arguments is 0 for CALL_NON_FUNCTION. | 1139 // Expected number of arguments is 0 for CALL_NON_FUNCTION. |
| 1141 __ mov(r2, Operand::Zero()); | 1140 __ mov(r2, Operand::Zero()); |
| 1142 __ SetCallKind(r5, CALL_AS_METHOD); | 1141 __ SetCallKind(r5, CALL_AS_METHOD); |
| 1143 __ cmp(r4, Operand(1)); | 1142 __ cmp(r4, Operand(1)); |
| 1144 __ b(ne, &non_proxy); | 1143 __ b(ne, &non_proxy); |
| 1145 | 1144 |
| 1146 __ push(r1); // re-add proxy object as additional argument | 1145 __ push(r1); // re-add proxy object as additional argument |
| 1147 __ add(r0, r0, Operand(1)); | 1146 __ add(r0, r0, Operand(1)); |
| 1148 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); | 1147 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY); |
| 1149 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1148 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1150 RelocInfo::CODE_TARGET); | 1149 RelocInfo::CODE_TARGET); |
| 1151 | 1150 |
| 1152 __ bind(&non_proxy); | 1151 __ bind(&non_proxy); |
| 1153 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); | 1152 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION); |
| 1154 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1153 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1155 RelocInfo::CODE_TARGET); | 1154 RelocInfo::CODE_TARGET); |
| 1156 __ bind(&function); | 1155 __ bind(&function); |
| 1157 } | 1156 } |
| 1158 | 1157 |
| 1159 // 5b. Get the code to call from the function and check that the number of | 1158 // 5b. Get the code to call from the function and check that the number of |
| 1160 // expected arguments matches what we're providing. If so, jump | 1159 // expected arguments matches what we're providing. If so, jump |
| 1161 // (tail-call) to the code in register edx without checking arguments. | 1160 // (tail-call) to the code in register edx without checking arguments. |
| 1162 // r0: actual number of arguments | 1161 // r0: actual number of arguments |
| 1163 // r1: function | 1162 // r1: function |
| 1164 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 1163 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 1165 __ ldr(r2, | 1164 __ ldr(r2, |
| 1166 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); | 1165 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 1167 __ SmiUntag(r2); | 1166 __ SmiUntag(r2); |
| 1168 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | |
| 1169 __ SetCallKind(r5, CALL_AS_METHOD); | 1167 __ SetCallKind(r5, CALL_AS_METHOD); |
| 1170 __ cmp(r2, r0); // Check formal and actual parameter counts. | 1168 __ cmp(r2, r0); // Check formal and actual parameter counts. |
| 1171 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1169 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1172 RelocInfo::CODE_TARGET, | 1170 RelocInfo::CODE_TARGET, |
| 1173 ne); | 1171 ne); |
| 1174 | 1172 |
| 1173 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
| 1175 ParameterCount expected(0); | 1174 ParameterCount expected(0); |
| 1176 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION, | 1175 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION, |
| 1177 NullCallWrapper(), CALL_AS_METHOD); | 1176 NullCallWrapper(), CALL_AS_METHOD); |
| 1178 } | 1177 } |
| 1179 | 1178 |
| 1180 | 1179 |
| 1181 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 1180 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
| 1182 const int kIndexOffset = | 1181 const int kIndexOffset = |
| 1183 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); | 1182 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); |
| 1184 const int kLimitOffset = | 1183 const int kLimitOffset = |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 frame_scope.GenerateLeaveFrame(); | 1322 frame_scope.GenerateLeaveFrame(); |
| 1324 __ add(sp, sp, Operand(3 * kPointerSize)); | 1323 __ add(sp, sp, Operand(3 * kPointerSize)); |
| 1325 __ Jump(lr); | 1324 __ Jump(lr); |
| 1326 | 1325 |
| 1327 // Invoke the function proxy. | 1326 // Invoke the function proxy. |
| 1328 __ bind(&call_proxy); | 1327 __ bind(&call_proxy); |
| 1329 __ push(r1); // add function proxy as last argument | 1328 __ push(r1); // add function proxy as last argument |
| 1330 __ add(r0, r0, Operand(1)); | 1329 __ add(r0, r0, Operand(1)); |
| 1331 __ mov(r2, Operand::Zero()); | 1330 __ mov(r2, Operand::Zero()); |
| 1332 __ SetCallKind(r5, CALL_AS_METHOD); | 1331 __ SetCallKind(r5, CALL_AS_METHOD); |
| 1333 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); | 1332 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY); |
| 1334 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1333 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1335 RelocInfo::CODE_TARGET); | 1334 RelocInfo::CODE_TARGET); |
| 1336 | 1335 |
| 1337 // Tear down the internal frame and remove function, receiver and args. | 1336 // Tear down the internal frame and remove function, receiver and args. |
| 1338 } | 1337 } |
| 1339 __ add(sp, sp, Operand(3 * kPointerSize)); | 1338 __ add(sp, sp, Operand(3 * kPointerSize)); |
| 1340 __ Jump(lr); | 1339 __ Jump(lr); |
| 1341 } | 1340 } |
| 1342 | 1341 |
| 1343 | 1342 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1363 __ add(sp, sp, Operand::PointerOffsetFromSmiKey(r1)); | 1362 __ add(sp, sp, Operand::PointerOffsetFromSmiKey(r1)); |
| 1364 __ add(sp, sp, Operand(kPointerSize)); // adjust for receiver | 1363 __ add(sp, sp, Operand(kPointerSize)); // adjust for receiver |
| 1365 } | 1364 } |
| 1366 | 1365 |
| 1367 | 1366 |
| 1368 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 1367 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
| 1369 // ----------- S t a t e ------------- | 1368 // ----------- S t a t e ------------- |
| 1370 // -- r0 : actual number of arguments | 1369 // -- r0 : actual number of arguments |
| 1371 // -- r1 : function (passed through to callee) | 1370 // -- r1 : function (passed through to callee) |
| 1372 // -- r2 : expected number of arguments | 1371 // -- r2 : expected number of arguments |
| 1373 // -- r3 : code entry to call | |
| 1374 // -- r5 : call kind information | 1372 // -- r5 : call kind information |
| 1375 // ----------------------------------- | 1373 // ----------------------------------- |
| 1376 | 1374 |
| 1377 Label invoke, dont_adapt_arguments; | 1375 Label invoke, dont_adapt_arguments; |
| 1378 | 1376 |
| 1379 Label enough, too_few; | 1377 Label enough, too_few; |
| 1378 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
| 1380 __ cmp(r0, r2); | 1379 __ cmp(r0, r2); |
| 1381 __ b(lt, &too_few); | 1380 __ b(lt, &too_few); |
| 1382 __ cmp(r2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); | 1381 __ cmp(r2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); |
| 1383 __ b(eq, &dont_adapt_arguments); | 1382 __ b(eq, &dont_adapt_arguments); |
| 1384 | 1383 |
| 1385 { // Enough parameters: actual >= expected | 1384 { // Enough parameters: actual >= expected |
| 1386 __ bind(&enough); | 1385 __ bind(&enough); |
| 1387 EnterArgumentsAdaptorFrame(masm); | 1386 EnterArgumentsAdaptorFrame(masm); |
| 1388 | 1387 |
| 1389 // Calculate copy start address into r0 and copy end address into r2. | 1388 // Calculate copy start address into r0 and copy end address into r2. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1473 __ bind(&dont_adapt_arguments); | 1472 __ bind(&dont_adapt_arguments); |
| 1474 __ Jump(r3); | 1473 __ Jump(r3); |
| 1475 } | 1474 } |
| 1476 | 1475 |
| 1477 | 1476 |
| 1478 #undef __ | 1477 #undef __ |
| 1479 | 1478 |
| 1480 } } // namespace v8::internal | 1479 } } // namespace v8::internal |
| 1481 | 1480 |
| 1482 #endif // V8_TARGET_ARCH_ARM | 1481 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |