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 2753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2764 | 2764 |
2765 NonexistentHandlerFrontend(object, last, name, &success, global); | 2765 NonexistentHandlerFrontend(object, last, name, &success, global); |
2766 | 2766 |
2767 __ bind(&success); | 2767 __ bind(&success); |
2768 // Return undefined if maps of the full prototype chain are still the | 2768 // Return undefined if maps of the full prototype chain are still the |
2769 // same and no global property with this name contains a value. | 2769 // same and no global property with this name contains a value. |
2770 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 2770 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
2771 __ ret(0); | 2771 __ ret(0); |
2772 | 2772 |
2773 // Return the generated code. | 2773 // Return the generated code. |
2774 return GetCode(Code::HANDLER_FRAGMENT, Code::NONEXISTENT, name); | 2774 return GetCode(kind(), Code::NONEXISTENT, name); |
2775 } | 2775 } |
2776 | 2776 |
2777 | 2777 |
2778 Register* LoadStubCompiler::registers() { | 2778 Register* LoadStubCompiler::registers() { |
2779 // receiver, name, scratch1, scratch2, scratch3, scratch4. | 2779 // receiver, name, scratch1, scratch2, scratch3, scratch4. |
2780 static Register registers[] = { rax, rcx, rdx, rbx, rdi, r8 }; | 2780 static Register registers[] = { rax, rcx, rdx, rbx, rdi, r8 }; |
2781 return registers; | 2781 return registers; |
2782 } | 2782 } |
2783 | 2783 |
2784 | 2784 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2864 | 2864 |
2865 HandlerFrontendFooter(&success, &miss); | 2865 HandlerFrontendFooter(&success, &miss); |
2866 __ bind(&success); | 2866 __ bind(&success); |
2867 | 2867 |
2868 Counters* counters = isolate()->counters(); | 2868 Counters* counters = isolate()->counters(); |
2869 __ IncrementCounter(counters->named_load_global_stub(), 1); | 2869 __ IncrementCounter(counters->named_load_global_stub(), 1); |
2870 __ movq(rax, rbx); | 2870 __ movq(rax, rbx); |
2871 __ ret(0); | 2871 __ ret(0); |
2872 | 2872 |
2873 // Return the generated code. | 2873 // Return the generated code. |
2874 return GetCode(Code::IC_FRAGMENT, Code::NORMAL, name); | 2874 return GetICCode(kind(), Code::NORMAL, name); |
2875 } | 2875 } |
2876 | 2876 |
2877 | 2877 |
2878 Handle<Code> KeyedLoadStubCompiler::CompileLoadElement( | 2878 Handle<Code> KeyedLoadStubCompiler::CompileLoadElement( |
2879 Handle<Map> receiver_map) { | 2879 Handle<Map> receiver_map) { |
2880 // ----------- S t a t e ------------- | 2880 // ----------- S t a t e ------------- |
2881 // -- rax : key | 2881 // -- rax : key |
2882 // -- rdx : receiver | 2882 // -- rdx : receiver |
2883 // -- rsp[0] : return address | 2883 // -- rsp[0] : return address |
2884 // ----------------------------------- | 2884 // ----------------------------------- |
2885 ElementsKind elements_kind = receiver_map->elements_kind(); | 2885 ElementsKind elements_kind = receiver_map->elements_kind(); |
2886 if (receiver_map->has_fast_elements() || | 2886 if (receiver_map->has_fast_elements() || |
2887 receiver_map->has_external_array_elements()) { | 2887 receiver_map->has_external_array_elements()) { |
2888 Handle<Code> stub = KeyedLoadFastElementStub( | 2888 Handle<Code> stub = KeyedLoadFastElementStub( |
2889 receiver_map->instance_type() == JS_ARRAY_TYPE, | 2889 receiver_map->instance_type() == JS_ARRAY_TYPE, |
2890 elements_kind).GetCode(isolate()); | 2890 elements_kind).GetCode(isolate()); |
2891 __ DispatchMap(rdx, receiver_map, stub, DO_SMI_CHECK); | 2891 __ DispatchMap(rdx, receiver_map, stub, DO_SMI_CHECK); |
2892 } else { | 2892 } else { |
2893 Handle<Code> stub = | 2893 Handle<Code> stub = |
2894 KeyedLoadDictionaryElementStub().GetCode(isolate()); | 2894 KeyedLoadDictionaryElementStub().GetCode(isolate()); |
2895 __ DispatchMap(rdx, receiver_map, stub, DO_SMI_CHECK); | 2895 __ DispatchMap(rdx, receiver_map, stub, DO_SMI_CHECK); |
2896 } | 2896 } |
2897 | 2897 |
2898 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2898 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2899 | 2899 |
2900 // Return the generated code. | 2900 // Return the generated code. |
2901 return GetCode(Code::IC_FRAGMENT, Code::NORMAL, factory()->empty_string()); | 2901 return GetICCode(kind(), Code::NORMAL, factory()->empty_string()); |
2902 } | 2902 } |
2903 | 2903 |
2904 | 2904 |
2905 Handle<Code> BaseLoadStubCompiler::CompilePolymorphicIC( | 2905 Handle<Code> BaseLoadStubCompiler::CompilePolymorphicIC( |
2906 MapHandleList* receiver_maps, | 2906 MapHandleList* receiver_maps, |
2907 CodeHandleList* handlers, | 2907 CodeHandleList* handlers, |
2908 Handle<Name> name, | 2908 Handle<Name> name, |
2909 Code::StubType type, | 2909 Code::StubType type, |
2910 IcCheckType check) { | 2910 IcCheckType check) { |
2911 Label miss; | 2911 Label miss; |
(...skipping 11 matching lines...) Expand all Loading... |
2923 __ Cmp(map_reg, receiver_maps->at(current)); | 2923 __ Cmp(map_reg, receiver_maps->at(current)); |
2924 __ j(equal, handlers->at(current), RelocInfo::CODE_TARGET); | 2924 __ j(equal, handlers->at(current), RelocInfo::CODE_TARGET); |
2925 } | 2925 } |
2926 | 2926 |
2927 __ bind(&miss); | 2927 __ bind(&miss); |
2928 GenerateLoadMiss(masm(), kind()); | 2928 GenerateLoadMiss(masm(), kind()); |
2929 | 2929 |
2930 // Return the generated code. | 2930 // Return the generated code. |
2931 InlineCacheState state = | 2931 InlineCacheState state = |
2932 receiver_maps->length() > 1 ? POLYMORPHIC : MONOMORPHIC; | 2932 receiver_maps->length() > 1 ? POLYMORPHIC : MONOMORPHIC; |
2933 return GetCode(Code::IC_FRAGMENT, type, name, state); | 2933 return GetICCode(kind(), type, name, state); |
2934 } | 2934 } |
2935 | 2935 |
2936 | 2936 |
2937 // Specialized stub for constructing objects from functions which only have only | 2937 // Specialized stub for constructing objects from functions which only have only |
2938 // simple assignments of the form this.x = ...; in their body. | 2938 // simple assignments of the form this.x = ...; in their body. |
2939 Handle<Code> ConstructStubCompiler::CompileConstructStub( | 2939 Handle<Code> ConstructStubCompiler::CompileConstructStub( |
2940 Handle<JSFunction> function) { | 2940 Handle<JSFunction> function) { |
2941 // ----------- S t a t e ------------- | 2941 // ----------- S t a t e ------------- |
2942 // -- rax : argc | 2942 // -- rax : argc |
2943 // -- rdi : constructor | 2943 // -- rdi : constructor |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3606 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 3606 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
3607 } | 3607 } |
3608 } | 3608 } |
3609 | 3609 |
3610 | 3610 |
3611 #undef __ | 3611 #undef __ |
3612 | 3612 |
3613 } } // namespace v8::internal | 3613 } } // namespace v8::internal |
3614 | 3614 |
3615 #endif // V8_TARGET_ARCH_X64 | 3615 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |