| 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 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 | 946 |
| 947 // If the result is a smi, it is *not* an object in the ECMA sense. | 947 // If the result is a smi, it is *not* an object in the ECMA sense. |
| 948 // r0: result | 948 // r0: result |
| 949 // sp[0]: receiver (newly allocated object) | 949 // sp[0]: receiver (newly allocated object) |
| 950 // sp[1]: constructor function | 950 // sp[1]: constructor function |
| 951 // sp[2]: number of arguments (smi-tagged) | 951 // sp[2]: number of arguments (smi-tagged) |
| 952 __ tst(r0, Operand(kSmiTagMask)); | 952 __ tst(r0, Operand(kSmiTagMask)); |
| 953 __ b(eq, &use_receiver); | 953 __ b(eq, &use_receiver); |
| 954 | 954 |
| 955 // If the type of the result (stored in its map) is less than | 955 // If the type of the result (stored in its map) is less than |
| 956 // FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense. | 956 // FIRST_SPEC_OBJECT_TYPE, it is not an object in the ECMA sense. |
| 957 __ CompareObjectType(r0, r3, r3, FIRST_JS_OBJECT_TYPE); | 957 __ CompareObjectType(r0, r3, r3, FIRST_SPEC_OBJECT_TYPE); |
| 958 __ b(ge, &exit); | 958 __ b(ge, &exit); |
| 959 | 959 |
| 960 // Throw away the result of the constructor invocation and use the | 960 // Throw away the result of the constructor invocation and use the |
| 961 // on-stack receiver as the result. | 961 // on-stack receiver as the result. |
| 962 __ bind(&use_receiver); | 962 __ bind(&use_receiver); |
| 963 __ ldr(r0, MemOperand(sp)); | 963 __ ldr(r0, MemOperand(sp)); |
| 964 | 964 |
| 965 // Remove receiver from the stack, remove caller arguments, and | 965 // Remove receiver from the stack, remove caller arguments, and |
| 966 // return. | 966 // return. |
| 967 __ bind(&exit); | 967 __ bind(&exit); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 __ tst(r2, Operand(kSmiTagMask)); | 1282 __ tst(r2, Operand(kSmiTagMask)); |
| 1283 __ b(eq, &convert_to_object); | 1283 __ b(eq, &convert_to_object); |
| 1284 | 1284 |
| 1285 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex); | 1285 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex); |
| 1286 __ cmp(r2, r3); | 1286 __ cmp(r2, r3); |
| 1287 __ b(eq, &use_global_receiver); | 1287 __ b(eq, &use_global_receiver); |
| 1288 __ LoadRoot(r3, Heap::kNullValueRootIndex); | 1288 __ LoadRoot(r3, Heap::kNullValueRootIndex); |
| 1289 __ cmp(r2, r3); | 1289 __ cmp(r2, r3); |
| 1290 __ b(eq, &use_global_receiver); | 1290 __ b(eq, &use_global_receiver); |
| 1291 | 1291 |
| 1292 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE); | 1292 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 1293 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 1293 __ CompareObjectType(r2, r3, r3, FIRST_SPEC_OBJECT_TYPE); |
| 1294 __ CompareObjectType(r2, r3, r3, FIRST_JS_OBJECT_TYPE); | |
| 1295 __ b(ge, &shift_arguments); | 1294 __ b(ge, &shift_arguments); |
| 1296 | 1295 |
| 1297 __ bind(&convert_to_object); | 1296 __ bind(&convert_to_object); |
| 1298 | 1297 |
| 1299 { | 1298 { |
| 1300 // Enter an internal frame in order to preserve argument count. | 1299 // Enter an internal frame in order to preserve argument count. |
| 1301 FrameScope scope(masm, StackFrame::INTERNAL); | 1300 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1302 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); // Smi-tagged. | 1301 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); // Smi-tagged. |
| 1303 __ push(r0); | 1302 __ push(r0); |
| 1304 | 1303 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 __ b(eq, &call_to_object); | 1469 __ b(eq, &call_to_object); |
| 1471 __ LoadRoot(r1, Heap::kNullValueRootIndex); | 1470 __ LoadRoot(r1, Heap::kNullValueRootIndex); |
| 1472 __ cmp(r0, r1); | 1471 __ cmp(r0, r1); |
| 1473 __ b(eq, &use_global_receiver); | 1472 __ b(eq, &use_global_receiver); |
| 1474 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); | 1473 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); |
| 1475 __ cmp(r0, r1); | 1474 __ cmp(r0, r1); |
| 1476 __ b(eq, &use_global_receiver); | 1475 __ b(eq, &use_global_receiver); |
| 1477 | 1476 |
| 1478 // Check if the receiver is already a JavaScript object. | 1477 // Check if the receiver is already a JavaScript object. |
| 1479 // r0: receiver | 1478 // r0: receiver |
| 1480 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE); | 1479 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 1481 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 1480 __ CompareObjectType(r0, r1, r1, FIRST_SPEC_OBJECT_TYPE); |
| 1482 __ CompareObjectType(r0, r1, r1, FIRST_JS_OBJECT_TYPE); | |
| 1483 __ b(ge, &push_receiver); | 1481 __ b(ge, &push_receiver); |
| 1484 | 1482 |
| 1485 // Convert the receiver to a regular object. | 1483 // Convert the receiver to a regular object. |
| 1486 // r0: receiver | 1484 // r0: receiver |
| 1487 __ bind(&call_to_object); | 1485 __ bind(&call_to_object); |
| 1488 __ push(r0); | 1486 __ push(r0); |
| 1489 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1487 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 1490 __ b(&push_receiver); | 1488 __ b(&push_receiver); |
| 1491 | 1489 |
| 1492 // Use the current global receiver object as the receiver. | 1490 // Use the current global receiver object as the receiver. |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 __ bind(&dont_adapt_arguments); | 1670 __ bind(&dont_adapt_arguments); |
| 1673 __ Jump(r3); | 1671 __ Jump(r3); |
| 1674 } | 1672 } |
| 1675 | 1673 |
| 1676 | 1674 |
| 1677 #undef __ | 1675 #undef __ |
| 1678 | 1676 |
| 1679 } } // namespace v8::internal | 1677 } } // namespace v8::internal |
| 1680 | 1678 |
| 1681 #endif // V8_TARGET_ARCH_ARM | 1679 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |