| 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 3160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3171 DO_SMI_CHECK); | 3171 DO_SMI_CHECK); |
| 3172 | 3172 |
| 3173 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); | 3173 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); |
| 3174 __ Jump(ic, RelocInfo::CODE_TARGET); | 3174 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 3175 | 3175 |
| 3176 // Return the generated code. | 3176 // Return the generated code. |
| 3177 return GetCode(NORMAL, NULL); | 3177 return GetCode(NORMAL, NULL); |
| 3178 } | 3178 } |
| 3179 | 3179 |
| 3180 | 3180 |
| 3181 MaybeObject* KeyedLoadStubCompiler::CompileLoadMegamorphic( | 3181 MaybeObject* KeyedLoadStubCompiler::CompileLoadPolymorphic( |
| 3182 MapList* receiver_maps, | 3182 MapList* receiver_maps, |
| 3183 CodeList* handler_ics) { | 3183 CodeList* handler_ics) { |
| 3184 // ----------- S t a t e ------------- | 3184 // ----------- S t a t e ------------- |
| 3185 // -- lr : return address | 3185 // -- lr : return address |
| 3186 // -- r0 : key | 3186 // -- r0 : key |
| 3187 // -- r1 : receiver | 3187 // -- r1 : receiver |
| 3188 // ----------------------------------- | 3188 // ----------------------------------- |
| 3189 Label miss; | 3189 Label miss; |
| 3190 __ JumpIfSmi(r1, &miss); | 3190 __ JumpIfSmi(r1, &miss); |
| 3191 | 3191 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3267 DO_SMI_CHECK); | 3267 DO_SMI_CHECK); |
| 3268 | 3268 |
| 3269 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); | 3269 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); |
| 3270 __ Jump(ic, RelocInfo::CODE_TARGET); | 3270 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 3271 | 3271 |
| 3272 // Return the generated code. | 3272 // Return the generated code. |
| 3273 return GetCode(NORMAL, NULL); | 3273 return GetCode(NORMAL, NULL); |
| 3274 } | 3274 } |
| 3275 | 3275 |
| 3276 | 3276 |
| 3277 MaybeObject* KeyedStoreStubCompiler::CompileStoreElementWithTransition( | 3277 MaybeObject* KeyedStoreStubCompiler::CompileStorePolymorphic( |
| 3278 Map* transitioned_map, | 3278 MapList* receiver_maps, |
| 3279 Map* untransitioned_map_1, | 3279 CodeList* handler_stubs, |
| 3280 Map* untransitioned_map_2) { | 3280 MapList* transitioned_maps) { |
| 3281 // ----------- S t a t e ------------- | 3281 // ----------- S t a t e ------------- |
| 3282 // -- r0 : value | 3282 // -- r0 : value |
| 3283 // -- r1 : key | 3283 // -- r1 : key |
| 3284 // -- r2 : receiver | |
| 3285 // -- lr : return address | |
| 3286 // -- r3 : scratch | |
| 3287 // ----------------------------------- | |
| 3288 | |
| 3289 // The order of map occurrences in the generated code below is important. | |
| 3290 // Both IC code and Crankshaft rely on |transitioned_map| being the first | |
| 3291 // map in the stub. | |
| 3292 | |
| 3293 Code* notransition_stub; | |
| 3294 ElementsKind elements_kind = transitioned_map->elements_kind(); | |
| 3295 bool is_js_array = transitioned_map->instance_type() == JS_ARRAY_TYPE; | |
| 3296 MaybeObject* maybe_stub = | |
| 3297 KeyedStoreElementStub(is_js_array, elements_kind).TryGetCode(); | |
| 3298 if (!maybe_stub->To(¬ransition_stub)) return maybe_stub; | |
| 3299 | |
| 3300 Label just_store, miss; | |
| 3301 __ JumpIfSmi(r2, &miss); | |
| 3302 __ ldr(r3, FieldMemOperand(r2, HeapObject::kMapOffset)); | |
| 3303 // r3: receiver->map(). | |
| 3304 __ mov(ip, Operand(Handle<Map>(transitioned_map))); | |
| 3305 __ cmp(r3, ip); | |
| 3306 __ b(eq, &just_store); | |
| 3307 ASSERT_NE(untransitioned_map_1, NULL); | |
| 3308 __ mov(ip, Operand(Handle<Map>(untransitioned_map_1))); | |
| 3309 __ cmp(r3, ip); | |
| 3310 Code* generic_stub = (strict_mode_ == kStrictMode) | |
| 3311 ? isolate()->builtins()->builtin(Builtins::kKeyedStoreIC_Generic_Strict) | |
| 3312 : isolate()->builtins()->builtin(Builtins::kKeyedStoreIC_Generic); | |
| 3313 __ Jump(Handle<Code>(generic_stub), RelocInfo::CODE_TARGET, eq); | |
| 3314 if (untransitioned_map_2 != NULL) { | |
| 3315 __ mov(ip, Operand(Handle<Map>(untransitioned_map_2))); | |
| 3316 __ cmp(r3, ip); | |
| 3317 __ Jump(Handle<Code>(generic_stub), RelocInfo::CODE_TARGET, eq); | |
| 3318 } | |
| 3319 | |
| 3320 __ bind(&miss); | |
| 3321 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); | |
| 3322 __ Jump(ic, RelocInfo::CODE_TARGET); | |
| 3323 | |
| 3324 __ bind(&just_store); | |
| 3325 __ Jump(Handle<Code>(notransition_stub), RelocInfo::CODE_TARGET); | |
| 3326 | |
| 3327 // Return the generated code. | |
| 3328 return GetCode(NORMAL, NULL, MEGAMORPHIC); | |
| 3329 } | |
| 3330 | |
| 3331 | |
| 3332 MaybeObject* KeyedStoreStubCompiler::CompileStoreMegamorphic( | |
| 3333 MapList* receiver_maps, | |
| 3334 CodeList* handler_ics) { | |
| 3335 // ----------- S t a t e ------------- | |
| 3336 // -- r0 : value | |
| 3337 // -- r1 : key | |
| 3338 // -- r2 : receiver | 3284 // -- r2 : receiver |
| 3339 // -- lr : return address | 3285 // -- lr : return address |
| 3340 // -- r3 : scratch | 3286 // -- r3 : scratch |
| 3341 // ----------------------------------- | 3287 // ----------------------------------- |
| 3342 Label miss; | 3288 Label miss; |
| 3343 __ JumpIfSmi(r2, &miss); | 3289 __ JumpIfSmi(r2, &miss); |
| 3344 | 3290 |
| 3345 int receiver_count = receiver_maps->length(); | 3291 int receiver_count = receiver_maps->length(); |
| 3346 __ ldr(r3, FieldMemOperand(r2, HeapObject::kMapOffset)); | 3292 __ ldr(r3, FieldMemOperand(r2, HeapObject::kMapOffset)); |
| 3347 for (int current = 0; current < receiver_count; ++current) { | 3293 for (int i = 0; i < receiver_count; ++i) { |
| 3348 Handle<Map> map(receiver_maps->at(current)); | 3294 Handle<Map> map(receiver_maps->at(i)); |
| 3349 Handle<Code> code(handler_ics->at(current)); | 3295 Handle<Code> code(handler_stubs->at(i)); |
| 3350 __ mov(ip, Operand(map)); | 3296 __ mov(ip, Operand(map)); |
| 3351 __ cmp(r3, ip); | 3297 __ cmp(r3, ip); |
| 3352 __ Jump(code, RelocInfo::CODE_TARGET, eq); | 3298 if (transitioned_maps->at(i) == NULL) { |
| 3299 __ Jump(code, RelocInfo::CODE_TARGET, eq); |
| 3300 } else { |
| 3301 Label next_map; |
| 3302 __ b(eq, &next_map); |
| 3303 __ mov(r4, Operand(Handle<Map>(transitioned_maps->at(i)))); |
| 3304 __ Jump(code, RelocInfo::CODE_TARGET, al); |
| 3305 __ bind(&next_map); |
| 3306 } |
| 3353 } | 3307 } |
| 3354 | 3308 |
| 3355 __ bind(&miss); | 3309 __ bind(&miss); |
| 3356 Handle<Code> miss_ic = isolate()->builtins()->KeyedStoreIC_Miss(); | 3310 Handle<Code> miss_ic = isolate()->builtins()->KeyedStoreIC_Miss(); |
| 3357 __ Jump(miss_ic, RelocInfo::CODE_TARGET, al); | 3311 __ Jump(miss_ic, RelocInfo::CODE_TARGET, al); |
| 3358 | 3312 |
| 3359 // Return the generated code. | 3313 // Return the generated code. |
| 3360 return GetCode(NORMAL, NULL, MEGAMORPHIC); | 3314 return GetCode(NORMAL, NULL, MEGAMORPHIC); |
| 3361 } | 3315 } |
| 3362 | 3316 |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4506 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); | 4460 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); |
| 4507 __ Jump(ic_miss, RelocInfo::CODE_TARGET); | 4461 __ Jump(ic_miss, RelocInfo::CODE_TARGET); |
| 4508 } | 4462 } |
| 4509 | 4463 |
| 4510 | 4464 |
| 4511 #undef __ | 4465 #undef __ |
| 4512 | 4466 |
| 4513 } } // namespace v8::internal | 4467 } } // namespace v8::internal |
| 4514 | 4468 |
| 4515 #endif // V8_TARGET_ARCH_ARM | 4469 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |