| 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 // If the result is an object (in the ECMA sense), we should get rid | 362 // If the result is an object (in the ECMA sense), we should get rid |
| 363 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 | 363 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 |
| 364 // on page 74. | 364 // on page 74. |
| 365 Label use_receiver, exit; | 365 Label use_receiver, exit; |
| 366 | 366 |
| 367 // If the result is a smi, it is *not* an object in the ECMA sense. | 367 // If the result is a smi, it is *not* an object in the ECMA sense. |
| 368 __ test(eax, Immediate(kSmiTagMask)); | 368 __ test(eax, Immediate(kSmiTagMask)); |
| 369 __ j(zero, &use_receiver); | 369 __ j(zero, &use_receiver); |
| 370 | 370 |
| 371 // If the type of the result (stored in its map) is less than | 371 // If the type of the result (stored in its map) is less than |
| 372 // FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense. | 372 // FIRST_SPEC_OBJECT_TYPE, it is not an object in the ECMA sense. |
| 373 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx); | 373 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); |
| 374 __ j(above_equal, &exit); | 374 __ j(above_equal, &exit); |
| 375 | 375 |
| 376 // Throw away the result of the constructor invocation and use the | 376 // Throw away the result of the constructor invocation and use the |
| 377 // on-stack receiver as the result. | 377 // on-stack receiver as the result. |
| 378 __ bind(&use_receiver); | 378 __ bind(&use_receiver); |
| 379 __ mov(eax, Operand(esp, 0)); | 379 __ mov(eax, Operand(esp, 0)); |
| 380 | 380 |
| 381 // Restore the arguments count and leave the construct frame. | 381 // Restore the arguments count and leave the construct frame. |
| 382 __ bind(&exit); | 382 __ bind(&exit); |
| 383 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count | 383 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 __ mov(ebx, Operand(esp, eax, times_4, 0)); // First argument. | 635 __ mov(ebx, Operand(esp, eax, times_4, 0)); // First argument. |
| 636 | 636 |
| 637 // Call ToObject on the receiver if it is not an object, or use the | 637 // Call ToObject on the receiver if it is not an object, or use the |
| 638 // global object if it is null or undefined. | 638 // global object if it is null or undefined. |
| 639 __ test(ebx, Immediate(kSmiTagMask)); | 639 __ test(ebx, Immediate(kSmiTagMask)); |
| 640 __ j(zero, &convert_to_object); | 640 __ j(zero, &convert_to_object); |
| 641 __ cmp(ebx, factory->null_value()); | 641 __ cmp(ebx, factory->null_value()); |
| 642 __ j(equal, &use_global_receiver); | 642 __ j(equal, &use_global_receiver); |
| 643 __ cmp(ebx, factory->undefined_value()); | 643 __ cmp(ebx, factory->undefined_value()); |
| 644 __ j(equal, &use_global_receiver); | 644 __ j(equal, &use_global_receiver); |
| 645 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE); | 645 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 646 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 646 __ CmpObjectType(ebx, FIRST_SPEC_OBJECT_TYPE, ecx); |
| 647 __ CmpObjectType(ebx, FIRST_JS_OBJECT_TYPE, ecx); | |
| 648 __ j(above_equal, &shift_arguments); | 647 __ j(above_equal, &shift_arguments); |
| 649 | 648 |
| 650 __ bind(&convert_to_object); | 649 __ bind(&convert_to_object); |
| 651 | 650 |
| 652 { // In order to preserve argument count. | 651 { // In order to preserve argument count. |
| 653 FrameScope scope(masm, StackFrame::INTERNAL); | 652 FrameScope scope(masm, StackFrame::INTERNAL); |
| 654 __ SmiTag(eax); | 653 __ SmiTag(eax); |
| 655 __ push(eax); | 654 __ push(eax); |
| 656 | 655 |
| 657 __ push(ebx); | 656 __ push(ebx); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 | 801 |
| 803 // Compute the receiver in non-strict mode. | 802 // Compute the receiver in non-strict mode. |
| 804 // Call ToObject on the receiver if it is not an object, or use the | 803 // Call ToObject on the receiver if it is not an object, or use the |
| 805 // global object if it is null or undefined. | 804 // global object if it is null or undefined. |
| 806 __ test(ebx, Immediate(kSmiTagMask)); | 805 __ test(ebx, Immediate(kSmiTagMask)); |
| 807 __ j(zero, &call_to_object); | 806 __ j(zero, &call_to_object); |
| 808 __ cmp(ebx, factory->null_value()); | 807 __ cmp(ebx, factory->null_value()); |
| 809 __ j(equal, &use_global_receiver); | 808 __ j(equal, &use_global_receiver); |
| 810 __ cmp(ebx, factory->undefined_value()); | 809 __ cmp(ebx, factory->undefined_value()); |
| 811 __ j(equal, &use_global_receiver); | 810 __ j(equal, &use_global_receiver); |
| 812 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE); | 811 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 813 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 812 __ CmpObjectType(ebx, FIRST_SPEC_OBJECT_TYPE, ecx); |
| 814 __ CmpObjectType(ebx, FIRST_JS_OBJECT_TYPE, ecx); | |
| 815 __ j(above_equal, &push_receiver); | 813 __ j(above_equal, &push_receiver); |
| 816 | 814 |
| 817 __ bind(&call_to_object); | 815 __ bind(&call_to_object); |
| 818 __ push(ebx); | 816 __ push(ebx); |
| 819 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 817 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 820 __ mov(ebx, Operand(eax)); | 818 __ mov(ebx, Operand(eax)); |
| 821 __ jmp(&push_receiver); | 819 __ jmp(&push_receiver); |
| 822 | 820 |
| 823 // Use the current global receiver object as the receiver. | 821 // Use the current global receiver object as the receiver. |
| 824 __ bind(&use_global_receiver); | 822 __ bind(&use_global_receiver); |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1636 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1639 generator.Generate(); | 1637 generator.Generate(); |
| 1640 } | 1638 } |
| 1641 | 1639 |
| 1642 | 1640 |
| 1643 #undef __ | 1641 #undef __ |
| 1644 } | 1642 } |
| 1645 } // namespace v8::internal | 1643 } // namespace v8::internal |
| 1646 | 1644 |
| 1647 #endif // V8_TARGET_ARCH_IA32 | 1645 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |