Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Side by Side Diff: src/mips/stub-cache-mips.cc

Issue 12186003: MIPS: Merge KeyedLoad and NamedLoad stub compiler code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2876 matching lines...) Expand 10 before | Expand all | Expand 10 after
2887 __ IncrementCounter(counters->named_store_global_inline_miss(), 1, a1, a3); 2887 __ IncrementCounter(counters->named_store_global_inline_miss(), 1, a1, a3);
2888 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); 2888 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss();
2889 __ Jump(ic, RelocInfo::CODE_TARGET); 2889 __ Jump(ic, RelocInfo::CODE_TARGET);
2890 2890
2891 // Return the generated code. 2891 // Return the generated code.
2892 return GetCode(Code::NORMAL, name); 2892 return GetCode(Code::NORMAL, name);
2893 } 2893 }
2894 2894
2895 2895
2896 Handle<Code> LoadStubCompiler::CompileLoadNonexistent( 2896 Handle<Code> LoadStubCompiler::CompileLoadNonexistent(
2897 Handle<String> name,
2898 Handle<JSObject> object, 2897 Handle<JSObject> object,
2899 Handle<JSObject> last, 2898 Handle<JSObject> last,
2899 Handle<String> name,
2900 Handle<GlobalObject> global) { 2900 Handle<GlobalObject> global) {
2901 // ----------- S t a t e ------------- 2901 // ----------- S t a t e -------------
2902 // -- a0 : receiver 2902 // -- a0 : receiver
2903 // -- ra : return address 2903 // -- ra : return address
2904 // ----------------------------------- 2904 // -----------------------------------
2905 Label miss; 2905 Label miss;
2906 2906
2907 // Check that the receiver is not a smi. 2907 // Check that the receiver is not a smi.
2908 __ JumpIfSmi(a0, &miss); 2908 __ JumpIfSmi(a0, &miss);
2909 2909
(...skipping 20 matching lines...) Expand all
2930 __ Ret(); 2930 __ Ret();
2931 2931
2932 __ bind(&miss); 2932 __ bind(&miss);
2933 GenerateLoadMiss(masm(), Code::LOAD_IC); 2933 GenerateLoadMiss(masm(), Code::LOAD_IC);
2934 2934
2935 // Return the generated code. 2935 // Return the generated code.
2936 return GetCode(Code::NONEXISTENT, factory()->empty_string()); 2936 return GetCode(Code::NONEXISTENT, factory()->empty_string());
2937 } 2937 }
2938 2938
2939 2939
2940 Handle<Code> LoadStubCompiler::CompileLoadField(Handle<JSObject> object, 2940 Register* LoadStubCompiler::registers() {
2941 Handle<JSObject> holder, 2941 // receiver, name, scratch1, scratch2, scratch3, scratch4.
2942 PropertyIndex index, 2942 static Register registers[] = { a0, a2, a3, a1, t0, t1 };
2943 Handle<String> name) { 2943 return registers;
2944 // ----------- S t a t e -------------
2945 // -- a0 : receiver
2946 // -- a2 : name
2947 // -- ra : return address
2948 // -----------------------------------
2949 Label miss;
2950
2951 __ mov(v0, a0);
2952
2953 GenerateLoadField(object, holder, v0, a3, a1, t0, index, name, &miss);
2954 __ bind(&miss);
2955 GenerateLoadMiss(masm(), Code::LOAD_IC);
2956
2957 // Return the generated code.
2958 return GetCode(Code::FIELD, name);
2959 } 2944 }
2960 2945
2961 2946
2962 Handle<Code> LoadStubCompiler::CompileLoadCallback( 2947 Register* KeyedLoadStubCompiler::registers() {
2963 Handle<String> name, 2948 // receiver, name, scratch1, scratch2, scratch3, scratch4.
2964 Handle<JSObject> object, 2949 static Register registers[] = { a1, a0, a2, a3, t0, t1 };
2965 Handle<JSObject> holder, 2950 return registers;
2966 Handle<AccessorInfo> callback) {
2967 // ----------- S t a t e -------------
2968 // -- a0 : receiver
2969 // -- a2 : name
2970 // -- ra : return address
2971 // -----------------------------------
2972 Label miss;
2973 GenerateLoadCallback(object, holder, a0, a2, a3, a1, t0, t1, callback, name,
2974 &miss);
2975 __ bind(&miss);
2976 GenerateLoadMiss(masm(), Code::LOAD_IC);
2977
2978 // Return the generated code.
2979 return GetCode(Code::CALLBACKS, name);
2980 } 2951 }
2981 2952
2982 2953
2954 void KeyedLoadStubCompiler::GenerateNameCheck(Handle<String> name,
2955 Register name_reg,
2956 Label* miss) {
2957 __ Branch(miss, ne, name_reg, Operand(name));
2958 }
2959
2960
2983 #undef __ 2961 #undef __
2984 #define __ ACCESS_MASM(masm) 2962 #define __ ACCESS_MASM(masm)
2985 2963
2986 2964
2987 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, 2965 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
2988 Handle<JSFunction> getter) { 2966 Handle<JSFunction> getter) {
2989 // ----------- S t a t e ------------- 2967 // ----------- S t a t e -------------
2990 // -- a0 : receiver 2968 // -- a0 : receiver
2991 // -- a2 : name 2969 // -- a2 : name
2992 // -- ra : return address 2970 // -- ra : return address
(...skipping 18 matching lines...) Expand all
3011 } 2989 }
3012 __ Ret(); 2990 __ Ret();
3013 } 2991 }
3014 2992
3015 2993
3016 #undef __ 2994 #undef __
3017 #define __ ACCESS_MASM(masm()) 2995 #define __ ACCESS_MASM(masm())
3018 2996
3019 2997
3020 Handle<Code> LoadStubCompiler::CompileLoadViaGetter( 2998 Handle<Code> LoadStubCompiler::CompileLoadViaGetter(
3021 Handle<String> name,
3022 Handle<JSObject> receiver, 2999 Handle<JSObject> receiver,
3023 Handle<JSObject> holder, 3000 Handle<JSObject> holder,
3001 Handle<String> name,
3024 Handle<JSFunction> getter) { 3002 Handle<JSFunction> getter) {
3025 // ----------- S t a t e ------------- 3003 // ----------- S t a t e -------------
3026 // -- a0 : receiver 3004 // -- a0 : receiver
3027 // -- a2 : name 3005 // -- a2 : name
3028 // -- ra : return address 3006 // -- ra : return address
3029 // ----------------------------------- 3007 // -----------------------------------
3030 Label miss; 3008 Label miss;
3031 3009
3032 // Check that the maps haven't changed. 3010 // Check that the maps haven't changed.
3033 __ JumpIfSmi(a0, &miss); 3011 __ JumpIfSmi(a0, &miss);
3034 CheckPrototypes(receiver, a0, holder, a3, t0, a1, name, &miss); 3012 CheckPrototypes(receiver, a0, holder, a3, t0, a1, name, &miss);
3035 3013
3036 GenerateLoadViaGetter(masm(), getter); 3014 GenerateLoadViaGetter(masm(), getter);
3037 3015
3038 __ bind(&miss); 3016 __ bind(&miss);
3039 GenerateLoadMiss(masm(), Code::LOAD_IC); 3017 GenerateLoadMiss(masm(), Code::LOAD_IC);
3040 3018
3041 // Return the generated code. 3019 // Return the generated code.
3042 return GetCode(Code::CALLBACKS, name); 3020 return GetCode(Code::CALLBACKS, name);
3043 } 3021 }
3044 3022
3045 3023
3046 Handle<Code> LoadStubCompiler::CompileLoadConstant(Handle<JSObject> object,
3047 Handle<JSObject> holder,
3048 Handle<JSFunction> value,
3049 Handle<String> name) {
3050 // ----------- S t a t e -------------
3051 // -- a0 : receiver
3052 // -- a2 : name
3053 // -- ra : return address
3054 // -----------------------------------
3055 Label miss;
3056
3057 GenerateLoadConstant(object, holder, a0, a3, a1, t0, value, name, &miss);
3058 __ bind(&miss);
3059 GenerateLoadMiss(masm(), Code::LOAD_IC);
3060
3061 // Return the generated code.
3062 return GetCode(Code::CONSTANT_FUNCTION, name);
3063 }
3064
3065
3066 Handle<Code> LoadStubCompiler::CompileLoadInterceptor(Handle<JSObject> object,
3067 Handle<JSObject> holder,
3068 Handle<String> name) {
3069 // ----------- S t a t e -------------
3070 // -- a0 : receiver
3071 // -- a2 : name
3072 // -- ra : return address
3073 // -- [sp] : receiver
3074 // -----------------------------------
3075 Label miss;
3076
3077 LookupResult lookup(isolate());
3078 LookupPostInterceptor(holder, name, &lookup);
3079 GenerateLoadInterceptor(object, holder, &lookup, a0, a2, a3, a1, t0, name,
3080 &miss);
3081 __ bind(&miss);
3082 GenerateLoadMiss(masm(), Code::LOAD_IC);
3083
3084 // Return the generated code.
3085 return GetCode(Code::INTERCEPTOR, name);
3086 }
3087
3088
3089 Handle<Code> LoadStubCompiler::CompileLoadGlobal( 3024 Handle<Code> LoadStubCompiler::CompileLoadGlobal(
3090 Handle<JSObject> object, 3025 Handle<JSObject> object,
3091 Handle<GlobalObject> holder, 3026 Handle<GlobalObject> holder,
3092 Handle<JSGlobalPropertyCell> cell, 3027 Handle<JSGlobalPropertyCell> cell,
3093 Handle<String> name, 3028 Handle<String> name,
3094 bool is_dont_delete) { 3029 bool is_dont_delete) {
3095 // ----------- S t a t e ------------- 3030 // ----------- S t a t e -------------
3096 // -- a0 : receiver 3031 // -- a0 : receiver
3097 // -- a2 : name 3032 // -- a2 : name
3098 // -- ra : return address 3033 // -- ra : return address
(...skipping 21 matching lines...) Expand all
3120 3055
3121 __ bind(&miss); 3056 __ bind(&miss);
3122 __ IncrementCounter(counters->named_load_global_stub_miss(), 1, a1, a3); 3057 __ IncrementCounter(counters->named_load_global_stub_miss(), 1, a1, a3);
3123 GenerateLoadMiss(masm(), Code::LOAD_IC); 3058 GenerateLoadMiss(masm(), Code::LOAD_IC);
3124 3059
3125 // Return the generated code. 3060 // Return the generated code.
3126 return GetCode(Code::NORMAL, name); 3061 return GetCode(Code::NORMAL, name);
3127 } 3062 }
3128 3063
3129 3064
3130 Handle<Code> KeyedLoadStubCompiler::CompileLoadField(Handle<String> name,
3131 Handle<JSObject> receiver,
3132 Handle<JSObject> holder,
3133 PropertyIndex index) {
3134 // ----------- S t a t e -------------
3135 // -- ra : return address
3136 // -- a0 : key
3137 // -- a1 : receiver
3138 // -----------------------------------
3139 Label miss;
3140
3141 // Check the key is the cached one.
3142 __ Branch(&miss, ne, a0, Operand(name));
3143
3144 GenerateLoadField(receiver, holder, a1, a2, a3, t0, index, name, &miss);
3145 __ bind(&miss);
3146 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
3147
3148 return GetCode(Code::FIELD, name);
3149 }
3150
3151
3152 Handle<Code> KeyedLoadStubCompiler::CompileLoadCallback(
3153 Handle<String> name,
3154 Handle<JSObject> receiver,
3155 Handle<JSObject> holder,
3156 Handle<AccessorInfo> callback) {
3157 // ----------- S t a t e -------------
3158 // -- ra : return address
3159 // -- a0 : key
3160 // -- a1 : receiver
3161 // -----------------------------------
3162 Label miss;
3163
3164 // Check the key is the cached one.
3165 __ Branch(&miss, ne, a0, Operand(name));
3166
3167 GenerateLoadCallback(receiver, holder, a1, a0, a2, a3, t0, t1, callback,
3168 name, &miss);
3169 __ bind(&miss);
3170 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
3171
3172 return GetCode(Code::CALLBACKS, name);
3173 }
3174
3175
3176 Handle<Code> KeyedLoadStubCompiler::CompileLoadConstant(
3177 Handle<String> name,
3178 Handle<JSObject> receiver,
3179 Handle<JSObject> holder,
3180 Handle<JSFunction> value) {
3181 // ----------- S t a t e -------------
3182 // -- ra : return address
3183 // -- a0 : key
3184 // -- a1 : receiver
3185 // -----------------------------------
3186 Label miss;
3187
3188 // Check the key is the cached one.
3189 __ Branch(&miss, ne, a0, Operand(name));
3190
3191 GenerateLoadConstant(receiver, holder, a1, a2, a3, t0, value, name, &miss);
3192 __ bind(&miss);
3193 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
3194
3195 // Return the generated code.
3196 return GetCode(Code::CONSTANT_FUNCTION, name);
3197 }
3198
3199
3200 Handle<Code> KeyedLoadStubCompiler::CompileLoadInterceptor(
3201 Handle<JSObject> receiver,
3202 Handle<JSObject> holder,
3203 Handle<String> name) {
3204 // ----------- S t a t e -------------
3205 // -- ra : return address
3206 // -- a0 : key
3207 // -- a1 : receiver
3208 // -----------------------------------
3209 Label miss;
3210
3211 // Check the key is the cached one.
3212 __ Branch(&miss, ne, a0, Operand(name));
3213
3214 LookupResult lookup(isolate());
3215 LookupPostInterceptor(holder, name, &lookup);
3216 GenerateLoadInterceptor(receiver, holder, &lookup, a1, a0, a2, a3, t0, name,
3217 &miss);
3218 __ bind(&miss);
3219 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
3220
3221 return GetCode(Code::INTERCEPTOR, name);
3222 }
3223
3224
3225 Handle<Code> KeyedLoadStubCompiler::CompileLoadElement( 3065 Handle<Code> KeyedLoadStubCompiler::CompileLoadElement(
3226 Handle<Map> receiver_map) { 3066 Handle<Map> receiver_map) {
3227 // ----------- S t a t e ------------- 3067 // ----------- S t a t e -------------
3228 // -- ra : return address 3068 // -- ra : return address
3229 // -- a0 : key 3069 // -- a0 : key
3230 // -- a1 : receiver 3070 // -- a1 : receiver
3231 // ----------------------------------- 3071 // -----------------------------------
3232 ElementsKind elements_kind = receiver_map->elements_kind(); 3072 ElementsKind elements_kind = receiver_map->elements_kind();
3233 if (receiver_map->has_fast_elements() || 3073 if (receiver_map->has_fast_elements() ||
3234 receiver_map->has_external_array_elements()) { 3074 receiver_map->has_external_array_elements()) {
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
4378 __ Jump(ic_slow, RelocInfo::CODE_TARGET); 4218 __ Jump(ic_slow, RelocInfo::CODE_TARGET);
4379 } 4219 }
4380 } 4220 }
4381 4221
4382 4222
4383 #undef __ 4223 #undef __
4384 4224
4385 } } // namespace v8::internal 4225 } } // namespace v8::internal
4386 4226
4387 #endif // V8_TARGET_ARCH_MIPS 4227 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698