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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 | 462 |
463 // Return the value (register v0). | 463 // Return the value (register v0). |
464 __ bind(&exit); | 464 __ bind(&exit); |
465 __ mov(v0, a0); | 465 __ mov(v0, a0); |
466 __ Ret(); | 466 __ Ret(); |
467 } | 467 } |
468 | 468 |
469 | 469 |
470 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { | 470 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { |
471 ASSERT(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC); | 471 ASSERT(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC); |
472 Code* code = NULL; | 472 Handle<Code> code = (kind == Code::LOAD_IC) |
473 if (kind == Code::LOAD_IC) { | 473 ? masm->isolate()->builtins()->LoadIC_Miss() |
474 code = masm->isolate()->builtins()->builtin(Builtins::kLoadIC_Miss); | 474 : masm->isolate()->builtins()->KeyedLoadIC_Miss(); |
475 } else { | 475 __ Jump(code, RelocInfo::CODE_TARGET); |
476 code = masm->isolate()->builtins()->builtin(Builtins::kKeyedLoadIC_Miss); | |
477 } | |
478 | |
479 Handle<Code> ic(code); | |
480 __ Jump(ic, RelocInfo::CODE_TARGET); | |
481 } | 476 } |
482 | 477 |
483 | 478 |
484 static void GenerateCallFunction(MacroAssembler* masm, | 479 static void GenerateCallFunction(MacroAssembler* masm, |
485 Object* object, | 480 Object* object, |
486 const ParameterCount& arguments, | 481 const ParameterCount& arguments, |
487 Label* miss, | 482 Label* miss, |
488 Code::ExtraICState extra_ic_state) { | 483 Code::ExtraICState extra_ic_state) { |
489 // ----------- S t a t e ------------- | 484 // ----------- S t a t e ------------- |
490 // -- a0: receiver | 485 // -- a0: receiver |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 name, | 1173 name, |
1179 scratch1, | 1174 scratch1, |
1180 miss); | 1175 miss); |
1181 if (result->IsFailure()) set_failure(Failure::cast(result)); | 1176 if (result->IsFailure()) set_failure(Failure::cast(result)); |
1182 | 1177 |
1183 // Return the register containing the holder. | 1178 // Return the register containing the holder. |
1184 return reg; | 1179 return reg; |
1185 } | 1180 } |
1186 | 1181 |
1187 | 1182 |
1188 void StubCompiler::GenerateLoadField(JSObject* object, | 1183 void StubCompiler::GenerateLoadField(Handle<JSObject> object, |
1189 JSObject* holder, | 1184 Handle<JSObject> holder, |
1190 Register receiver, | 1185 Register receiver, |
1191 Register scratch1, | 1186 Register scratch1, |
1192 Register scratch2, | 1187 Register scratch2, |
1193 Register scratch3, | 1188 Register scratch3, |
1194 int index, | 1189 int index, |
1195 String* name, | 1190 Handle<String> name, |
1196 Label* miss) { | 1191 Label* miss) { |
1197 // Check that the receiver isn't a smi. | 1192 // Check that the receiver isn't a smi. |
1198 __ And(scratch1, receiver, Operand(kSmiTagMask)); | 1193 __ And(scratch1, receiver, Operand(kSmiTagMask)); |
1199 __ Branch(miss, eq, scratch1, Operand(zero_reg)); | 1194 __ Branch(miss, eq, scratch1, Operand(zero_reg)); |
1200 | 1195 |
1201 // Check that the maps haven't changed. | 1196 // Check that the maps haven't changed. |
1202 Register reg = | 1197 Register reg = CheckPrototypes( |
1203 CheckPrototypes(object, receiver, holder, scratch1, scratch2, scratch3, | 1198 object, receiver, holder, scratch1, scratch2, scratch3, name, miss); |
1204 name, miss); | |
1205 GenerateFastPropertyLoad(masm(), v0, reg, holder, index); | 1199 GenerateFastPropertyLoad(masm(), v0, reg, holder, index); |
1206 __ Ret(); | 1200 __ Ret(); |
1207 } | 1201 } |
1208 | 1202 |
1209 | 1203 |
1210 void StubCompiler::GenerateLoadConstant(JSObject* object, | 1204 void StubCompiler::GenerateLoadConstant(Handle<JSObject> object, |
1211 JSObject* holder, | 1205 Handle<JSObject> holder, |
1212 Register receiver, | 1206 Register receiver, |
1213 Register scratch1, | 1207 Register scratch1, |
1214 Register scratch2, | 1208 Register scratch2, |
1215 Register scratch3, | 1209 Register scratch3, |
1216 Object* value, | 1210 Handle<Object> value, |
1217 String* name, | 1211 Handle<String> name, |
1218 Label* miss) { | 1212 Label* miss) { |
1219 // Check that the receiver isn't a smi. | 1213 // Check that the receiver isn't a smi. |
1220 __ JumpIfSmi(receiver, miss, scratch1); | 1214 __ JumpIfSmi(receiver, miss, scratch1); |
1221 | 1215 |
1222 // Check that the maps haven't changed. | 1216 // Check that the maps haven't changed. |
1223 Register reg = | 1217 Register reg = |
1224 CheckPrototypes(object, receiver, holder, | 1218 CheckPrototypes(object, receiver, holder, |
1225 scratch1, scratch2, scratch3, name, miss); | 1219 scratch1, scratch2, scratch3, name, miss); |
1226 | 1220 |
1227 // Return the constant value. | 1221 // Return the constant value. |
1228 __ li(v0, Operand(Handle<Object>(value))); | 1222 __ li(v0, Operand(value)); |
1229 __ Ret(); | 1223 __ Ret(); |
1230 } | 1224 } |
1231 | 1225 |
1232 | 1226 |
1233 MaybeObject* StubCompiler::GenerateLoadCallback(JSObject* object, | 1227 MaybeObject* StubCompiler::GenerateLoadCallback(JSObject* object, |
1234 JSObject* holder, | 1228 JSObject* holder, |
1235 Register receiver, | 1229 Register receiver, |
1236 Register name_reg, | 1230 Register name_reg, |
1237 Register scratch1, | 1231 Register scratch1, |
1238 Register scratch2, | 1232 Register scratch2, |
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2786 __ bind(&miss); | 2780 __ bind(&miss); |
2787 __ IncrementCounter(counters->named_store_global_inline_miss(), 1, a1, a3); | 2781 __ IncrementCounter(counters->named_store_global_inline_miss(), 1, a1, a3); |
2788 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); | 2782 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); |
2789 __ Jump(ic, RelocInfo::CODE_TARGET); | 2783 __ Jump(ic, RelocInfo::CODE_TARGET); |
2790 | 2784 |
2791 // Return the generated code. | 2785 // Return the generated code. |
2792 return GetCode(NORMAL, name); | 2786 return GetCode(NORMAL, name); |
2793 } | 2787 } |
2794 | 2788 |
2795 | 2789 |
2796 MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name, | 2790 Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<String> name, |
2797 JSObject* object, | 2791 Handle<JSObject> object, |
2798 JSObject* last) { | 2792 Handle<JSObject> last) { |
2799 // ----------- S t a t e ------------- | 2793 // ----------- S t a t e ------------- |
2800 // -- a0 : receiver | 2794 // -- a0 : receiver |
2801 // -- ra : return address | 2795 // -- ra : return address |
2802 // ----------------------------------- | 2796 // ----------------------------------- |
2803 Label miss; | 2797 Label miss; |
2804 | 2798 |
2805 // Check that the receiver is not a smi. | 2799 // Check that the receiver is not a smi. |
2806 __ JumpIfSmi(a0, &miss); | 2800 __ JumpIfSmi(a0, &miss); |
2807 | 2801 |
2808 // Check the maps of the full prototype chain. | 2802 // Check the maps of the full prototype chain. |
2809 CheckPrototypes(object, a0, last, a3, a1, t0, name, &miss); | 2803 CheckPrototypes(object, a0, last, a3, a1, t0, name, &miss); |
2810 | 2804 |
2811 // If the last object in the prototype chain is a global object, | 2805 // If the last object in the prototype chain is a global object, |
2812 // check that the global property cell is empty. | 2806 // check that the global property cell is empty. |
2813 if (last->IsGlobalObject()) { | 2807 if (last->IsGlobalObject()) { |
2814 MaybeObject* cell = GenerateCheckPropertyCell(masm(), | 2808 GenerateCheckPropertyCell( |
2815 GlobalObject::cast(last), | 2809 masm(), Handle<GlobalObject>::cast(last), name, a1, &miss); |
2816 name, | |
2817 a1, | |
2818 &miss); | |
2819 if (cell->IsFailure()) { | |
2820 miss.Unuse(); | |
2821 return cell; | |
2822 } | |
2823 } | 2810 } |
2824 | 2811 |
2825 // Return undefined if maps of the full prototype chain is still the same. | 2812 // Return undefined if maps of the full prototype chain is still the same. |
2826 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); | 2813 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); |
2827 __ Ret(); | 2814 __ Ret(); |
2828 | 2815 |
2829 __ bind(&miss); | 2816 __ bind(&miss); |
2830 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2817 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2831 | 2818 |
2832 // Return the generated code. | 2819 // Return the generated code. |
2833 return GetCode(NONEXISTENT, heap()->empty_string()); | 2820 return GetCode(NONEXISTENT, factory()->empty_string()); |
2834 } | 2821 } |
2835 | 2822 |
2836 | 2823 |
2837 MaybeObject* LoadStubCompiler::CompileLoadField(JSObject* object, | 2824 Handle<Code> LoadStubCompiler::CompileLoadField(Handle<JSObject> object, |
2838 JSObject* holder, | 2825 Handle<JSObject> holder, |
2839 int index, | 2826 int index, |
2840 String* name) { | 2827 Handle<String> name) { |
2841 // ----------- S t a t e ------------- | 2828 // ----------- S t a t e ------------- |
2842 // -- a0 : receiver | 2829 // -- a0 : receiver |
2843 // -- a2 : name | 2830 // -- a2 : name |
2844 // -- ra : return address | 2831 // -- ra : return address |
2845 // ----------------------------------- | 2832 // ----------------------------------- |
2846 Label miss; | 2833 Label miss; |
2847 | 2834 |
2848 __ mov(v0, a0); | 2835 __ mov(v0, a0); |
2849 | 2836 |
2850 GenerateLoadField(object, holder, v0, a3, a1, t0, index, name, &miss); | 2837 GenerateLoadField(object, holder, v0, a3, a1, t0, index, name, &miss); |
(...skipping 20 matching lines...) Expand all Loading... |
2871 callback, name, &miss); | 2858 callback, name, &miss); |
2872 if (result->IsFailure()) { | 2859 if (result->IsFailure()) { |
2873 miss.Unuse(); | 2860 miss.Unuse(); |
2874 return result; | 2861 return result; |
2875 } | 2862 } |
2876 | 2863 |
2877 __ bind(&miss); | 2864 __ bind(&miss); |
2878 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2865 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2879 | 2866 |
2880 // Return the generated code. | 2867 // Return the generated code. |
2881 return GetCode(CALLBACKS, name); | 2868 return TryGetCode(CALLBACKS, name); |
2882 } | 2869 } |
2883 | 2870 |
2884 | 2871 |
2885 MaybeObject* LoadStubCompiler::CompileLoadConstant(JSObject* object, | 2872 Handle<Code> LoadStubCompiler::CompileLoadConstant(Handle<JSObject> object, |
2886 JSObject* holder, | 2873 Handle<JSObject> holder, |
2887 Object* value, | 2874 Handle<Object> value, |
2888 String* name) { | 2875 Handle<String> name) { |
2889 // ----------- S t a t e ------------- | 2876 // ----------- S t a t e ------------- |
2890 // -- a0 : receiver | 2877 // -- a0 : receiver |
2891 // -- a2 : name | 2878 // -- a2 : name |
2892 // -- ra : return address | 2879 // -- ra : return address |
2893 // ----------------------------------- | 2880 // ----------------------------------- |
2894 Label miss; | 2881 Label miss; |
2895 | 2882 |
2896 GenerateLoadConstant(object, holder, a0, a3, a1, t0, value, name, &miss); | 2883 GenerateLoadConstant(object, holder, a0, a3, a1, t0, value, name, &miss); |
2897 __ bind(&miss); | 2884 __ bind(&miss); |
2898 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2885 GenerateLoadMiss(masm(), Code::LOAD_IC); |
(...skipping 23 matching lines...) Expand all Loading... |
2922 a2, | 2909 a2, |
2923 a3, | 2910 a3, |
2924 a1, | 2911 a1, |
2925 t0, | 2912 t0, |
2926 name, | 2913 name, |
2927 &miss); | 2914 &miss); |
2928 __ bind(&miss); | 2915 __ bind(&miss); |
2929 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2916 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2930 | 2917 |
2931 // Return the generated code. | 2918 // Return the generated code. |
2932 return GetCode(INTERCEPTOR, name); | 2919 return TryGetCode(INTERCEPTOR, name); |
2933 } | 2920 } |
2934 | 2921 |
2935 | 2922 |
2936 MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object, | 2923 MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object, |
2937 GlobalObject* holder, | 2924 GlobalObject* holder, |
2938 JSGlobalPropertyCell* cell, | 2925 JSGlobalPropertyCell* cell, |
2939 String* name, | 2926 String* name, |
2940 bool is_dont_delete) { | 2927 bool is_dont_delete) { |
2941 // ----------- S t a t e ------------- | 2928 // ----------- S t a t e ------------- |
2942 // -- a0 : receiver | 2929 // -- a0 : receiver |
(...skipping 26 matching lines...) Expand all Loading... |
2969 __ mov(v0, t0); | 2956 __ mov(v0, t0); |
2970 Counters* counters = masm()->isolate()->counters(); | 2957 Counters* counters = masm()->isolate()->counters(); |
2971 __ IncrementCounter(counters->named_load_global_stub(), 1, a1, a3); | 2958 __ IncrementCounter(counters->named_load_global_stub(), 1, a1, a3); |
2972 __ Ret(); | 2959 __ Ret(); |
2973 | 2960 |
2974 __ bind(&miss); | 2961 __ bind(&miss); |
2975 __ IncrementCounter(counters->named_load_global_stub_miss(), 1, a1, a3); | 2962 __ IncrementCounter(counters->named_load_global_stub_miss(), 1, a1, a3); |
2976 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2963 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2977 | 2964 |
2978 // Return the generated code. | 2965 // Return the generated code. |
2979 return GetCode(NORMAL, name); | 2966 return TryGetCode(NORMAL, name); |
2980 } | 2967 } |
2981 | 2968 |
2982 | 2969 |
2983 MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name, | 2970 Handle<Code> KeyedLoadStubCompiler::CompileLoadField(Handle<String> name, |
2984 JSObject* receiver, | 2971 Handle<JSObject> receiver, |
2985 JSObject* holder, | 2972 Handle<JSObject> holder, |
2986 int index) { | 2973 int index) { |
2987 // ----------- S t a t e ------------- | 2974 // ----------- S t a t e ------------- |
2988 // -- ra : return address | 2975 // -- ra : return address |
2989 // -- a0 : key | 2976 // -- a0 : key |
2990 // -- a1 : receiver | 2977 // -- a1 : receiver |
2991 // ----------------------------------- | 2978 // ----------------------------------- |
2992 Label miss; | 2979 Label miss; |
2993 | 2980 |
2994 // Check the key is the cached one. | 2981 // Check the key is the cached one. |
2995 __ Branch(&miss, ne, a0, Operand(Handle<String>(name))); | 2982 __ Branch(&miss, ne, a0, Operand(name)); |
2996 | 2983 |
2997 GenerateLoadField(receiver, holder, a1, a2, a3, t0, index, name, &miss); | 2984 GenerateLoadField(receiver, holder, a1, a2, a3, t0, index, name, &miss); |
2998 __ bind(&miss); | 2985 __ bind(&miss); |
2999 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2986 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3000 | 2987 |
3001 return GetCode(FIELD, name); | 2988 return GetCode(FIELD, name); |
3002 } | 2989 } |
3003 | 2990 |
3004 | 2991 |
3005 MaybeObject* KeyedLoadStubCompiler::CompileLoadCallback( | 2992 MaybeObject* KeyedLoadStubCompiler::CompileLoadCallback( |
(...skipping 14 matching lines...) Expand all Loading... |
3020 MaybeObject* result = GenerateLoadCallback(receiver, holder, a1, a0, a2, a3, | 3007 MaybeObject* result = GenerateLoadCallback(receiver, holder, a1, a0, a2, a3, |
3021 t0, callback, name, &miss); | 3008 t0, callback, name, &miss); |
3022 if (result->IsFailure()) { | 3009 if (result->IsFailure()) { |
3023 miss.Unuse(); | 3010 miss.Unuse(); |
3024 return result; | 3011 return result; |
3025 } | 3012 } |
3026 | 3013 |
3027 __ bind(&miss); | 3014 __ bind(&miss); |
3028 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3015 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3029 | 3016 |
3030 return GetCode(CALLBACKS, name); | 3017 return TryGetCode(CALLBACKS, name); |
3031 } | 3018 } |
3032 | 3019 |
3033 | 3020 |
3034 MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name, | 3021 Handle<Code> KeyedLoadStubCompiler::CompileLoadConstant( |
3035 JSObject* receiver, | 3022 Handle<String> name, |
3036 JSObject* holder, | 3023 Handle<JSObject> receiver, |
3037 Object* value) { | 3024 Handle<JSObject> holder, |
| 3025 Handle<Object> value) { |
3038 // ----------- S t a t e ------------- | 3026 // ----------- S t a t e ------------- |
3039 // -- ra : return address | 3027 // -- ra : return address |
3040 // -- a0 : key | 3028 // -- a0 : key |
3041 // -- a1 : receiver | 3029 // -- a1 : receiver |
3042 // ----------------------------------- | 3030 // ----------------------------------- |
3043 Label miss; | 3031 Label miss; |
3044 | 3032 |
3045 // Check the key is the cached one. | 3033 // Check the key is the cached one. |
3046 __ Branch(&miss, ne, a0, Operand(Handle<String>(name))); | 3034 __ Branch(&miss, ne, a0, Operand(name)); |
3047 | 3035 |
3048 GenerateLoadConstant(receiver, holder, a1, a2, a3, t0, value, name, &miss); | 3036 GenerateLoadConstant(receiver, holder, a1, a2, a3, t0, value, name, &miss); |
3049 __ bind(&miss); | 3037 __ bind(&miss); |
3050 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3038 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3051 | 3039 |
3052 // Return the generated code. | 3040 // Return the generated code. |
3053 return GetCode(CONSTANT_FUNCTION, name); | 3041 return GetCode(CONSTANT_FUNCTION, name); |
3054 } | 3042 } |
3055 | 3043 |
3056 | 3044 |
(...skipping 18 matching lines...) Expand all Loading... |
3075 a1, | 3063 a1, |
3076 a0, | 3064 a0, |
3077 a2, | 3065 a2, |
3078 a3, | 3066 a3, |
3079 t0, | 3067 t0, |
3080 name, | 3068 name, |
3081 &miss); | 3069 &miss); |
3082 __ bind(&miss); | 3070 __ bind(&miss); |
3083 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3071 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3084 | 3072 |
3085 return GetCode(INTERCEPTOR, name); | 3073 return TryGetCode(INTERCEPTOR, name); |
3086 } | 3074 } |
3087 | 3075 |
3088 | 3076 |
3089 MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { | 3077 Handle<Code> KeyedLoadStubCompiler::CompileLoadArrayLength( |
| 3078 Handle<String> name) { |
3090 // ----------- S t a t e ------------- | 3079 // ----------- S t a t e ------------- |
3091 // -- ra : return address | 3080 // -- ra : return address |
3092 // -- a0 : key | 3081 // -- a0 : key |
3093 // -- a1 : receiver | 3082 // -- a1 : receiver |
3094 // ----------------------------------- | 3083 // ----------------------------------- |
3095 Label miss; | 3084 Label miss; |
3096 | 3085 |
3097 // Check the key is the cached one. | 3086 // Check the key is the cached one. |
3098 __ Branch(&miss, ne, a0, Operand(Handle<String>(name))); | 3087 __ Branch(&miss, ne, a0, Operand(name)); |
3099 | 3088 |
3100 GenerateLoadArrayLength(masm(), a1, a2, &miss); | 3089 GenerateLoadArrayLength(masm(), a1, a2, &miss); |
3101 __ bind(&miss); | 3090 __ bind(&miss); |
3102 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3091 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3103 | 3092 |
3104 return GetCode(CALLBACKS, name); | 3093 return GetCode(CALLBACKS, name); |
3105 } | 3094 } |
3106 | 3095 |
3107 | 3096 |
3108 MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { | 3097 Handle<Code> KeyedLoadStubCompiler::CompileLoadStringLength( |
| 3098 Handle<String> name) { |
3109 // ----------- S t a t e ------------- | 3099 // ----------- S t a t e ------------- |
3110 // -- ra : return address | 3100 // -- ra : return address |
3111 // -- a0 : key | 3101 // -- a0 : key |
3112 // -- a1 : receiver | 3102 // -- a1 : receiver |
3113 // ----------------------------------- | 3103 // ----------------------------------- |
3114 Label miss; | 3104 Label miss; |
3115 | 3105 |
3116 Counters* counters = masm()->isolate()->counters(); | 3106 Counters* counters = masm()->isolate()->counters(); |
3117 __ IncrementCounter(counters->keyed_load_string_length(), 1, a2, a3); | 3107 __ IncrementCounter(counters->keyed_load_string_length(), 1, a2, a3); |
3118 | 3108 |
3119 // Check the key is the cached one. | 3109 // Check the key is the cached one. |
3120 __ Branch(&miss, ne, a0, Operand(Handle<String>(name))); | 3110 __ Branch(&miss, ne, a0, Operand(name)); |
3121 | 3111 |
3122 GenerateLoadStringLength(masm(), a1, a2, a3, &miss, true); | 3112 GenerateLoadStringLength(masm(), a1, a2, a3, &miss, true); |
3123 __ bind(&miss); | 3113 __ bind(&miss); |
3124 __ DecrementCounter(counters->keyed_load_string_length(), 1, a2, a3); | 3114 __ DecrementCounter(counters->keyed_load_string_length(), 1, a2, a3); |
3125 | 3115 |
3126 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3116 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3127 | 3117 |
3128 return GetCode(CALLBACKS, name); | 3118 return GetCode(CALLBACKS, name); |
3129 } | 3119 } |
3130 | 3120 |
3131 | 3121 |
3132 MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { | 3122 Handle<Code> KeyedLoadStubCompiler::CompileLoadFunctionPrototype( |
| 3123 Handle<String> name) { |
3133 // ----------- S t a t e ------------- | 3124 // ----------- S t a t e ------------- |
3134 // -- ra : return address | 3125 // -- ra : return address |
3135 // -- a0 : key | 3126 // -- a0 : key |
3136 // -- a1 : receiver | 3127 // -- a1 : receiver |
3137 // ----------------------------------- | 3128 // ----------------------------------- |
3138 Label miss; | 3129 Label miss; |
3139 | 3130 |
3140 Counters* counters = masm()->isolate()->counters(); | 3131 Counters* counters = masm()->isolate()->counters(); |
3141 __ IncrementCounter(counters->keyed_load_function_prototype(), 1, a2, a3); | 3132 __ IncrementCounter(counters->keyed_load_function_prototype(), 1, a2, a3); |
3142 | 3133 |
3143 // Check the name hasn't changed. | 3134 // Check the name hasn't changed. |
3144 __ Branch(&miss, ne, a0, Operand(Handle<String>(name))); | 3135 __ Branch(&miss, ne, a0, Operand(name)); |
3145 | 3136 |
3146 GenerateLoadFunctionPrototype(masm(), a1, a2, a3, &miss); | 3137 GenerateLoadFunctionPrototype(masm(), a1, a2, a3, &miss); |
3147 __ bind(&miss); | 3138 __ bind(&miss); |
3148 __ DecrementCounter(counters->keyed_load_function_prototype(), 1, a2, a3); | 3139 __ DecrementCounter(counters->keyed_load_function_prototype(), 1, a2, a3); |
3149 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3140 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3150 | 3141 |
3151 return GetCode(CALLBACKS, name); | 3142 return GetCode(CALLBACKS, name); |
3152 } | 3143 } |
3153 | 3144 |
3154 | 3145 |
(...skipping 10 matching lines...) Expand all Loading... |
3165 __ DispatchMap(a1, | 3156 __ DispatchMap(a1, |
3166 a2, | 3157 a2, |
3167 Handle<Map>(receiver_map), | 3158 Handle<Map>(receiver_map), |
3168 Handle<Code>(stub), | 3159 Handle<Code>(stub), |
3169 DO_SMI_CHECK); | 3160 DO_SMI_CHECK); |
3170 | 3161 |
3171 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); | 3162 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); |
3172 __ Jump(ic, RelocInfo::CODE_TARGET); | 3163 __ Jump(ic, RelocInfo::CODE_TARGET); |
3173 | 3164 |
3174 // Return the generated code. | 3165 // Return the generated code. |
3175 return GetCode(NORMAL, NULL); | 3166 return TryGetCode(NORMAL, NULL); |
3176 } | 3167 } |
3177 | 3168 |
3178 | 3169 |
3179 MaybeObject* KeyedLoadStubCompiler::CompileLoadPolymorphic( | 3170 MaybeObject* KeyedLoadStubCompiler::CompileLoadPolymorphic( |
3180 MapList* receiver_maps, | 3171 MapList* receiver_maps, |
3181 CodeList* handler_ics) { | 3172 CodeList* handler_ics) { |
3182 // ----------- S t a t e ------------- | 3173 // ----------- S t a t e ------------- |
3183 // -- ra : return address | 3174 // -- ra : return address |
3184 // -- a0 : key | 3175 // -- a0 : key |
3185 // -- a1 : receiver | 3176 // -- a1 : receiver |
3186 // ----------------------------------- | 3177 // ----------------------------------- |
3187 Label miss; | 3178 Label miss; |
3188 __ JumpIfSmi(a1, &miss); | 3179 __ JumpIfSmi(a1, &miss); |
3189 | 3180 |
3190 int receiver_count = receiver_maps->length(); | 3181 int receiver_count = receiver_maps->length(); |
3191 __ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset)); | 3182 __ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset)); |
3192 for (int current = 0; current < receiver_count; ++current) { | 3183 for (int current = 0; current < receiver_count; ++current) { |
3193 Handle<Map> map(receiver_maps->at(current)); | 3184 Handle<Map> map(receiver_maps->at(current)); |
3194 Handle<Code> code(handler_ics->at(current)); | 3185 Handle<Code> code(handler_ics->at(current)); |
3195 __ Jump(code, RelocInfo::CODE_TARGET, eq, a2, Operand(map)); | 3186 __ Jump(code, RelocInfo::CODE_TARGET, eq, a2, Operand(map)); |
3196 } | 3187 } |
3197 | 3188 |
3198 __ bind(&miss); | 3189 __ bind(&miss); |
3199 Handle<Code> miss_ic = isolate()->builtins()->KeyedLoadIC_Miss(); | 3190 Handle<Code> miss_ic = isolate()->builtins()->KeyedLoadIC_Miss(); |
3200 __ Jump(miss_ic, RelocInfo::CODE_TARGET); | 3191 __ Jump(miss_ic, RelocInfo::CODE_TARGET); |
3201 | 3192 |
3202 // Return the generated code. | 3193 // Return the generated code. |
3203 return GetCode(NORMAL, NULL, MEGAMORPHIC); | 3194 return TryGetCode(NORMAL, NULL, MEGAMORPHIC); |
3204 } | 3195 } |
3205 | 3196 |
3206 | 3197 |
3207 MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, | 3198 MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, |
3208 int index, | 3199 int index, |
3209 Map* transition, | 3200 Map* transition, |
3210 String* name) { | 3201 String* name) { |
3211 // ----------- S t a t e ------------- | 3202 // ----------- S t a t e ------------- |
3212 // -- a0 : value | 3203 // -- a0 : value |
3213 // -- a1 : key | 3204 // -- a1 : key |
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4524 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); | 4515 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); |
4525 __ Jump(ic_miss, RelocInfo::CODE_TARGET); | 4516 __ Jump(ic_miss, RelocInfo::CODE_TARGET); |
4526 } | 4517 } |
4527 | 4518 |
4528 | 4519 |
4529 #undef __ | 4520 #undef __ |
4530 | 4521 |
4531 } } // namespace v8::internal | 4522 } } // namespace v8::internal |
4532 | 4523 |
4533 #endif // V8_TARGET_ARCH_MIPS | 4524 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |