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

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

Issue 22745003: Remove platform-specific dead code for KeyedStores (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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 | « src/flag-definitions.h ('k') | src/ic.cc » ('j') | 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 3236 matching lines...) Expand 10 before | Expand all | Expand 10 after
3247 __ bind(&miss_force_generic); 3247 __ bind(&miss_force_generic);
3248 // ----------- S t a t e ------------- 3248 // ----------- S t a t e -------------
3249 // -- ecx : key 3249 // -- ecx : key
3250 // -- edx : receiver 3250 // -- edx : receiver
3251 // -- esp[0] : return address 3251 // -- esp[0] : return address
3252 // ----------------------------------- 3252 // -----------------------------------
3253 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3253 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3254 } 3254 }
3255 3255
3256 3256
3257 static void GenerateSmiKeyCheck(MacroAssembler* masm,
3258 Register key,
3259 Register scratch,
3260 XMMRegister xmm_scratch0,
3261 XMMRegister xmm_scratch1,
3262 Label* fail) {
3263 // Check that key is a smi and if SSE2 is available a heap number
3264 // containing a smi and branch if the check fails.
3265 if (CpuFeatures::IsSupported(SSE2)) {
3266 CpuFeatureScope use_sse2(masm, SSE2);
3267 Label key_ok;
3268 __ JumpIfSmi(key, &key_ok);
3269 __ cmp(FieldOperand(key, HeapObject::kMapOffset),
3270 Immediate(Handle<Map>(masm->isolate()->heap()->heap_number_map())));
3271 __ j(not_equal, fail);
3272 __ movdbl(xmm_scratch0, FieldOperand(key, HeapNumber::kValueOffset));
3273 __ cvttsd2si(scratch, Operand(xmm_scratch0));
3274 __ cvtsi2sd(xmm_scratch1, scratch);
3275 __ ucomisd(xmm_scratch1, xmm_scratch0);
3276 __ j(not_equal, fail);
3277 __ j(parity_even, fail); // NaN.
3278 // Check if the key fits in the smi range.
3279 __ cmp(scratch, 0xc0000000);
3280 __ j(sign, fail);
3281 __ SmiTag(scratch);
3282 __ mov(key, scratch);
3283 __ bind(&key_ok);
3284 } else {
3285 __ JumpIfNotSmi(key, fail);
3286 }
3287 }
3288
3289
3290 void KeyedStoreStubCompiler::GenerateStoreExternalArray(
3291 MacroAssembler* masm,
3292 ElementsKind elements_kind) {
3293 // ----------- S t a t e -------------
3294 // -- eax : value
3295 // -- ecx : key
3296 // -- edx : receiver
3297 // -- esp[0] : return address
3298 // -----------------------------------
3299 Label miss_force_generic, slow, check_heap_number;
3300
3301 // This stub is meant to be tail-jumped to, the receiver must already
3302 // have been verified by the caller to not be a smi.
3303
3304 // Check that the key is a smi or a heap number convertible to a smi.
3305 GenerateSmiKeyCheck(masm, ecx, ebx, xmm0, xmm1, &miss_force_generic);
3306
3307 // Check that the index is in range.
3308 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
3309 __ cmp(ecx, FieldOperand(edi, ExternalArray::kLengthOffset));
3310 // Unsigned comparison catches both negative and too-large values.
3311 __ j(above_equal, &slow);
3312
3313 // Handle both smis and HeapNumbers in the fast path. Go to the
3314 // runtime for all other kinds of values.
3315 // eax: value
3316 // edx: receiver
3317 // ecx: key
3318 // edi: elements array
3319 if (elements_kind == EXTERNAL_PIXEL_ELEMENTS) {
3320 __ JumpIfNotSmi(eax, &slow);
3321 } else {
3322 __ JumpIfNotSmi(eax, &check_heap_number);
3323 }
3324
3325 // smi case
3326 __ mov(ebx, eax); // Preserve the value in eax as the return value.
3327 __ SmiUntag(ebx);
3328 __ mov(edi, FieldOperand(edi, ExternalArray::kExternalPointerOffset));
3329 // edi: base pointer of external storage
3330 switch (elements_kind) {
3331 case EXTERNAL_PIXEL_ELEMENTS:
3332 __ ClampUint8(ebx);
3333 __ SmiUntag(ecx);
3334 __ mov_b(Operand(edi, ecx, times_1, 0), ebx);
3335 break;
3336 case EXTERNAL_BYTE_ELEMENTS:
3337 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
3338 __ SmiUntag(ecx);
3339 __ mov_b(Operand(edi, ecx, times_1, 0), ebx);
3340 break;
3341 case EXTERNAL_SHORT_ELEMENTS:
3342 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
3343 __ mov_w(Operand(edi, ecx, times_1, 0), ebx);
3344 break;
3345 case EXTERNAL_INT_ELEMENTS:
3346 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
3347 __ mov(Operand(edi, ecx, times_2, 0), ebx);
3348 break;
3349 case EXTERNAL_FLOAT_ELEMENTS:
3350 case EXTERNAL_DOUBLE_ELEMENTS:
3351 // Need to perform int-to-float conversion.
3352 __ push(ebx);
3353 __ fild_s(Operand(esp, 0));
3354 __ pop(ebx);
3355 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) {
3356 __ fstp_s(Operand(edi, ecx, times_2, 0));
3357 } else { // elements_kind == EXTERNAL_DOUBLE_ELEMENTS.
3358 __ fstp_d(Operand(edi, ecx, times_4, 0));
3359 }
3360 break;
3361 default:
3362 UNREACHABLE();
3363 break;
3364 }
3365 __ ret(0); // Return the original value.
3366
3367 // TODO(danno): handle heap number -> pixel array conversion
3368 if (elements_kind != EXTERNAL_PIXEL_ELEMENTS) {
3369 __ bind(&check_heap_number);
3370 // eax: value
3371 // edx: receiver
3372 // ecx: key
3373 // edi: elements array
3374 __ cmp(FieldOperand(eax, HeapObject::kMapOffset),
3375 Immediate(masm->isolate()->factory()->heap_number_map()));
3376 __ j(not_equal, &slow);
3377
3378 // The WebGL specification leaves the behavior of storing NaN and
3379 // +/-Infinity into integer arrays basically undefined. For more
3380 // reproducible behavior, convert these to zero.
3381 __ mov(edi, FieldOperand(edi, ExternalArray::kExternalPointerOffset));
3382 // edi: base pointer of external storage
3383 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) {
3384 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset));
3385 __ fstp_s(Operand(edi, ecx, times_2, 0));
3386 __ ret(0);
3387 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) {
3388 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset));
3389 __ fstp_d(Operand(edi, ecx, times_4, 0));
3390 __ ret(0);
3391 } else {
3392 // Perform float-to-int conversion with truncation (round-to-zero)
3393 // behavior.
3394
3395 // For the moment we make the slow call to the runtime on
3396 // processors that don't support SSE2. The code in IntegerConvert
3397 // (code-stubs-ia32.cc) is roughly what is needed here though the
3398 // conversion failure case does not need to be handled.
3399 if (CpuFeatures::IsSupported(SSE2)) {
3400 if ((elements_kind == EXTERNAL_INT_ELEMENTS ||
3401 elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) &&
3402 CpuFeatures::IsSupported(SSE3)) {
3403 CpuFeatureScope scope(masm, SSE3);
3404 // fisttp stores values as signed integers. To represent the
3405 // entire range of int and unsigned int arrays, store as a
3406 // 64-bit int and discard the high 32 bits.
3407 __ fld_d(FieldOperand(eax, HeapNumber::kValueOffset));
3408 __ sub(esp, Immediate(2 * kPointerSize));
3409 __ fisttp_d(Operand(esp, 0));
3410
3411 // If conversion failed (NaN, infinity, or a number outside
3412 // signed int64 range), the result is 0x8000000000000000, and
3413 // we must handle this case in the runtime.
3414 Label ok;
3415 __ cmp(Operand(esp, kPointerSize), Immediate(0x80000000u));
3416 __ j(not_equal, &ok);
3417 __ cmp(Operand(esp, 0), Immediate(0));
3418 __ j(not_equal, &ok);
3419 __ add(esp, Immediate(2 * kPointerSize)); // Restore the stack.
3420 __ jmp(&slow);
3421
3422 __ bind(&ok);
3423 __ pop(ebx);
3424 __ add(esp, Immediate(kPointerSize));
3425 __ mov(Operand(edi, ecx, times_2, 0), ebx);
3426 } else {
3427 ASSERT(CpuFeatures::IsSupported(SSE2));
3428 CpuFeatureScope scope(masm, SSE2);
3429 __ cvttsd2si(ebx, FieldOperand(eax, HeapNumber::kValueOffset));
3430 __ cmp(ebx, 0x80000000u);
3431 __ j(equal, &slow);
3432 // ebx: untagged integer value
3433 switch (elements_kind) {
3434 case EXTERNAL_PIXEL_ELEMENTS:
3435 __ ClampUint8(ebx);
3436 // Fall through.
3437 case EXTERNAL_BYTE_ELEMENTS:
3438 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
3439 __ SmiUntag(ecx);
3440 __ mov_b(Operand(edi, ecx, times_1, 0), ebx);
3441 break;
3442 case EXTERNAL_SHORT_ELEMENTS:
3443 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
3444 __ mov_w(Operand(edi, ecx, times_1, 0), ebx);
3445 break;
3446 case EXTERNAL_INT_ELEMENTS:
3447 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
3448 __ mov(Operand(edi, ecx, times_2, 0), ebx);
3449 break;
3450 default:
3451 UNREACHABLE();
3452 break;
3453 }
3454 }
3455 __ ret(0); // Return original value.
3456 }
3457 }
3458 }
3459
3460 // Slow case: call runtime.
3461 __ bind(&slow);
3462 Counters* counters = masm->isolate()->counters();
3463 __ IncrementCounter(counters->keyed_store_external_array_slow(), 1);
3464
3465 // ----------- S t a t e -------------
3466 // -- eax : value
3467 // -- ecx : key
3468 // -- edx : receiver
3469 // -- esp[0] : return address
3470 // -----------------------------------
3471 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3472
3473 // ----------- S t a t e -------------
3474 // -- eax : value
3475 // -- ecx : key
3476 // -- edx : receiver
3477 // -- esp[0] : return address
3478 // -----------------------------------
3479
3480 __ bind(&miss_force_generic);
3481 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_MissForceGeneric);
3482 }
3483
3484
3485 void KeyedStoreStubCompiler::GenerateStoreFastElement(
3486 MacroAssembler* masm,
3487 bool is_js_array,
3488 ElementsKind elements_kind,
3489 KeyedAccessStoreMode store_mode) {
3490 // ----------- S t a t e -------------
3491 // -- eax : value
3492 // -- ecx : key
3493 // -- edx : receiver
3494 // -- esp[0] : return address
3495 // -----------------------------------
3496 Label miss_force_generic, grow, slow, transition_elements_kind;
3497 Label check_capacity, prepare_slow, finish_store, commit_backing_store;
3498
3499 // This stub is meant to be tail-jumped to, the receiver must already
3500 // have been verified by the caller to not be a smi.
3501
3502 // Check that the key is a smi or a heap number convertible to a smi.
3503 GenerateSmiKeyCheck(masm, ecx, ebx, xmm0, xmm1, &miss_force_generic);
3504
3505 if (IsFastSmiElementsKind(elements_kind)) {
3506 __ JumpIfNotSmi(eax, &transition_elements_kind);
3507 }
3508
3509 // Get the elements array and make sure it is a fast element array, not 'cow'.
3510 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
3511 if (is_js_array) {
3512 // Check that the key is within bounds.
3513 __ cmp(ecx, FieldOperand(edx, JSArray::kLengthOffset)); // smis.
3514 if (IsGrowStoreMode(store_mode)) {
3515 __ j(above_equal, &grow);
3516 } else {
3517 __ j(above_equal, &miss_force_generic);
3518 }
3519 } else {
3520 // Check that the key is within bounds.
3521 __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); // smis.
3522 __ j(above_equal, &miss_force_generic);
3523 }
3524
3525 __ cmp(FieldOperand(edi, HeapObject::kMapOffset),
3526 Immediate(masm->isolate()->factory()->fixed_array_map()));
3527 __ j(not_equal, &miss_force_generic);
3528
3529 __ bind(&finish_store);
3530 if (IsFastSmiElementsKind(elements_kind)) {
3531 // ecx is a smi, use times_half_pointer_size instead of
3532 // times_pointer_size
3533 __ mov(FieldOperand(edi,
3534 ecx,
3535 times_half_pointer_size,
3536 FixedArray::kHeaderSize), eax);
3537 } else {
3538 ASSERT(IsFastObjectElementsKind(elements_kind));
3539 // Do the store and update the write barrier.
3540 // ecx is a smi, use times_half_pointer_size instead of
3541 // times_pointer_size
3542 __ lea(ecx, FieldOperand(edi,
3543 ecx,
3544 times_half_pointer_size,
3545 FixedArray::kHeaderSize));
3546 __ mov(Operand(ecx, 0), eax);
3547 // Make sure to preserve the value in register eax.
3548 __ mov(ebx, eax);
3549 __ RecordWrite(edi, ecx, ebx, kDontSaveFPRegs);
3550 }
3551
3552 // Done.
3553 __ ret(0);
3554
3555 // Handle store cache miss, replacing the ic with the generic stub.
3556 __ bind(&miss_force_generic);
3557 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_MissForceGeneric);
3558
3559 // Handle transition to other elements kinds without using the generic stub.
3560 __ bind(&transition_elements_kind);
3561 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Miss);
3562
3563 if (is_js_array && IsGrowStoreMode(store_mode)) {
3564 // Handle transition requiring the array to grow.
3565 __ bind(&grow);
3566
3567 // Make sure the array is only growing by a single element, anything else
3568 // must be handled by the runtime. Flags are already set by previous
3569 // compare.
3570 __ j(not_equal, &miss_force_generic);
3571
3572 // Check for the empty array, and preallocate a small backing store if
3573 // possible.
3574 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
3575 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array()));
3576 __ j(not_equal, &check_capacity);
3577
3578 int size = FixedArray::SizeFor(JSArray::kPreallocatedArrayElements);
3579 __ Allocate(size, edi, ebx, ecx, &prepare_slow, TAG_OBJECT);
3580 // Restore the key, which is known to be the array length.
3581
3582 // eax: value
3583 // ecx: key
3584 // edx: receiver
3585 // edi: elements
3586 // Make sure that the backing store can hold additional elements.
3587 __ mov(FieldOperand(edi, JSObject::kMapOffset),
3588 Immediate(masm->isolate()->factory()->fixed_array_map()));
3589 __ mov(FieldOperand(edi, FixedArray::kLengthOffset),
3590 Immediate(Smi::FromInt(JSArray::kPreallocatedArrayElements)));
3591 __ mov(ebx, Immediate(masm->isolate()->factory()->the_hole_value()));
3592 for (int i = 1; i < JSArray::kPreallocatedArrayElements; ++i) {
3593 __ mov(FieldOperand(edi, FixedArray::SizeFor(i)), ebx);
3594 }
3595
3596 // Store the element at index zero.
3597 __ mov(FieldOperand(edi, FixedArray::SizeFor(0)), eax);
3598
3599 // Install the new backing store in the JSArray.
3600 __ mov(FieldOperand(edx, JSObject::kElementsOffset), edi);
3601 __ RecordWriteField(edx, JSObject::kElementsOffset, edi, ebx,
3602 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
3603
3604 // Increment the length of the array.
3605 __ mov(FieldOperand(edx, JSArray::kLengthOffset),
3606 Immediate(Smi::FromInt(1)));
3607 __ ret(0);
3608
3609 __ bind(&check_capacity);
3610 __ cmp(FieldOperand(edi, HeapObject::kMapOffset),
3611 Immediate(masm->isolate()->factory()->fixed_cow_array_map()));
3612 __ j(equal, &miss_force_generic);
3613
3614 // eax: value
3615 // ecx: key
3616 // edx: receiver
3617 // edi: elements
3618 // Make sure that the backing store can hold additional elements.
3619 __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset));
3620 __ j(above_equal, &slow);
3621
3622 // Grow the array and finish the store.
3623 __ add(FieldOperand(edx, JSArray::kLengthOffset),
3624 Immediate(Smi::FromInt(1)));
3625 __ jmp(&finish_store);
3626
3627 __ bind(&prepare_slow);
3628 // Restore the key, which is known to be the array length.
3629 __ mov(ecx, Immediate(0));
3630
3631 __ bind(&slow);
3632 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3633 }
3634 }
3635
3636
3637 void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(
3638 MacroAssembler* masm,
3639 bool is_js_array,
3640 KeyedAccessStoreMode store_mode) {
3641 // ----------- S t a t e -------------
3642 // -- eax : value
3643 // -- ecx : key
3644 // -- edx : receiver
3645 // -- esp[0] : return address
3646 // -----------------------------------
3647 Label miss_force_generic, transition_elements_kind, grow, slow;
3648 Label check_capacity, prepare_slow, finish_store, commit_backing_store;
3649
3650 // This stub is meant to be tail-jumped to, the receiver must already
3651 // have been verified by the caller to not be a smi.
3652
3653 // Check that the key is a smi or a heap number convertible to a smi.
3654 GenerateSmiKeyCheck(masm, ecx, ebx, xmm0, xmm1, &miss_force_generic);
3655
3656 // Get the elements array.
3657 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
3658 __ AssertFastElements(edi);
3659
3660 if (is_js_array) {
3661 // Check that the key is within bounds.
3662 __ cmp(ecx, FieldOperand(edx, JSArray::kLengthOffset)); // smis.
3663 if (IsGrowStoreMode(store_mode)) {
3664 __ j(above_equal, &grow);
3665 } else {
3666 __ j(above_equal, &miss_force_generic);
3667 }
3668 } else {
3669 // Check that the key is within bounds.
3670 __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); // smis.
3671 __ j(above_equal, &miss_force_generic);
3672 }
3673
3674 __ bind(&finish_store);
3675 __ StoreNumberToDoubleElements(eax, edi, ecx, edx, xmm0,
3676 &transition_elements_kind, true);
3677 __ ret(0);
3678
3679 // Handle store cache miss, replacing the ic with the generic stub.
3680 __ bind(&miss_force_generic);
3681 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_MissForceGeneric);
3682
3683 // Handle transition to other elements kinds without using the generic stub.
3684 __ bind(&transition_elements_kind);
3685 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Miss);
3686
3687 if (is_js_array && IsGrowStoreMode(store_mode)) {
3688 // Handle transition requiring the array to grow.
3689 __ bind(&grow);
3690
3691 // Make sure the array is only growing by a single element, anything else
3692 // must be handled by the runtime. Flags are already set by previous
3693 // compare.
3694 __ j(not_equal, &miss_force_generic);
3695
3696 // Transition on values that can't be stored in a FixedDoubleArray.
3697 Label value_is_smi;
3698 __ JumpIfSmi(eax, &value_is_smi);
3699 __ cmp(FieldOperand(eax, HeapObject::kMapOffset),
3700 Immediate(Handle<Map>(masm->isolate()->heap()->heap_number_map())));
3701 __ j(not_equal, &transition_elements_kind);
3702 __ bind(&value_is_smi);
3703
3704 // Check for the empty array, and preallocate a small backing store if
3705 // possible.
3706 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
3707 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array()));
3708 __ j(not_equal, &check_capacity);
3709
3710 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements);
3711 __ Allocate(size, edi, ebx, ecx, &prepare_slow, TAG_OBJECT);
3712
3713 // Restore the key, which is known to be the array length.
3714 __ mov(ecx, Immediate(0));
3715
3716 // eax: value
3717 // ecx: key
3718 // edx: receiver
3719 // edi: elements
3720 // Initialize the new FixedDoubleArray.
3721 __ mov(FieldOperand(edi, JSObject::kMapOffset),
3722 Immediate(masm->isolate()->factory()->fixed_double_array_map()));
3723 __ mov(FieldOperand(edi, FixedDoubleArray::kLengthOffset),
3724 Immediate(Smi::FromInt(JSArray::kPreallocatedArrayElements)));
3725
3726 __ StoreNumberToDoubleElements(eax, edi, ecx, ebx, xmm0,
3727 &transition_elements_kind, true);
3728
3729 for (int i = 1; i < JSArray::kPreallocatedArrayElements; i++) {
3730 int offset = FixedDoubleArray::OffsetOfElementAt(i);
3731 __ mov(FieldOperand(edi, offset), Immediate(kHoleNanLower32));
3732 __ mov(FieldOperand(edi, offset + kPointerSize),
3733 Immediate(kHoleNanUpper32));
3734 }
3735
3736 // Install the new backing store in the JSArray.
3737 __ mov(FieldOperand(edx, JSObject::kElementsOffset), edi);
3738 __ RecordWriteField(edx, JSObject::kElementsOffset, edi, ebx,
3739 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
3740
3741 // Increment the length of the array.
3742 __ add(FieldOperand(edx, JSArray::kLengthOffset),
3743 Immediate(Smi::FromInt(1)));
3744 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
3745 __ ret(0);
3746
3747 __ bind(&check_capacity);
3748 // eax: value
3749 // ecx: key
3750 // edx: receiver
3751 // edi: elements
3752 // Make sure that the backing store can hold additional elements.
3753 __ cmp(ecx, FieldOperand(edi, FixedDoubleArray::kLengthOffset));
3754 __ j(above_equal, &slow);
3755
3756 // Grow the array and finish the store.
3757 __ add(FieldOperand(edx, JSArray::kLengthOffset),
3758 Immediate(Smi::FromInt(1)));
3759 __ jmp(&finish_store);
3760
3761 __ bind(&prepare_slow);
3762 // Restore the key, which is known to be the array length.
3763 __ mov(ecx, Immediate(0));
3764
3765 __ bind(&slow);
3766 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3767 }
3768 }
3769
3770
3771 #undef __ 3257 #undef __
3772 3258
3773 } } // namespace v8::internal 3259 } } // namespace v8::internal
3774 3260
3775 #endif // V8_TARGET_ARCH_IA32 3261 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698