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

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

Issue 10170030: Implement tracking and optimizations of packed arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years, 7 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 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 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 __ bind(&with_write_barrier); 1574 __ bind(&with_write_barrier);
1575 1575
1576 __ ldr(r3, FieldMemOperand(receiver, HeapObject::kMapOffset)); 1576 __ ldr(r3, FieldMemOperand(receiver, HeapObject::kMapOffset));
1577 1577
1578 if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) { 1578 if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) {
1579 Label fast_object, not_fast_object; 1579 Label fast_object, not_fast_object;
1580 __ CheckFastObjectElements(r3, r7, &not_fast_object); 1580 __ CheckFastObjectElements(r3, r7, &not_fast_object);
1581 __ jmp(&fast_object); 1581 __ jmp(&fast_object);
1582 // In case of fast smi-only, convert to fast object, otherwise bail out. 1582 // In case of fast smi-only, convert to fast object, otherwise bail out.
1583 __ bind(&not_fast_object); 1583 __ bind(&not_fast_object);
1584 __ CheckFastSmiOnlyElements(r3, r7, &call_builtin); 1584 __ CheckFastSmiElements(r3, r7, &call_builtin);
1585 // edx: receiver 1585 // edx: receiver
1586 // r3: map 1586 // r3: map
1587 __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS, 1587 Label try_holey_map;
1588 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
1588 FAST_ELEMENTS, 1589 FAST_ELEMENTS,
1589 r3, 1590 r3,
1590 r7, 1591 r7,
1592 &try_holey_map);
1593 __ mov(r2, receiver);
1594 ElementsTransitionGenerator::
1595 GenerateMapChangeElementsTransition(masm());
1596 __ jmp(&fast_object);
1597
1598 __ bind(&try_holey_map);
1599 __ LoadTransitionedArrayMapConditional(FAST_HOLEY_SMI_ELEMENTS,
1600 FAST_HOLEY_ELEMENTS,
1601 r3,
1602 r7,
1591 &call_builtin); 1603 &call_builtin);
1592 __ mov(r2, receiver); 1604 __ mov(r2, receiver);
1593 ElementsTransitionGenerator::GenerateSmiOnlyToObject(masm()); 1605 ElementsTransitionGenerator::
1606 GenerateMapChangeElementsTransition(masm());
1594 __ bind(&fast_object); 1607 __ bind(&fast_object);
1595 } else { 1608 } else {
1596 __ CheckFastObjectElements(r3, r3, &call_builtin); 1609 __ CheckFastObjectElements(r3, r3, &call_builtin);
1597 } 1610 }
1598 1611
1599 // Save new length. 1612 // Save new length.
1600 __ str(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); 1613 __ str(r0, FieldMemOperand(receiver, JSArray::kLengthOffset));
1601 1614
1602 // Store the value. 1615 // Store the value.
1603 // We may need a register containing the address end_elements below, 1616 // We may need a register containing the address end_elements below,
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
3365 3378
3366 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 3379 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
3367 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 3380 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
3368 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 3381 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
3369 case EXTERNAL_PIXEL_ELEMENTS: 3382 case EXTERNAL_PIXEL_ELEMENTS:
3370 return false; 3383 return false;
3371 3384
3372 case EXTERNAL_FLOAT_ELEMENTS: 3385 case EXTERNAL_FLOAT_ELEMENTS:
3373 case EXTERNAL_DOUBLE_ELEMENTS: 3386 case EXTERNAL_DOUBLE_ELEMENTS:
3374 case FAST_ELEMENTS: 3387 case FAST_ELEMENTS:
3375 case FAST_SMI_ONLY_ELEMENTS: 3388 case FAST_SMI_ELEMENTS:
3376 case FAST_DOUBLE_ELEMENTS: 3389 case FAST_DOUBLE_ELEMENTS:
3390 case FAST_HOLEY_ELEMENTS:
3391 case FAST_HOLEY_SMI_ELEMENTS:
3392 case FAST_HOLEY_DOUBLE_ELEMENTS:
3377 case DICTIONARY_ELEMENTS: 3393 case DICTIONARY_ELEMENTS:
3378 case NON_STRICT_ARGUMENTS_ELEMENTS: 3394 case NON_STRICT_ARGUMENTS_ELEMENTS:
3379 UNREACHABLE(); 3395 UNREACHABLE();
3380 return false; 3396 return false;
3381 } 3397 }
3382 return false; 3398 return false;
3383 } 3399 }
3384 3400
3385 3401
3386 static void GenerateSmiKeyCheck(MacroAssembler* masm, 3402 static void GenerateSmiKeyCheck(MacroAssembler* masm,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
3490 __ add(r2, r3, Operand(key, LSL, 2)); 3506 __ add(r2, r3, Operand(key, LSL, 2));
3491 __ vldr(d0, r2, 0); 3507 __ vldr(d0, r2, 0);
3492 } else { 3508 } else {
3493 __ add(r4, r3, Operand(key, LSL, 2)); 3509 __ add(r4, r3, Operand(key, LSL, 2));
3494 // r4: pointer to the beginning of the double we want to load. 3510 // r4: pointer to the beginning of the double we want to load.
3495 __ ldr(r2, MemOperand(r4, 0)); 3511 __ ldr(r2, MemOperand(r4, 0));
3496 __ ldr(r3, MemOperand(r4, Register::kSizeInBytes)); 3512 __ ldr(r3, MemOperand(r4, Register::kSizeInBytes));
3497 } 3513 }
3498 break; 3514 break;
3499 case FAST_ELEMENTS: 3515 case FAST_ELEMENTS:
3500 case FAST_SMI_ONLY_ELEMENTS: 3516 case FAST_SMI_ELEMENTS:
3501 case FAST_DOUBLE_ELEMENTS: 3517 case FAST_DOUBLE_ELEMENTS:
3518 case FAST_HOLEY_ELEMENTS:
3519 case FAST_HOLEY_SMI_ELEMENTS:
3520 case FAST_HOLEY_DOUBLE_ELEMENTS:
3502 case DICTIONARY_ELEMENTS: 3521 case DICTIONARY_ELEMENTS:
3503 case NON_STRICT_ARGUMENTS_ELEMENTS: 3522 case NON_STRICT_ARGUMENTS_ELEMENTS:
3504 UNREACHABLE(); 3523 UNREACHABLE();
3505 break; 3524 break;
3506 } 3525 }
3507 3526
3508 // For integer array types: 3527 // For integer array types:
3509 // r2: value 3528 // r2: value
3510 // For float array type: 3529 // For float array type:
3511 // s0: value (if VFP3 is supported) 3530 // s0: value (if VFP3 is supported)
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
3831 r4, s2); // These are: scratch2, single_scratch. 3850 r4, s2); // These are: scratch2, single_scratch.
3832 if (destination == FloatingPointHelper::kVFPRegisters) { 3851 if (destination == FloatingPointHelper::kVFPRegisters) {
3833 CpuFeatures::Scope scope(VFP3); 3852 CpuFeatures::Scope scope(VFP3);
3834 __ vstr(d0, r3, 0); 3853 __ vstr(d0, r3, 0);
3835 } else { 3854 } else {
3836 __ str(r6, MemOperand(r3, 0)); 3855 __ str(r6, MemOperand(r3, 0));
3837 __ str(r7, MemOperand(r3, Register::kSizeInBytes)); 3856 __ str(r7, MemOperand(r3, Register::kSizeInBytes));
3838 } 3857 }
3839 break; 3858 break;
3840 case FAST_ELEMENTS: 3859 case FAST_ELEMENTS:
3841 case FAST_SMI_ONLY_ELEMENTS: 3860 case FAST_SMI_ELEMENTS:
3842 case FAST_DOUBLE_ELEMENTS: 3861 case FAST_DOUBLE_ELEMENTS:
3862 case FAST_HOLEY_ELEMENTS:
3863 case FAST_HOLEY_SMI_ELEMENTS:
3864 case FAST_HOLEY_DOUBLE_ELEMENTS:
3843 case DICTIONARY_ELEMENTS: 3865 case DICTIONARY_ELEMENTS:
3844 case NON_STRICT_ARGUMENTS_ELEMENTS: 3866 case NON_STRICT_ARGUMENTS_ELEMENTS:
3845 UNREACHABLE(); 3867 UNREACHABLE();
3846 break; 3868 break;
3847 } 3869 }
3848 3870
3849 // Entry registers are intact, r0 holds the value which is the return value. 3871 // Entry registers are intact, r0 holds the value which is the return value.
3850 __ Ret(); 3872 __ Ret();
3851 3873
3852 if (elements_kind != EXTERNAL_PIXEL_ELEMENTS) { 3874 if (elements_kind != EXTERNAL_PIXEL_ELEMENTS) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3895 __ strh(r5, MemOperand(r3, key, LSL, 0)); 3917 __ strh(r5, MemOperand(r3, key, LSL, 0));
3896 break; 3918 break;
3897 case EXTERNAL_INT_ELEMENTS: 3919 case EXTERNAL_INT_ELEMENTS:
3898 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 3920 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
3899 __ str(r5, MemOperand(r3, key, LSL, 1)); 3921 __ str(r5, MemOperand(r3, key, LSL, 1));
3900 break; 3922 break;
3901 case EXTERNAL_PIXEL_ELEMENTS: 3923 case EXTERNAL_PIXEL_ELEMENTS:
3902 case EXTERNAL_FLOAT_ELEMENTS: 3924 case EXTERNAL_FLOAT_ELEMENTS:
3903 case EXTERNAL_DOUBLE_ELEMENTS: 3925 case EXTERNAL_DOUBLE_ELEMENTS:
3904 case FAST_ELEMENTS: 3926 case FAST_ELEMENTS:
3905 case FAST_SMI_ONLY_ELEMENTS: 3927 case FAST_SMI_ELEMENTS:
3906 case FAST_DOUBLE_ELEMENTS: 3928 case FAST_DOUBLE_ELEMENTS:
3929 case FAST_HOLEY_ELEMENTS:
3930 case FAST_HOLEY_SMI_ELEMENTS:
3931 case FAST_HOLEY_DOUBLE_ELEMENTS:
3907 case DICTIONARY_ELEMENTS: 3932 case DICTIONARY_ELEMENTS:
3908 case NON_STRICT_ARGUMENTS_ELEMENTS: 3933 case NON_STRICT_ARGUMENTS_ELEMENTS:
3909 UNREACHABLE(); 3934 UNREACHABLE();
3910 break; 3935 break;
3911 } 3936 }
3912 } 3937 }
3913 3938
3914 // Entry registers are intact, r0 holds the value which is the return 3939 // Entry registers are intact, r0 holds the value which is the return
3915 // value. 3940 // value.
3916 __ Ret(); 3941 __ Ret();
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
4035 __ strh(r5, MemOperand(r3, key, LSL, 0)); 4060 __ strh(r5, MemOperand(r3, key, LSL, 0));
4036 break; 4061 break;
4037 case EXTERNAL_INT_ELEMENTS: 4062 case EXTERNAL_INT_ELEMENTS:
4038 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 4063 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
4039 __ str(r5, MemOperand(r3, key, LSL, 1)); 4064 __ str(r5, MemOperand(r3, key, LSL, 1));
4040 break; 4065 break;
4041 case EXTERNAL_PIXEL_ELEMENTS: 4066 case EXTERNAL_PIXEL_ELEMENTS:
4042 case EXTERNAL_FLOAT_ELEMENTS: 4067 case EXTERNAL_FLOAT_ELEMENTS:
4043 case EXTERNAL_DOUBLE_ELEMENTS: 4068 case EXTERNAL_DOUBLE_ELEMENTS:
4044 case FAST_ELEMENTS: 4069 case FAST_ELEMENTS:
4045 case FAST_SMI_ONLY_ELEMENTS: 4070 case FAST_SMI_ELEMENTS:
4046 case FAST_DOUBLE_ELEMENTS: 4071 case FAST_DOUBLE_ELEMENTS:
4072 case FAST_HOLEY_ELEMENTS:
4073 case FAST_HOLEY_SMI_ELEMENTS:
4074 case FAST_HOLEY_DOUBLE_ELEMENTS:
4047 case DICTIONARY_ELEMENTS: 4075 case DICTIONARY_ELEMENTS:
4048 case NON_STRICT_ARGUMENTS_ELEMENTS: 4076 case NON_STRICT_ARGUMENTS_ELEMENTS:
4049 UNREACHABLE(); 4077 UNREACHABLE();
4050 break; 4078 break;
4051 } 4079 }
4052 } 4080 }
4053 } 4081 }
4054 } 4082 }
4055 4083
4056 // Slow case, key and receiver still in r0 and r1. 4084 // Slow case, key and receiver still in r0 and r1.
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
4218 Register elements_reg = r3; 4246 Register elements_reg = r3;
4219 Register length_reg = r5; 4247 Register length_reg = r5;
4220 Register scratch2 = r6; 4248 Register scratch2 = r6;
4221 4249
4222 // This stub is meant to be tail-jumped to, the receiver must already 4250 // This stub is meant to be tail-jumped to, the receiver must already
4223 // have been verified by the caller to not be a smi. 4251 // have been verified by the caller to not be a smi.
4224 4252
4225 // Check that the key is a smi or a heap number convertible to a smi. 4253 // Check that the key is a smi or a heap number convertible to a smi.
4226 GenerateSmiKeyCheck(masm, key_reg, r4, r5, d1, &miss_force_generic); 4254 GenerateSmiKeyCheck(masm, key_reg, r4, r5, d1, &miss_force_generic);
4227 4255
4228 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { 4256 if (IsFastSmiElementsKind(elements_kind)) {
4229 __ JumpIfNotSmi(value_reg, &transition_elements_kind); 4257 __ JumpIfNotSmi(value_reg, &transition_elements_kind);
4230 } 4258 }
4231 4259
4232 // Check that the key is within bounds. 4260 // Check that the key is within bounds.
4233 __ ldr(elements_reg, 4261 __ ldr(elements_reg,
4234 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); 4262 FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
4235 if (is_js_array) { 4263 if (is_js_array) {
4236 __ ldr(scratch, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); 4264 __ ldr(scratch, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
4237 } else { 4265 } else {
4238 __ ldr(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); 4266 __ ldr(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset));
4239 } 4267 }
4240 // Compare smis. 4268 // Compare smis.
4241 __ cmp(key_reg, scratch); 4269 __ cmp(key_reg, scratch);
4242 if (is_js_array && grow_mode == ALLOW_JSARRAY_GROWTH) { 4270 if (is_js_array && grow_mode == ALLOW_JSARRAY_GROWTH) {
4243 __ b(hs, &grow); 4271 __ b(hs, &grow);
4244 } else { 4272 } else {
4245 __ b(hs, &miss_force_generic); 4273 __ b(hs, &miss_force_generic);
4246 } 4274 }
4247 4275
4248 // Make sure elements is a fast element array, not 'cow'. 4276 // Make sure elements is a fast element array, not 'cow'.
4249 __ CheckMap(elements_reg, 4277 __ CheckMap(elements_reg,
4250 scratch, 4278 scratch,
4251 Heap::kFixedArrayMapRootIndex, 4279 Heap::kFixedArrayMapRootIndex,
4252 &miss_force_generic, 4280 &miss_force_generic,
4253 DONT_DO_SMI_CHECK); 4281 DONT_DO_SMI_CHECK);
4254 4282
4255 __ bind(&finish_store); 4283 __ bind(&finish_store);
4256 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { 4284 if (IsFastSmiElementsKind(elements_kind)) {
4257 __ add(scratch, 4285 __ add(scratch,
4258 elements_reg, 4286 elements_reg,
4259 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 4287 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
4260 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2); 4288 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2);
4261 __ add(scratch, 4289 __ add(scratch,
4262 scratch, 4290 scratch,
4263 Operand(key_reg, LSL, kPointerSizeLog2 - kSmiTagSize)); 4291 Operand(key_reg, LSL, kPointerSizeLog2 - kSmiTagSize));
4264 __ str(value_reg, MemOperand(scratch)); 4292 __ str(value_reg, MemOperand(scratch));
4265 } else { 4293 } else {
4266 ASSERT(elements_kind == FAST_ELEMENTS); 4294 ASSERT(IsFastObjectElementsKind(elements_kind));
4267 __ add(scratch, 4295 __ add(scratch,
4268 elements_reg, 4296 elements_reg,
4269 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 4297 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
4270 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2); 4298 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2);
4271 __ add(scratch, 4299 __ add(scratch,
4272 scratch, 4300 scratch,
4273 Operand(key_reg, LSL, kPointerSizeLog2 - kSmiTagSize)); 4301 Operand(key_reg, LSL, kPointerSizeLog2 - kSmiTagSize));
4274 __ str(value_reg, MemOperand(scratch)); 4302 __ str(value_reg, MemOperand(scratch));
4275 __ mov(receiver_reg, value_reg); 4303 __ mov(receiver_reg, value_reg);
4276 __ RecordWrite(elements_reg, // Object. 4304 __ RecordWrite(elements_reg, // Object.
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
4503 __ Jump(ic_slow, RelocInfo::CODE_TARGET); 4531 __ Jump(ic_slow, RelocInfo::CODE_TARGET);
4504 } 4532 }
4505 } 4533 }
4506 4534
4507 4535
4508 #undef __ 4536 #undef __
4509 4537
4510 } } // namespace v8::internal 4538 } } // namespace v8::internal
4511 4539
4512 #endif // V8_TARGET_ARCH_ARM 4540 #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