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

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

Issue 7849017: Mechanical refactor to move ElementsKind type out of JSObject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: latest changes Created 9 years, 3 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/arm/macro-assembler-arm.cc ('k') | src/bootstrapper.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 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 3081 matching lines...) Expand 10 before | Expand all | Expand 10 after
3092 } 3092 }
3093 3093
3094 3094
3095 MaybeObject* KeyedLoadStubCompiler::CompileLoadElement(Map* receiver_map) { 3095 MaybeObject* KeyedLoadStubCompiler::CompileLoadElement(Map* receiver_map) {
3096 // ----------- S t a t e ------------- 3096 // ----------- S t a t e -------------
3097 // -- lr : return address 3097 // -- lr : return address
3098 // -- r0 : key 3098 // -- r0 : key
3099 // -- r1 : receiver 3099 // -- r1 : receiver
3100 // ----------------------------------- 3100 // -----------------------------------
3101 Code* stub; 3101 Code* stub;
3102 JSObject::ElementsKind elements_kind = receiver_map->elements_kind(); 3102 ElementsKind elements_kind = receiver_map->elements_kind();
3103 MaybeObject* maybe_stub = KeyedLoadElementStub(elements_kind).TryGetCode(); 3103 MaybeObject* maybe_stub = KeyedLoadElementStub(elements_kind).TryGetCode();
3104 if (!maybe_stub->To(&stub)) return maybe_stub; 3104 if (!maybe_stub->To(&stub)) return maybe_stub;
3105 __ DispatchMap(r1, 3105 __ DispatchMap(r1,
3106 r2, 3106 r2,
3107 Handle<Map>(receiver_map), 3107 Handle<Map>(receiver_map),
3108 Handle<Code>(stub), 3108 Handle<Code>(stub),
3109 DO_SMI_CHECK); 3109 DO_SMI_CHECK);
3110 3110
3111 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); 3111 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss();
3112 __ Jump(ic, RelocInfo::CODE_TARGET); 3112 __ Jump(ic, RelocInfo::CODE_TARGET);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
3186 3186
3187 MaybeObject* KeyedStoreStubCompiler::CompileStoreElement(Map* receiver_map) { 3187 MaybeObject* KeyedStoreStubCompiler::CompileStoreElement(Map* receiver_map) {
3188 // ----------- S t a t e ------------- 3188 // ----------- S t a t e -------------
3189 // -- r0 : value 3189 // -- r0 : value
3190 // -- r1 : key 3190 // -- r1 : key
3191 // -- r2 : receiver 3191 // -- r2 : receiver
3192 // -- lr : return address 3192 // -- lr : return address
3193 // -- r3 : scratch 3193 // -- r3 : scratch
3194 // ----------------------------------- 3194 // -----------------------------------
3195 Code* stub; 3195 Code* stub;
3196 JSObject::ElementsKind elements_kind = receiver_map->elements_kind(); 3196 ElementsKind elements_kind = receiver_map->elements_kind();
3197 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 3197 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
3198 MaybeObject* maybe_stub = 3198 MaybeObject* maybe_stub =
3199 KeyedStoreElementStub(is_js_array, elements_kind).TryGetCode(); 3199 KeyedStoreElementStub(is_js_array, elements_kind).TryGetCode();
3200 if (!maybe_stub->To(&stub)) return maybe_stub; 3200 if (!maybe_stub->To(&stub)) return maybe_stub;
3201 __ DispatchMap(r2, 3201 __ DispatchMap(r2,
3202 r3, 3202 r3,
3203 Handle<Map>(receiver_map), 3203 Handle<Map>(receiver_map),
3204 Handle<Code>(stub), 3204 Handle<Code>(stub),
3205 DO_SMI_CHECK); 3205 DO_SMI_CHECK);
3206 3206
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
3431 // -- r0 : key 3431 // -- r0 : key
3432 // -- r1 : receiver 3432 // -- r1 : receiver
3433 // ----------------------------------- 3433 // -----------------------------------
3434 3434
3435 Handle<Code> miss_ic = 3435 Handle<Code> miss_ic =
3436 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric(); 3436 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric();
3437 __ Jump(miss_ic, RelocInfo::CODE_TARGET); 3437 __ Jump(miss_ic, RelocInfo::CODE_TARGET);
3438 } 3438 }
3439 3439
3440 3440
3441 static bool IsElementTypeSigned(JSObject::ElementsKind elements_kind) { 3441 static bool IsElementTypeSigned(ElementsKind elements_kind) {
3442 switch (elements_kind) { 3442 switch (elements_kind) {
3443 case JSObject::EXTERNAL_BYTE_ELEMENTS: 3443 case EXTERNAL_BYTE_ELEMENTS:
3444 case JSObject::EXTERNAL_SHORT_ELEMENTS: 3444 case EXTERNAL_SHORT_ELEMENTS:
3445 case JSObject::EXTERNAL_INT_ELEMENTS: 3445 case EXTERNAL_INT_ELEMENTS:
3446 return true; 3446 return true;
3447 3447
3448 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 3448 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
3449 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 3449 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
3450 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: 3450 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
3451 case JSObject::EXTERNAL_PIXEL_ELEMENTS: 3451 case EXTERNAL_PIXEL_ELEMENTS:
3452 return false; 3452 return false;
3453 3453
3454 case JSObject::EXTERNAL_FLOAT_ELEMENTS: 3454 case EXTERNAL_FLOAT_ELEMENTS:
3455 case JSObject::EXTERNAL_DOUBLE_ELEMENTS: 3455 case EXTERNAL_DOUBLE_ELEMENTS:
3456 case JSObject::FAST_ELEMENTS: 3456 case FAST_ELEMENTS:
3457 case JSObject::FAST_DOUBLE_ELEMENTS: 3457 case FAST_DOUBLE_ELEMENTS:
3458 case JSObject::DICTIONARY_ELEMENTS: 3458 case DICTIONARY_ELEMENTS:
3459 case JSObject::NON_STRICT_ARGUMENTS_ELEMENTS: 3459 case NON_STRICT_ARGUMENTS_ELEMENTS:
3460 UNREACHABLE(); 3460 UNREACHABLE();
3461 return false; 3461 return false;
3462 } 3462 }
3463 return false; 3463 return false;
3464 } 3464 }
3465 3465
3466 3466
3467 void KeyedLoadStubCompiler::GenerateLoadExternalArray( 3467 void KeyedLoadStubCompiler::GenerateLoadExternalArray(
3468 MacroAssembler* masm, 3468 MacroAssembler* masm,
3469 JSObject::ElementsKind elements_kind) { 3469 ElementsKind elements_kind) {
3470 // ---------- S t a t e -------------- 3470 // ---------- S t a t e --------------
3471 // -- lr : return address 3471 // -- lr : return address
3472 // -- r0 : key 3472 // -- r0 : key
3473 // -- r1 : receiver 3473 // -- r1 : receiver
3474 // ----------------------------------- 3474 // -----------------------------------
3475 Label miss_force_generic, slow, failed_allocation; 3475 Label miss_force_generic, slow, failed_allocation;
3476 3476
3477 Register key = r0; 3477 Register key = r0;
3478 Register receiver = r1; 3478 Register receiver = r1;
3479 3479
(...skipping 14 matching lines...) Expand all
3494 3494
3495 __ ldr(r3, FieldMemOperand(r3, ExternalArray::kExternalPointerOffset)); 3495 __ ldr(r3, FieldMemOperand(r3, ExternalArray::kExternalPointerOffset));
3496 // r3: base pointer of external storage 3496 // r3: base pointer of external storage
3497 3497
3498 // We are not untagging smi key and instead work with it 3498 // We are not untagging smi key and instead work with it
3499 // as if it was premultiplied by 2. 3499 // as if it was premultiplied by 2.
3500 STATIC_ASSERT((kSmiTag == 0) && (kSmiTagSize == 1)); 3500 STATIC_ASSERT((kSmiTag == 0) && (kSmiTagSize == 1));
3501 3501
3502 Register value = r2; 3502 Register value = r2;
3503 switch (elements_kind) { 3503 switch (elements_kind) {
3504 case JSObject::EXTERNAL_BYTE_ELEMENTS: 3504 case EXTERNAL_BYTE_ELEMENTS:
3505 __ ldrsb(value, MemOperand(r3, key, LSR, 1)); 3505 __ ldrsb(value, MemOperand(r3, key, LSR, 1));
3506 break; 3506 break;
3507 case JSObject::EXTERNAL_PIXEL_ELEMENTS: 3507 case EXTERNAL_PIXEL_ELEMENTS:
3508 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 3508 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
3509 __ ldrb(value, MemOperand(r3, key, LSR, 1)); 3509 __ ldrb(value, MemOperand(r3, key, LSR, 1));
3510 break; 3510 break;
3511 case JSObject::EXTERNAL_SHORT_ELEMENTS: 3511 case EXTERNAL_SHORT_ELEMENTS:
3512 __ ldrsh(value, MemOperand(r3, key, LSL, 0)); 3512 __ ldrsh(value, MemOperand(r3, key, LSL, 0));
3513 break; 3513 break;
3514 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 3514 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
3515 __ ldrh(value, MemOperand(r3, key, LSL, 0)); 3515 __ ldrh(value, MemOperand(r3, key, LSL, 0));
3516 break; 3516 break;
3517 case JSObject::EXTERNAL_INT_ELEMENTS: 3517 case EXTERNAL_INT_ELEMENTS:
3518 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: 3518 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
3519 __ ldr(value, MemOperand(r3, key, LSL, 1)); 3519 __ ldr(value, MemOperand(r3, key, LSL, 1));
3520 break; 3520 break;
3521 case JSObject::EXTERNAL_FLOAT_ELEMENTS: 3521 case EXTERNAL_FLOAT_ELEMENTS:
3522 if (CpuFeatures::IsSupported(VFP3)) { 3522 if (CpuFeatures::IsSupported(VFP3)) {
3523 CpuFeatures::Scope scope(VFP3); 3523 CpuFeatures::Scope scope(VFP3);
3524 __ add(r2, r3, Operand(key, LSL, 1)); 3524 __ add(r2, r3, Operand(key, LSL, 1));
3525 __ vldr(s0, r2, 0); 3525 __ vldr(s0, r2, 0);
3526 } else { 3526 } else {
3527 __ ldr(value, MemOperand(r3, key, LSL, 1)); 3527 __ ldr(value, MemOperand(r3, key, LSL, 1));
3528 } 3528 }
3529 break; 3529 break;
3530 case JSObject::EXTERNAL_DOUBLE_ELEMENTS: 3530 case EXTERNAL_DOUBLE_ELEMENTS:
3531 if (CpuFeatures::IsSupported(VFP3)) { 3531 if (CpuFeatures::IsSupported(VFP3)) {
3532 CpuFeatures::Scope scope(VFP3); 3532 CpuFeatures::Scope scope(VFP3);
3533 __ add(r2, r3, Operand(key, LSL, 2)); 3533 __ add(r2, r3, Operand(key, LSL, 2));
3534 __ vldr(d0, r2, 0); 3534 __ vldr(d0, r2, 0);
3535 } else { 3535 } else {
3536 __ add(r4, r3, Operand(key, LSL, 2)); 3536 __ add(r4, r3, Operand(key, LSL, 2));
3537 // r4: pointer to the beginning of the double we want to load. 3537 // r4: pointer to the beginning of the double we want to load.
3538 __ ldr(r2, MemOperand(r4, 0)); 3538 __ ldr(r2, MemOperand(r4, 0));
3539 __ ldr(r3, MemOperand(r4, Register::kSizeInBytes)); 3539 __ ldr(r3, MemOperand(r4, Register::kSizeInBytes));
3540 } 3540 }
3541 break; 3541 break;
3542 case JSObject::FAST_ELEMENTS: 3542 case FAST_ELEMENTS:
3543 case JSObject::FAST_DOUBLE_ELEMENTS: 3543 case FAST_DOUBLE_ELEMENTS:
3544 case JSObject::DICTIONARY_ELEMENTS: 3544 case DICTIONARY_ELEMENTS:
3545 case JSObject::NON_STRICT_ARGUMENTS_ELEMENTS: 3545 case NON_STRICT_ARGUMENTS_ELEMENTS:
3546 UNREACHABLE(); 3546 UNREACHABLE();
3547 break; 3547 break;
3548 } 3548 }
3549 3549
3550 // For integer array types: 3550 // For integer array types:
3551 // r2: value 3551 // r2: value
3552 // For float array type: 3552 // For float array type:
3553 // s0: value (if VFP3 is supported) 3553 // s0: value (if VFP3 is supported)
3554 // r2: value (if VFP3 is not supported) 3554 // r2: value (if VFP3 is not supported)
3555 // For double array type: 3555 // For double array type:
3556 // d0: value (if VFP3 is supported) 3556 // d0: value (if VFP3 is supported)
3557 // r2/r3: value (if VFP3 is not supported) 3557 // r2/r3: value (if VFP3 is not supported)
3558 3558
3559 if (elements_kind == JSObject::EXTERNAL_INT_ELEMENTS) { 3559 if (elements_kind == EXTERNAL_INT_ELEMENTS) {
3560 // For the Int and UnsignedInt array types, we need to see whether 3560 // For the Int and UnsignedInt array types, we need to see whether
3561 // the value can be represented in a Smi. If not, we need to convert 3561 // the value can be represented in a Smi. If not, we need to convert
3562 // it to a HeapNumber. 3562 // it to a HeapNumber.
3563 Label box_int; 3563 Label box_int;
3564 __ cmp(value, Operand(0xC0000000)); 3564 __ cmp(value, Operand(0xC0000000));
3565 __ b(mi, &box_int); 3565 __ b(mi, &box_int);
3566 // Tag integer as smi and return it. 3566 // Tag integer as smi and return it.
3567 __ mov(r0, Operand(value, LSL, kSmiTagSize)); 3567 __ mov(r0, Operand(value, LSL, kSmiTagSize));
3568 __ Ret(); 3568 __ Ret();
3569 3569
(...skipping 23 matching lines...) Expand all
3593 dest, 3593 dest,
3594 d0, 3594 d0,
3595 dst1, 3595 dst1,
3596 dst2, 3596 dst2,
3597 r9, 3597 r9,
3598 s0); 3598 s0);
3599 __ str(dst1, FieldMemOperand(r0, HeapNumber::kMantissaOffset)); 3599 __ str(dst1, FieldMemOperand(r0, HeapNumber::kMantissaOffset));
3600 __ str(dst2, FieldMemOperand(r0, HeapNumber::kExponentOffset)); 3600 __ str(dst2, FieldMemOperand(r0, HeapNumber::kExponentOffset));
3601 __ Ret(); 3601 __ Ret();
3602 } 3602 }
3603 } else if (elements_kind == JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS) { 3603 } else if (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) {
3604 // The test is different for unsigned int values. Since we need 3604 // The test is different for unsigned int values. Since we need
3605 // the value to be in the range of a positive smi, we can't 3605 // the value to be in the range of a positive smi, we can't
3606 // handle either of the top two bits being set in the value. 3606 // handle either of the top two bits being set in the value.
3607 if (CpuFeatures::IsSupported(VFP3)) { 3607 if (CpuFeatures::IsSupported(VFP3)) {
3608 CpuFeatures::Scope scope(VFP3); 3608 CpuFeatures::Scope scope(VFP3);
3609 Label box_int, done; 3609 Label box_int, done;
3610 __ tst(value, Operand(0xC0000000)); 3610 __ tst(value, Operand(0xC0000000));
3611 __ b(ne, &box_int); 3611 __ b(ne, &box_int);
3612 // Tag integer as smi and return it. 3612 // Tag integer as smi and return it.
3613 __ mov(r0, Operand(value, LSL, kSmiTagSize)); 3613 __ mov(r0, Operand(value, LSL, kSmiTagSize));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3658 // space. 3658 // space.
3659 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex); 3659 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex);
3660 __ AllocateHeapNumber(r4, r5, r7, r6, &slow); 3660 __ AllocateHeapNumber(r4, r5, r7, r6, &slow);
3661 3661
3662 __ str(hiword, FieldMemOperand(r4, HeapNumber::kExponentOffset)); 3662 __ str(hiword, FieldMemOperand(r4, HeapNumber::kExponentOffset));
3663 __ str(loword, FieldMemOperand(r4, HeapNumber::kMantissaOffset)); 3663 __ str(loword, FieldMemOperand(r4, HeapNumber::kMantissaOffset));
3664 3664
3665 __ mov(r0, r4); 3665 __ mov(r0, r4);
3666 __ Ret(); 3666 __ Ret();
3667 } 3667 }
3668 } else if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { 3668 } else if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) {
3669 // For the floating-point array type, we need to always allocate a 3669 // For the floating-point array type, we need to always allocate a
3670 // HeapNumber. 3670 // HeapNumber.
3671 if (CpuFeatures::IsSupported(VFP3)) { 3671 if (CpuFeatures::IsSupported(VFP3)) {
3672 CpuFeatures::Scope scope(VFP3); 3672 CpuFeatures::Scope scope(VFP3);
3673 // Allocate a HeapNumber for the result. Don't use r0 and r1 as 3673 // Allocate a HeapNumber for the result. Don't use r0 and r1 as
3674 // AllocateHeapNumber clobbers all registers - also when jumping due to 3674 // AllocateHeapNumber clobbers all registers - also when jumping due to
3675 // exhausted young space. 3675 // exhausted young space.
3676 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex); 3676 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex);
3677 __ AllocateHeapNumber(r2, r3, r4, r6, &slow); 3677 __ AllocateHeapNumber(r2, r3, r4, r6, &slow);
3678 __ vcvt_f64_f32(d0, s0); 3678 __ vcvt_f64_f32(d0, s0);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3728 3728
3729 __ orr(r2, r2, Operand(r0, LSR, kMantissaShiftForHiWord)); 3729 __ orr(r2, r2, Operand(r0, LSR, kMantissaShiftForHiWord));
3730 __ mov(r0, Operand(r0, LSL, kMantissaShiftForLoWord)); 3730 __ mov(r0, Operand(r0, LSL, kMantissaShiftForLoWord));
3731 3731
3732 __ str(r2, FieldMemOperand(r3, HeapNumber::kExponentOffset)); 3732 __ str(r2, FieldMemOperand(r3, HeapNumber::kExponentOffset));
3733 __ str(r0, FieldMemOperand(r3, HeapNumber::kMantissaOffset)); 3733 __ str(r0, FieldMemOperand(r3, HeapNumber::kMantissaOffset));
3734 3734
3735 __ mov(r0, r3); 3735 __ mov(r0, r3);
3736 __ Ret(); 3736 __ Ret();
3737 } 3737 }
3738 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { 3738 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) {
3739 if (CpuFeatures::IsSupported(VFP3)) { 3739 if (CpuFeatures::IsSupported(VFP3)) {
3740 CpuFeatures::Scope scope(VFP3); 3740 CpuFeatures::Scope scope(VFP3);
3741 // Allocate a HeapNumber for the result. Don't use r0 and r1 as 3741 // Allocate a HeapNumber for the result. Don't use r0 and r1 as
3742 // AllocateHeapNumber clobbers all registers - also when jumping due to 3742 // AllocateHeapNumber clobbers all registers - also when jumping due to
3743 // exhausted young space. 3743 // exhausted young space.
3744 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex); 3744 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex);
3745 __ AllocateHeapNumber(r2, r3, r4, r6, &slow); 3745 __ AllocateHeapNumber(r2, r3, r4, r6, &slow);
3746 __ sub(r1, r2, Operand(kHeapObjectTag)); 3746 __ sub(r1, r2, Operand(kHeapObjectTag));
3747 __ vstr(d0, r1, HeapNumber::kValueOffset); 3747 __ vstr(d0, r1, HeapNumber::kValueOffset);
3748 3748
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3785 3785
3786 __ bind(&miss_force_generic); 3786 __ bind(&miss_force_generic);
3787 Code* stub = masm->isolate()->builtins()->builtin( 3787 Code* stub = masm->isolate()->builtins()->builtin(
3788 Builtins::kKeyedLoadIC_MissForceGeneric); 3788 Builtins::kKeyedLoadIC_MissForceGeneric);
3789 __ Jump(Handle<Code>(stub), RelocInfo::CODE_TARGET); 3789 __ Jump(Handle<Code>(stub), RelocInfo::CODE_TARGET);
3790 } 3790 }
3791 3791
3792 3792
3793 void KeyedStoreStubCompiler::GenerateStoreExternalArray( 3793 void KeyedStoreStubCompiler::GenerateStoreExternalArray(
3794 MacroAssembler* masm, 3794 MacroAssembler* masm,
3795 JSObject::ElementsKind elements_kind) { 3795 ElementsKind elements_kind) {
3796 // ---------- S t a t e -------------- 3796 // ---------- S t a t e --------------
3797 // -- r0 : value 3797 // -- r0 : value
3798 // -- r1 : key 3798 // -- r1 : key
3799 // -- r2 : receiver 3799 // -- r2 : receiver
3800 // -- lr : return address 3800 // -- lr : return address
3801 // ----------------------------------- 3801 // -----------------------------------
3802 Label slow, check_heap_number, miss_force_generic; 3802 Label slow, check_heap_number, miss_force_generic;
3803 3803
3804 // Register usage. 3804 // Register usage.
3805 Register value = r0; 3805 Register value = r0;
(...skipping 11 matching lines...) Expand all
3817 3817
3818 // Check that the index is in range 3818 // Check that the index is in range
3819 __ ldr(ip, FieldMemOperand(r3, ExternalArray::kLengthOffset)); 3819 __ ldr(ip, FieldMemOperand(r3, ExternalArray::kLengthOffset));
3820 __ cmp(key, ip); 3820 __ cmp(key, ip);
3821 // Unsigned comparison catches both negative and too-large values. 3821 // Unsigned comparison catches both negative and too-large values.
3822 __ b(hs, &miss_force_generic); 3822 __ b(hs, &miss_force_generic);
3823 3823
3824 // Handle both smis and HeapNumbers in the fast path. Go to the 3824 // Handle both smis and HeapNumbers in the fast path. Go to the
3825 // runtime for all other kinds of values. 3825 // runtime for all other kinds of values.
3826 // r3: external array. 3826 // r3: external array.
3827 if (elements_kind == JSObject::EXTERNAL_PIXEL_ELEMENTS) { 3827 if (elements_kind == EXTERNAL_PIXEL_ELEMENTS) {
3828 // Double to pixel conversion is only implemented in the runtime for now. 3828 // Double to pixel conversion is only implemented in the runtime for now.
3829 __ JumpIfNotSmi(value, &slow); 3829 __ JumpIfNotSmi(value, &slow);
3830 } else { 3830 } else {
3831 __ JumpIfNotSmi(value, &check_heap_number); 3831 __ JumpIfNotSmi(value, &check_heap_number);
3832 } 3832 }
3833 __ SmiUntag(r5, value); 3833 __ SmiUntag(r5, value);
3834 __ ldr(r3, FieldMemOperand(r3, ExternalArray::kExternalPointerOffset)); 3834 __ ldr(r3, FieldMemOperand(r3, ExternalArray::kExternalPointerOffset));
3835 3835
3836 // r3: base pointer of external storage. 3836 // r3: base pointer of external storage.
3837 // r5: value (integer). 3837 // r5: value (integer).
3838 switch (elements_kind) { 3838 switch (elements_kind) {
3839 case JSObject::EXTERNAL_PIXEL_ELEMENTS: 3839 case EXTERNAL_PIXEL_ELEMENTS:
3840 // Clamp the value to [0..255]. 3840 // Clamp the value to [0..255].
3841 __ Usat(r5, 8, Operand(r5)); 3841 __ Usat(r5, 8, Operand(r5));
3842 __ strb(r5, MemOperand(r3, key, LSR, 1)); 3842 __ strb(r5, MemOperand(r3, key, LSR, 1));
3843 break; 3843 break;
3844 case JSObject::EXTERNAL_BYTE_ELEMENTS: 3844 case EXTERNAL_BYTE_ELEMENTS:
3845 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 3845 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
3846 __ strb(r5, MemOperand(r3, key, LSR, 1)); 3846 __ strb(r5, MemOperand(r3, key, LSR, 1));
3847 break; 3847 break;
3848 case JSObject::EXTERNAL_SHORT_ELEMENTS: 3848 case EXTERNAL_SHORT_ELEMENTS:
3849 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 3849 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
3850 __ strh(r5, MemOperand(r3, key, LSL, 0)); 3850 __ strh(r5, MemOperand(r3, key, LSL, 0));
3851 break; 3851 break;
3852 case JSObject::EXTERNAL_INT_ELEMENTS: 3852 case EXTERNAL_INT_ELEMENTS:
3853 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: 3853 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
3854 __ str(r5, MemOperand(r3, key, LSL, 1)); 3854 __ str(r5, MemOperand(r3, key, LSL, 1));
3855 break; 3855 break;
3856 case JSObject::EXTERNAL_FLOAT_ELEMENTS: 3856 case EXTERNAL_FLOAT_ELEMENTS:
3857 // Perform int-to-float conversion and store to memory. 3857 // Perform int-to-float conversion and store to memory.
3858 __ SmiUntag(r4, key); 3858 __ SmiUntag(r4, key);
3859 StoreIntAsFloat(masm, r3, r4, r5, r6, r7, r9); 3859 StoreIntAsFloat(masm, r3, r4, r5, r6, r7, r9);
3860 break; 3860 break;
3861 case JSObject::EXTERNAL_DOUBLE_ELEMENTS: 3861 case EXTERNAL_DOUBLE_ELEMENTS:
3862 __ add(r3, r3, Operand(key, LSL, 2)); 3862 __ add(r3, r3, Operand(key, LSL, 2));
3863 // r3: effective address of the double element 3863 // r3: effective address of the double element
3864 FloatingPointHelper::Destination destination; 3864 FloatingPointHelper::Destination destination;
3865 if (CpuFeatures::IsSupported(VFP3)) { 3865 if (CpuFeatures::IsSupported(VFP3)) {
3866 destination = FloatingPointHelper::kVFPRegisters; 3866 destination = FloatingPointHelper::kVFPRegisters;
3867 } else { 3867 } else {
3868 destination = FloatingPointHelper::kCoreRegisters; 3868 destination = FloatingPointHelper::kCoreRegisters;
3869 } 3869 }
3870 FloatingPointHelper::ConvertIntToDouble( 3870 FloatingPointHelper::ConvertIntToDouble(
3871 masm, r5, destination, 3871 masm, r5, destination,
3872 d0, r6, r7, // These are: double_dst, dst1, dst2. 3872 d0, r6, r7, // These are: double_dst, dst1, dst2.
3873 r4, s2); // These are: scratch2, single_scratch. 3873 r4, s2); // These are: scratch2, single_scratch.
3874 if (destination == FloatingPointHelper::kVFPRegisters) { 3874 if (destination == FloatingPointHelper::kVFPRegisters) {
3875 CpuFeatures::Scope scope(VFP3); 3875 CpuFeatures::Scope scope(VFP3);
3876 __ vstr(d0, r3, 0); 3876 __ vstr(d0, r3, 0);
3877 } else { 3877 } else {
3878 __ str(r6, MemOperand(r3, 0)); 3878 __ str(r6, MemOperand(r3, 0));
3879 __ str(r7, MemOperand(r3, Register::kSizeInBytes)); 3879 __ str(r7, MemOperand(r3, Register::kSizeInBytes));
3880 } 3880 }
3881 break; 3881 break;
3882 case JSObject::FAST_ELEMENTS: 3882 case FAST_ELEMENTS:
3883 case JSObject::FAST_DOUBLE_ELEMENTS: 3883 case FAST_DOUBLE_ELEMENTS:
3884 case JSObject::DICTIONARY_ELEMENTS: 3884 case DICTIONARY_ELEMENTS:
3885 case JSObject::NON_STRICT_ARGUMENTS_ELEMENTS: 3885 case NON_STRICT_ARGUMENTS_ELEMENTS:
3886 UNREACHABLE(); 3886 UNREACHABLE();
3887 break; 3887 break;
3888 } 3888 }
3889 3889
3890 // Entry registers are intact, r0 holds the value which is the return value. 3890 // Entry registers are intact, r0 holds the value which is the return value.
3891 __ Ret(); 3891 __ Ret();
3892 3892
3893 if (elements_kind != JSObject::EXTERNAL_PIXEL_ELEMENTS) { 3893 if (elements_kind != EXTERNAL_PIXEL_ELEMENTS) {
3894 // r3: external array. 3894 // r3: external array.
3895 __ bind(&check_heap_number); 3895 __ bind(&check_heap_number);
3896 __ CompareObjectType(value, r5, r6, HEAP_NUMBER_TYPE); 3896 __ CompareObjectType(value, r5, r6, HEAP_NUMBER_TYPE);
3897 __ b(ne, &slow); 3897 __ b(ne, &slow);
3898 3898
3899 __ ldr(r3, FieldMemOperand(r3, ExternalArray::kExternalPointerOffset)); 3899 __ ldr(r3, FieldMemOperand(r3, ExternalArray::kExternalPointerOffset));
3900 3900
3901 // r3: base pointer of external storage. 3901 // r3: base pointer of external storage.
3902 3902
3903 // The WebGL specification leaves the behavior of storing NaN and 3903 // The WebGL specification leaves the behavior of storing NaN and
3904 // +/-Infinity into integer arrays basically undefined. For more 3904 // +/-Infinity into integer arrays basically undefined. For more
3905 // reproducible behavior, convert these to zero. 3905 // reproducible behavior, convert these to zero.
3906 if (CpuFeatures::IsSupported(VFP3)) { 3906 if (CpuFeatures::IsSupported(VFP3)) {
3907 CpuFeatures::Scope scope(VFP3); 3907 CpuFeatures::Scope scope(VFP3);
3908 3908
3909 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { 3909 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) {
3910 // vldr requires offset to be a multiple of 4 so we can not 3910 // vldr requires offset to be a multiple of 4 so we can not
3911 // include -kHeapObjectTag into it. 3911 // include -kHeapObjectTag into it.
3912 __ sub(r5, r0, Operand(kHeapObjectTag)); 3912 __ sub(r5, r0, Operand(kHeapObjectTag));
3913 __ vldr(d0, r5, HeapNumber::kValueOffset); 3913 __ vldr(d0, r5, HeapNumber::kValueOffset);
3914 __ add(r5, r3, Operand(key, LSL, 1)); 3914 __ add(r5, r3, Operand(key, LSL, 1));
3915 __ vcvt_f32_f64(s0, d0); 3915 __ vcvt_f32_f64(s0, d0);
3916 __ vstr(s0, r5, 0); 3916 __ vstr(s0, r5, 0);
3917 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { 3917 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) {
3918 __ sub(r5, r0, Operand(kHeapObjectTag)); 3918 __ sub(r5, r0, Operand(kHeapObjectTag));
3919 __ vldr(d0, r5, HeapNumber::kValueOffset); 3919 __ vldr(d0, r5, HeapNumber::kValueOffset);
3920 __ add(r5, r3, Operand(key, LSL, 2)); 3920 __ add(r5, r3, Operand(key, LSL, 2));
3921 __ vstr(d0, r5, 0); 3921 __ vstr(d0, r5, 0);
3922 } else { 3922 } else {
3923 // Hoisted load. vldr requires offset to be a multiple of 4 so we can 3923 // Hoisted load. vldr requires offset to be a multiple of 4 so we can
3924 // not include -kHeapObjectTag into it. 3924 // not include -kHeapObjectTag into it.
3925 __ sub(r5, value, Operand(kHeapObjectTag)); 3925 __ sub(r5, value, Operand(kHeapObjectTag));
3926 __ vldr(d0, r5, HeapNumber::kValueOffset); 3926 __ vldr(d0, r5, HeapNumber::kValueOffset);
3927 __ EmitECMATruncate(r5, d0, s2, r6, r7, r9); 3927 __ EmitECMATruncate(r5, d0, s2, r6, r7, r9);
3928 3928
3929 switch (elements_kind) { 3929 switch (elements_kind) {
3930 case JSObject::EXTERNAL_BYTE_ELEMENTS: 3930 case EXTERNAL_BYTE_ELEMENTS:
3931 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 3931 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
3932 __ strb(r5, MemOperand(r3, key, LSR, 1)); 3932 __ strb(r5, MemOperand(r3, key, LSR, 1));
3933 break; 3933 break;
3934 case JSObject::EXTERNAL_SHORT_ELEMENTS: 3934 case EXTERNAL_SHORT_ELEMENTS:
3935 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 3935 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
3936 __ strh(r5, MemOperand(r3, key, LSL, 0)); 3936 __ strh(r5, MemOperand(r3, key, LSL, 0));
3937 break; 3937 break;
3938 case JSObject::EXTERNAL_INT_ELEMENTS: 3938 case EXTERNAL_INT_ELEMENTS:
3939 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: 3939 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
3940 __ str(r5, MemOperand(r3, key, LSL, 1)); 3940 __ str(r5, MemOperand(r3, key, LSL, 1));
3941 break; 3941 break;
3942 case JSObject::EXTERNAL_PIXEL_ELEMENTS: 3942 case EXTERNAL_PIXEL_ELEMENTS:
3943 case JSObject::EXTERNAL_FLOAT_ELEMENTS: 3943 case EXTERNAL_FLOAT_ELEMENTS:
3944 case JSObject::EXTERNAL_DOUBLE_ELEMENTS: 3944 case EXTERNAL_DOUBLE_ELEMENTS:
3945 case JSObject::FAST_ELEMENTS: 3945 case FAST_ELEMENTS:
3946 case JSObject::FAST_DOUBLE_ELEMENTS: 3946 case FAST_DOUBLE_ELEMENTS:
3947 case JSObject::DICTIONARY_ELEMENTS: 3947 case DICTIONARY_ELEMENTS:
3948 case JSObject::NON_STRICT_ARGUMENTS_ELEMENTS: 3948 case NON_STRICT_ARGUMENTS_ELEMENTS:
3949 UNREACHABLE(); 3949 UNREACHABLE();
3950 break; 3950 break;
3951 } 3951 }
3952 } 3952 }
3953 3953
3954 // Entry registers are intact, r0 holds the value which is the return 3954 // Entry registers are intact, r0 holds the value which is the return
3955 // value. 3955 // value.
3956 __ Ret(); 3956 __ Ret();
3957 } else { 3957 } else {
3958 // VFP3 is not available do manual conversions. 3958 // VFP3 is not available do manual conversions.
3959 __ ldr(r5, FieldMemOperand(value, HeapNumber::kExponentOffset)); 3959 __ ldr(r5, FieldMemOperand(value, HeapNumber::kExponentOffset));
3960 __ ldr(r6, FieldMemOperand(value, HeapNumber::kMantissaOffset)); 3960 __ ldr(r6, FieldMemOperand(value, HeapNumber::kMantissaOffset));
3961 3961
3962 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) { 3962 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) {
3963 Label done, nan_or_infinity_or_zero; 3963 Label done, nan_or_infinity_or_zero;
3964 static const int kMantissaInHiWordShift = 3964 static const int kMantissaInHiWordShift =
3965 kBinary32MantissaBits - HeapNumber::kMantissaBitsInTopWord; 3965 kBinary32MantissaBits - HeapNumber::kMantissaBitsInTopWord;
3966 3966
3967 static const int kMantissaInLoWordShift = 3967 static const int kMantissaInLoWordShift =
3968 kBitsPerInt - kMantissaInHiWordShift; 3968 kBitsPerInt - kMantissaInHiWordShift;
3969 3969
3970 // Test for all special exponent values: zeros, subnormal numbers, NaNs 3970 // Test for all special exponent values: zeros, subnormal numbers, NaNs
3971 // and infinities. All these should be converted to 0. 3971 // and infinities. All these should be converted to 0.
3972 __ mov(r7, Operand(HeapNumber::kExponentMask)); 3972 __ mov(r7, Operand(HeapNumber::kExponentMask));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
4004 // value. 4004 // value.
4005 __ Ret(); 4005 __ Ret();
4006 4006
4007 __ bind(&nan_or_infinity_or_zero); 4007 __ bind(&nan_or_infinity_or_zero);
4008 __ and_(r7, r5, Operand(HeapNumber::kSignMask)); 4008 __ and_(r7, r5, Operand(HeapNumber::kSignMask));
4009 __ and_(r5, r5, Operand(HeapNumber::kMantissaMask)); 4009 __ and_(r5, r5, Operand(HeapNumber::kMantissaMask));
4010 __ orr(r9, r9, r7); 4010 __ orr(r9, r9, r7);
4011 __ orr(r9, r9, Operand(r5, LSL, kMantissaInHiWordShift)); 4011 __ orr(r9, r9, Operand(r5, LSL, kMantissaInHiWordShift));
4012 __ orr(r5, r9, Operand(r6, LSR, kMantissaInLoWordShift)); 4012 __ orr(r5, r9, Operand(r6, LSR, kMantissaInLoWordShift));
4013 __ b(&done); 4013 __ b(&done);
4014 } else if (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { 4014 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) {
4015 __ add(r7, r3, Operand(key, LSL, 2)); 4015 __ add(r7, r3, Operand(key, LSL, 2));
4016 // r7: effective address of destination element. 4016 // r7: effective address of destination element.
4017 __ str(r6, MemOperand(r7, 0)); 4017 __ str(r6, MemOperand(r7, 0));
4018 __ str(r5, MemOperand(r7, Register::kSizeInBytes)); 4018 __ str(r5, MemOperand(r7, Register::kSizeInBytes));
4019 __ Ret(); 4019 __ Ret();
4020 } else { 4020 } else {
4021 bool is_signed_type = IsElementTypeSigned(elements_kind); 4021 bool is_signed_type = IsElementTypeSigned(elements_kind);
4022 int meaningfull_bits = is_signed_type ? (kBitsPerInt - 1) : kBitsPerInt; 4022 int meaningfull_bits = is_signed_type ? (kBitsPerInt - 1) : kBitsPerInt;
4023 int32_t min_value = is_signed_type ? 0x80000000 : 0x00000000; 4023 int32_t min_value = is_signed_type ? 0x80000000 : 0x00000000;
4024 4024
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4059 __ mov(r5, Operand(r5, LSL, r9)); 4059 __ mov(r5, Operand(r5, LSL, r9));
4060 __ rsb(r9, r9, Operand(meaningfull_bits)); 4060 __ rsb(r9, r9, Operand(meaningfull_bits));
4061 __ orr(r5, r5, Operand(r6, LSR, r9)); 4061 __ orr(r5, r5, Operand(r6, LSR, r9));
4062 4062
4063 __ bind(&sign); 4063 __ bind(&sign);
4064 __ teq(r7, Operand(0, RelocInfo::NONE)); 4064 __ teq(r7, Operand(0, RelocInfo::NONE));
4065 __ rsb(r5, r5, Operand(0, RelocInfo::NONE), LeaveCC, ne); 4065 __ rsb(r5, r5, Operand(0, RelocInfo::NONE), LeaveCC, ne);
4066 4066
4067 __ bind(&done); 4067 __ bind(&done);
4068 switch (elements_kind) { 4068 switch (elements_kind) {
4069 case JSObject::EXTERNAL_BYTE_ELEMENTS: 4069 case EXTERNAL_BYTE_ELEMENTS:
4070 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 4070 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
4071 __ strb(r5, MemOperand(r3, key, LSR, 1)); 4071 __ strb(r5, MemOperand(r3, key, LSR, 1));
4072 break; 4072 break;
4073 case JSObject::EXTERNAL_SHORT_ELEMENTS: 4073 case EXTERNAL_SHORT_ELEMENTS:
4074 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 4074 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
4075 __ strh(r5, MemOperand(r3, key, LSL, 0)); 4075 __ strh(r5, MemOperand(r3, key, LSL, 0));
4076 break; 4076 break;
4077 case JSObject::EXTERNAL_INT_ELEMENTS: 4077 case EXTERNAL_INT_ELEMENTS:
4078 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: 4078 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
4079 __ str(r5, MemOperand(r3, key, LSL, 1)); 4079 __ str(r5, MemOperand(r3, key, LSL, 1));
4080 break; 4080 break;
4081 case JSObject::EXTERNAL_PIXEL_ELEMENTS: 4081 case EXTERNAL_PIXEL_ELEMENTS:
4082 case JSObject::EXTERNAL_FLOAT_ELEMENTS: 4082 case EXTERNAL_FLOAT_ELEMENTS:
4083 case JSObject::EXTERNAL_DOUBLE_ELEMENTS: 4083 case EXTERNAL_DOUBLE_ELEMENTS:
4084 case JSObject::FAST_ELEMENTS: 4084 case FAST_ELEMENTS:
4085 case JSObject::FAST_DOUBLE_ELEMENTS: 4085 case FAST_DOUBLE_ELEMENTS:
4086 case JSObject::DICTIONARY_ELEMENTS: 4086 case DICTIONARY_ELEMENTS:
4087 case JSObject::NON_STRICT_ARGUMENTS_ELEMENTS: 4087 case NON_STRICT_ARGUMENTS_ELEMENTS:
4088 UNREACHABLE(); 4088 UNREACHABLE();
4089 break; 4089 break;
4090 } 4090 }
4091 } 4091 }
4092 } 4092 }
4093 } 4093 }
4094 4094
4095 // Slow case, key and receiver still in r0 and r1. 4095 // Slow case, key and receiver still in r0 and r1.
4096 __ bind(&slow); 4096 __ bind(&slow);
4097 __ IncrementCounter( 4097 __ IncrementCounter(
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
4421 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); 4421 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
4422 __ Jump(ic, RelocInfo::CODE_TARGET); 4422 __ Jump(ic, RelocInfo::CODE_TARGET);
4423 } 4423 }
4424 4424
4425 4425
4426 #undef __ 4426 #undef __
4427 4427
4428 } } // namespace v8::internal 4428 } } // namespace v8::internal
4429 4429
4430 #endif // V8_TARGET_ARCH_ARM 4430 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698