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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 | 743 |
744 StubCompiler* stub_compiler_; | 744 StubCompiler* stub_compiler_; |
745 const ParameterCount& arguments_; | 745 const ParameterCount& arguments_; |
746 Register name_; | 746 Register name_; |
747 Code::ExtraICState extra_ic_state_; | 747 Code::ExtraICState extra_ic_state_; |
748 }; | 748 }; |
749 | 749 |
750 | 750 |
751 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { | 751 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { |
752 ASSERT(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC); | 752 ASSERT(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC); |
753 Code* code = NULL; | 753 Handle<Code> code = (kind == Code::LOAD_IC) |
754 if (kind == Code::LOAD_IC) { | 754 ? masm->isolate()->builtins()->LoadIC_Miss() |
755 code = masm->isolate()->builtins()->builtin(Builtins::kLoadIC_Miss); | 755 : masm->isolate()->builtins()->KeyedLoadIC_Miss(); |
756 } else { | 756 __ Jump(code, RelocInfo::CODE_TARGET); |
757 code = masm->isolate()->builtins()->builtin(Builtins::kKeyedLoadIC_Miss); | |
758 } | |
759 | |
760 Handle<Code> ic(code); | |
761 __ Jump(ic, RelocInfo::CODE_TARGET); | |
762 } | 757 } |
763 | 758 |
764 | 759 |
765 void StubCompiler::GenerateKeyedLoadMissForceGeneric(MacroAssembler* masm) { | 760 void StubCompiler::GenerateKeyedLoadMissForceGeneric(MacroAssembler* masm) { |
766 Code* code = masm->isolate()->builtins()->builtin( | 761 Code* code = masm->isolate()->builtins()->builtin( |
767 Builtins::kKeyedLoadIC_MissForceGeneric); | 762 Builtins::kKeyedLoadIC_MissForceGeneric); |
768 Handle<Code> ic(code); | 763 Handle<Code> ic(code); |
769 __ Jump(ic, RelocInfo::CODE_TARGET); | 764 __ Jump(ic, RelocInfo::CODE_TARGET); |
770 } | 765 } |
771 | 766 |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 name, | 1191 name, |
1197 scratch1, | 1192 scratch1, |
1198 miss); | 1193 miss); |
1199 if (result->IsFailure()) set_failure(Failure::cast(result)); | 1194 if (result->IsFailure()) set_failure(Failure::cast(result)); |
1200 | 1195 |
1201 // Return the register containing the holder. | 1196 // Return the register containing the holder. |
1202 return reg; | 1197 return reg; |
1203 } | 1198 } |
1204 | 1199 |
1205 | 1200 |
1206 void StubCompiler::GenerateLoadField(JSObject* object, | 1201 void StubCompiler::GenerateLoadField(Handle<JSObject> object, |
1207 JSObject* holder, | 1202 Handle<JSObject> holder, |
1208 Register receiver, | 1203 Register receiver, |
1209 Register scratch1, | 1204 Register scratch1, |
1210 Register scratch2, | 1205 Register scratch2, |
1211 Register scratch3, | 1206 Register scratch3, |
1212 int index, | 1207 int index, |
1213 String* name, | 1208 Handle<String> name, |
1214 Label* miss) { | 1209 Label* miss) { |
1215 // Check that the receiver isn't a smi. | 1210 // Check that the receiver isn't a smi. |
1216 __ JumpIfSmi(receiver, miss); | 1211 __ JumpIfSmi(receiver, miss); |
1217 | 1212 |
1218 // Check the prototype chain. | 1213 // Check the prototype chain. |
1219 Register reg = | 1214 Register reg = CheckPrototypes( |
1220 CheckPrototypes(object, receiver, holder, | 1215 object, receiver, holder, scratch1, scratch2, scratch3, name, miss); |
1221 scratch1, scratch2, scratch3, name, miss); | |
1222 | 1216 |
1223 // Get the value from the properties. | 1217 // Get the value from the properties. |
1224 GenerateFastPropertyLoad(masm(), rax, reg, Handle<JSObject>(holder), index); | 1218 GenerateFastPropertyLoad(masm(), rax, reg, holder, index); |
1225 __ ret(0); | 1219 __ ret(0); |
1226 } | 1220 } |
1227 | 1221 |
1228 | 1222 |
1229 MaybeObject* StubCompiler::GenerateLoadCallback(JSObject* object, | 1223 MaybeObject* StubCompiler::GenerateLoadCallback(JSObject* object, |
1230 JSObject* holder, | 1224 JSObject* holder, |
1231 Register receiver, | 1225 Register receiver, |
1232 Register name_reg, | 1226 Register name_reg, |
1233 Register scratch1, | 1227 Register scratch1, |
1234 Register scratch2, | 1228 Register scratch2, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 __ lea(accessor_info_arg, StackSpaceOperand(0)); | 1290 __ lea(accessor_info_arg, StackSpaceOperand(0)); |
1297 | 1291 |
1298 // Emitting a stub call may try to allocate (if the code is not | 1292 // Emitting a stub call may try to allocate (if the code is not |
1299 // already generated). Do not allow the assembler to perform a | 1293 // already generated). Do not allow the assembler to perform a |
1300 // garbage collection but instead return the allocation failure | 1294 // garbage collection but instead return the allocation failure |
1301 // object. | 1295 // object. |
1302 return masm()->TryCallApiFunctionAndReturn(&fun, kStackSpace); | 1296 return masm()->TryCallApiFunctionAndReturn(&fun, kStackSpace); |
1303 } | 1297 } |
1304 | 1298 |
1305 | 1299 |
1306 void StubCompiler::GenerateLoadConstant(JSObject* object, | 1300 void StubCompiler::GenerateLoadConstant(Handle<JSObject> object, |
1307 JSObject* holder, | 1301 Handle<JSObject> holder, |
1308 Register receiver, | 1302 Register receiver, |
1309 Register scratch1, | 1303 Register scratch1, |
1310 Register scratch2, | 1304 Register scratch2, |
1311 Register scratch3, | 1305 Register scratch3, |
1312 Object* value, | 1306 Handle<Object> value, |
1313 String* name, | 1307 Handle<String> name, |
1314 Label* miss) { | 1308 Label* miss) { |
1315 // Check that the receiver isn't a smi. | 1309 // Check that the receiver isn't a smi. |
1316 __ JumpIfSmi(receiver, miss); | 1310 __ JumpIfSmi(receiver, miss); |
1317 | 1311 |
1318 // Check that the maps haven't changed. | 1312 // Check that the maps haven't changed. |
1319 CheckPrototypes(object, receiver, holder, | 1313 CheckPrototypes( |
1320 scratch1, scratch2, scratch3, name, miss); | 1314 object, receiver, holder, scratch1, scratch2, scratch3, name, miss); |
1321 | 1315 |
1322 // Return the constant value. | 1316 // Return the constant value. |
1323 __ Move(rax, Handle<Object>(value)); | 1317 __ Move(rax, value); |
1324 __ ret(0); | 1318 __ ret(0); |
1325 } | 1319 } |
1326 | 1320 |
1327 | 1321 |
1328 void StubCompiler::GenerateLoadInterceptor(JSObject* object, | 1322 void StubCompiler::GenerateLoadInterceptor(JSObject* object, |
1329 JSObject* interceptor_holder, | 1323 JSObject* interceptor_holder, |
1330 LookupResult* lookup, | 1324 LookupResult* lookup, |
1331 Register receiver, | 1325 Register receiver, |
1332 Register name_reg, | 1326 Register name_reg, |
1333 Register scratch1, | 1327 Register scratch1, |
(...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2863 | 2857 |
2864 __ bind(&miss); | 2858 __ bind(&miss); |
2865 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); | 2859 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); |
2866 __ jmp(ic, RelocInfo::CODE_TARGET); | 2860 __ jmp(ic, RelocInfo::CODE_TARGET); |
2867 | 2861 |
2868 // Return the generated code. | 2862 // Return the generated code. |
2869 return GetCode(NORMAL, NULL, MEGAMORPHIC); | 2863 return GetCode(NORMAL, NULL, MEGAMORPHIC); |
2870 } | 2864 } |
2871 | 2865 |
2872 | 2866 |
2873 MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name, | 2867 Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<String> name, |
2874 JSObject* object, | 2868 Handle<JSObject> object, |
2875 JSObject* last) { | 2869 Handle<JSObject> last) { |
2876 // ----------- S t a t e ------------- | 2870 // ----------- S t a t e ------------- |
2877 // -- rax : receiver | 2871 // -- rax : receiver |
2878 // -- rcx : name | 2872 // -- rcx : name |
2879 // -- rsp[0] : return address | 2873 // -- rsp[0] : return address |
2880 // ----------------------------------- | 2874 // ----------------------------------- |
2881 Label miss; | 2875 Label miss; |
2882 | 2876 |
2883 // Check that receiver is not a smi. | 2877 // Check that receiver is not a smi. |
2884 __ JumpIfSmi(rax, &miss); | 2878 __ JumpIfSmi(rax, &miss); |
2885 | 2879 |
2886 // Check the maps of the full prototype chain. Also check that | 2880 // Check the maps of the full prototype chain. Also check that |
2887 // global property cells up to (but not including) the last object | 2881 // global property cells up to (but not including) the last object |
2888 // in the prototype chain are empty. | 2882 // in the prototype chain are empty. |
2889 CheckPrototypes(object, rax, last, rbx, rdx, rdi, name, &miss); | 2883 CheckPrototypes(object, rax, last, rbx, rdx, rdi, name, &miss); |
2890 | 2884 |
2891 // If the last object in the prototype chain is a global object, | 2885 // If the last object in the prototype chain is a global object, |
2892 // check that the global property cell is empty. | 2886 // check that the global property cell is empty. |
2893 if (last->IsGlobalObject()) { | 2887 if (last->IsGlobalObject()) { |
2894 MaybeObject* cell = TryGenerateCheckPropertyCell(masm(), | 2888 GenerateCheckPropertyCell( |
2895 GlobalObject::cast(last), | 2889 masm(), Handle<GlobalObject>::cast(last), name, rdx, &miss); |
2896 name, | |
2897 rdx, | |
2898 &miss); | |
2899 if (cell->IsFailure()) { | |
2900 miss.Unuse(); | |
2901 return cell; | |
2902 } | |
2903 } | 2890 } |
2904 | 2891 |
2905 // Return undefined if maps of the full prototype chain are still the | 2892 // Return undefined if maps of the full prototype chain are still the |
2906 // same and no global property with this name contains a value. | 2893 // same and no global property with this name contains a value. |
2907 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 2894 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
2908 __ ret(0); | 2895 __ ret(0); |
2909 | 2896 |
2910 __ bind(&miss); | 2897 __ bind(&miss); |
2911 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2898 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2912 | 2899 |
2913 // Return the generated code. | 2900 // Return the generated code. |
2914 return GetCode(NONEXISTENT, heap()->empty_string()); | 2901 return GetCode(NONEXISTENT, factory()->empty_string()); |
2915 } | 2902 } |
2916 | 2903 |
2917 | 2904 |
2918 MaybeObject* LoadStubCompiler::CompileLoadField(JSObject* object, | 2905 Handle<Code> LoadStubCompiler::CompileLoadField(Handle<JSObject> object, |
2919 JSObject* holder, | 2906 Handle<JSObject> holder, |
2920 int index, | 2907 int index, |
2921 String* name) { | 2908 Handle<String> name) { |
2922 // ----------- S t a t e ------------- | 2909 // ----------- S t a t e ------------- |
2923 // -- rax : receiver | 2910 // -- rax : receiver |
2924 // -- rcx : name | 2911 // -- rcx : name |
2925 // -- rsp[0] : return address | 2912 // -- rsp[0] : return address |
2926 // ----------------------------------- | 2913 // ----------------------------------- |
2927 Label miss; | 2914 Label miss; |
2928 | 2915 |
2929 GenerateLoadField(object, holder, rax, rbx, rdx, rdi, index, name, &miss); | 2916 GenerateLoadField(object, holder, rax, rbx, rdx, rdi, index, name, &miss); |
2930 __ bind(&miss); | 2917 __ bind(&miss); |
2931 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2918 GenerateLoadMiss(masm(), Code::LOAD_IC); |
(...skipping 18 matching lines...) Expand all Loading... |
2950 rdi, callback, name, &miss); | 2937 rdi, callback, name, &miss); |
2951 if (result->IsFailure()) { | 2938 if (result->IsFailure()) { |
2952 miss.Unuse(); | 2939 miss.Unuse(); |
2953 return result; | 2940 return result; |
2954 } | 2941 } |
2955 | 2942 |
2956 __ bind(&miss); | 2943 __ bind(&miss); |
2957 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2944 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2958 | 2945 |
2959 // Return the generated code. | 2946 // Return the generated code. |
2960 return GetCode(CALLBACKS, name); | 2947 return TryGetCode(CALLBACKS, name); |
2961 } | 2948 } |
2962 | 2949 |
2963 | 2950 |
2964 MaybeObject* LoadStubCompiler::CompileLoadConstant(JSObject* object, | 2951 Handle<Code> LoadStubCompiler::CompileLoadConstant(Handle<JSObject> object, |
2965 JSObject* holder, | 2952 Handle<JSObject> holder, |
2966 Object* value, | 2953 Handle<Object> value, |
2967 String* name) { | 2954 Handle<String> name) { |
2968 // ----------- S t a t e ------------- | 2955 // ----------- S t a t e ------------- |
2969 // -- rax : receiver | 2956 // -- rax : receiver |
2970 // -- rcx : name | 2957 // -- rcx : name |
2971 // -- rsp[0] : return address | 2958 // -- rsp[0] : return address |
2972 // ----------------------------------- | 2959 // ----------------------------------- |
2973 Label miss; | 2960 Label miss; |
2974 | 2961 |
2975 GenerateLoadConstant(object, holder, rax, rbx, rdx, rdi, value, name, &miss); | 2962 GenerateLoadConstant(object, holder, rax, rbx, rdx, rdi, value, name, &miss); |
2976 __ bind(&miss); | 2963 __ bind(&miss); |
2977 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2964 GenerateLoadMiss(masm(), Code::LOAD_IC); |
(...skipping 26 matching lines...) Expand all Loading... |
3004 rdx, | 2991 rdx, |
3005 rbx, | 2992 rbx, |
3006 rdi, | 2993 rdi, |
3007 name, | 2994 name, |
3008 &miss); | 2995 &miss); |
3009 | 2996 |
3010 __ bind(&miss); | 2997 __ bind(&miss); |
3011 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2998 GenerateLoadMiss(masm(), Code::LOAD_IC); |
3012 | 2999 |
3013 // Return the generated code. | 3000 // Return the generated code. |
3014 return GetCode(INTERCEPTOR, name); | 3001 return TryGetCode(INTERCEPTOR, name); |
3015 } | 3002 } |
3016 | 3003 |
3017 | 3004 |
3018 MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object, | 3005 MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object, |
3019 GlobalObject* holder, | 3006 GlobalObject* holder, |
3020 JSGlobalPropertyCell* cell, | 3007 JSGlobalPropertyCell* cell, |
3021 String* name, | 3008 String* name, |
3022 bool is_dont_delete) { | 3009 bool is_dont_delete) { |
3023 // ----------- S t a t e ------------- | 3010 // ----------- S t a t e ------------- |
3024 // -- rax : receiver | 3011 // -- rax : receiver |
(...skipping 28 matching lines...) Expand all Loading... |
3053 Counters* counters = isolate()->counters(); | 3040 Counters* counters = isolate()->counters(); |
3054 __ IncrementCounter(counters->named_load_global_stub(), 1); | 3041 __ IncrementCounter(counters->named_load_global_stub(), 1); |
3055 __ movq(rax, rbx); | 3042 __ movq(rax, rbx); |
3056 __ ret(0); | 3043 __ ret(0); |
3057 | 3044 |
3058 __ bind(&miss); | 3045 __ bind(&miss); |
3059 __ IncrementCounter(counters->named_load_global_stub_miss(), 1); | 3046 __ IncrementCounter(counters->named_load_global_stub_miss(), 1); |
3060 GenerateLoadMiss(masm(), Code::LOAD_IC); | 3047 GenerateLoadMiss(masm(), Code::LOAD_IC); |
3061 | 3048 |
3062 // Return the generated code. | 3049 // Return the generated code. |
3063 return GetCode(NORMAL, name); | 3050 return TryGetCode(NORMAL, name); |
3064 } | 3051 } |
3065 | 3052 |
3066 | 3053 |
3067 MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name, | 3054 Handle<Code> KeyedLoadStubCompiler::CompileLoadField(Handle<String> name, |
3068 JSObject* receiver, | 3055 Handle<JSObject> receiver, |
3069 JSObject* holder, | 3056 Handle<JSObject> holder, |
3070 int index) { | 3057 int index) { |
3071 // ----------- S t a t e ------------- | 3058 // ----------- S t a t e ------------- |
3072 // -- rax : key | 3059 // -- rax : key |
3073 // -- rdx : receiver | 3060 // -- rdx : receiver |
3074 // -- rsp[0] : return address | 3061 // -- rsp[0] : return address |
3075 // ----------------------------------- | 3062 // ----------------------------------- |
3076 Label miss; | 3063 Label miss; |
3077 | 3064 |
3078 Counters* counters = isolate()->counters(); | 3065 Counters* counters = isolate()->counters(); |
3079 __ IncrementCounter(counters->keyed_load_field(), 1); | 3066 __ IncrementCounter(counters->keyed_load_field(), 1); |
3080 | 3067 |
3081 // Check that the name has not changed. | 3068 // Check that the name has not changed. |
3082 __ Cmp(rax, Handle<String>(name)); | 3069 __ Cmp(rax, name); |
3083 __ j(not_equal, &miss); | 3070 __ j(not_equal, &miss); |
3084 | 3071 |
3085 GenerateLoadField(receiver, holder, rdx, rbx, rcx, rdi, index, name, &miss); | 3072 GenerateLoadField(receiver, holder, rdx, rbx, rcx, rdi, index, name, &miss); |
3086 | 3073 |
3087 __ bind(&miss); | 3074 __ bind(&miss); |
3088 __ DecrementCounter(counters->keyed_load_field(), 1); | 3075 __ DecrementCounter(counters->keyed_load_field(), 1); |
3089 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3076 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3090 | 3077 |
3091 // Return the generated code. | 3078 // Return the generated code. |
3092 return GetCode(FIELD, name); | 3079 return GetCode(FIELD, name); |
(...skipping 25 matching lines...) Expand all Loading... |
3118 miss.Unuse(); | 3105 miss.Unuse(); |
3119 return result; | 3106 return result; |
3120 } | 3107 } |
3121 | 3108 |
3122 __ bind(&miss); | 3109 __ bind(&miss); |
3123 | 3110 |
3124 __ DecrementCounter(counters->keyed_load_callback(), 1); | 3111 __ DecrementCounter(counters->keyed_load_callback(), 1); |
3125 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3112 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3126 | 3113 |
3127 // Return the generated code. | 3114 // Return the generated code. |
3128 return GetCode(CALLBACKS, name); | 3115 return TryGetCode(CALLBACKS, name); |
3129 } | 3116 } |
3130 | 3117 |
3131 | 3118 |
3132 MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name, | 3119 Handle<Code> KeyedLoadStubCompiler::CompileLoadConstant( |
3133 JSObject* receiver, | 3120 Handle<String> name, |
3134 JSObject* holder, | 3121 Handle<JSObject> receiver, |
3135 Object* value) { | 3122 Handle<JSObject> holder, |
| 3123 Handle<Object> value) { |
3136 // ----------- S t a t e ------------- | 3124 // ----------- S t a t e ------------- |
3137 // -- rax : key | 3125 // -- rax : key |
3138 // -- rdx : receiver | 3126 // -- rdx : receiver |
3139 // -- rsp[0] : return address | 3127 // -- rsp[0] : return address |
3140 // ----------------------------------- | 3128 // ----------------------------------- |
3141 Label miss; | 3129 Label miss; |
3142 | 3130 |
3143 Counters* counters = isolate()->counters(); | 3131 Counters* counters = isolate()->counters(); |
3144 __ IncrementCounter(counters->keyed_load_constant_function(), 1); | 3132 __ IncrementCounter(counters->keyed_load_constant_function(), 1); |
3145 | 3133 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3185 rcx, | 3173 rcx, |
3186 rbx, | 3174 rbx, |
3187 rdi, | 3175 rdi, |
3188 name, | 3176 name, |
3189 &miss); | 3177 &miss); |
3190 __ bind(&miss); | 3178 __ bind(&miss); |
3191 __ DecrementCounter(counters->keyed_load_interceptor(), 1); | 3179 __ DecrementCounter(counters->keyed_load_interceptor(), 1); |
3192 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3180 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3193 | 3181 |
3194 // Return the generated code. | 3182 // Return the generated code. |
3195 return GetCode(INTERCEPTOR, name); | 3183 return TryGetCode(INTERCEPTOR, name); |
3196 } | 3184 } |
3197 | 3185 |
3198 | 3186 |
3199 MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { | 3187 Handle<Code> KeyedLoadStubCompiler::CompileLoadArrayLength( |
| 3188 Handle<String> name) { |
3200 // ----------- S t a t e ------------- | 3189 // ----------- S t a t e ------------- |
3201 // -- rax : key | 3190 // -- rax : key |
3202 // -- rdx : receiver | 3191 // -- rdx : receiver |
3203 // -- rsp[0] : return address | 3192 // -- rsp[0] : return address |
3204 // ----------------------------------- | 3193 // ----------------------------------- |
3205 Label miss; | 3194 Label miss; |
3206 | 3195 |
3207 Counters* counters = isolate()->counters(); | 3196 Counters* counters = isolate()->counters(); |
3208 __ IncrementCounter(counters->keyed_load_array_length(), 1); | 3197 __ IncrementCounter(counters->keyed_load_array_length(), 1); |
3209 | 3198 |
3210 // Check that the name has not changed. | 3199 // Check that the name has not changed. |
3211 __ Cmp(rax, Handle<String>(name)); | 3200 __ Cmp(rax, name); |
3212 __ j(not_equal, &miss); | 3201 __ j(not_equal, &miss); |
3213 | 3202 |
3214 GenerateLoadArrayLength(masm(), rdx, rcx, &miss); | 3203 GenerateLoadArrayLength(masm(), rdx, rcx, &miss); |
3215 __ bind(&miss); | 3204 __ bind(&miss); |
3216 __ DecrementCounter(counters->keyed_load_array_length(), 1); | 3205 __ DecrementCounter(counters->keyed_load_array_length(), 1); |
3217 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3206 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3218 | 3207 |
3219 // Return the generated code. | 3208 // Return the generated code. |
3220 return GetCode(CALLBACKS, name); | 3209 return GetCode(CALLBACKS, name); |
3221 } | 3210 } |
3222 | 3211 |
3223 | 3212 |
3224 MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { | 3213 Handle<Code> KeyedLoadStubCompiler::CompileLoadStringLength( |
| 3214 Handle<String> name) { |
3225 // ----------- S t a t e ------------- | 3215 // ----------- S t a t e ------------- |
3226 // -- rax : key | 3216 // -- rax : key |
3227 // -- rdx : receiver | 3217 // -- rdx : receiver |
3228 // -- rsp[0] : return address | 3218 // -- rsp[0] : return address |
3229 // ----------------------------------- | 3219 // ----------------------------------- |
3230 Label miss; | 3220 Label miss; |
3231 | 3221 |
3232 Counters* counters = isolate()->counters(); | 3222 Counters* counters = isolate()->counters(); |
3233 __ IncrementCounter(counters->keyed_load_string_length(), 1); | 3223 __ IncrementCounter(counters->keyed_load_string_length(), 1); |
3234 | 3224 |
3235 // Check that the name has not changed. | 3225 // Check that the name has not changed. |
3236 __ Cmp(rax, Handle<String>(name)); | 3226 __ Cmp(rax, name); |
3237 __ j(not_equal, &miss); | 3227 __ j(not_equal, &miss); |
3238 | 3228 |
3239 GenerateLoadStringLength(masm(), rdx, rcx, rbx, &miss, true); | 3229 GenerateLoadStringLength(masm(), rdx, rcx, rbx, &miss, true); |
3240 __ bind(&miss); | 3230 __ bind(&miss); |
3241 __ DecrementCounter(counters->keyed_load_string_length(), 1); | 3231 __ DecrementCounter(counters->keyed_load_string_length(), 1); |
3242 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3232 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3243 | 3233 |
3244 // Return the generated code. | 3234 // Return the generated code. |
3245 return GetCode(CALLBACKS, name); | 3235 return GetCode(CALLBACKS, name); |
3246 } | 3236 } |
3247 | 3237 |
3248 | 3238 |
3249 MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { | 3239 Handle<Code> KeyedLoadStubCompiler::CompileLoadFunctionPrototype( |
| 3240 Handle<String> name) { |
3250 // ----------- S t a t e ------------- | 3241 // ----------- S t a t e ------------- |
3251 // -- rax : key | 3242 // -- rax : key |
3252 // -- rdx : receiver | 3243 // -- rdx : receiver |
3253 // -- rsp[0] : return address | 3244 // -- rsp[0] : return address |
3254 // ----------------------------------- | 3245 // ----------------------------------- |
3255 Label miss; | 3246 Label miss; |
3256 | 3247 |
3257 Counters* counters = isolate()->counters(); | 3248 Counters* counters = isolate()->counters(); |
3258 __ IncrementCounter(counters->keyed_load_function_prototype(), 1); | 3249 __ IncrementCounter(counters->keyed_load_function_prototype(), 1); |
3259 | 3250 |
3260 // Check that the name has not changed. | 3251 // Check that the name has not changed. |
3261 __ Cmp(rax, Handle<String>(name)); | 3252 __ Cmp(rax, name); |
3262 __ j(not_equal, &miss); | 3253 __ j(not_equal, &miss); |
3263 | 3254 |
3264 GenerateLoadFunctionPrototype(masm(), rdx, rcx, rbx, &miss); | 3255 GenerateLoadFunctionPrototype(masm(), rdx, rcx, rbx, &miss); |
3265 __ bind(&miss); | 3256 __ bind(&miss); |
3266 __ DecrementCounter(counters->keyed_load_function_prototype(), 1); | 3257 __ DecrementCounter(counters->keyed_load_function_prototype(), 1); |
3267 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3258 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3268 | 3259 |
3269 // Return the generated code. | 3260 // Return the generated code. |
3270 return GetCode(CALLBACKS, name); | 3261 return GetCode(CALLBACKS, name); |
3271 } | 3262 } |
(...skipping 11 matching lines...) Expand all Loading... |
3283 if (!maybe_stub->To(&stub)) return maybe_stub; | 3274 if (!maybe_stub->To(&stub)) return maybe_stub; |
3284 __ DispatchMap(rdx, | 3275 __ DispatchMap(rdx, |
3285 Handle<Map>(receiver_map), | 3276 Handle<Map>(receiver_map), |
3286 Handle<Code>(stub), | 3277 Handle<Code>(stub), |
3287 DO_SMI_CHECK); | 3278 DO_SMI_CHECK); |
3288 | 3279 |
3289 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); | 3280 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); |
3290 __ jmp(ic, RelocInfo::CODE_TARGET); | 3281 __ jmp(ic, RelocInfo::CODE_TARGET); |
3291 | 3282 |
3292 // Return the generated code. | 3283 // Return the generated code. |
3293 return GetCode(NORMAL, NULL); | 3284 return TryGetCode(NORMAL, NULL); |
3294 } | 3285 } |
3295 | 3286 |
3296 | 3287 |
3297 MaybeObject* KeyedLoadStubCompiler::CompileLoadPolymorphic( | 3288 MaybeObject* KeyedLoadStubCompiler::CompileLoadPolymorphic( |
3298 MapList* receiver_maps, | 3289 MapList* receiver_maps, |
3299 CodeList* handler_ics) { | 3290 CodeList* handler_ics) { |
3300 // ----------- S t a t e ------------- | 3291 // ----------- S t a t e ------------- |
3301 // -- rax : key | 3292 // -- rax : key |
3302 // -- rdx : receiver | 3293 // -- rdx : receiver |
3303 // -- rsp[0] : return address | 3294 // -- rsp[0] : return address |
(...skipping 10 matching lines...) Expand all Loading... |
3314 __ Cmp(map_reg, map); | 3305 __ Cmp(map_reg, map); |
3315 __ j(equal, | 3306 __ j(equal, |
3316 Handle<Code>(handler_ics->at(current)), | 3307 Handle<Code>(handler_ics->at(current)), |
3317 RelocInfo::CODE_TARGET); | 3308 RelocInfo::CODE_TARGET); |
3318 } | 3309 } |
3319 | 3310 |
3320 __ bind(&miss); | 3311 __ bind(&miss); |
3321 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3312 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3322 | 3313 |
3323 // Return the generated code. | 3314 // Return the generated code. |
3324 return GetCode(NORMAL, NULL, MEGAMORPHIC); | 3315 return TryGetCode(NORMAL, NULL, MEGAMORPHIC); |
3325 } | 3316 } |
3326 | 3317 |
3327 | 3318 |
3328 // Specialized stub for constructing objects from functions which only have only | 3319 // Specialized stub for constructing objects from functions which only have only |
3329 // simple assignments of the form this.x = ...; in their body. | 3320 // simple assignments of the form this.x = ...; in their body. |
3330 MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) { | 3321 MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) { |
3331 // ----------- S t a t e ------------- | 3322 // ----------- S t a t e ------------- |
3332 // -- rax : argc | 3323 // -- rax : argc |
3333 // -- rdi : constructor | 3324 // -- rdi : constructor |
3334 // -- rsp[0] : return address | 3325 // -- rsp[0] : return address |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4030 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); | 4021 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); |
4031 __ jmp(ic_miss, RelocInfo::CODE_TARGET); | 4022 __ jmp(ic_miss, RelocInfo::CODE_TARGET); |
4032 } | 4023 } |
4033 | 4024 |
4034 | 4025 |
4035 #undef __ | 4026 #undef __ |
4036 | 4027 |
4037 } } // namespace v8::internal | 4028 } } // namespace v8::internal |
4038 | 4029 |
4039 #endif // V8_TARGET_ARCH_X64 | 4030 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |