OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 void BaseStoreStubCompiler::GenerateRestoreName(MacroAssembler* masm, | 719 void BaseStoreStubCompiler::GenerateRestoreName(MacroAssembler* masm, |
720 Label* label, | 720 Label* label, |
721 Handle<Name> name) { | 721 Handle<Name> name) { |
722 if (!label->is_unused()) { | 722 if (!label->is_unused()) { |
723 __ bind(label); | 723 __ bind(label); |
724 __ mov(this->name(), Immediate(name)); | 724 __ mov(this->name(), Immediate(name)); |
725 } | 725 } |
726 } | 726 } |
727 | 727 |
728 | 728 |
| 729 // Generate code to check that a global property cell is empty. Create |
| 730 // the property cell at compilation time if no cell exists for the |
| 731 // property. |
| 732 static void GenerateCheckPropertyCell(MacroAssembler* masm, |
| 733 Handle<GlobalObject> global, |
| 734 Handle<Name> name, |
| 735 Register scratch, |
| 736 Label* miss) { |
| 737 Handle<JSGlobalPropertyCell> cell = |
| 738 GlobalObject::EnsurePropertyCell(global, name); |
| 739 ASSERT(cell->value()->IsTheHole()); |
| 740 Handle<Oddball> the_hole = masm->isolate()->factory()->the_hole_value(); |
| 741 if (Serializer::enabled()) { |
| 742 __ mov(scratch, Immediate(cell)); |
| 743 __ cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset), |
| 744 Immediate(the_hole)); |
| 745 } else { |
| 746 __ cmp(Operand::Cell(cell), Immediate(the_hole)); |
| 747 } |
| 748 __ j(not_equal, miss); |
| 749 } |
| 750 |
| 751 |
729 // Both name_reg and receiver_reg are preserved on jumps to miss_label, | 752 // Both name_reg and receiver_reg are preserved on jumps to miss_label, |
730 // but may be destroyed if store is successful. | 753 // but may be destroyed if store is successful. |
731 void StubCompiler::GenerateStoreField(MacroAssembler* masm, | 754 void StubCompiler::GenerateStoreField(MacroAssembler* masm, |
732 Handle<JSObject> object, | 755 Handle<JSObject> object, |
733 LookupResult* lookup, | 756 LookupResult* lookup, |
734 Handle<Map> transition, | 757 Handle<Map> transition, |
735 Handle<Name> name, | 758 Handle<Name> name, |
736 Register receiver_reg, | 759 Register receiver_reg, |
737 Register name_reg, | 760 Register name_reg, |
738 Register value_reg, | 761 Register value_reg, |
(...skipping 25 matching lines...) Expand all Loading... |
764 holder = JSObject::cast(holder->GetPrototype()); | 787 holder = JSObject::cast(holder->GetPrototype()); |
765 } while (holder->GetPrototype()->IsJSObject()); | 788 } while (holder->GetPrototype()->IsJSObject()); |
766 } | 789 } |
767 // We need an extra register, push | 790 // We need an extra register, push |
768 Register holder_reg = CheckPrototypes( | 791 Register holder_reg = CheckPrototypes( |
769 object, receiver_reg, Handle<JSObject>(holder), name_reg, | 792 object, receiver_reg, Handle<JSObject>(holder), name_reg, |
770 scratch1, scratch2, name, miss_restore_name); | 793 scratch1, scratch2, name, miss_restore_name); |
771 // If no property was found, and the holder (the last object in the | 794 // If no property was found, and the holder (the last object in the |
772 // prototype chain) is in slow mode, we need to do a negative lookup on the | 795 // prototype chain) is in slow mode, we need to do a negative lookup on the |
773 // holder. | 796 // holder. |
774 if (lookup->holder() == *object && | 797 if (lookup->holder() == *object) { |
775 !holder->HasFastProperties() && | 798 if (holder->IsJSGlobalObject()) { |
776 !holder->IsJSGlobalProxy() && | 799 GenerateCheckPropertyCell( |
777 !holder->IsJSGlobalObject()) { | 800 masm, |
778 GenerateDictionaryNegativeLookup( | 801 Handle<GlobalObject>(GlobalObject::cast(holder)), |
779 masm, miss_restore_name, holder_reg, name, scratch1, scratch2); | 802 name, |
| 803 scratch1, |
| 804 miss_restore_name); |
| 805 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) { |
| 806 GenerateDictionaryNegativeLookup( |
| 807 masm, miss_restore_name, holder_reg, name, scratch1, scratch2); |
| 808 } |
780 } | 809 } |
781 } | 810 } |
782 | 811 |
783 // Stub never generated for non-global objects that require access | 812 // Stub never generated for non-global objects that require access |
784 // checks. | 813 // checks. |
785 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 814 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
786 | 815 |
787 // Perform map transition for the receiver if necessary. | 816 // Perform map transition for the receiver if necessary. |
788 if (!transition.is_null() && (object->map()->unused_property_fields() == 0)) { | 817 if (!transition.is_null() && (object->map()->unused_property_fields() == 0)) { |
789 // The properties must be extended before we can store the value. | 818 // The properties must be extended before we can store the value. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 receiver_reg, | 886 receiver_reg, |
858 kDontSaveFPRegs); | 887 kDontSaveFPRegs); |
859 } | 888 } |
860 | 889 |
861 // Return the value (register eax). | 890 // Return the value (register eax). |
862 ASSERT(value_reg.is(eax)); | 891 ASSERT(value_reg.is(eax)); |
863 __ ret(0); | 892 __ ret(0); |
864 } | 893 } |
865 | 894 |
866 | 895 |
867 // Generate code to check that a global property cell is empty. Create | |
868 // the property cell at compilation time if no cell exists for the | |
869 // property. | |
870 static void GenerateCheckPropertyCell(MacroAssembler* masm, | |
871 Handle<GlobalObject> global, | |
872 Handle<Name> name, | |
873 Register scratch, | |
874 Label* miss) { | |
875 Handle<JSGlobalPropertyCell> cell = | |
876 GlobalObject::EnsurePropertyCell(global, name); | |
877 ASSERT(cell->value()->IsTheHole()); | |
878 Handle<Oddball> the_hole = masm->isolate()->factory()->the_hole_value(); | |
879 if (Serializer::enabled()) { | |
880 __ mov(scratch, Immediate(cell)); | |
881 __ cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset), | |
882 Immediate(the_hole)); | |
883 } else { | |
884 __ cmp(Operand::Cell(cell), Immediate(the_hole)); | |
885 } | |
886 __ j(not_equal, miss); | |
887 } | |
888 | |
889 | |
890 // Calls GenerateCheckPropertyCell for each global object in the prototype chain | 896 // Calls GenerateCheckPropertyCell for each global object in the prototype chain |
891 // from object to (but not including) holder. | 897 // from object to (but not including) holder. |
892 static void GenerateCheckPropertyCells(MacroAssembler* masm, | 898 static void GenerateCheckPropertyCells(MacroAssembler* masm, |
893 Handle<JSObject> object, | 899 Handle<JSObject> object, |
894 Handle<JSObject> holder, | 900 Handle<JSObject> holder, |
895 Handle<Name> name, | 901 Handle<Name> name, |
896 Register scratch, | 902 Register scratch, |
897 Label* miss) { | 903 Label* miss) { |
898 Handle<JSObject> current = object; | 904 Handle<JSObject> current = object; |
899 while (!current.is_identical_to(holder)) { | 905 while (!current.is_identical_to(holder)) { |
(...skipping 2722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3622 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3628 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
3623 } | 3629 } |
3624 } | 3630 } |
3625 | 3631 |
3626 | 3632 |
3627 #undef __ | 3633 #undef __ |
3628 | 3634 |
3629 } } // namespace v8::internal | 3635 } } // namespace v8::internal |
3630 | 3636 |
3631 #endif // V8_TARGET_ARCH_IA32 | 3637 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |