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 2771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2782 | 2782 |
2783 __ bind(&miss); | 2783 __ bind(&miss); |
2784 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); | 2784 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); |
2785 __ jmp(ic, RelocInfo::CODE_TARGET); | 2785 __ jmp(ic, RelocInfo::CODE_TARGET); |
2786 | 2786 |
2787 // Return the generated code. | 2787 // Return the generated code. |
2788 return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC); | 2788 return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC); |
2789 } | 2789 } |
2790 | 2790 |
2791 | 2791 |
2792 Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<String> name, | 2792 Handle<Code> LoadStubCompiler::CompileLoadNonexistent( |
2793 Handle<JSObject> object, | 2793 Handle<String> name, |
2794 Handle<JSObject> last) { | 2794 Handle<JSObject> object, |
| 2795 Handle<JSObject> last, |
| 2796 Handle<GlobalObject> global) { |
2795 // ----------- S t a t e ------------- | 2797 // ----------- S t a t e ------------- |
2796 // -- rax : receiver | 2798 // -- rax : receiver |
2797 // -- rcx : name | 2799 // -- rcx : name |
2798 // -- rsp[0] : return address | 2800 // -- rsp[0] : return address |
2799 // ----------------------------------- | 2801 // ----------------------------------- |
2800 Label miss; | 2802 Label miss; |
2801 | 2803 |
2802 // Check that receiver is not a smi. | 2804 // Check that receiver is not a smi. |
2803 __ JumpIfSmi(rax, &miss); | 2805 __ JumpIfSmi(rax, &miss); |
2804 | 2806 |
2805 // Check the maps of the full prototype chain. Also check that | 2807 // Check the maps of the full prototype chain. Also check that |
2806 // global property cells up to (but not including) the last object | 2808 // global property cells up to (but not including) the last object |
2807 // in the prototype chain are empty. | 2809 // in the prototype chain are empty. |
2808 CheckPrototypes(object, rax, last, rbx, rdx, rdi, name, &miss); | 2810 Register scratch = rdx; |
| 2811 Register result = |
| 2812 CheckPrototypes(object, rax, last, rbx, scratch, rdi, name, &miss); |
2809 | 2813 |
2810 // If the last object in the prototype chain is a global object, | 2814 // If the last object in the prototype chain is a global object, |
2811 // check that the global property cell is empty. | 2815 // check that the global property cell is empty. |
2812 if (last->IsGlobalObject()) { | 2816 if (!global.is_null()) { |
2813 GenerateCheckPropertyCell( | 2817 GenerateCheckPropertyCell(masm(), global, name, scratch, &miss); |
2814 masm(), Handle<GlobalObject>::cast(last), name, rdx, &miss); | 2818 } |
| 2819 |
| 2820 if (!last->HasFastProperties()) { |
| 2821 __ movq(scratch, FieldOperand(result, HeapObject::kMapOffset)); |
| 2822 __ movq(scratch, FieldOperand(scratch, Map::kPrototypeOffset)); |
| 2823 __ Cmp(scratch, isolate()->factory()->null_value()); |
| 2824 __ j(not_equal, &miss); |
2815 } | 2825 } |
2816 | 2826 |
2817 // Return undefined if maps of the full prototype chain are still the | 2827 // Return undefined if maps of the full prototype chain are still the |
2818 // same and no global property with this name contains a value. | 2828 // same and no global property with this name contains a value. |
2819 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 2829 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
2820 __ ret(0); | 2830 __ ret(0); |
2821 | 2831 |
2822 __ bind(&miss); | 2832 __ bind(&miss); |
2823 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2833 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2824 | 2834 |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3863 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 3873 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
3864 } | 3874 } |
3865 } | 3875 } |
3866 | 3876 |
3867 | 3877 |
3868 #undef __ | 3878 #undef __ |
3869 | 3879 |
3870 } } // namespace v8::internal | 3880 } } // namespace v8::internal |
3871 | 3881 |
3872 #endif // V8_TARGET_ARCH_X64 | 3882 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |