| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 353 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 354 | 354 |
| 355 // If the result is an object (in the ECMA sense), we should get rid | 355 // If the result is an object (in the ECMA sense), we should get rid |
| 356 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 | 356 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 |
| 357 // on page 74. | 357 // on page 74. |
| 358 Label use_receiver, exit; | 358 Label use_receiver, exit; |
| 359 // If the result is a smi, it is *not* an object in the ECMA sense. | 359 // If the result is a smi, it is *not* an object in the ECMA sense. |
| 360 __ JumpIfSmi(rax, &use_receiver); | 360 __ JumpIfSmi(rax, &use_receiver); |
| 361 | 361 |
| 362 // If the type of the result (stored in its map) is less than | 362 // If the type of the result (stored in its map) is less than |
| 363 // FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense. | 363 // FIRST_SPEC_OBJECT_TYPE, it is not an object in the ECMA sense. |
| 364 __ CmpObjectType(rax, FIRST_JS_OBJECT_TYPE, rcx); | 364 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 365 __ CmpObjectType(rax, FIRST_SPEC_OBJECT_TYPE, rcx); |
| 365 __ j(above_equal, &exit); | 366 __ j(above_equal, &exit); |
| 366 | 367 |
| 367 // Throw away the result of the constructor invocation and use the | 368 // Throw away the result of the constructor invocation and use the |
| 368 // on-stack receiver as the result. | 369 // on-stack receiver as the result. |
| 369 __ bind(&use_receiver); | 370 __ bind(&use_receiver); |
| 370 __ movq(rax, Operand(rsp, 0)); | 371 __ movq(rax, Operand(rsp, 0)); |
| 371 | 372 |
| 372 // Restore the arguments count and leave the construct frame. | 373 // Restore the arguments count and leave the construct frame. |
| 373 __ bind(&exit); | 374 __ bind(&exit); |
| 374 __ movq(rbx, Operand(rsp, kPointerSize)); // get arguments count | 375 __ movq(rbx, Operand(rsp, kPointerSize)); // get arguments count |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 | 667 |
| 667 // Compute the receiver in non-strict mode. | 668 // Compute the receiver in non-strict mode. |
| 668 __ movq(rbx, Operand(rsp, rax, times_pointer_size, 0)); | 669 __ movq(rbx, Operand(rsp, rax, times_pointer_size, 0)); |
| 669 __ JumpIfSmi(rbx, &convert_to_object); | 670 __ JumpIfSmi(rbx, &convert_to_object); |
| 670 | 671 |
| 671 __ CompareRoot(rbx, Heap::kNullValueRootIndex); | 672 __ CompareRoot(rbx, Heap::kNullValueRootIndex); |
| 672 __ j(equal, &use_global_receiver); | 673 __ j(equal, &use_global_receiver); |
| 673 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); | 674 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); |
| 674 __ j(equal, &use_global_receiver); | 675 __ j(equal, &use_global_receiver); |
| 675 | 676 |
| 676 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx); | 677 __ CmpObjectType(rbx, FIRST_SPEC_OBJECT_TYPE, rcx); |
| 677 __ j(below, &convert_to_object); | 678 __ j(below, &convert_to_object); |
| 678 __ CmpInstanceType(rcx, LAST_JS_OBJECT_TYPE); | 679 __ CmpInstanceType(rcx, LAST_SPEC_OBJECT_TYPE); |
| 679 __ j(below_equal, &shift_arguments); | 680 __ j(below_equal, &shift_arguments); |
| 680 | 681 |
| 681 __ bind(&convert_to_object); | 682 __ bind(&convert_to_object); |
| 682 __ EnterInternalFrame(); // In order to preserve argument count. | 683 __ EnterInternalFrame(); // In order to preserve argument count. |
| 683 __ Integer32ToSmi(rax, rax); | 684 __ Integer32ToSmi(rax, rax); |
| 684 __ push(rax); | 685 __ push(rax); |
| 685 | 686 |
| 686 __ push(rbx); | 687 __ push(rbx); |
| 687 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 688 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 688 __ movq(rbx, rax); | 689 __ movq(rbx, rax); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 | 836 |
| 836 // Compute the receiver in non-strict mode. | 837 // Compute the receiver in non-strict mode. |
| 837 __ JumpIfSmi(rbx, &call_to_object); | 838 __ JumpIfSmi(rbx, &call_to_object); |
| 838 __ CompareRoot(rbx, Heap::kNullValueRootIndex); | 839 __ CompareRoot(rbx, Heap::kNullValueRootIndex); |
| 839 __ j(equal, &use_global_receiver); | 840 __ j(equal, &use_global_receiver); |
| 840 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); | 841 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); |
| 841 __ j(equal, &use_global_receiver); | 842 __ j(equal, &use_global_receiver); |
| 842 | 843 |
| 843 // If given receiver is already a JavaScript object then there's no | 844 // If given receiver is already a JavaScript object then there's no |
| 844 // reason for converting it. | 845 // reason for converting it. |
| 845 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx); | 846 __ CmpObjectType(rbx, FIRST_SPEC_OBJECT_TYPE, rcx); |
| 846 __ j(below, &call_to_object); | 847 __ j(below, &call_to_object); |
| 847 __ CmpInstanceType(rcx, LAST_JS_OBJECT_TYPE); | 848 __ CmpInstanceType(rcx, LAST_SPEC_OBJECT_TYPE); |
| 848 __ j(below_equal, &push_receiver); | 849 __ j(below_equal, &push_receiver); |
| 849 | 850 |
| 850 // Convert the receiver to an object. | 851 // Convert the receiver to an object. |
| 851 __ bind(&call_to_object); | 852 __ bind(&call_to_object); |
| 852 __ push(rbx); | 853 __ push(rbx); |
| 853 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 854 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 854 __ movq(rbx, rax); | 855 __ movq(rbx, rax); |
| 855 __ jmp(&push_receiver); | 856 __ jmp(&push_receiver); |
| 856 | 857 |
| 857 // Use the current global receiver object as the receiver. | 858 // Use the current global receiver object as the receiver. |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1495 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1496 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1496 generator.Generate(); | 1497 generator.Generate(); |
| 1497 } | 1498 } |
| 1498 | 1499 |
| 1499 | 1500 |
| 1500 #undef __ | 1501 #undef __ |
| 1501 | 1502 |
| 1502 } } // namespace v8::internal | 1503 } } // namespace v8::internal |
| 1503 | 1504 |
| 1504 #endif // V8_TARGET_ARCH_X64 | 1505 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |