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 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 | 967 |
968 // If the result is a smi, it is *not* an object in the ECMA sense. | 968 // If the result is a smi, it is *not* an object in the ECMA sense. |
969 // v0: result | 969 // v0: result |
970 // sp[0]: receiver (newly allocated object) | 970 // sp[0]: receiver (newly allocated object) |
971 // sp[1]: constructor function | 971 // sp[1]: constructor function |
972 // sp[2]: number of arguments (smi-tagged) | 972 // sp[2]: number of arguments (smi-tagged) |
973 __ And(t0, v0, Operand(kSmiTagMask)); | 973 __ And(t0, v0, Operand(kSmiTagMask)); |
974 __ Branch(&use_receiver, eq, t0, Operand(zero_reg)); | 974 __ Branch(&use_receiver, eq, t0, Operand(zero_reg)); |
975 | 975 |
976 // If the type of the result (stored in its map) is less than | 976 // If the type of the result (stored in its map) is less than |
977 // FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense. | 977 // FIRST_SPEC_OBJECT_TYPE, it is not an object in the ECMA sense. |
978 __ GetObjectType(v0, a3, a3); | 978 __ GetObjectType(v0, a3, a3); |
979 __ Branch(&exit, greater_equal, a3, Operand(FIRST_JS_OBJECT_TYPE)); | 979 __ Branch(&exit, greater_equal, a3, Operand(FIRST_SPEC_OBJECT_TYPE)); |
980 | 980 |
981 // Throw away the result of the constructor invocation and use the | 981 // Throw away the result of the constructor invocation and use the |
982 // on-stack receiver as the result. | 982 // on-stack receiver as the result. |
983 __ bind(&use_receiver); | 983 __ bind(&use_receiver); |
984 __ lw(v0, MemOperand(sp)); | 984 __ lw(v0, MemOperand(sp)); |
985 | 985 |
986 // Remove receiver from the stack, remove caller arguments, and | 986 // Remove receiver from the stack, remove caller arguments, and |
987 // return. | 987 // return. |
988 __ bind(&exit); | 988 __ bind(&exit); |
989 // v0: result | 989 // v0: result |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 // a0: actual number of arguments | 1227 // a0: actual number of arguments |
1228 // a1: function | 1228 // a1: function |
1229 // a2: first argument | 1229 // a2: first argument |
1230 __ JumpIfSmi(a2, &convert_to_object, t2); | 1230 __ JumpIfSmi(a2, &convert_to_object, t2); |
1231 | 1231 |
1232 __ LoadRoot(a3, Heap::kUndefinedValueRootIndex); | 1232 __ LoadRoot(a3, Heap::kUndefinedValueRootIndex); |
1233 __ Branch(&use_global_receiver, eq, a2, Operand(a3)); | 1233 __ Branch(&use_global_receiver, eq, a2, Operand(a3)); |
1234 __ LoadRoot(a3, Heap::kNullValueRootIndex); | 1234 __ LoadRoot(a3, Heap::kNullValueRootIndex); |
1235 __ Branch(&use_global_receiver, eq, a2, Operand(a3)); | 1235 __ Branch(&use_global_receiver, eq, a2, Operand(a3)); |
1236 | 1236 |
1237 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE); | 1237 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
1238 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | |
1239 __ GetObjectType(a2, a3, a3); | 1238 __ GetObjectType(a2, a3, a3); |
1240 __ Branch(&shift_arguments, ge, a3, Operand(FIRST_JS_OBJECT_TYPE)); | 1239 __ Branch(&shift_arguments, ge, a3, Operand(FIRST_SPEC_OBJECT_TYPE)); |
1241 | 1240 |
1242 __ bind(&convert_to_object); | 1241 __ bind(&convert_to_object); |
1243 __ EnterInternalFrame(); // In order to preserve argument count. | 1242 __ EnterInternalFrame(); // In order to preserve argument count. |
1244 __ sll(a0, a0, kSmiTagSize); // Smi tagged. | 1243 __ sll(a0, a0, kSmiTagSize); // Smi tagged. |
1245 __ push(a0); | 1244 __ push(a0); |
1246 | 1245 |
1247 __ push(a2); | 1246 __ push(a2); |
1248 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1247 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
1249 __ mov(a2, v0); | 1248 __ mov(a2, v0); |
1250 | 1249 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 // Compute the receiver in non-strict mode. | 1408 // Compute the receiver in non-strict mode. |
1410 __ And(t0, a0, Operand(kSmiTagMask)); | 1409 __ And(t0, a0, Operand(kSmiTagMask)); |
1411 __ Branch(&call_to_object, eq, t0, Operand(zero_reg)); | 1410 __ Branch(&call_to_object, eq, t0, Operand(zero_reg)); |
1412 __ LoadRoot(a1, Heap::kNullValueRootIndex); | 1411 __ LoadRoot(a1, Heap::kNullValueRootIndex); |
1413 __ Branch(&use_global_receiver, eq, a0, Operand(a1)); | 1412 __ Branch(&use_global_receiver, eq, a0, Operand(a1)); |
1414 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 1413 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
1415 __ Branch(&use_global_receiver, eq, a0, Operand(a2)); | 1414 __ Branch(&use_global_receiver, eq, a0, Operand(a2)); |
1416 | 1415 |
1417 // Check if the receiver is already a JavaScript object. | 1416 // Check if the receiver is already a JavaScript object. |
1418 // a0: receiver | 1417 // a0: receiver |
1419 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE); | 1418 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
1420 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | |
1421 __ GetObjectType(a0, a1, a1); | 1419 __ GetObjectType(a0, a1, a1); |
1422 __ Branch(&push_receiver, ge, a1, Operand(FIRST_JS_OBJECT_TYPE)); | 1420 __ Branch(&push_receiver, ge, a1, Operand(FIRST_SPEC_OBJECT_TYPE)); |
1423 | 1421 |
1424 // Convert the receiver to a regular object. | 1422 // Convert the receiver to a regular object. |
1425 // a0: receiver | 1423 // a0: receiver |
1426 __ bind(&call_to_object); | 1424 __ bind(&call_to_object); |
1427 __ push(a0); | 1425 __ push(a0); |
1428 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1426 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
1429 __ mov(a0, v0); // Put object in a0 to match other paths to push_receiver. | 1427 __ mov(a0, v0); // Put object in a0 to match other paths to push_receiver. |
1430 __ Branch(&push_receiver); | 1428 __ Branch(&push_receiver); |
1431 | 1429 |
1432 // Use the current global receiver object as the receiver. | 1430 // Use the current global receiver object as the receiver. |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 __ bind(&dont_adapt_arguments); | 1619 __ bind(&dont_adapt_arguments); |
1622 __ Jump(a3); | 1620 __ Jump(a3); |
1623 } | 1621 } |
1624 | 1622 |
1625 | 1623 |
1626 #undef __ | 1624 #undef __ |
1627 | 1625 |
1628 } } // namespace v8::internal | 1626 } } // namespace v8::internal |
1629 | 1627 |
1630 #endif // V8_TARGET_ARCH_MIPS | 1628 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |