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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 } | 518 } |
519 | 519 |
520 // Return the value (register r0). | 520 // Return the value (register r0). |
521 __ bind(&exit); | 521 __ bind(&exit); |
522 __ Ret(); | 522 __ Ret(); |
523 } | 523 } |
524 | 524 |
525 | 525 |
526 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { | 526 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { |
527 ASSERT(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC); | 527 ASSERT(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC); |
528 Code* code = NULL; | 528 Handle<Code> code = (kind == Code::LOAD_IC) |
529 if (kind == Code::LOAD_IC) { | 529 ? masm->isolate()->builtins()->LoadIC_Miss() |
530 code = masm->isolate()->builtins()->builtin(Builtins::kLoadIC_Miss); | 530 : masm->isolate()->builtins()->KeyedLoadIC_Miss(); |
531 } else { | 531 __ Jump(code, RelocInfo::CODE_TARGET); |
532 code = masm->isolate()->builtins()->builtin(Builtins::kKeyedLoadIC_Miss); | |
533 } | |
534 | |
535 Handle<Code> ic(code); | |
536 __ Jump(ic, RelocInfo::CODE_TARGET); | |
537 } | 532 } |
538 | 533 |
539 | 534 |
540 static void GenerateCallFunction(MacroAssembler* masm, | 535 static void GenerateCallFunction(MacroAssembler* masm, |
541 Handle<Object> object, | 536 Handle<Object> object, |
542 const ParameterCount& arguments, | 537 const ParameterCount& arguments, |
543 Label* miss, | 538 Label* miss, |
544 Code::ExtraICState extra_ic_state) { | 539 Code::ExtraICState extra_ic_state) { |
545 // ----------- S t a t e ------------- | 540 // ----------- S t a t e ------------- |
546 // -- r0: receiver | 541 // -- r0: receiver |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 name, | 1363 name, |
1369 scratch1, | 1364 scratch1, |
1370 miss); | 1365 miss); |
1371 if (result->IsFailure()) set_failure(Failure::cast(result)); | 1366 if (result->IsFailure()) set_failure(Failure::cast(result)); |
1372 | 1367 |
1373 // Return the register containing the holder. | 1368 // Return the register containing the holder. |
1374 return reg; | 1369 return reg; |
1375 } | 1370 } |
1376 | 1371 |
1377 | 1372 |
1378 void StubCompiler::GenerateLoadField(JSObject* object, | 1373 void StubCompiler::GenerateLoadField(Handle<JSObject> object, |
1379 JSObject* holder, | 1374 Handle<JSObject> holder, |
1380 Register receiver, | 1375 Register receiver, |
1381 Register scratch1, | 1376 Register scratch1, |
1382 Register scratch2, | 1377 Register scratch2, |
1383 Register scratch3, | 1378 Register scratch3, |
1384 int index, | 1379 int index, |
1385 String* name, | 1380 Handle<String> name, |
1386 Label* miss) { | 1381 Label* miss) { |
1387 // Check that the receiver isn't a smi. | 1382 // Check that the receiver isn't a smi. |
1388 __ JumpIfSmi(receiver, miss); | 1383 __ JumpIfSmi(receiver, miss); |
1389 | 1384 |
1390 // Check that the maps haven't changed. | 1385 // Check that the maps haven't changed. |
1391 Register reg = | 1386 Register reg = CheckPrototypes( |
1392 CheckPrototypes(object, receiver, holder, scratch1, scratch2, scratch3, | 1387 object, receiver, holder, scratch1, scratch2, scratch3, name, miss); |
1393 name, miss); | 1388 GenerateFastPropertyLoad(masm(), r0, reg, holder, index); |
1394 GenerateFastPropertyLoad(masm(), r0, reg, Handle<JSObject>(holder), index); | |
1395 __ Ret(); | 1389 __ Ret(); |
1396 } | 1390 } |
1397 | 1391 |
1398 | 1392 |
1399 void StubCompiler::GenerateLoadConstant(JSObject* object, | 1393 void StubCompiler::GenerateLoadConstant(Handle<JSObject> object, |
1400 JSObject* holder, | 1394 Handle<JSObject> holder, |
1401 Register receiver, | 1395 Register receiver, |
1402 Register scratch1, | 1396 Register scratch1, |
1403 Register scratch2, | 1397 Register scratch2, |
1404 Register scratch3, | 1398 Register scratch3, |
1405 Object* value, | 1399 Handle<Object> value, |
1406 String* name, | 1400 Handle<String> name, |
1407 Label* miss) { | 1401 Label* miss) { |
1408 // Check that the receiver isn't a smi. | 1402 // Check that the receiver isn't a smi. |
1409 __ JumpIfSmi(receiver, miss); | 1403 __ JumpIfSmi(receiver, miss); |
1410 | 1404 |
1411 // Check that the maps haven't changed. | 1405 // Check that the maps haven't changed. |
1412 CheckPrototypes(object, receiver, holder, scratch1, scratch2, scratch3, name, | 1406 CheckPrototypes( |
1413 miss); | 1407 object, receiver, holder, scratch1, scratch2, scratch3, name, miss); |
1414 | 1408 |
1415 // Return the constant value. | 1409 // Return the constant value. |
1416 __ mov(r0, Operand(Handle<Object>(value))); | 1410 __ mov(r0, Operand(value)); |
1417 __ Ret(); | 1411 __ Ret(); |
1418 } | 1412 } |
1419 | 1413 |
1420 | 1414 |
1421 MaybeObject* StubCompiler::GenerateLoadCallback(JSObject* object, | 1415 MaybeObject* StubCompiler::GenerateLoadCallback(JSObject* object, |
1422 JSObject* holder, | 1416 JSObject* holder, |
1423 Register receiver, | 1417 Register receiver, |
1424 Register name_reg, | 1418 Register name_reg, |
1425 Register scratch1, | 1419 Register scratch1, |
1426 Register scratch2, | 1420 Register scratch2, |
(...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2996 __ bind(&miss); | 2990 __ bind(&miss); |
2997 __ IncrementCounter(counters->named_store_global_inline_miss(), 1, r4, r3); | 2991 __ IncrementCounter(counters->named_store_global_inline_miss(), 1, r4, r3); |
2998 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); | 2992 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); |
2999 __ Jump(ic, RelocInfo::CODE_TARGET); | 2993 __ Jump(ic, RelocInfo::CODE_TARGET); |
3000 | 2994 |
3001 // Return the generated code. | 2995 // Return the generated code. |
3002 return GetCode(NORMAL, name); | 2996 return GetCode(NORMAL, name); |
3003 } | 2997 } |
3004 | 2998 |
3005 | 2999 |
3006 MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name, | 3000 Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<String> name, |
3007 JSObject* object, | 3001 Handle<JSObject> object, |
3008 JSObject* last) { | 3002 Handle<JSObject> last) { |
3009 // ----------- S t a t e ------------- | 3003 // ----------- S t a t e ------------- |
3010 // -- r0 : receiver | 3004 // -- r0 : receiver |
3011 // -- lr : return address | 3005 // -- lr : return address |
3012 // ----------------------------------- | 3006 // ----------------------------------- |
3013 Label miss; | 3007 Label miss; |
3014 | 3008 |
3015 // Check that receiver is not a smi. | 3009 // Check that receiver is not a smi. |
3016 __ JumpIfSmi(r0, &miss); | 3010 __ JumpIfSmi(r0, &miss); |
3017 | 3011 |
3018 // Check the maps of the full prototype chain. | 3012 // Check the maps of the full prototype chain. |
3019 CheckPrototypes(object, r0, last, r3, r1, r4, name, &miss); | 3013 CheckPrototypes(object, r0, last, r3, r1, r4, name, &miss); |
3020 | 3014 |
3021 // If the last object in the prototype chain is a global object, | 3015 // If the last object in the prototype chain is a global object, |
3022 // check that the global property cell is empty. | 3016 // check that the global property cell is empty. |
3023 if (last->IsGlobalObject()) { | 3017 if (last->IsGlobalObject()) { |
3024 MaybeObject* cell = TryGenerateCheckPropertyCell(masm(), | 3018 GenerateCheckPropertyCell( |
3025 GlobalObject::cast(last), | 3019 masm(), Handle<GlobalObject>::cast(last), name, r1, &miss); |
3026 name, | |
3027 r1, | |
3028 &miss); | |
3029 if (cell->IsFailure()) { | |
3030 miss.Unuse(); | |
3031 return cell; | |
3032 } | |
3033 } | 3020 } |
3034 | 3021 |
3035 // Return undefined if maps of the full prototype chain are still the | 3022 // Return undefined if maps of the full prototype chain are still the |
3036 // same and no global property with this name contains a value. | 3023 // same and no global property with this name contains a value. |
3037 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 3024 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
3038 __ Ret(); | 3025 __ Ret(); |
3039 | 3026 |
3040 __ bind(&miss); | 3027 __ bind(&miss); |
3041 GenerateLoadMiss(masm(), Code::LOAD_IC); | 3028 GenerateLoadMiss(masm(), Code::LOAD_IC); |
3042 | 3029 |
3043 // Return the generated code. | 3030 // Return the generated code. |
3044 return GetCode(NONEXISTENT, heap()->empty_string()); | 3031 return GetCode(NONEXISTENT, factory()->empty_string()); |
3045 } | 3032 } |
3046 | 3033 |
3047 | 3034 |
3048 MaybeObject* LoadStubCompiler::CompileLoadField(JSObject* object, | 3035 Handle<Code> LoadStubCompiler::CompileLoadField(Handle<JSObject> object, |
3049 JSObject* holder, | 3036 Handle<JSObject> holder, |
3050 int index, | 3037 int index, |
3051 String* name) { | 3038 Handle<String> name) { |
3052 // ----------- S t a t e ------------- | 3039 // ----------- S t a t e ------------- |
3053 // -- r0 : receiver | 3040 // -- r0 : receiver |
3054 // -- r2 : name | 3041 // -- r2 : name |
3055 // -- lr : return address | 3042 // -- lr : return address |
3056 // ----------------------------------- | 3043 // ----------------------------------- |
3057 Label miss; | 3044 Label miss; |
3058 | 3045 |
3059 GenerateLoadField(object, holder, r0, r3, r1, r4, index, name, &miss); | 3046 GenerateLoadField(object, holder, r0, r3, r1, r4, index, name, &miss); |
3060 __ bind(&miss); | 3047 __ bind(&miss); |
3061 GenerateLoadMiss(masm(), Code::LOAD_IC); | 3048 GenerateLoadMiss(masm(), Code::LOAD_IC); |
(...skipping 18 matching lines...) Expand all Loading... |
3080 callback, name, &miss); | 3067 callback, name, &miss); |
3081 if (result->IsFailure()) { | 3068 if (result->IsFailure()) { |
3082 miss.Unuse(); | 3069 miss.Unuse(); |
3083 return result; | 3070 return result; |
3084 } | 3071 } |
3085 | 3072 |
3086 __ bind(&miss); | 3073 __ bind(&miss); |
3087 GenerateLoadMiss(masm(), Code::LOAD_IC); | 3074 GenerateLoadMiss(masm(), Code::LOAD_IC); |
3088 | 3075 |
3089 // Return the generated code. | 3076 // Return the generated code. |
3090 return GetCode(CALLBACKS, name); | 3077 return TryGetCode(CALLBACKS, name); |
3091 } | 3078 } |
3092 | 3079 |
3093 | 3080 |
3094 MaybeObject* LoadStubCompiler::CompileLoadConstant(JSObject* object, | 3081 Handle<Code> LoadStubCompiler::CompileLoadConstant(Handle<JSObject> object, |
3095 JSObject* holder, | 3082 Handle<JSObject> holder, |
3096 Object* value, | 3083 Handle<Object> value, |
3097 String* name) { | 3084 Handle<String> name) { |
3098 // ----------- S t a t e ------------- | 3085 // ----------- S t a t e ------------- |
3099 // -- r0 : receiver | 3086 // -- r0 : receiver |
3100 // -- r2 : name | 3087 // -- r2 : name |
3101 // -- lr : return address | 3088 // -- lr : return address |
3102 // ----------------------------------- | 3089 // ----------------------------------- |
3103 Label miss; | 3090 Label miss; |
3104 | 3091 |
3105 GenerateLoadConstant(object, holder, r0, r3, r1, r4, value, name, &miss); | 3092 GenerateLoadConstant(object, holder, r0, r3, r1, r4, value, name, &miss); |
3106 __ bind(&miss); | 3093 __ bind(&miss); |
3107 GenerateLoadMiss(masm(), Code::LOAD_IC); | 3094 GenerateLoadMiss(masm(), Code::LOAD_IC); |
(...skipping 22 matching lines...) Expand all Loading... |
3130 r2, | 3117 r2, |
3131 r3, | 3118 r3, |
3132 r1, | 3119 r1, |
3133 r4, | 3120 r4, |
3134 name, | 3121 name, |
3135 &miss); | 3122 &miss); |
3136 __ bind(&miss); | 3123 __ bind(&miss); |
3137 GenerateLoadMiss(masm(), Code::LOAD_IC); | 3124 GenerateLoadMiss(masm(), Code::LOAD_IC); |
3138 | 3125 |
3139 // Return the generated code. | 3126 // Return the generated code. |
3140 return GetCode(INTERCEPTOR, name); | 3127 return TryGetCode(INTERCEPTOR, name); |
3141 } | 3128 } |
3142 | 3129 |
3143 | 3130 |
3144 MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object, | 3131 MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object, |
3145 GlobalObject* holder, | 3132 GlobalObject* holder, |
3146 JSGlobalPropertyCell* cell, | 3133 JSGlobalPropertyCell* cell, |
3147 String* name, | 3134 String* name, |
3148 bool is_dont_delete) { | 3135 bool is_dont_delete) { |
3149 // ----------- S t a t e ------------- | 3136 // ----------- S t a t e ------------- |
3150 // -- r0 : receiver | 3137 // -- r0 : receiver |
(...skipping 26 matching lines...) Expand all Loading... |
3177 __ mov(r0, r4); | 3164 __ mov(r0, r4); |
3178 Counters* counters = masm()->isolate()->counters(); | 3165 Counters* counters = masm()->isolate()->counters(); |
3179 __ IncrementCounter(counters->named_load_global_stub(), 1, r1, r3); | 3166 __ IncrementCounter(counters->named_load_global_stub(), 1, r1, r3); |
3180 __ Ret(); | 3167 __ Ret(); |
3181 | 3168 |
3182 __ bind(&miss); | 3169 __ bind(&miss); |
3183 __ IncrementCounter(counters->named_load_global_stub_miss(), 1, r1, r3); | 3170 __ IncrementCounter(counters->named_load_global_stub_miss(), 1, r1, r3); |
3184 GenerateLoadMiss(masm(), Code::LOAD_IC); | 3171 GenerateLoadMiss(masm(), Code::LOAD_IC); |
3185 | 3172 |
3186 // Return the generated code. | 3173 // Return the generated code. |
3187 return GetCode(NORMAL, name); | 3174 return TryGetCode(NORMAL, name); |
3188 } | 3175 } |
3189 | 3176 |
3190 | 3177 |
3191 MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name, | 3178 Handle<Code> KeyedLoadStubCompiler::CompileLoadField(Handle<String> name, |
3192 JSObject* receiver, | 3179 Handle<JSObject> receiver, |
3193 JSObject* holder, | 3180 Handle<JSObject> holder, |
3194 int index) { | 3181 int index) { |
3195 // ----------- S t a t e ------------- | 3182 // ----------- S t a t e ------------- |
3196 // -- lr : return address | 3183 // -- lr : return address |
3197 // -- r0 : key | 3184 // -- r0 : key |
3198 // -- r1 : receiver | 3185 // -- r1 : receiver |
3199 // ----------------------------------- | 3186 // ----------------------------------- |
3200 Label miss; | 3187 Label miss; |
3201 | 3188 |
3202 // Check the key is the cached one. | 3189 // Check the key is the cached one. |
3203 __ cmp(r0, Operand(Handle<String>(name))); | 3190 __ cmp(r0, Operand(name)); |
3204 __ b(ne, &miss); | 3191 __ b(ne, &miss); |
3205 | 3192 |
3206 GenerateLoadField(receiver, holder, r1, r2, r3, r4, index, name, &miss); | 3193 GenerateLoadField(receiver, holder, r1, r2, r3, r4, index, name, &miss); |
3207 __ bind(&miss); | 3194 __ bind(&miss); |
3208 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3195 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3209 | 3196 |
3210 return GetCode(FIELD, name); | 3197 return GetCode(FIELD, name); |
3211 } | 3198 } |
3212 | 3199 |
3213 | 3200 |
(...skipping 16 matching lines...) Expand all Loading... |
3230 MaybeObject* result = GenerateLoadCallback(receiver, holder, r1, r0, r2, r3, | 3217 MaybeObject* result = GenerateLoadCallback(receiver, holder, r1, r0, r2, r3, |
3231 r4, callback, name, &miss); | 3218 r4, callback, name, &miss); |
3232 if (result->IsFailure()) { | 3219 if (result->IsFailure()) { |
3233 miss.Unuse(); | 3220 miss.Unuse(); |
3234 return result; | 3221 return result; |
3235 } | 3222 } |
3236 | 3223 |
3237 __ bind(&miss); | 3224 __ bind(&miss); |
3238 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3225 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3239 | 3226 |
3240 return GetCode(CALLBACKS, name); | 3227 return TryGetCode(CALLBACKS, name); |
3241 } | 3228 } |
3242 | 3229 |
3243 | 3230 |
3244 MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name, | 3231 Handle<Code> KeyedLoadStubCompiler::CompileLoadConstant( |
3245 JSObject* receiver, | 3232 Handle<String> name, |
3246 JSObject* holder, | 3233 Handle<JSObject> receiver, |
3247 Object* value) { | 3234 Handle<JSObject> holder, |
| 3235 Handle<Object> value) { |
3248 // ----------- S t a t e ------------- | 3236 // ----------- S t a t e ------------- |
3249 // -- lr : return address | 3237 // -- lr : return address |
3250 // -- r0 : key | 3238 // -- r0 : key |
3251 // -- r1 : receiver | 3239 // -- r1 : receiver |
3252 // ----------------------------------- | 3240 // ----------------------------------- |
3253 Label miss; | 3241 Label miss; |
3254 | 3242 |
3255 // Check the key is the cached one. | 3243 // Check the key is the cached one. |
3256 __ cmp(r0, Operand(Handle<String>(name))); | 3244 __ cmp(r0, Operand(name)); |
3257 __ b(ne, &miss); | 3245 __ b(ne, &miss); |
3258 | 3246 |
3259 GenerateLoadConstant(receiver, holder, r1, r2, r3, r4, value, name, &miss); | 3247 GenerateLoadConstant(receiver, holder, r1, r2, r3, r4, value, name, &miss); |
3260 __ bind(&miss); | 3248 __ bind(&miss); |
3261 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3249 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3262 | 3250 |
3263 // Return the generated code. | 3251 // Return the generated code. |
3264 return GetCode(CONSTANT_FUNCTION, name); | 3252 return GetCode(CONSTANT_FUNCTION, name); |
3265 } | 3253 } |
3266 | 3254 |
(...skipping 20 matching lines...) Expand all Loading... |
3287 r1, | 3275 r1, |
3288 r0, | 3276 r0, |
3289 r2, | 3277 r2, |
3290 r3, | 3278 r3, |
3291 r4, | 3279 r4, |
3292 name, | 3280 name, |
3293 &miss); | 3281 &miss); |
3294 __ bind(&miss); | 3282 __ bind(&miss); |
3295 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3283 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3296 | 3284 |
3297 return GetCode(INTERCEPTOR, name); | 3285 return TryGetCode(INTERCEPTOR, name); |
3298 } | 3286 } |
3299 | 3287 |
3300 | 3288 |
3301 MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { | 3289 Handle<Code> KeyedLoadStubCompiler::CompileLoadArrayLength( |
| 3290 Handle<String> name) { |
3302 // ----------- S t a t e ------------- | 3291 // ----------- S t a t e ------------- |
3303 // -- lr : return address | 3292 // -- lr : return address |
3304 // -- r0 : key | 3293 // -- r0 : key |
3305 // -- r1 : receiver | 3294 // -- r1 : receiver |
3306 // ----------------------------------- | 3295 // ----------------------------------- |
3307 Label miss; | 3296 Label miss; |
3308 | 3297 |
3309 // Check the key is the cached one. | 3298 // Check the key is the cached one. |
3310 __ cmp(r0, Operand(Handle<String>(name))); | 3299 __ cmp(r0, Operand(name)); |
3311 __ b(ne, &miss); | 3300 __ b(ne, &miss); |
3312 | 3301 |
3313 GenerateLoadArrayLength(masm(), r1, r2, &miss); | 3302 GenerateLoadArrayLength(masm(), r1, r2, &miss); |
3314 __ bind(&miss); | 3303 __ bind(&miss); |
3315 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3304 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3316 | 3305 |
3317 return GetCode(CALLBACKS, name); | 3306 return GetCode(CALLBACKS, name); |
3318 } | 3307 } |
3319 | 3308 |
3320 | 3309 |
3321 MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { | 3310 Handle<Code> KeyedLoadStubCompiler::CompileLoadStringLength( |
| 3311 Handle<String> name) { |
3322 // ----------- S t a t e ------------- | 3312 // ----------- S t a t e ------------- |
3323 // -- lr : return address | 3313 // -- lr : return address |
3324 // -- r0 : key | 3314 // -- r0 : key |
3325 // -- r1 : receiver | 3315 // -- r1 : receiver |
3326 // ----------------------------------- | 3316 // ----------------------------------- |
3327 Label miss; | 3317 Label miss; |
3328 | 3318 |
3329 Counters* counters = masm()->isolate()->counters(); | 3319 Counters* counters = masm()->isolate()->counters(); |
3330 __ IncrementCounter(counters->keyed_load_string_length(), 1, r2, r3); | 3320 __ IncrementCounter(counters->keyed_load_string_length(), 1, r2, r3); |
3331 | 3321 |
3332 // Check the key is the cached one. | 3322 // Check the key is the cached one. |
3333 __ cmp(r0, Operand(Handle<String>(name))); | 3323 __ cmp(r0, Operand(name)); |
3334 __ b(ne, &miss); | 3324 __ b(ne, &miss); |
3335 | 3325 |
3336 GenerateLoadStringLength(masm(), r1, r2, r3, &miss, true); | 3326 GenerateLoadStringLength(masm(), r1, r2, r3, &miss, true); |
3337 __ bind(&miss); | 3327 __ bind(&miss); |
3338 __ DecrementCounter(counters->keyed_load_string_length(), 1, r2, r3); | 3328 __ DecrementCounter(counters->keyed_load_string_length(), 1, r2, r3); |
3339 | 3329 |
3340 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3330 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3341 | 3331 |
3342 return GetCode(CALLBACKS, name); | 3332 return GetCode(CALLBACKS, name); |
3343 } | 3333 } |
3344 | 3334 |
3345 | 3335 |
3346 MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { | 3336 Handle<Code> KeyedLoadStubCompiler::CompileLoadFunctionPrototype( |
| 3337 Handle<String> name) { |
3347 // ----------- S t a t e ------------- | 3338 // ----------- S t a t e ------------- |
3348 // -- lr : return address | 3339 // -- lr : return address |
3349 // -- r0 : key | 3340 // -- r0 : key |
3350 // -- r1 : receiver | 3341 // -- r1 : receiver |
3351 // ----------------------------------- | 3342 // ----------------------------------- |
3352 Label miss; | 3343 Label miss; |
3353 | 3344 |
3354 Counters* counters = masm()->isolate()->counters(); | 3345 Counters* counters = masm()->isolate()->counters(); |
3355 __ IncrementCounter(counters->keyed_load_function_prototype(), 1, r2, r3); | 3346 __ IncrementCounter(counters->keyed_load_function_prototype(), 1, r2, r3); |
3356 | 3347 |
3357 // Check the name hasn't changed. | 3348 // Check the name hasn't changed. |
3358 __ cmp(r0, Operand(Handle<String>(name))); | 3349 __ cmp(r0, Operand(name)); |
3359 __ b(ne, &miss); | 3350 __ b(ne, &miss); |
3360 | 3351 |
3361 GenerateLoadFunctionPrototype(masm(), r1, r2, r3, &miss); | 3352 GenerateLoadFunctionPrototype(masm(), r1, r2, r3, &miss); |
3362 __ bind(&miss); | 3353 __ bind(&miss); |
3363 __ DecrementCounter(counters->keyed_load_function_prototype(), 1, r2, r3); | 3354 __ DecrementCounter(counters->keyed_load_function_prototype(), 1, r2, r3); |
3364 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3355 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3365 | 3356 |
3366 return GetCode(CALLBACKS, name); | 3357 return GetCode(CALLBACKS, name); |
3367 } | 3358 } |
3368 | 3359 |
(...skipping 11 matching lines...) Expand all Loading... |
3380 __ DispatchMap(r1, | 3371 __ DispatchMap(r1, |
3381 r2, | 3372 r2, |
3382 Handle<Map>(receiver_map), | 3373 Handle<Map>(receiver_map), |
3383 Handle<Code>(stub), | 3374 Handle<Code>(stub), |
3384 DO_SMI_CHECK); | 3375 DO_SMI_CHECK); |
3385 | 3376 |
3386 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); | 3377 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); |
3387 __ Jump(ic, RelocInfo::CODE_TARGET); | 3378 __ Jump(ic, RelocInfo::CODE_TARGET); |
3388 | 3379 |
3389 // Return the generated code. | 3380 // Return the generated code. |
3390 return GetCode(NORMAL, NULL); | 3381 return TryGetCode(NORMAL, NULL); |
3391 } | 3382 } |
3392 | 3383 |
3393 | 3384 |
3394 MaybeObject* KeyedLoadStubCompiler::CompileLoadPolymorphic( | 3385 MaybeObject* KeyedLoadStubCompiler::CompileLoadPolymorphic( |
3395 MapList* receiver_maps, | 3386 MapList* receiver_maps, |
3396 CodeList* handler_ics) { | 3387 CodeList* handler_ics) { |
3397 // ----------- S t a t e ------------- | 3388 // ----------- S t a t e ------------- |
3398 // -- lr : return address | 3389 // -- lr : return address |
3399 // -- r0 : key | 3390 // -- r0 : key |
3400 // -- r1 : receiver | 3391 // -- r1 : receiver |
3401 // ----------------------------------- | 3392 // ----------------------------------- |
3402 Label miss; | 3393 Label miss; |
3403 __ JumpIfSmi(r1, &miss); | 3394 __ JumpIfSmi(r1, &miss); |
3404 | 3395 |
3405 int receiver_count = receiver_maps->length(); | 3396 int receiver_count = receiver_maps->length(); |
3406 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); | 3397 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); |
3407 for (int current = 0; current < receiver_count; ++current) { | 3398 for (int current = 0; current < receiver_count; ++current) { |
3408 Handle<Map> map(receiver_maps->at(current)); | 3399 Handle<Map> map(receiver_maps->at(current)); |
3409 Handle<Code> code(handler_ics->at(current)); | 3400 Handle<Code> code(handler_ics->at(current)); |
3410 __ mov(ip, Operand(map)); | 3401 __ mov(ip, Operand(map)); |
3411 __ cmp(r2, ip); | 3402 __ cmp(r2, ip); |
3412 __ Jump(code, RelocInfo::CODE_TARGET, eq); | 3403 __ Jump(code, RelocInfo::CODE_TARGET, eq); |
3413 } | 3404 } |
3414 | 3405 |
3415 __ bind(&miss); | 3406 __ bind(&miss); |
3416 Handle<Code> miss_ic = isolate()->builtins()->KeyedLoadIC_Miss(); | 3407 Handle<Code> miss_ic = isolate()->builtins()->KeyedLoadIC_Miss(); |
3417 __ Jump(miss_ic, RelocInfo::CODE_TARGET, al); | 3408 __ Jump(miss_ic, RelocInfo::CODE_TARGET, al); |
3418 | 3409 |
3419 // Return the generated code. | 3410 // Return the generated code. |
3420 return GetCode(NORMAL, NULL, MEGAMORPHIC); | 3411 return TryGetCode(NORMAL, NULL, MEGAMORPHIC); |
3421 } | 3412 } |
3422 | 3413 |
3423 | 3414 |
3424 MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, | 3415 MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, |
3425 int index, | 3416 int index, |
3426 Map* transition, | 3417 Map* transition, |
3427 String* name) { | 3418 String* name) { |
3428 // ----------- S t a t e ------------- | 3419 // ----------- S t a t e ------------- |
3429 // -- r0 : value | 3420 // -- r0 : value |
3430 // -- r1 : name | 3421 // -- r1 : name |
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4673 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); | 4664 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); |
4674 __ Jump(ic_miss, RelocInfo::CODE_TARGET); | 4665 __ Jump(ic_miss, RelocInfo::CODE_TARGET); |
4675 } | 4666 } |
4676 | 4667 |
4677 | 4668 |
4678 #undef __ | 4669 #undef __ |
4679 | 4670 |
4680 } } // namespace v8::internal | 4671 } } // namespace v8::internal |
4681 | 4672 |
4682 #endif // V8_TARGET_ARCH_ARM | 4673 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |