| 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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 __ SmiUntag(r0); | 1082 __ SmiUntag(r0); |
| 1083 | 1083 |
| 1084 // Exit the internal frame. | 1084 // Exit the internal frame. |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 // Restore the function to r1, and the flag to r4. | 1087 // Restore the function to r1, and the flag to r4. |
| 1088 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 1088 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
| 1089 __ mov(r4, Operand::Zero()); | 1089 __ mov(r4, Operand::Zero()); |
| 1090 __ jmp(&patch_receiver); | 1090 __ jmp(&patch_receiver); |
| 1091 | 1091 |
| 1092 // Use the global receiver object from the called function as the | |
| 1093 // receiver. | |
| 1094 __ bind(&use_global_receiver); | 1092 __ bind(&use_global_receiver); |
| 1095 __ ldr(r2, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | 1093 __ ldr(r2, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
| 1096 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); | 1094 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); |
| 1097 | 1095 |
| 1098 __ bind(&patch_receiver); | 1096 __ bind(&patch_receiver); |
| 1099 __ add(r3, sp, Operand(r0, LSL, kPointerSizeLog2)); | 1097 __ add(r3, sp, Operand(r0, LSL, kPointerSizeLog2)); |
| 1100 __ str(r2, MemOperand(r3, -kPointerSize)); | 1098 __ str(r2, MemOperand(r3, -kPointerSize)); |
| 1101 | 1099 |
| 1102 __ jmp(&shift_arguments); | 1100 __ jmp(&shift_arguments); |
| 1103 } | 1101 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 // 5b. Get the code to call from the function and check that the number of | 1171 // 5b. Get the code to call from the function and check that the number of |
| 1174 // expected arguments matches what we're providing. If so, jump | 1172 // expected arguments matches what we're providing. If so, jump |
| 1175 // (tail-call) to the code in register edx without checking arguments. | 1173 // (tail-call) to the code in register edx without checking arguments. |
| 1176 // r0: actual number of arguments | 1174 // r0: actual number of arguments |
| 1177 // r1: function | 1175 // r1: function |
| 1178 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 1176 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 1179 __ ldr(r2, | 1177 __ ldr(r2, |
| 1180 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); | 1178 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 1181 __ SmiUntag(r2); | 1179 __ SmiUntag(r2); |
| 1182 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 1180 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
| 1183 __ SetCallKind(r5, CALL_AS_METHOD); | 1181 __ SetCallKind(r5, CALL_AS_FUNCTION); |
| 1184 __ cmp(r2, r0); // Check formal and actual parameter counts. | 1182 __ cmp(r2, r0); // Check formal and actual parameter counts. |
| 1185 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1183 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1186 RelocInfo::CODE_TARGET, | 1184 RelocInfo::CODE_TARGET, |
| 1187 ne); | 1185 ne); |
| 1188 | 1186 |
| 1189 ParameterCount expected(0); | 1187 ParameterCount expected(0); |
| 1190 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION, | 1188 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION, |
| 1191 NullCallWrapper(), CALL_AS_METHOD); | 1189 NullCallWrapper(), CALL_AS_FUNCTION); |
| 1192 } | 1190 } |
| 1193 | 1191 |
| 1194 | 1192 |
| 1195 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 1193 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
| 1196 const int kIndexOffset = | 1194 const int kIndexOffset = |
| 1197 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); | 1195 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); |
| 1198 const int kLimitOffset = | 1196 const int kLimitOffset = |
| 1199 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); | 1197 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); |
| 1200 const int kArgsOffset = 2 * kPointerSize; | 1198 const int kArgsOffset = 2 * kPointerSize; |
| 1201 const int kRecvOffset = 3 * kPointerSize; | 1199 const int kRecvOffset = 3 * kPointerSize; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 __ CompareObjectType(r0, r1, r1, FIRST_SPEC_OBJECT_TYPE); | 1273 __ CompareObjectType(r0, r1, r1, FIRST_SPEC_OBJECT_TYPE); |
| 1276 __ b(ge, &push_receiver); | 1274 __ b(ge, &push_receiver); |
| 1277 | 1275 |
| 1278 // Convert the receiver to a regular object. | 1276 // Convert the receiver to a regular object. |
| 1279 // r0: receiver | 1277 // r0: receiver |
| 1280 __ bind(&call_to_object); | 1278 __ bind(&call_to_object); |
| 1281 __ push(r0); | 1279 __ push(r0); |
| 1282 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1280 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 1283 __ b(&push_receiver); | 1281 __ b(&push_receiver); |
| 1284 | 1282 |
| 1285 // Use the current global receiver object as the receiver. | |
| 1286 __ bind(&use_global_receiver); | 1283 __ bind(&use_global_receiver); |
| 1287 __ ldr(r0, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | 1284 __ ldr(r0, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
| 1288 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); | 1285 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); |
| 1289 | 1286 |
| 1290 // Push the receiver. | 1287 // Push the receiver. |
| 1291 // r0: receiver | 1288 // r0: receiver |
| 1292 __ bind(&push_receiver); | 1289 __ bind(&push_receiver); |
| 1293 __ push(r0); | 1290 __ push(r0); |
| 1294 | 1291 |
| 1295 // Copy all arguments from the array to the stack. | 1292 // Copy all arguments from the array to the stack. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1313 __ add(r0, r0, Operand(1 << kSmiTagSize)); | 1310 __ add(r0, r0, Operand(1 << kSmiTagSize)); |
| 1314 __ str(r0, MemOperand(fp, kIndexOffset)); | 1311 __ str(r0, MemOperand(fp, kIndexOffset)); |
| 1315 | 1312 |
| 1316 // Test if the copy loop has finished copying all the elements from the | 1313 // Test if the copy loop has finished copying all the elements from the |
| 1317 // arguments object. | 1314 // arguments object. |
| 1318 __ bind(&entry); | 1315 __ bind(&entry); |
| 1319 __ ldr(r1, MemOperand(fp, kLimitOffset)); | 1316 __ ldr(r1, MemOperand(fp, kLimitOffset)); |
| 1320 __ cmp(r0, r1); | 1317 __ cmp(r0, r1); |
| 1321 __ b(ne, &loop); | 1318 __ b(ne, &loop); |
| 1322 | 1319 |
| 1323 // Invoke the function. | 1320 // Call the function. |
| 1324 Label call_proxy; | 1321 Label call_proxy; |
| 1325 ParameterCount actual(r0); | 1322 ParameterCount actual(r0); |
| 1326 __ SmiUntag(r0); | 1323 __ SmiUntag(r0); |
| 1327 __ ldr(r1, MemOperand(fp, kFunctionOffset)); | 1324 __ ldr(r1, MemOperand(fp, kFunctionOffset)); |
| 1328 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); | 1325 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); |
| 1329 __ b(ne, &call_proxy); | 1326 __ b(ne, &call_proxy); |
| 1330 __ InvokeFunction(r1, actual, CALL_FUNCTION, | 1327 __ InvokeFunction(r1, actual, CALL_FUNCTION, |
| 1331 NullCallWrapper(), CALL_AS_METHOD); | 1328 NullCallWrapper(), CALL_AS_FUNCTION); |
| 1332 | 1329 |
| 1333 frame_scope.GenerateLeaveFrame(); | 1330 frame_scope.GenerateLeaveFrame(); |
| 1334 __ add(sp, sp, Operand(3 * kPointerSize)); | 1331 __ add(sp, sp, Operand(3 * kPointerSize)); |
| 1335 __ Jump(lr); | 1332 __ Jump(lr); |
| 1336 | 1333 |
| 1337 // Invoke the function proxy. | 1334 // Call the function proxy. |
| 1338 __ bind(&call_proxy); | 1335 __ bind(&call_proxy); |
| 1339 __ push(r1); // add function proxy as last argument | 1336 __ push(r1); // add function proxy as last argument |
| 1340 __ add(r0, r0, Operand(1)); | 1337 __ add(r0, r0, Operand(1)); |
| 1341 __ mov(r2, Operand::Zero()); | 1338 __ mov(r2, Operand::Zero()); |
| 1342 __ SetCallKind(r5, CALL_AS_METHOD); | 1339 __ SetCallKind(r5, CALL_AS_FUNCTION); |
| 1343 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); | 1340 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); |
| 1344 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1341 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1345 RelocInfo::CODE_TARGET); | 1342 RelocInfo::CODE_TARGET); |
| 1346 | 1343 |
| 1347 // Tear down the internal frame and remove function, receiver and args. | 1344 // Tear down the internal frame and remove function, receiver and args. |
| 1348 } | 1345 } |
| 1349 __ add(sp, sp, Operand(3 * kPointerSize)); | 1346 __ add(sp, sp, Operand(3 * kPointerSize)); |
| 1350 __ Jump(lr); | 1347 __ Jump(lr); |
| 1351 } | 1348 } |
| 1352 | 1349 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 __ bind(&dont_adapt_arguments); | 1482 __ bind(&dont_adapt_arguments); |
| 1486 __ Jump(r3); | 1483 __ Jump(r3); |
| 1487 } | 1484 } |
| 1488 | 1485 |
| 1489 | 1486 |
| 1490 #undef __ | 1487 #undef __ |
| 1491 | 1488 |
| 1492 } } // namespace v8::internal | 1489 } } // namespace v8::internal |
| 1493 | 1490 |
| 1494 #endif // V8_TARGET_ARCH_ARM | 1491 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |