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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 | 638 |
639 // a0: number of arguments | 639 // a0: number of arguments |
640 // a1: called object | 640 // a1: called object |
641 __ bind(&non_function_call); | 641 __ bind(&non_function_call); |
642 // CALL_NON_FUNCTION expects the non-function constructor as receiver | 642 // CALL_NON_FUNCTION expects the non-function constructor as receiver |
643 // (instead of the original receiver from the call site). The receiver is | 643 // (instead of the original receiver from the call site). The receiver is |
644 // stack element argc. | 644 // stack element argc. |
645 // Set expected number of arguments to zero (not changing a0). | 645 // Set expected number of arguments to zero (not changing a0). |
646 __ mov(a2, zero_reg); | 646 __ mov(a2, zero_reg); |
647 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); | 647 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); |
| 648 __ SetCallKind(t1, CALL_AS_METHOD); |
648 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 649 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
649 RelocInfo::CODE_TARGET); | 650 RelocInfo::CODE_TARGET); |
650 } | 651 } |
651 | 652 |
652 | 653 |
653 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 654 static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
654 bool is_api_function, | 655 bool is_api_function, |
655 bool count_constructions) { | 656 bool count_constructions) { |
656 // Should never count constructions for api objects. | 657 // Should never count constructions for api objects. |
657 ASSERT(!is_api_function || !count_constructions); | 658 ASSERT(!is_api_function || !count_constructions); |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 Generate_JSEntryTrampolineHelper(masm, true); | 1096 Generate_JSEntryTrampolineHelper(masm, true); |
1096 } | 1097 } |
1097 | 1098 |
1098 | 1099 |
1099 void Builtins::Generate_LazyCompile(MacroAssembler* masm) { | 1100 void Builtins::Generate_LazyCompile(MacroAssembler* masm) { |
1100 // Enter an internal frame. | 1101 // Enter an internal frame. |
1101 __ EnterInternalFrame(); | 1102 __ EnterInternalFrame(); |
1102 | 1103 |
1103 // Preserve the function. | 1104 // Preserve the function. |
1104 __ push(a1); | 1105 __ push(a1); |
| 1106 // Push call kind information. |
| 1107 __ push(t1); |
1105 | 1108 |
1106 // Push the function on the stack as the argument to the runtime function. | 1109 // Push the function on the stack as the argument to the runtime function. |
1107 __ push(a1); | 1110 __ push(a1); |
1108 // Call the runtime function. | 1111 // Call the runtime function. |
1109 __ CallRuntime(Runtime::kLazyCompile, 1); | 1112 __ CallRuntime(Runtime::kLazyCompile, 1); |
1110 // Calculate the entry point. | 1113 // Calculate the entry point. |
1111 __ addiu(t9, v0, Code::kHeaderSize - kHeapObjectTag); | 1114 __ addiu(t9, v0, Code::kHeaderSize - kHeapObjectTag); |
| 1115 |
| 1116 // Restore call kind information. |
| 1117 __ pop(t1); |
1112 // Restore saved function. | 1118 // Restore saved function. |
1113 __ pop(a1); | 1119 __ pop(a1); |
1114 | 1120 |
1115 // Tear down temporary frame. | 1121 // Tear down temporary frame. |
1116 __ LeaveInternalFrame(); | 1122 __ LeaveInternalFrame(); |
1117 | 1123 |
1118 // Do a tail-call of the compiled function. | 1124 // Do a tail-call of the compiled function. |
1119 __ Jump(t9); | 1125 __ Jump(t9); |
1120 } | 1126 } |
1121 | 1127 |
1122 | 1128 |
1123 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { | 1129 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { |
1124 // Enter an internal frame. | 1130 // Enter an internal frame. |
1125 __ EnterInternalFrame(); | 1131 __ EnterInternalFrame(); |
1126 | 1132 |
1127 // Preserve the function. | 1133 // Preserve the function. |
1128 __ push(a1); | 1134 __ push(a1); |
| 1135 // Push call kind information. |
| 1136 __ push(t1); |
1129 | 1137 |
1130 // Push the function on the stack as the argument to the runtime function. | 1138 // Push the function on the stack as the argument to the runtime function. |
1131 __ push(a1); | 1139 __ push(a1); |
1132 __ CallRuntime(Runtime::kLazyRecompile, 1); | 1140 __ CallRuntime(Runtime::kLazyRecompile, 1); |
1133 // Calculate the entry point. | 1141 // Calculate the entry point. |
1134 __ Addu(t9, v0, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1142 __ Addu(t9, v0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1143 |
| 1144 // Restore call kind information. |
| 1145 __ pop(t1); |
1135 // Restore saved function. | 1146 // Restore saved function. |
1136 __ pop(a1); | 1147 __ pop(a1); |
1137 | 1148 |
1138 // Tear down temporary frame. | 1149 // Tear down temporary frame. |
1139 __ LeaveInternalFrame(); | 1150 __ LeaveInternalFrame(); |
1140 | 1151 |
1141 // Do a tail-call of the compiled function. | 1152 // Do a tail-call of the compiled function. |
1142 __ Jump(t9); | 1153 __ Jump(t9); |
1143 } | 1154 } |
1144 | 1155 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 __ Pop(); | 1310 __ Pop(); |
1300 } | 1311 } |
1301 | 1312 |
1302 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin. | 1313 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin. |
1303 // a0: actual number of arguments | 1314 // a0: actual number of arguments |
1304 // a1: function | 1315 // a1: function |
1305 { Label function; | 1316 { Label function; |
1306 __ Branch(&function, ne, a1, Operand(zero_reg)); | 1317 __ Branch(&function, ne, a1, Operand(zero_reg)); |
1307 __ mov(a2, zero_reg); // expected arguments is 0 for CALL_NON_FUNCTION | 1318 __ mov(a2, zero_reg); // expected arguments is 0 for CALL_NON_FUNCTION |
1308 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION); | 1319 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION); |
| 1320 __ SetCallKind(t1, CALL_AS_METHOD); |
1309 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1321 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
1310 RelocInfo::CODE_TARGET); | 1322 RelocInfo::CODE_TARGET); |
1311 __ bind(&function); | 1323 __ bind(&function); |
1312 } | 1324 } |
1313 | 1325 |
1314 // 5b. Get the code to call from the function and check that the number of | 1326 // 5b. Get the code to call from the function and check that the number of |
1315 // expected arguments matches what we're providing. If so, jump | 1327 // expected arguments matches what we're providing. If so, jump |
1316 // (tail-call) to the code in register edx without checking arguments. | 1328 // (tail-call) to the code in register edx without checking arguments. |
1317 // a0: actual number of arguments | 1329 // a0: actual number of arguments |
1318 // a1: function | 1330 // a1: function |
1319 __ lw(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 1331 __ lw(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
1320 __ lw(a2, | 1332 __ lw(a2, |
1321 FieldMemOperand(a3, SharedFunctionInfo::kFormalParameterCountOffset)); | 1333 FieldMemOperand(a3, SharedFunctionInfo::kFormalParameterCountOffset)); |
1322 __ sra(a2, a2, kSmiTagSize); | 1334 __ sra(a2, a2, kSmiTagSize); |
1323 __ lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); | 1335 __ lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
| 1336 __ SetCallKind(t1, CALL_AS_METHOD); |
1324 // Check formal and actual parameter counts. | 1337 // Check formal and actual parameter counts. |
1325 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1338 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
1326 RelocInfo::CODE_TARGET, ne, a2, Operand(a0)); | 1339 RelocInfo::CODE_TARGET, ne, a2, Operand(a0)); |
1327 | 1340 |
1328 ParameterCount expected(0); | 1341 ParameterCount expected(0); |
1329 __ InvokeCode(a3, expected, expected, JUMP_FUNCTION); | 1342 __ InvokeCode(a3, expected, expected, JUMP_FUNCTION); |
1330 } | 1343 } |
1331 | 1344 |
1332 | 1345 |
1333 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 1346 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 } | 1506 } |
1494 | 1507 |
1495 | 1508 |
1496 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 1509 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
1497 // State setup as expected by MacroAssembler::InvokePrologue. | 1510 // State setup as expected by MacroAssembler::InvokePrologue. |
1498 // ----------- S t a t e ------------- | 1511 // ----------- S t a t e ------------- |
1499 // -- a0: actual arguments count | 1512 // -- a0: actual arguments count |
1500 // -- a1: function (passed through to callee) | 1513 // -- a1: function (passed through to callee) |
1501 // -- a2: expected arguments count | 1514 // -- a2: expected arguments count |
1502 // -- a3: callee code entry | 1515 // -- a3: callee code entry |
| 1516 // -- t1: call kind information |
1503 // ----------------------------------- | 1517 // ----------------------------------- |
1504 | 1518 |
1505 Label invoke, dont_adapt_arguments; | 1519 Label invoke, dont_adapt_arguments; |
1506 | 1520 |
1507 Label enough, too_few; | 1521 Label enough, too_few; |
1508 __ Branch(&dont_adapt_arguments, eq, | 1522 __ Branch(&dont_adapt_arguments, eq, |
1509 a2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); | 1523 a2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); |
1510 // We use Uless as the number of argument should always be greater than 0. | 1524 // We use Uless as the number of argument should always be greater than 0. |
1511 __ Branch(&too_few, Uless, a0, Operand(a2)); | 1525 __ Branch(&too_few, Uless, a0, Operand(a2)); |
1512 | 1526 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 __ bind(&dont_adapt_arguments); | 1619 __ bind(&dont_adapt_arguments); |
1606 __ Jump(a3); | 1620 __ Jump(a3); |
1607 } | 1621 } |
1608 | 1622 |
1609 | 1623 |
1610 #undef __ | 1624 #undef __ |
1611 | 1625 |
1612 } } // namespace v8::internal | 1626 } } // namespace v8::internal |
1613 | 1627 |
1614 #endif // V8_TARGET_ARCH_MIPS | 1628 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |