OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 | 935 |
936 // Call the function. | 936 // Call the function. |
937 // a0: number of arguments | 937 // a0: number of arguments |
938 // a1: constructor function | 938 // a1: constructor function |
939 if (is_api_function) { | 939 if (is_api_function) { |
940 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 940 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
941 Handle<Code> code = | 941 Handle<Code> code = |
942 masm->isolate()->builtins()->HandleApiCallConstruct(); | 942 masm->isolate()->builtins()->HandleApiCallConstruct(); |
943 ParameterCount expected(0); | 943 ParameterCount expected(0); |
944 __ InvokeCode(code, expected, expected, | 944 __ InvokeCode(code, expected, expected, |
945 RelocInfo::CODE_TARGET, CALL_FUNCTION); | 945 RelocInfo::CODE_TARGET, CALL_FUNCTION, CALL_AS_METHOD); |
946 } else { | 946 } else { |
947 ParameterCount actual(a0); | 947 ParameterCount actual(a0); |
948 __ InvokeFunction(a1, actual, CALL_FUNCTION); | 948 __ InvokeFunction(a1, actual, CALL_FUNCTION, |
| 949 NullCallWrapper(), CALL_AS_METHOD); |
949 } | 950 } |
950 | 951 |
951 // Pop the function from the stack. | 952 // Pop the function from the stack. |
952 // v0: result | 953 // v0: result |
953 // sp[0]: constructor function | 954 // sp[0]: constructor function |
954 // sp[2]: receiver | 955 // sp[2]: receiver |
955 // sp[3]: constructor function | 956 // sp[3]: constructor function |
956 // sp[4]: number of arguments (smi-tagged) | 957 // sp[4]: number of arguments (smi-tagged) |
957 __ Pop(); | 958 __ Pop(); |
958 | 959 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 // s6 holds the root address. Do not clobber. | 1072 // s6 holds the root address. Do not clobber. |
1072 // s7 is cp. Do not init. | 1073 // s7 is cp. Do not init. |
1073 | 1074 |
1074 // Invoke the code and pass argc as a0. | 1075 // Invoke the code and pass argc as a0. |
1075 __ mov(a0, a3); | 1076 __ mov(a0, a3); |
1076 if (is_construct) { | 1077 if (is_construct) { |
1077 __ Call(masm->isolate()->builtins()->JSConstructCall(), | 1078 __ Call(masm->isolate()->builtins()->JSConstructCall(), |
1078 RelocInfo::CODE_TARGET); | 1079 RelocInfo::CODE_TARGET); |
1079 } else { | 1080 } else { |
1080 ParameterCount actual(a0); | 1081 ParameterCount actual(a0); |
1081 __ InvokeFunction(a1, actual, CALL_FUNCTION); | 1082 __ InvokeFunction(a1, actual, CALL_FUNCTION, |
| 1083 NullCallWrapper(), CALL_AS_METHOD); |
1082 } | 1084 } |
1083 | 1085 |
1084 __ LeaveInternalFrame(); | 1086 __ LeaveInternalFrame(); |
1085 | 1087 |
1086 __ Jump(ra); | 1088 __ Jump(ra); |
1087 } | 1089 } |
1088 | 1090 |
1089 | 1091 |
1090 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { | 1092 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { |
1091 Generate_JSEntryTrampolineHelper(masm, false); | 1093 Generate_JSEntryTrampolineHelper(masm, false); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 __ lw(a2, | 1333 __ lw(a2, |
1332 FieldMemOperand(a3, SharedFunctionInfo::kFormalParameterCountOffset)); | 1334 FieldMemOperand(a3, SharedFunctionInfo::kFormalParameterCountOffset)); |
1333 __ sra(a2, a2, kSmiTagSize); | 1335 __ sra(a2, a2, kSmiTagSize); |
1334 __ lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); | 1336 __ lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
1335 __ SetCallKind(t1, CALL_AS_METHOD); | 1337 __ SetCallKind(t1, CALL_AS_METHOD); |
1336 // Check formal and actual parameter counts. | 1338 // Check formal and actual parameter counts. |
1337 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1339 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
1338 RelocInfo::CODE_TARGET, ne, a2, Operand(a0)); | 1340 RelocInfo::CODE_TARGET, ne, a2, Operand(a0)); |
1339 | 1341 |
1340 ParameterCount expected(0); | 1342 ParameterCount expected(0); |
1341 __ InvokeCode(a3, expected, expected, JUMP_FUNCTION); | 1343 __ InvokeCode(a3, expected, expected, JUMP_FUNCTION, |
| 1344 NullCallWrapper(), CALL_AS_METHOD); |
1342 } | 1345 } |
1343 | 1346 |
1344 | 1347 |
1345 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 1348 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
1346 const int kIndexOffset = -5 * kPointerSize; | 1349 const int kIndexOffset = -5 * kPointerSize; |
1347 const int kLimitOffset = -4 * kPointerSize; | 1350 const int kLimitOffset = -4 * kPointerSize; |
1348 const int kArgsOffset = 2 * kPointerSize; | 1351 const int kArgsOffset = 2 * kPointerSize; |
1349 const int kRecvOffset = 3 * kPointerSize; | 1352 const int kRecvOffset = 3 * kPointerSize; |
1350 const int kFunctionOffset = 4 * kPointerSize; | 1353 const int kFunctionOffset = 4 * kPointerSize; |
1351 | 1354 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 | 1467 |
1465 // Test if the copy loop has finished copying all the elements from the | 1468 // Test if the copy loop has finished copying all the elements from the |
1466 // arguments object. | 1469 // arguments object. |
1467 __ bind(&entry); | 1470 __ bind(&entry); |
1468 __ lw(a1, MemOperand(fp, kLimitOffset)); | 1471 __ lw(a1, MemOperand(fp, kLimitOffset)); |
1469 __ Branch(&loop, ne, a0, Operand(a1)); | 1472 __ Branch(&loop, ne, a0, Operand(a1)); |
1470 // Invoke the function. | 1473 // Invoke the function. |
1471 ParameterCount actual(a0); | 1474 ParameterCount actual(a0); |
1472 __ sra(a0, a0, kSmiTagSize); | 1475 __ sra(a0, a0, kSmiTagSize); |
1473 __ lw(a1, MemOperand(fp, kFunctionOffset)); | 1476 __ lw(a1, MemOperand(fp, kFunctionOffset)); |
1474 __ InvokeFunction(a1, actual, CALL_FUNCTION); | 1477 __ InvokeFunction(a1, actual, CALL_FUNCTION, |
| 1478 NullCallWrapper(), CALL_AS_METHOD); |
1475 | 1479 |
1476 // Tear down the internal frame and remove function, receiver and args. | 1480 // Tear down the internal frame and remove function, receiver and args. |
1477 __ LeaveInternalFrame(); | 1481 __ LeaveInternalFrame(); |
1478 __ Addu(sp, sp, Operand(3 * kPointerSize)); | 1482 __ Addu(sp, sp, Operand(3 * kPointerSize)); |
1479 __ Ret(); | 1483 __ Ret(); |
1480 } | 1484 } |
1481 | 1485 |
1482 | 1486 |
1483 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { | 1487 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { |
1484 __ sll(a0, a0, kSmiTagSize); | 1488 __ sll(a0, a0, kSmiTagSize); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 __ bind(&dont_adapt_arguments); | 1621 __ bind(&dont_adapt_arguments); |
1618 __ Jump(a3); | 1622 __ Jump(a3); |
1619 } | 1623 } |
1620 | 1624 |
1621 | 1625 |
1622 #undef __ | 1626 #undef __ |
1623 | 1627 |
1624 } } // namespace v8::internal | 1628 } } // namespace v8::internal |
1625 | 1629 |
1626 #endif // V8_TARGET_ARCH_MIPS | 1630 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |