 Chromium Code Reviews
 Chromium Code Reviews Issue 9310117:
  Implement KeyedStoreICs to grow arrays on out-of-bound stores.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 9310117:
  Implement KeyedStoreICs to grow arrays on out-of-bound stores.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| OLD | NEW | 
|---|---|
| 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 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2412 // ----------- S t a t e ------------- | 2412 // ----------- S t a t e ------------- | 
| 2413 // -- rax : value | 2413 // -- rax : value | 
| 2414 // -- rcx : key | 2414 // -- rcx : key | 
| 2415 // -- rdx : receiver | 2415 // -- rdx : receiver | 
| 2416 // -- rsp[0] : return address | 2416 // -- rsp[0] : return address | 
| 2417 // ----------------------------------- | 2417 // ----------------------------------- | 
| 2418 | 2418 | 
| 2419 ElementsKind elements_kind = receiver_map->elements_kind(); | 2419 ElementsKind elements_kind = receiver_map->elements_kind(); | 
| 2420 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 2420 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 
| 2421 Handle<Code> stub = | 2421 Handle<Code> stub = | 
| 2422 KeyedStoreElementStub(is_js_array, elements_kind).GetCode(); | 2422 KeyedStoreElementStub(is_js_array, elements_kind, grow_mode_).GetCode(); | 
| 2423 | 2423 | 
| 2424 __ DispatchMap(rdx, receiver_map, stub, DO_SMI_CHECK); | 2424 __ DispatchMap(rdx, receiver_map, stub, DO_SMI_CHECK); | 
| 2425 | 2425 | 
| 2426 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); | 2426 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); | 
| 2427 __ jmp(ic, RelocInfo::CODE_TARGET); | 2427 __ jmp(ic, RelocInfo::CODE_TARGET); | 
| 2428 | 2428 | 
| 2429 // Return the generated code. | 2429 // Return the generated code. | 
| 2430 return GetCode(NORMAL, factory()->empty_string()); | 2430 return GetCode(NORMAL, factory()->empty_string()); | 
| 2431 } | 2431 } | 
| 2432 | 2432 | 
| (...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3470 __ bind(&miss_force_generic); | 3470 __ bind(&miss_force_generic); | 
| 3471 Handle<Code> miss_ic = | 3471 Handle<Code> miss_ic = | 
| 3472 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric(); | 3472 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric(); | 
| 3473 __ jmp(miss_ic, RelocInfo::CODE_TARGET); | 3473 __ jmp(miss_ic, RelocInfo::CODE_TARGET); | 
| 3474 } | 3474 } | 
| 3475 | 3475 | 
| 3476 | 3476 | 
| 3477 void KeyedStoreStubCompiler::GenerateStoreFastElement( | 3477 void KeyedStoreStubCompiler::GenerateStoreFastElement( | 
| 3478 MacroAssembler* masm, | 3478 MacroAssembler* masm, | 
| 3479 bool is_js_array, | 3479 bool is_js_array, | 
| 3480 ElementsKind elements_kind) { | 3480 ElementsKind elements_kind, | 
| 3481 KeyedAccessGrowMode grow_mode) { | |
| 3481 // ----------- S t a t e ------------- | 3482 // ----------- S t a t e ------------- | 
| 3482 // -- rax : value | 3483 // -- rax : value | 
| 3483 // -- rcx : key | 3484 // -- rcx : key | 
| 3484 // -- rdx : receiver | 3485 // -- rdx : receiver | 
| 3485 // -- rsp[0] : return address | 3486 // -- rsp[0] : return address | 
| 3486 // ----------------------------------- | 3487 // ----------------------------------- | 
| 3487 Label miss_force_generic, transition_elements_kind; | 3488 Label miss_force_generic, transition_elements_kind, finish_store, grow; | 
| 3489 Label check_capacity, slow; | |
| 3488 | 3490 | 
| 3489 // This stub is meant to be tail-jumped to, the receiver must already | 3491 // This stub is meant to be tail-jumped to, the receiver must already | 
| 3490 // have been verified by the caller to not be a smi. | 3492 // have been verified by the caller to not be a smi. | 
| 3491 | 3493 | 
| 3492 // Check that the key is a smi. | 3494 // Check that the key is a smi. | 
| 3493 __ JumpIfNotSmi(rcx, &miss_force_generic); | 3495 __ JumpIfNotSmi(rcx, &miss_force_generic); | 
| 3494 | 3496 | 
| 3497 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { | |
| 3498 __ JumpIfNotSmi(rax, &transition_elements_kind); | |
| 3499 } | |
| 3500 | |
| 3495 // Get the elements array and make sure it is a fast element array, not 'cow'. | 3501 // Get the elements array and make sure it is a fast element array, not 'cow'. | 
| 3496 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); | 3502 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); | 
| 3497 __ CompareRoot(FieldOperand(rdi, HeapObject::kMapOffset), | |
| 3498 Heap::kFixedArrayMapRootIndex); | |
| 3499 __ j(not_equal, &miss_force_generic); | |
| 3500 | |
| 3501 // Check that the key is within bounds. | 3503 // Check that the key is within bounds. | 
| 3502 if (is_js_array) { | 3504 if (is_js_array) { | 
| 3503 __ SmiCompare(rcx, FieldOperand(rdx, JSArray::kLengthOffset)); | 3505 __ SmiCompare(rcx, FieldOperand(rdx, JSArray::kLengthOffset)); | 
| 3504 __ j(above_equal, &miss_force_generic); | 3506 if (grow_mode == ALLOW_JSARRAY_GROWTH) { | 
| 3507 __ j(above_equal, &grow); | |
| 3508 } else { | |
| 3509 __ j(above_equal, &miss_force_generic); | |
| 3510 } | |
| 3505 } else { | 3511 } else { | 
| 3506 __ SmiCompare(rcx, FieldOperand(rdi, FixedArray::kLengthOffset)); | 3512 __ SmiCompare(rcx, FieldOperand(rdi, FixedArray::kLengthOffset)); | 
| 3507 __ j(above_equal, &miss_force_generic); | 3513 __ j(above_equal, &miss_force_generic); | 
| 3508 } | 3514 } | 
| 3509 | 3515 | 
| 3516 __ CompareRoot(FieldOperand(rdi, HeapObject::kMapOffset), | |
| 3517 Heap::kFixedArrayMapRootIndex); | |
| 3518 __ j(not_equal, &miss_force_generic); | |
| 3519 | |
| 3520 __ bind(&finish_store); | |
| 3510 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { | 3521 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { | 
| 3511 __ JumpIfNotSmi(rax, &transition_elements_kind); | |
| 3512 __ SmiToInteger32(rcx, rcx); | 3522 __ SmiToInteger32(rcx, rcx); | 
| 3513 __ movq(FieldOperand(rdi, rcx, times_pointer_size, FixedArray::kHeaderSize), | 3523 __ movq(FieldOperand(rdi, rcx, times_pointer_size, FixedArray::kHeaderSize), | 
| 3514 rax); | 3524 rax); | 
| 3515 } else { | 3525 } else { | 
| 3516 // Do the store and update the write barrier. | 3526 // Do the store and update the write barrier. | 
| 3517 ASSERT(elements_kind == FAST_ELEMENTS); | 3527 ASSERT(elements_kind == FAST_ELEMENTS); | 
| 3518 __ SmiToInteger32(rcx, rcx); | 3528 __ SmiToInteger32(rcx, rcx); | 
| 3519 __ lea(rcx, | 3529 __ lea(rcx, | 
| 3520 FieldOperand(rdi, rcx, times_pointer_size, FixedArray::kHeaderSize)); | 3530 FieldOperand(rdi, rcx, times_pointer_size, FixedArray::kHeaderSize)); | 
| 3521 __ movq(Operand(rcx, 0), rax); | 3531 __ movq(Operand(rcx, 0), rax); | 
| 3522 // Make sure to preserve the value in register rax. | 3532 // Make sure to preserve the value in register rax. | 
| 3523 __ movq(rdx, rax); | 3533 __ movq(rbx, rax); | 
| 3524 __ RecordWrite(rdi, rcx, rdx, kDontSaveFPRegs); | 3534 __ RecordWrite(rdi, rcx, rbx, kDontSaveFPRegs); | 
| 3525 } | 3535 } | 
| 3526 | 3536 | 
| 3527 // Done. | 3537 // Done. | 
| 3528 __ ret(0); | 3538 __ ret(0); | 
| 3529 | 3539 | 
| 3530 // Handle store cache miss. | 3540 // Handle store cache miss. | 
| 3531 __ bind(&miss_force_generic); | 3541 __ bind(&miss_force_generic); | 
| 3532 Handle<Code> ic_force_generic = | 3542 Handle<Code> ic_force_generic = | 
| 3533 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 3543 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 
| 3534 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | 3544 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | 
| 3535 | 3545 | 
| 3536 __ bind(&transition_elements_kind); | 3546 __ bind(&transition_elements_kind); | 
| 3537 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); | 3547 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); | 
| 3538 __ jmp(ic_miss, RelocInfo::CODE_TARGET); | 3548 __ jmp(ic_miss, RelocInfo::CODE_TARGET); | 
| 3549 | |
| 3550 if (is_js_array && grow_mode == ALLOW_JSARRAY_GROWTH) { | |
| 3551 // Grow the array by a single element if possible. | |
| 3552 __ bind(&grow); | |
| 3553 | |
| 3554 // Make sure the array is only growing by a single element, anything else | |
| 3555 // must be handled by the runtime. Flags are already set by previous | |
| 3556 // compare. | |
| 3557 __ j(not_equal, &miss_force_generic); | |
| 3558 | |
| 3559 // Check for the empty array, and preallocate a small backing store if | |
| 3560 // possible. | |
| 3561 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); | |
| 3562 __ Cmp(rdi, masm->isolate()->factory()->empty_fixed_array()); | |
| 
Vyacheslav Egorov (Chromium)
2012/02/10 00:19:18
CompareRoot
 
danno
2012/02/10 12:25:34
Done.
 | |
| 3563 __ j(not_equal, &check_capacity); | |
| 3564 | |
| 3565 int size = FixedArray::SizeFor(JSArray::kPreallocatedArrayElements); | |
| 3566 __ AllocateInNewSpace(size, | |
| 3567 rdi, | |
| 3568 rbx, | |
| 3569 r8, | |
| 3570 &slow, | |
| 3571 TAG_OBJECT); | |
| 3572 | |
| 3573 // rax: value | |
| 3574 // rcx: key | |
| 3575 // rdx: receiver | |
| 3576 // rdi: elements | |
| 3577 // Make sure that the backing store can hold additional elements. | |
| 3578 __ Move(FieldOperand(rdi, JSObject::kMapOffset), | |
| 3579 masm->isolate()->factory()->fixed_array_map()); | |
| 3580 __ Move(FieldOperand(rdi, FixedArray::kLengthOffset), | |
| 3581 Smi::FromInt(JSArray::kPreallocatedArrayElements)); | |
| 3582 __ Move(rbx, masm->isolate()->factory()->the_hole_value()); | |
| 
Vyacheslav Egorov (Chromium)
2012/02/10 00:19:18
LoadRoot
 
danno
2012/02/10 12:25:34
Done.
 | |
| 3583 for (int i = 1; i < JSArray::kPreallocatedArrayElements; ++i) { | |
| 3584 __ movq(FieldOperand(rdi, FixedArray::SizeFor(i)), rbx); | |
| 3585 } | |
| 3586 | |
| 3587 // Store the element at index zero. | |
| 3588 __ movq(FieldOperand(rdi, FixedArray::SizeFor(0)), rax); | |
| 3589 | |
| 3590 // Install the new backing store in the JSArray. | |
| 3591 __ movq(FieldOperand(rdx, JSObject::kElementsOffset), rdi); | |
| 3592 __ RecordWriteField(rdx, JSObject::kElementsOffset, rdi, rbx, | |
| 3593 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
| 3594 | |
| 3595 // Increment the length of the array. | |
| 3596 __ SmiAddConstant(FieldOperand(rdx, JSArray::kLengthOffset), | |
| 
Vyacheslav Egorov (Chromium)
2012/02/10 00:19:18
Store 1 directly into field instead of addition.
 
danno
2012/02/10 12:25:34
Done.
 | |
| 3597 Smi::FromInt(1)); | |
| 3598 __ ret(0); | |
| 3599 | |
| 3600 __ bind(&check_capacity); | |
| 3601 // Check for cow elements, in general they are not handled by this stub. | |
| 3602 __ Cmp(FieldOperand(rdi, HeapObject::kMapOffset), | |
| 
Vyacheslav Egorov (Chromium)
2012/02/10 00:19:18
CompareRoot.
 
danno
2012/02/10 12:25:34
Done.
 | |
| 3603 masm->isolate()->factory()->fixed_cow_array_map()); | |
| 3604 __ j(equal, &miss_force_generic); | |
| 3605 | |
| 3606 // rax: value | |
| 3607 // rcx: key | |
| 3608 // rdx: receiver | |
| 3609 // rdi: elements | |
| 3610 // Make sure that the backing store can hold additional elements. | |
| 3611 __ cmpq(rcx, FieldOperand(rdi, FixedArray::kLengthOffset)); | |
| 3612 __ j(above_equal, &slow); | |
| 3613 | |
| 3614 // Grow the array and finish the store. | |
| 3615 __ SmiAddConstant(FieldOperand(rdx, JSArray::kLengthOffset), | |
| 3616 Smi::FromInt(1)); | |
| 3617 __ jmp(&finish_store); | |
| 3618 | |
| 3619 __ bind(&slow); | |
| 3620 Handle<Code> ic_slow = masm->isolate()->builtins()->KeyedStoreIC_Slow(); | |
| 3621 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | |
| 3622 } | |
| 3539 } | 3623 } | 
| 3540 | 3624 | 
| 3541 | 3625 | 
| 3542 void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement( | 3626 void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement( | 
| 3543 MacroAssembler* masm, | 3627 MacroAssembler* masm, | 
| 3544 bool is_js_array) { | 3628 bool is_js_array, | 
| 3629 KeyedAccessGrowMode grow_mode) { | |
| 3545 // ----------- S t a t e ------------- | 3630 // ----------- S t a t e ------------- | 
| 3546 // -- rax : value | 3631 // -- rax : value | 
| 3547 // -- rcx : key | 3632 // -- rcx : key | 
| 3548 // -- rdx : receiver | 3633 // -- rdx : receiver | 
| 3549 // -- rsp[0] : return address | 3634 // -- rsp[0] : return address | 
| 3550 // ----------------------------------- | 3635 // ----------------------------------- | 
| 3551 Label miss_force_generic, transition_elements_kind; | 3636 Label miss_force_generic, transition_elements_kind, finish_store; | 
| 3637 Label grow, slow, check_capacity; | |
| 3552 | 3638 | 
| 3553 // This stub is meant to be tail-jumped to, the receiver must already | 3639 // This stub is meant to be tail-jumped to, the receiver must already | 
| 3554 // have been verified by the caller to not be a smi. | 3640 // have been verified by the caller to not be a smi. | 
| 3555 | 3641 | 
| 3556 // Check that the key is a smi. | 3642 // Check that the key is a smi. | 
| 3557 __ JumpIfNotSmi(rcx, &miss_force_generic); | 3643 __ JumpIfNotSmi(rcx, &miss_force_generic); | 
| 3558 | 3644 | 
| 3559 // Get the elements array. | 3645 // Get the elements array. | 
| 3560 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); | 3646 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); | 
| 3561 __ AssertFastElements(rdi); | 3647 __ AssertFastElements(rdi); | 
| 3562 | 3648 | 
| 3563 // Check that the key is within bounds. | 3649 // Check that the key is within bounds. | 
| 3564 if (is_js_array) { | 3650 if (is_js_array) { | 
| 3565 __ SmiCompare(rcx, FieldOperand(rdx, JSArray::kLengthOffset)); | 3651 __ SmiCompare(rcx, FieldOperand(rdx, JSArray::kLengthOffset)); | 
| 3652 if (grow_mode == ALLOW_JSARRAY_GROWTH) { | |
| 3653 __ j(above_equal, &grow); | |
| 3654 } else { | |
| 3655 __ j(above_equal, &miss_force_generic); | |
| 3656 } | |
| 3566 } else { | 3657 } else { | 
| 3567 __ SmiCompare(rcx, FieldOperand(rdi, FixedDoubleArray::kLengthOffset)); | 3658 __ SmiCompare(rcx, FieldOperand(rdi, FixedDoubleArray::kLengthOffset)); | 
| 3659 __ j(above_equal, &miss_force_generic); | |
| 3568 } | 3660 } | 
| 3569 __ j(above_equal, &miss_force_generic); | |
| 3570 | 3661 | 
| 3571 // Handle smi values specially | 3662 // Handle smi values specially | 
| 3663 __ bind(&finish_store); | |
| 3572 __ SmiToInteger32(rcx, rcx); | 3664 __ SmiToInteger32(rcx, rcx); | 
| 3573 __ StoreNumberToDoubleElements(rax, rdi, rcx, xmm0, | 3665 __ StoreNumberToDoubleElements(rax, rdi, rcx, xmm0, | 
| 3574 &transition_elements_kind); | 3666 &transition_elements_kind); | 
| 3575 __ ret(0); | 3667 __ ret(0); | 
| 3576 | 3668 | 
| 3577 // Handle store cache miss, replacing the ic with the generic stub. | 3669 // Handle store cache miss, replacing the ic with the generic stub. | 
| 3578 __ bind(&miss_force_generic); | 3670 __ bind(&miss_force_generic); | 
| 3579 Handle<Code> ic_force_generic = | 3671 Handle<Code> ic_force_generic = | 
| 3580 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 3672 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 
| 3581 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | 3673 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | 
| 3582 | 3674 | 
| 3583 __ bind(&transition_elements_kind); | 3675 __ bind(&transition_elements_kind); | 
| 3584 // Restore smi-tagging of rcx. | 3676 // Restore smi-tagging of rcx. | 
| 3585 __ Integer32ToSmi(rcx, rcx); | 3677 __ Integer32ToSmi(rcx, rcx); | 
| 3586 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); | 3678 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); | 
| 3587 __ jmp(ic_miss, RelocInfo::CODE_TARGET); | 3679 __ jmp(ic_miss, RelocInfo::CODE_TARGET); | 
| 3680 | |
| 3681 if (is_js_array && grow_mode == ALLOW_JSARRAY_GROWTH) { | |
| 3682 // Grow the array by a single element if possible. | |
| 3683 __ bind(&grow); | |
| 3684 | |
| 3685 // Make sure the array is only growing by a single element, anything else | |
| 3686 // must be handled by the runtime. Flags are already set by previous | |
| 3687 // compare. | |
| 3688 __ j(not_equal, &miss_force_generic); | |
| 3689 | |
| 3690 // Transition on values that can't be stored in a FixedDoubleArray. | |
| 3691 Label value_is_smi; | |
| 3692 __ JumpIfSmi(rax, &value_is_smi); | |
| 3693 __ Cmp(FieldOperand(rax, HeapObject::kMapOffset), | |
| 
Vyacheslav Egorov (Chromium)
2012/02/10 00:19:18
CompareRoot
 
danno
2012/02/10 12:25:34
Done.
 | |
| 3694 Handle<Map>(masm->isolate()->heap()->heap_number_map())); | |
| 3695 __ j(not_equal, &transition_elements_kind); | |
| 3696 __ bind(&value_is_smi); | |
| 3697 | |
| 3698 // Check for the empty array, and preallocate a small backing store if | |
| 3699 // possible. | |
| 3700 __ movq(rdi, FieldOperand(rdx, JSObject::kElementsOffset)); | |
| 3701 __ Cmp(rdi, masm->isolate()->factory()->empty_fixed_array()); | |
| 
Vyacheslav Egorov (Chromium)
2012/02/10 00:19:18
CompareRoot
 
danno
2012/02/10 12:25:34
Done.
 | |
| 3702 __ j(not_equal, &check_capacity); | |
| 3703 | |
| 3704 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements); | |
| 3705 __ AllocateInNewSpace(size, | |
| 3706 rdi, | |
| 3707 rbx, | |
| 3708 r8, | |
| 3709 &slow, | |
| 3710 TAG_OBJECT); | |
| 3711 | |
| 3712 // rax: value | |
| 3713 // rcx: key | |
| 3714 // rdx: receiver | |
| 3715 // rdi: elements | |
| 3716 // Make sure that the backing store can hold additional elements. | |
| 3717 __ Move(FieldOperand(rdi, JSObject::kMapOffset), | |
| 3718 masm->isolate()->factory()->fixed_double_array_map()); | |
| 
Vyacheslav Egorov (Chromium)
2012/02/10 00:19:18
indentation
 
danno
2012/02/10 12:25:34
Done.
 | |
| 3719 __ Move(FieldOperand(rdi, FixedDoubleArray::kLengthOffset), | |
| 3720 Smi::FromInt(JSArray::kPreallocatedArrayElements)); | |
| 
Vyacheslav Egorov (Chromium)
2012/02/10 00:19:18
indentation
 
danno
2012/02/10 12:25:34
Done.
 | |
| 3721 | |
| 3722 // Install the new backing store in the JSArray. | |
| 3723 __ movq(FieldOperand(rdx, JSObject::kElementsOffset), rdi); | |
| 
Vyacheslav Egorov (Chromium)
2012/02/10 00:19:18
elements seem to be uninitialized. if this is inte
 
danno
2012/02/10 12:25:34
Done.
 | |
| 3724 __ RecordWriteField(rdx, JSObject::kElementsOffset, rdi, rbx, | |
| 3725 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
| 3726 | |
| 3727 // Increment the length of the array. | |
| 3728 __ SmiAddConstant(FieldOperand(rdx, JSArray::kLengthOffset), | |
| 
Vyacheslav Egorov (Chromium)
2012/02/10 00:19:18
Store 1 directly instead of add.
 
danno
2012/02/10 12:25:34
Done.
 
danno
2012/02/10 12:25:34
Done.
 | |
| 3729 Smi::FromInt(1)); | |
| 3730 __ jmp(&finish_store); | |
| 3731 | |
| 3732 __ bind(&check_capacity); | |
| 3733 // rax: value | |
| 3734 // rcx: key | |
| 3735 // rdx: receiver | |
| 3736 // rdi: elements | |
| 3737 // Make sure that the backing store can hold additional elements. | |
| 3738 __ cmpq(rcx, FieldOperand(rdi, FixedDoubleArray::kLengthOffset)); | |
| 3739 __ j(above_equal, &slow); | |
| 3740 | |
| 3741 // Grow the array and finish the store. | |
| 3742 __ SmiAddConstant(FieldOperand(rdx, JSArray::kLengthOffset), | |
| 3743 Smi::FromInt(1)); | |
| 3744 __ jmp(&finish_store); | |
| 3745 | |
| 3746 __ bind(&slow); | |
| 3747 Handle<Code> ic_slow = masm->isolate()->builtins()->KeyedStoreIC_Slow(); | |
| 3748 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | |
| 3749 } | |
| 3588 } | 3750 } | 
| 3589 | 3751 | 
| 3590 | 3752 | 
| 3591 #undef __ | 3753 #undef __ | 
| 3592 | 3754 | 
| 3593 } } // namespace v8::internal | 3755 } } // namespace v8::internal | 
| 3594 | 3756 | 
| 3595 #endif // V8_TARGET_ARCH_X64 | 3757 #endif // V8_TARGET_ARCH_X64 | 
| OLD | NEW |