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 2877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2888 __ IncrementCounter(counters->named_store_global_inline_miss(), 1, r4, r3); | 2888 __ IncrementCounter(counters->named_store_global_inline_miss(), 1, r4, r3); |
2889 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); | 2889 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); |
2890 __ Jump(ic, RelocInfo::CODE_TARGET); | 2890 __ Jump(ic, RelocInfo::CODE_TARGET); |
2891 | 2891 |
2892 // Return the generated code. | 2892 // Return the generated code. |
2893 return GetCode(Code::NORMAL, name); | 2893 return GetCode(Code::NORMAL, name); |
2894 } | 2894 } |
2895 | 2895 |
2896 | 2896 |
2897 Handle<Code> LoadStubCompiler::CompileLoadNonexistent( | 2897 Handle<Code> LoadStubCompiler::CompileLoadNonexistent( |
2898 Handle<String> name, | |
2899 Handle<JSObject> object, | 2898 Handle<JSObject> object, |
2900 Handle<JSObject> last, | 2899 Handle<JSObject> last, |
| 2900 Handle<String> name, |
2901 Handle<GlobalObject> global) { | 2901 Handle<GlobalObject> global) { |
2902 // ----------- S t a t e ------------- | 2902 // ----------- S t a t e ------------- |
2903 // -- r0 : receiver | 2903 // -- r0 : receiver |
2904 // -- lr : return address | 2904 // -- lr : return address |
2905 // ----------------------------------- | 2905 // ----------------------------------- |
2906 Label miss; | 2906 Label miss; |
2907 | 2907 |
2908 // Check that receiver is not a smi. | 2908 // Check that receiver is not a smi. |
2909 __ JumpIfSmi(r0, &miss); | 2909 __ JumpIfSmi(r0, &miss); |
2910 | 2910 |
(...skipping 23 matching lines...) Expand all Loading... |
2934 __ Ret(); | 2934 __ Ret(); |
2935 | 2935 |
2936 __ bind(&miss); | 2936 __ bind(&miss); |
2937 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2937 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2938 | 2938 |
2939 // Return the generated code. | 2939 // Return the generated code. |
2940 return GetCode(Code::NONEXISTENT, factory()->empty_string()); | 2940 return GetCode(Code::NONEXISTENT, factory()->empty_string()); |
2941 } | 2941 } |
2942 | 2942 |
2943 | 2943 |
2944 Handle<Code> LoadStubCompiler::CompileLoadField(Handle<JSObject> object, | 2944 Register* LoadStubCompiler::registers() { |
2945 Handle<JSObject> holder, | 2945 // receiver, name, scratch1, scratch2, scratch3, scratch4. |
2946 PropertyIndex index, | 2946 static Register registers[] = { r0, r2, r3, r1, r4, r5 }; |
2947 Handle<String> name) { | 2947 return registers; |
2948 // ----------- S t a t e ------------- | |
2949 // -- r0 : receiver | |
2950 // -- r2 : name | |
2951 // -- lr : return address | |
2952 // ----------------------------------- | |
2953 Label miss; | |
2954 | |
2955 GenerateLoadField(object, holder, r0, r3, r1, r4, index, name, &miss); | |
2956 __ bind(&miss); | |
2957 GenerateLoadMiss(masm(), Code::LOAD_IC); | |
2958 | |
2959 // Return the generated code. | |
2960 return GetCode(Code::FIELD, name); | |
2961 } | 2948 } |
2962 | 2949 |
2963 | 2950 |
2964 Handle<Code> LoadStubCompiler::CompileLoadCallback( | 2951 Register* KeyedLoadStubCompiler::registers() { |
2965 Handle<String> name, | 2952 // receiver, name, scratch1, scratch2, scratch3, scratch4. |
2966 Handle<JSObject> object, | 2953 static Register registers[] = { r1, r0, r2, r3, r4, r5 }; |
2967 Handle<JSObject> holder, | 2954 return registers; |
2968 Handle<AccessorInfo> callback) { | |
2969 // ----------- S t a t e ------------- | |
2970 // -- r0 : receiver | |
2971 // -- r2 : name | |
2972 // -- lr : return address | |
2973 // ----------------------------------- | |
2974 Label miss; | |
2975 GenerateLoadCallback(object, holder, r0, r2, r3, r1, r4, r5, callback, name, | |
2976 &miss); | |
2977 __ bind(&miss); | |
2978 GenerateLoadMiss(masm(), Code::LOAD_IC); | |
2979 | |
2980 // Return the generated code. | |
2981 return GetCode(Code::CALLBACKS, name); | |
2982 } | 2955 } |
2983 | 2956 |
2984 | 2957 |
| 2958 void KeyedLoadStubCompiler::GenerateNameCheck(Handle<String> name, |
| 2959 Register name_reg, |
| 2960 Label* miss) { |
| 2961 __ cmp(name_reg, Operand(name)); |
| 2962 __ b(ne, miss); |
| 2963 } |
| 2964 |
| 2965 |
2985 #undef __ | 2966 #undef __ |
2986 #define __ ACCESS_MASM(masm) | 2967 #define __ ACCESS_MASM(masm) |
2987 | 2968 |
2988 | 2969 |
2989 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, | 2970 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, |
2990 Handle<JSFunction> getter) { | 2971 Handle<JSFunction> getter) { |
2991 // ----------- S t a t e ------------- | 2972 // ----------- S t a t e ------------- |
2992 // -- r0 : receiver | 2973 // -- r0 : receiver |
2993 // -- r2 : name | 2974 // -- r2 : name |
2994 // -- lr : return address | 2975 // -- lr : return address |
(...skipping 18 matching lines...) Expand all Loading... |
3013 } | 2994 } |
3014 __ Ret(); | 2995 __ Ret(); |
3015 } | 2996 } |
3016 | 2997 |
3017 | 2998 |
3018 #undef __ | 2999 #undef __ |
3019 #define __ ACCESS_MASM(masm()) | 3000 #define __ ACCESS_MASM(masm()) |
3020 | 3001 |
3021 | 3002 |
3022 Handle<Code> LoadStubCompiler::CompileLoadViaGetter( | 3003 Handle<Code> LoadStubCompiler::CompileLoadViaGetter( |
3023 Handle<String> name, | |
3024 Handle<JSObject> receiver, | 3004 Handle<JSObject> receiver, |
3025 Handle<JSObject> holder, | 3005 Handle<JSObject> holder, |
| 3006 Handle<String> name, |
3026 Handle<JSFunction> getter) { | 3007 Handle<JSFunction> getter) { |
3027 // ----------- S t a t e ------------- | 3008 // ----------- S t a t e ------------- |
3028 // -- r0 : receiver | 3009 // -- r0 : receiver |
3029 // -- r2 : name | 3010 // -- r2 : name |
3030 // -- lr : return address | 3011 // -- lr : return address |
3031 // ----------------------------------- | 3012 // ----------------------------------- |
3032 Label miss; | 3013 Label miss; |
3033 | 3014 |
3034 // Check that the maps haven't changed. | 3015 // Check that the maps haven't changed. |
3035 __ JumpIfSmi(r0, &miss); | 3016 __ JumpIfSmi(r0, &miss); |
3036 CheckPrototypes(receiver, r0, holder, r3, r4, r1, name, &miss); | 3017 CheckPrototypes(receiver, r0, holder, r3, r4, r1, name, &miss); |
3037 | 3018 |
3038 GenerateLoadViaGetter(masm(), getter); | 3019 GenerateLoadViaGetter(masm(), getter); |
3039 | 3020 |
3040 __ bind(&miss); | 3021 __ bind(&miss); |
3041 GenerateLoadMiss(masm(), Code::LOAD_IC); | 3022 GenerateLoadMiss(masm(), Code::LOAD_IC); |
3042 | 3023 |
3043 // Return the generated code. | 3024 // Return the generated code. |
3044 return GetCode(Code::CALLBACKS, name); | 3025 return GetCode(Code::CALLBACKS, name); |
3045 } | 3026 } |
3046 | 3027 |
3047 | 3028 |
3048 Handle<Code> LoadStubCompiler::CompileLoadConstant(Handle<JSObject> object, | |
3049 Handle<JSObject> holder, | |
3050 Handle<JSFunction> value, | |
3051 Handle<String> name) { | |
3052 // ----------- S t a t e ------------- | |
3053 // -- r0 : receiver | |
3054 // -- r2 : name | |
3055 // -- lr : return address | |
3056 // ----------------------------------- | |
3057 Label miss; | |
3058 | |
3059 GenerateLoadConstant(object, holder, r0, r3, r1, r4, value, name, &miss); | |
3060 __ bind(&miss); | |
3061 GenerateLoadMiss(masm(), Code::LOAD_IC); | |
3062 | |
3063 // Return the generated code. | |
3064 return GetCode(Code::CONSTANT_FUNCTION, name); | |
3065 } | |
3066 | |
3067 | |
3068 Handle<Code> LoadStubCompiler::CompileLoadInterceptor(Handle<JSObject> object, | |
3069 Handle<JSObject> holder, | |
3070 Handle<String> name) { | |
3071 // ----------- S t a t e ------------- | |
3072 // -- r0 : receiver | |
3073 // -- r2 : name | |
3074 // -- lr : return address | |
3075 // ----------------------------------- | |
3076 Label miss; | |
3077 | |
3078 LookupResult lookup(isolate()); | |
3079 LookupPostInterceptor(holder, name, &lookup); | |
3080 GenerateLoadInterceptor(object, holder, &lookup, r0, r2, r3, r1, r4, name, | |
3081 &miss); | |
3082 __ bind(&miss); | |
3083 GenerateLoadMiss(masm(), Code::LOAD_IC); | |
3084 | |
3085 // Return the generated code. | |
3086 return GetCode(Code::INTERCEPTOR, name); | |
3087 } | |
3088 | |
3089 | |
3090 Handle<Code> LoadStubCompiler::CompileLoadGlobal( | 3029 Handle<Code> LoadStubCompiler::CompileLoadGlobal( |
3091 Handle<JSObject> object, | 3030 Handle<JSObject> object, |
3092 Handle<GlobalObject> holder, | 3031 Handle<GlobalObject> holder, |
3093 Handle<JSGlobalPropertyCell> cell, | 3032 Handle<JSGlobalPropertyCell> cell, |
3094 Handle<String> name, | 3033 Handle<String> name, |
3095 bool is_dont_delete) { | 3034 bool is_dont_delete) { |
3096 // ----------- S t a t e ------------- | 3035 // ----------- S t a t e ------------- |
3097 // -- r0 : receiver | 3036 // -- r0 : receiver |
3098 // -- r2 : name | 3037 // -- r2 : name |
3099 // -- lr : return address | 3038 // -- lr : return address |
(...skipping 22 matching lines...) Expand all Loading... |
3122 | 3061 |
3123 __ bind(&miss); | 3062 __ bind(&miss); |
3124 __ IncrementCounter(counters->named_load_global_stub_miss(), 1, r1, r3); | 3063 __ IncrementCounter(counters->named_load_global_stub_miss(), 1, r1, r3); |
3125 GenerateLoadMiss(masm(), Code::LOAD_IC); | 3064 GenerateLoadMiss(masm(), Code::LOAD_IC); |
3126 | 3065 |
3127 // Return the generated code. | 3066 // Return the generated code. |
3128 return GetCode(Code::NORMAL, name); | 3067 return GetCode(Code::NORMAL, name); |
3129 } | 3068 } |
3130 | 3069 |
3131 | 3070 |
3132 Handle<Code> KeyedLoadStubCompiler::CompileLoadField(Handle<String> name, | |
3133 Handle<JSObject> receiver, | |
3134 Handle<JSObject> holder, | |
3135 PropertyIndex index) { | |
3136 // ----------- S t a t e ------------- | |
3137 // -- lr : return address | |
3138 // -- r0 : key | |
3139 // -- r1 : receiver | |
3140 // ----------------------------------- | |
3141 Label miss; | |
3142 | |
3143 // Check the key is the cached one. | |
3144 __ cmp(r0, Operand(name)); | |
3145 __ b(ne, &miss); | |
3146 | |
3147 GenerateLoadField(receiver, holder, r1, r2, r3, r4, index, name, &miss); | |
3148 __ bind(&miss); | |
3149 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | |
3150 | |
3151 return GetCode(Code::FIELD, name); | |
3152 } | |
3153 | |
3154 | |
3155 Handle<Code> KeyedLoadStubCompiler::CompileLoadCallback( | |
3156 Handle<String> name, | |
3157 Handle<JSObject> receiver, | |
3158 Handle<JSObject> holder, | |
3159 Handle<AccessorInfo> callback) { | |
3160 // ----------- S t a t e ------------- | |
3161 // -- lr : return address | |
3162 // -- r0 : key | |
3163 // -- r1 : receiver | |
3164 // ----------------------------------- | |
3165 Label miss; | |
3166 | |
3167 // Check the key is the cached one. | |
3168 __ cmp(r0, Operand(name)); | |
3169 __ b(ne, &miss); | |
3170 | |
3171 GenerateLoadCallback(receiver, holder, r1, r0, r2, r3, r4, r5, callback, name, | |
3172 &miss); | |
3173 __ bind(&miss); | |
3174 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | |
3175 | |
3176 return GetCode(Code::CALLBACKS, name); | |
3177 } | |
3178 | |
3179 | |
3180 Handle<Code> KeyedLoadStubCompiler::CompileLoadConstant( | |
3181 Handle<String> name, | |
3182 Handle<JSObject> receiver, | |
3183 Handle<JSObject> holder, | |
3184 Handle<JSFunction> value) { | |
3185 // ----------- S t a t e ------------- | |
3186 // -- lr : return address | |
3187 // -- r0 : key | |
3188 // -- r1 : receiver | |
3189 // ----------------------------------- | |
3190 Label miss; | |
3191 | |
3192 // Check the key is the cached one. | |
3193 __ cmp(r0, Operand(name)); | |
3194 __ b(ne, &miss); | |
3195 | |
3196 GenerateLoadConstant(receiver, holder, r1, r2, r3, r4, value, name, &miss); | |
3197 __ bind(&miss); | |
3198 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | |
3199 | |
3200 // Return the generated code. | |
3201 return GetCode(Code::CONSTANT_FUNCTION, name); | |
3202 } | |
3203 | |
3204 | |
3205 Handle<Code> KeyedLoadStubCompiler::CompileLoadInterceptor( | |
3206 Handle<JSObject> receiver, | |
3207 Handle<JSObject> holder, | |
3208 Handle<String> name) { | |
3209 // ----------- S t a t e ------------- | |
3210 // -- lr : return address | |
3211 // -- r0 : key | |
3212 // -- r1 : receiver | |
3213 // ----------------------------------- | |
3214 Label miss; | |
3215 | |
3216 // Check the key is the cached one. | |
3217 __ cmp(r0, Operand(name)); | |
3218 __ b(ne, &miss); | |
3219 | |
3220 LookupResult lookup(isolate()); | |
3221 LookupPostInterceptor(holder, name, &lookup); | |
3222 GenerateLoadInterceptor(receiver, holder, &lookup, r1, r0, r2, r3, r4, name, | |
3223 &miss); | |
3224 __ bind(&miss); | |
3225 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | |
3226 | |
3227 return GetCode(Code::INTERCEPTOR, name); | |
3228 } | |
3229 | |
3230 | |
3231 Handle<Code> KeyedLoadStubCompiler::CompileLoadElement( | 3071 Handle<Code> KeyedLoadStubCompiler::CompileLoadElement( |
3232 Handle<Map> receiver_map) { | 3072 Handle<Map> receiver_map) { |
3233 // ----------- S t a t e ------------- | 3073 // ----------- S t a t e ------------- |
3234 // -- lr : return address | 3074 // -- lr : return address |
3235 // -- r0 : key | 3075 // -- r0 : key |
3236 // -- r1 : receiver | 3076 // -- r1 : receiver |
3237 // ----------------------------------- | 3077 // ----------------------------------- |
3238 ElementsKind elements_kind = receiver_map->elements_kind(); | 3078 ElementsKind elements_kind = receiver_map->elements_kind(); |
3239 if (receiver_map->has_fast_elements() || | 3079 if (receiver_map->has_fast_elements() || |
3240 receiver_map->has_external_array_elements()) { | 3080 receiver_map->has_external_array_elements()) { |
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4325 __ Jump(ic_slow, RelocInfo::CODE_TARGET); | 4165 __ Jump(ic_slow, RelocInfo::CODE_TARGET); |
4326 } | 4166 } |
4327 } | 4167 } |
4328 | 4168 |
4329 | 4169 |
4330 #undef __ | 4170 #undef __ |
4331 | 4171 |
4332 } } // namespace v8::internal | 4172 } } // namespace v8::internal |
4333 | 4173 |
4334 #endif // V8_TARGET_ARCH_ARM | 4174 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |