| 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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 __ sub(r3, r3, Operand(2), SetCC); | 599 __ sub(r3, r3, Operand(2), SetCC); |
| 600 __ b(ge, &loop); | 600 __ b(ge, &loop); |
| 601 | 601 |
| 602 // Call the function. | 602 // Call the function. |
| 603 // r0: number of arguments | 603 // r0: number of arguments |
| 604 // r1: constructor function | 604 // r1: constructor function |
| 605 if (is_api_function) { | 605 if (is_api_function) { |
| 606 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 606 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 607 Handle<Code> code = | 607 Handle<Code> code = |
| 608 masm->isolate()->builtins()->HandleApiCallConstruct(); | 608 masm->isolate()->builtins()->HandleApiCallConstruct(); |
| 609 ParameterCount expected(0); | 609 __ SetCallKind(r5, CALL_AS_METHOD); |
| 610 __ InvokeCode(code, expected, expected, | 610 __ Call(code, RelocInfo::CODE_TARGET); |
| 611 RelocInfo::CODE_TARGET, CALL_FUNCTION, CALL_AS_METHOD); | |
| 612 } else { | 611 } else { |
| 613 ParameterCount actual(r0); | 612 ParameterCount actual(r0); |
| 614 __ InvokeFunction(r1, actual, CALL_FUNCTION, | 613 __ InvokeFunction(r1, actual, CALL_FUNCTION, |
| 615 NullCallWrapper(), CALL_AS_METHOD); | 614 NullCallWrapper(), CALL_AS_METHOD); |
| 616 } | 615 } |
| 617 | 616 |
| 618 // Store offset of return address for deoptimizer. | 617 // Store offset of return address for deoptimizer. |
| 619 if (!is_api_function && !count_constructions) { | 618 if (!is_api_function && !count_constructions) { |
| 620 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); | 619 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); |
| 621 } | 620 } |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 __ tst(r4, r4); | 1154 __ tst(r4, r4); |
| 1156 __ b(eq, &function); | 1155 __ b(eq, &function); |
| 1157 // Expected number of arguments is 0 for CALL_NON_FUNCTION. | 1156 // Expected number of arguments is 0 for CALL_NON_FUNCTION. |
| 1158 __ mov(r2, Operand::Zero()); | 1157 __ mov(r2, Operand::Zero()); |
| 1159 __ SetCallKind(r5, CALL_AS_METHOD); | 1158 __ SetCallKind(r5, CALL_AS_METHOD); |
| 1160 __ cmp(r4, Operand(1)); | 1159 __ cmp(r4, Operand(1)); |
| 1161 __ b(ne, &non_proxy); | 1160 __ b(ne, &non_proxy); |
| 1162 | 1161 |
| 1163 __ push(r1); // re-add proxy object as additional argument | 1162 __ push(r1); // re-add proxy object as additional argument |
| 1164 __ add(r0, r0, Operand(1)); | 1163 __ add(r0, r0, Operand(1)); |
| 1165 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); | 1164 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY); |
| 1166 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1165 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1167 RelocInfo::CODE_TARGET); | 1166 RelocInfo::CODE_TARGET); |
| 1168 | 1167 |
| 1169 __ bind(&non_proxy); | 1168 __ bind(&non_proxy); |
| 1170 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); | 1169 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION); |
| 1171 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1170 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1172 RelocInfo::CODE_TARGET); | 1171 RelocInfo::CODE_TARGET); |
| 1173 __ bind(&function); | 1172 __ bind(&function); |
| 1174 } | 1173 } |
| 1175 | 1174 |
| 1176 // 5b. Get the code to call from the function and check that the number of | 1175 // 5b. Get the code to call from the function and check that the number of |
| 1177 // expected arguments matches what we're providing. If so, jump | 1176 // expected arguments matches what we're providing. If so, jump |
| 1178 // (tail-call) to the code in register edx without checking arguments. | 1177 // (tail-call) to the code in register edx without checking arguments. |
| 1179 // r0: actual number of arguments | 1178 // r0: actual number of arguments |
| 1180 // r1: function | 1179 // r1: function |
| 1181 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 1180 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 1182 __ ldr(r2, | 1181 __ ldr(r2, |
| 1183 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); | 1182 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 1184 __ SmiUntag(r2); | 1183 __ SmiUntag(r2); |
| 1185 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | |
| 1186 __ SetCallKind(r5, CALL_AS_METHOD); | 1184 __ SetCallKind(r5, CALL_AS_METHOD); |
| 1187 __ cmp(r2, r0); // Check formal and actual parameter counts. | 1185 __ cmp(r2, r0); // Check formal and actual parameter counts. |
| 1188 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1186 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1189 RelocInfo::CODE_TARGET, | 1187 RelocInfo::CODE_TARGET, |
| 1190 ne); | 1188 ne); |
| 1191 | 1189 |
| 1190 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
| 1192 ParameterCount expected(0); | 1191 ParameterCount expected(0); |
| 1193 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION, | 1192 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION, |
| 1194 NullCallWrapper(), CALL_AS_METHOD); | 1193 NullCallWrapper(), CALL_AS_METHOD); |
| 1195 } | 1194 } |
| 1196 | 1195 |
| 1197 | 1196 |
| 1198 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 1197 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
| 1199 const int kIndexOffset = | 1198 const int kIndexOffset = |
| 1200 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); | 1199 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); |
| 1201 const int kLimitOffset = | 1200 const int kLimitOffset = |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 frame_scope.GenerateLeaveFrame(); | 1339 frame_scope.GenerateLeaveFrame(); |
| 1341 __ add(sp, sp, Operand(3 * kPointerSize)); | 1340 __ add(sp, sp, Operand(3 * kPointerSize)); |
| 1342 __ Jump(lr); | 1341 __ Jump(lr); |
| 1343 | 1342 |
| 1344 // Invoke the function proxy. | 1343 // Invoke the function proxy. |
| 1345 __ bind(&call_proxy); | 1344 __ bind(&call_proxy); |
| 1346 __ push(r1); // add function proxy as last argument | 1345 __ push(r1); // add function proxy as last argument |
| 1347 __ add(r0, r0, Operand(1)); | 1346 __ add(r0, r0, Operand(1)); |
| 1348 __ mov(r2, Operand::Zero()); | 1347 __ mov(r2, Operand::Zero()); |
| 1349 __ SetCallKind(r5, CALL_AS_METHOD); | 1348 __ SetCallKind(r5, CALL_AS_METHOD); |
| 1350 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); | 1349 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY); |
| 1351 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1350 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1352 RelocInfo::CODE_TARGET); | 1351 RelocInfo::CODE_TARGET); |
| 1353 | 1352 |
| 1354 // Tear down the internal frame and remove function, receiver and args. | 1353 // Tear down the internal frame and remove function, receiver and args. |
| 1355 } | 1354 } |
| 1356 __ add(sp, sp, Operand(3 * kPointerSize)); | 1355 __ add(sp, sp, Operand(3 * kPointerSize)); |
| 1357 __ Jump(lr); | 1356 __ Jump(lr); |
| 1358 } | 1357 } |
| 1359 | 1358 |
| 1360 | 1359 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1380 __ add(sp, sp, Operand::PointerOffsetFromSmiKey(r1)); | 1379 __ add(sp, sp, Operand::PointerOffsetFromSmiKey(r1)); |
| 1381 __ add(sp, sp, Operand(kPointerSize)); // adjust for receiver | 1380 __ add(sp, sp, Operand(kPointerSize)); // adjust for receiver |
| 1382 } | 1381 } |
| 1383 | 1382 |
| 1384 | 1383 |
| 1385 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 1384 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
| 1386 // ----------- S t a t e ------------- | 1385 // ----------- S t a t e ------------- |
| 1387 // -- r0 : actual number of arguments | 1386 // -- r0 : actual number of arguments |
| 1388 // -- r1 : function (passed through to callee) | 1387 // -- r1 : function (passed through to callee) |
| 1389 // -- r2 : expected number of arguments | 1388 // -- r2 : expected number of arguments |
| 1390 // -- r3 : code entry to call | |
| 1391 // -- r5 : call kind information | 1389 // -- r5 : call kind information |
| 1392 // ----------------------------------- | 1390 // ----------------------------------- |
| 1393 | 1391 |
| 1394 Label invoke, dont_adapt_arguments; | 1392 Label invoke, dont_adapt_arguments; |
| 1395 | 1393 |
| 1396 Label enough, too_few; | 1394 Label enough, too_few; |
| 1395 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
| 1397 __ cmp(r0, r2); | 1396 __ cmp(r0, r2); |
| 1398 __ b(lt, &too_few); | 1397 __ b(lt, &too_few); |
| 1399 __ cmp(r2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); | 1398 __ cmp(r2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); |
| 1400 __ b(eq, &dont_adapt_arguments); | 1399 __ b(eq, &dont_adapt_arguments); |
| 1401 | 1400 |
| 1402 { // Enough parameters: actual >= expected | 1401 { // Enough parameters: actual >= expected |
| 1403 __ bind(&enough); | 1402 __ bind(&enough); |
| 1404 EnterArgumentsAdaptorFrame(masm); | 1403 EnterArgumentsAdaptorFrame(masm); |
| 1405 | 1404 |
| 1406 // Calculate copy start address into r0 and copy end address into r2. | 1405 // 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... |
| 1490 __ bind(&dont_adapt_arguments); | 1489 __ bind(&dont_adapt_arguments); |
| 1491 __ Jump(r3); | 1490 __ Jump(r3); |
| 1492 } | 1491 } |
| 1493 | 1492 |
| 1494 | 1493 |
| 1495 #undef __ | 1494 #undef __ |
| 1496 | 1495 |
| 1497 } } // namespace v8::internal | 1496 } } // namespace v8::internal |
| 1498 | 1497 |
| 1499 #endif // V8_TARGET_ARCH_ARM | 1498 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |