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 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 // a0: actual number of arguments | 1215 // a0: actual number of arguments |
1216 // a1: function | 1216 // a1: function |
1217 // a2: first argument | 1217 // a2: first argument |
1218 __ JumpIfSmi(a2, &convert_to_object, t2); | 1218 __ JumpIfSmi(a2, &convert_to_object, t2); |
1219 | 1219 |
1220 __ LoadRoot(a3, Heap::kUndefinedValueRootIndex); | 1220 __ LoadRoot(a3, Heap::kUndefinedValueRootIndex); |
1221 __ Branch(&use_global_receiver, eq, a2, Operand(a3)); | 1221 __ Branch(&use_global_receiver, eq, a2, Operand(a3)); |
1222 __ LoadRoot(a3, Heap::kNullValueRootIndex); | 1222 __ LoadRoot(a3, Heap::kNullValueRootIndex); |
1223 __ Branch(&use_global_receiver, eq, a2, Operand(a3)); | 1223 __ Branch(&use_global_receiver, eq, a2, Operand(a3)); |
1224 | 1224 |
| 1225 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE); |
| 1226 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); |
1225 __ GetObjectType(a2, a3, a3); | 1227 __ GetObjectType(a2, a3, a3); |
1226 __ Branch(&convert_to_object, lt, a3, Operand(FIRST_JS_OBJECT_TYPE)); | 1228 __ Branch(&shift_arguments, ge, a3, Operand(FIRST_JS_OBJECT_TYPE)); |
1227 __ Branch(&shift_arguments, le, a3, Operand(LAST_JS_OBJECT_TYPE)); | |
1228 | 1229 |
1229 __ bind(&convert_to_object); | 1230 __ bind(&convert_to_object); |
1230 __ EnterInternalFrame(); // In order to preserve argument count. | 1231 __ EnterInternalFrame(); // In order to preserve argument count. |
1231 __ sll(a0, a0, kSmiTagSize); // Smi tagged. | 1232 __ sll(a0, a0, kSmiTagSize); // Smi tagged. |
1232 __ push(a0); | 1233 __ push(a0); |
1233 | 1234 |
1234 __ push(a2); | 1235 __ push(a2); |
1235 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1236 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
1236 __ mov(a2, v0); | 1237 __ mov(a2, v0); |
1237 | 1238 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 // Compute the receiver in non-strict mode. | 1395 // Compute the receiver in non-strict mode. |
1395 __ And(t0, a0, Operand(kSmiTagMask)); | 1396 __ And(t0, a0, Operand(kSmiTagMask)); |
1396 __ Branch(&call_to_object, eq, t0, Operand(zero_reg)); | 1397 __ Branch(&call_to_object, eq, t0, Operand(zero_reg)); |
1397 __ LoadRoot(a1, Heap::kNullValueRootIndex); | 1398 __ LoadRoot(a1, Heap::kNullValueRootIndex); |
1398 __ Branch(&use_global_receiver, eq, a0, Operand(a1)); | 1399 __ Branch(&use_global_receiver, eq, a0, Operand(a1)); |
1399 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 1400 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
1400 __ Branch(&use_global_receiver, eq, a0, Operand(a2)); | 1401 __ Branch(&use_global_receiver, eq, a0, Operand(a2)); |
1401 | 1402 |
1402 // Check if the receiver is already a JavaScript object. | 1403 // Check if the receiver is already a JavaScript object. |
1403 // a0: receiver | 1404 // a0: receiver |
| 1405 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE); |
| 1406 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); |
1404 __ GetObjectType(a0, a1, a1); | 1407 __ GetObjectType(a0, a1, a1); |
1405 __ Branch(&call_to_object, lt, a1, Operand(FIRST_JS_OBJECT_TYPE)); | 1408 __ Branch(&push_receiver, ge, a1, Operand(FIRST_JS_OBJECT_TYPE)); |
1406 __ Branch(&push_receiver, le, a1, Operand(LAST_JS_OBJECT_TYPE)); | |
1407 | 1409 |
1408 // Convert the receiver to a regular object. | 1410 // Convert the receiver to a regular object. |
1409 // a0: receiver | 1411 // a0: receiver |
1410 __ bind(&call_to_object); | 1412 __ bind(&call_to_object); |
1411 __ push(a0); | 1413 __ push(a0); |
1412 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1414 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
1413 __ mov(a0, v0); // Put object in a0 to match other paths to push_receiver. | 1415 __ mov(a0, v0); // Put object in a0 to match other paths to push_receiver. |
1414 __ Branch(&push_receiver); | 1416 __ Branch(&push_receiver); |
1415 | 1417 |
1416 // Use the current global receiver object as the receiver. | 1418 // Use the current global receiver object as the receiver. |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 __ bind(&dont_adapt_arguments); | 1605 __ bind(&dont_adapt_arguments); |
1604 __ Jump(a3); | 1606 __ Jump(a3); |
1605 } | 1607 } |
1606 | 1608 |
1607 | 1609 |
1608 #undef __ | 1610 #undef __ |
1609 | 1611 |
1610 } } // namespace v8::internal | 1612 } } // namespace v8::internal |
1611 | 1613 |
1612 #endif // V8_TARGET_ARCH_MIPS | 1614 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |