Chromium Code Reviews| 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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 659 __ j(not_equal, &shift_arguments); | 659 __ j(not_equal, &shift_arguments); |
| 660 | 660 |
| 661 // Do not transform the receiver for natives. | 661 // Do not transform the receiver for natives. |
| 662 // SharedFunctionInfo is already loaded into rbx. | 662 // SharedFunctionInfo is already loaded into rbx. |
| 663 __ testb(FieldOperand(rbx, SharedFunctionInfo::kES5NativeByteOffset), | 663 __ testb(FieldOperand(rbx, SharedFunctionInfo::kES5NativeByteOffset), |
| 664 Immediate(1 << SharedFunctionInfo::kES5NativeBitWithinByte)); | 664 Immediate(1 << SharedFunctionInfo::kES5NativeBitWithinByte)); |
| 665 __ j(not_zero, &shift_arguments); | 665 __ j(not_zero, &shift_arguments); |
| 666 | 666 |
| 667 // Compute the receiver in non-strict mode. | 667 // Compute the receiver in non-strict mode. |
| 668 __ movq(rbx, Operand(rsp, rax, times_pointer_size, 0)); | 668 __ movq(rbx, Operand(rsp, rax, times_pointer_size, 0)); |
| 669 __ JumpIfSmi(rbx, &convert_to_object); | 669 __ JumpIfSmi(rbx, &convert_to_object, Label::kNear); |
| 670 | 670 |
| 671 __ CompareRoot(rbx, Heap::kNullValueRootIndex); | 671 __ CompareRoot(rbx, Heap::kNullValueRootIndex); |
| 672 __ j(equal, &use_global_receiver); | 672 __ j(equal, &use_global_receiver); |
| 673 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); | 673 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); |
| 674 __ j(equal, &use_global_receiver); | 674 __ j(equal, &use_global_receiver); |
| 675 | 675 |
| 676 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx); | 676 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx); |
| 677 __ j(below, &convert_to_object); | 677 __ j(above_equal, &shift_arguments); |
|
Vyacheslav Egorov (Chromium)
2011/05/23 14:58:01
add an assertion that LAST_TYPE == JS_FUNCTION_TYP
| |
| 678 __ CmpInstanceType(rcx, LAST_JS_OBJECT_TYPE); | |
| 679 __ j(below_equal, &shift_arguments); | |
| 680 | 678 |
| 681 __ bind(&convert_to_object); | 679 __ bind(&convert_to_object); |
| 682 __ EnterInternalFrame(); // In order to preserve argument count. | 680 __ EnterInternalFrame(); // In order to preserve argument count. |
| 683 __ Integer32ToSmi(rax, rax); | 681 __ Integer32ToSmi(rax, rax); |
| 684 __ push(rax); | 682 __ push(rax); |
| 685 | 683 |
| 686 __ push(rbx); | 684 __ push(rbx); |
| 687 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 685 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 688 __ movq(rbx, rax); | 686 __ movq(rbx, rax); |
| 689 | 687 |
| 690 __ pop(rax); | 688 __ pop(rax); |
| 691 __ SmiToInteger32(rax, rax); | 689 __ SmiToInteger32(rax, rax); |
| 692 __ LeaveInternalFrame(); | 690 __ LeaveInternalFrame(); |
| 693 // Restore the function to rdi. | 691 // Restore the function to rdi. |
| 694 __ movq(rdi, Operand(rsp, rax, times_pointer_size, 1 * kPointerSize)); | 692 __ movq(rdi, Operand(rsp, rax, times_pointer_size, 1 * kPointerSize)); |
| 695 __ jmp(&patch_receiver); | 693 __ jmp(&patch_receiver, Label::kNear); |
| 696 | 694 |
| 697 // Use the global receiver object from the called function as the | 695 // Use the global receiver object from the called function as the |
| 698 // receiver. | 696 // receiver. |
| 699 __ bind(&use_global_receiver); | 697 __ bind(&use_global_receiver); |
| 700 const int kGlobalIndex = | 698 const int kGlobalIndex = |
| 701 Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; | 699 Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; |
| 702 __ movq(rbx, FieldOperand(rsi, kGlobalIndex)); | 700 __ movq(rbx, FieldOperand(rsi, kGlobalIndex)); |
| 703 __ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalContextOffset)); | 701 __ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalContextOffset)); |
| 704 __ movq(rbx, FieldOperand(rbx, kGlobalIndex)); | 702 __ movq(rbx, FieldOperand(rbx, kGlobalIndex)); |
| 705 __ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset)); | 703 __ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset)); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 827 __ testb(FieldOperand(rdx, SharedFunctionInfo::kStrictModeByteOffset), | 825 __ testb(FieldOperand(rdx, SharedFunctionInfo::kStrictModeByteOffset), |
| 828 Immediate(1 << SharedFunctionInfo::kStrictModeBitWithinByte)); | 826 Immediate(1 << SharedFunctionInfo::kStrictModeBitWithinByte)); |
| 829 __ j(not_equal, &push_receiver); | 827 __ j(not_equal, &push_receiver); |
| 830 | 828 |
| 831 // Do not transform the receiver for natives. | 829 // Do not transform the receiver for natives. |
| 832 __ testb(FieldOperand(rdx, SharedFunctionInfo::kES5NativeByteOffset), | 830 __ testb(FieldOperand(rdx, SharedFunctionInfo::kES5NativeByteOffset), |
| 833 Immediate(1 << SharedFunctionInfo::kES5NativeBitWithinByte)); | 831 Immediate(1 << SharedFunctionInfo::kES5NativeBitWithinByte)); |
| 834 __ j(not_zero, &push_receiver); | 832 __ j(not_zero, &push_receiver); |
| 835 | 833 |
| 836 // Compute the receiver in non-strict mode. | 834 // Compute the receiver in non-strict mode. |
| 837 __ JumpIfSmi(rbx, &call_to_object); | 835 __ JumpIfSmi(rbx, &call_to_object, Label::kNear); |
| 838 __ CompareRoot(rbx, Heap::kNullValueRootIndex); | 836 __ CompareRoot(rbx, Heap::kNullValueRootIndex); |
| 839 __ j(equal, &use_global_receiver); | 837 __ j(equal, &use_global_receiver); |
| 840 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); | 838 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); |
| 841 __ j(equal, &use_global_receiver); | 839 __ j(equal, &use_global_receiver); |
| 842 | 840 |
| 843 // If given receiver is already a JavaScript object then there's no | 841 // If given receiver is already a JavaScript object then there's no |
| 844 // reason for converting it. | 842 // reason for converting it. |
| 845 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx); | 843 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx); |
| 846 __ j(below, &call_to_object); | 844 __ j(above_equal, &push_receiver); |
|
Vyacheslav Egorov (Chromium)
2011/05/23 14:58:01
add an assertion that LAST_TYPE == JS_FUNCTION_TYP
| |
| 847 __ CmpInstanceType(rcx, LAST_JS_OBJECT_TYPE); | |
| 848 __ j(below_equal, &push_receiver); | |
| 849 | 845 |
| 850 // Convert the receiver to an object. | 846 // Convert the receiver to an object. |
| 851 __ bind(&call_to_object); | 847 __ bind(&call_to_object); |
| 852 __ push(rbx); | 848 __ push(rbx); |
| 853 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 849 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 854 __ movq(rbx, rax); | 850 __ movq(rbx, rax); |
| 855 __ jmp(&push_receiver); | 851 __ jmp(&push_receiver, Label::kNear); |
| 856 | 852 |
| 857 // Use the current global receiver object as the receiver. | 853 // Use the current global receiver object as the receiver. |
| 858 __ bind(&use_global_receiver); | 854 __ bind(&use_global_receiver); |
| 859 const int kGlobalOffset = | 855 const int kGlobalOffset = |
| 860 Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; | 856 Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; |
| 861 __ movq(rbx, FieldOperand(rsi, kGlobalOffset)); | 857 __ movq(rbx, FieldOperand(rsi, kGlobalOffset)); |
| 862 __ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalContextOffset)); | 858 __ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalContextOffset)); |
| 863 __ movq(rbx, FieldOperand(rbx, kGlobalOffset)); | 859 __ movq(rbx, FieldOperand(rbx, kGlobalOffset)); |
| 864 __ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset)); | 860 __ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset)); |
| 865 | 861 |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1495 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1491 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1496 generator.Generate(); | 1492 generator.Generate(); |
| 1497 } | 1493 } |
| 1498 | 1494 |
| 1499 | 1495 |
| 1500 #undef __ | 1496 #undef __ |
| 1501 | 1497 |
| 1502 } } // namespace v8::internal | 1498 } } // namespace v8::internal |
| 1503 | 1499 |
| 1504 #endif // V8_TARGET_ARCH_X64 | 1500 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |