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

Side by Side Diff: src/mips/stub-cache-mips.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/mips/macro-assembler-mips.cc ('k') | src/objects.h » ('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 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 __ bind(&with_write_barrier); 1578 __ bind(&with_write_barrier);
1579 1579
1580 __ lw(a3, FieldMemOperand(receiver, HeapObject::kMapOffset)); 1580 __ lw(a3, FieldMemOperand(receiver, HeapObject::kMapOffset));
1581 1581
1582 if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) { 1582 if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) {
1583 Label fast_object, not_fast_object; 1583 Label fast_object, not_fast_object;
1584 __ CheckFastObjectElements(a3, t3, &not_fast_object); 1584 __ CheckFastObjectElements(a3, t3, &not_fast_object);
1585 __ jmp(&fast_object); 1585 __ jmp(&fast_object);
1586 // In case of fast smi-only, convert to fast object, otherwise bail out. 1586 // In case of fast smi-only, convert to fast object, otherwise bail out.
1587 __ bind(&not_fast_object); 1587 __ bind(&not_fast_object);
1588 __ CheckFastSmiOnlyElements(a3, t3, &call_builtin); 1588 __ CheckFastSmiElements(a3, t3, &call_builtin);
1589 // edx: receiver 1589 // edx: receiver
1590 // r3: map 1590 // r3: map
1591 __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS, 1591 Label try_holey_map;
1592 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
1592 FAST_ELEMENTS, 1593 FAST_ELEMENTS,
1593 a3, 1594 a3,
1594 t3, 1595 t3,
1596 &try_holey_map);
1597 __ mov(a2, receiver);
1598 ElementsTransitionGenerator::
1599 GenerateMapChangeElementsTransition(masm());
1600 __ jmp(&fast_object);
1601
1602 __ bind(&try_holey_map);
1603 __ LoadTransitionedArrayMapConditional(FAST_HOLEY_SMI_ELEMENTS,
1604 FAST_HOLEY_ELEMENTS,
1605 a3,
1606 t3,
1595 &call_builtin); 1607 &call_builtin);
1596 __ mov(a2, receiver); 1608 __ mov(a2, receiver);
1597 ElementsTransitionGenerator::GenerateSmiOnlyToObject(masm()); 1609 ElementsTransitionGenerator::
1610 GenerateMapChangeElementsTransition(masm());
1598 __ bind(&fast_object); 1611 __ bind(&fast_object);
1599 } else { 1612 } else {
1600 __ CheckFastObjectElements(a3, a3, &call_builtin); 1613 __ CheckFastObjectElements(a3, a3, &call_builtin);
1601 } 1614 }
1602 1615
1603 // Save new length. 1616 // Save new length.
1604 __ sw(v0, FieldMemOperand(receiver, JSArray::kLengthOffset)); 1617 __ sw(v0, FieldMemOperand(receiver, JSArray::kLengthOffset));
1605 1618
1606 // Store the value. 1619 // Store the value.
1607 // We may need a register containing the address end_elements below, 1620 // We may need a register containing the address end_elements below,
(...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after
3365 return true; 3378 return true;
3366 3379
3367 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: 3380 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
3368 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: 3381 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
3369 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 3382 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
3370 case EXTERNAL_PIXEL_ELEMENTS: 3383 case EXTERNAL_PIXEL_ELEMENTS:
3371 return false; 3384 return false;
3372 3385
3373 case EXTERNAL_FLOAT_ELEMENTS: 3386 case EXTERNAL_FLOAT_ELEMENTS:
3374 case EXTERNAL_DOUBLE_ELEMENTS: 3387 case EXTERNAL_DOUBLE_ELEMENTS:
3375 case FAST_SMI_ONLY_ELEMENTS: 3388 case FAST_SMI_ELEMENTS:
3376 case FAST_ELEMENTS: 3389 case FAST_ELEMENTS:
3377 case FAST_DOUBLE_ELEMENTS: 3390 case FAST_DOUBLE_ELEMENTS:
3391 case FAST_HOLEY_SMI_ELEMENTS:
3392 case FAST_HOLEY_ELEMENTS:
3393 case FAST_HOLEY_DOUBLE_ELEMENTS:
3378 case DICTIONARY_ELEMENTS: 3394 case DICTIONARY_ELEMENTS:
3379 case NON_STRICT_ARGUMENTS_ELEMENTS: 3395 case NON_STRICT_ARGUMENTS_ELEMENTS:
3380 UNREACHABLE(); 3396 UNREACHABLE();
3381 return false; 3397 return false;
3382 } 3398 }
3383 return false; 3399 return false;
3384 } 3400 }
3385 3401
3386 3402
3387 static void GenerateSmiKeyCheck(MacroAssembler* masm, 3403 static void GenerateSmiKeyCheck(MacroAssembler* masm,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
3501 if (CpuFeatures::IsSupported(FPU)) { 3517 if (CpuFeatures::IsSupported(FPU)) {
3502 CpuFeatures::Scope scope(FPU); 3518 CpuFeatures::Scope scope(FPU);
3503 __ ldc1(f0, MemOperand(t3, 0)); 3519 __ ldc1(f0, MemOperand(t3, 0));
3504 } else { 3520 } else {
3505 // t3: pointer to the beginning of the double we want to load. 3521 // t3: pointer to the beginning of the double we want to load.
3506 __ lw(a2, MemOperand(t3, 0)); 3522 __ lw(a2, MemOperand(t3, 0));
3507 __ lw(a3, MemOperand(t3, Register::kSizeInBytes)); 3523 __ lw(a3, MemOperand(t3, Register::kSizeInBytes));
3508 } 3524 }
3509 break; 3525 break;
3510 case FAST_ELEMENTS: 3526 case FAST_ELEMENTS:
3511 case FAST_SMI_ONLY_ELEMENTS: 3527 case FAST_SMI_ELEMENTS:
3512 case FAST_DOUBLE_ELEMENTS: 3528 case FAST_DOUBLE_ELEMENTS:
3529 case FAST_HOLEY_ELEMENTS:
3530 case FAST_HOLEY_SMI_ELEMENTS:
3531 case FAST_HOLEY_DOUBLE_ELEMENTS:
3513 case DICTIONARY_ELEMENTS: 3532 case DICTIONARY_ELEMENTS:
3514 case NON_STRICT_ARGUMENTS_ELEMENTS: 3533 case NON_STRICT_ARGUMENTS_ELEMENTS:
3515 UNREACHABLE(); 3534 UNREACHABLE();
3516 break; 3535 break;
3517 } 3536 }
3518 3537
3519 // For integer array types: 3538 // For integer array types:
3520 // a2: value 3539 // a2: value
3521 // For float array type: 3540 // For float array type:
3522 // f0: value (if FPU is supported) 3541 // f0: value (if FPU is supported)
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
3862 t0, f2); // These are: scratch2, single_scratch. 3881 t0, f2); // These are: scratch2, single_scratch.
3863 if (destination == FloatingPointHelper::kFPURegisters) { 3882 if (destination == FloatingPointHelper::kFPURegisters) {
3864 CpuFeatures::Scope scope(FPU); 3883 CpuFeatures::Scope scope(FPU);
3865 __ sdc1(f0, MemOperand(a3, 0)); 3884 __ sdc1(f0, MemOperand(a3, 0));
3866 } else { 3885 } else {
3867 __ sw(t2, MemOperand(a3, 0)); 3886 __ sw(t2, MemOperand(a3, 0));
3868 __ sw(t3, MemOperand(a3, Register::kSizeInBytes)); 3887 __ sw(t3, MemOperand(a3, Register::kSizeInBytes));
3869 } 3888 }
3870 break; 3889 break;
3871 case FAST_ELEMENTS: 3890 case FAST_ELEMENTS:
3872 case FAST_SMI_ONLY_ELEMENTS: 3891 case FAST_SMI_ELEMENTS:
3873 case FAST_DOUBLE_ELEMENTS: 3892 case FAST_DOUBLE_ELEMENTS:
3893 case FAST_HOLEY_ELEMENTS:
3894 case FAST_HOLEY_SMI_ELEMENTS:
3895 case FAST_HOLEY_DOUBLE_ELEMENTS:
3874 case DICTIONARY_ELEMENTS: 3896 case DICTIONARY_ELEMENTS:
3875 case NON_STRICT_ARGUMENTS_ELEMENTS: 3897 case NON_STRICT_ARGUMENTS_ELEMENTS:
3876 UNREACHABLE(); 3898 UNREACHABLE();
3877 break; 3899 break;
3878 } 3900 }
3879 3901
3880 // Entry registers are intact, a0 holds the value which is the return value. 3902 // Entry registers are intact, a0 holds the value which is the return value.
3881 __ mov(v0, a0); 3903 __ mov(v0, a0);
3882 __ Ret(); 3904 __ Ret();
3883 3905
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
3927 case EXTERNAL_INT_ELEMENTS: 3949 case EXTERNAL_INT_ELEMENTS:
3928 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 3950 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
3929 __ sll(t8, key, 1); 3951 __ sll(t8, key, 1);
3930 __ addu(t8, a3, t8); 3952 __ addu(t8, a3, t8);
3931 __ sw(t3, MemOperand(t8, 0)); 3953 __ sw(t3, MemOperand(t8, 0));
3932 break; 3954 break;
3933 case EXTERNAL_PIXEL_ELEMENTS: 3955 case EXTERNAL_PIXEL_ELEMENTS:
3934 case EXTERNAL_FLOAT_ELEMENTS: 3956 case EXTERNAL_FLOAT_ELEMENTS:
3935 case EXTERNAL_DOUBLE_ELEMENTS: 3957 case EXTERNAL_DOUBLE_ELEMENTS:
3936 case FAST_ELEMENTS: 3958 case FAST_ELEMENTS:
3937 case FAST_SMI_ONLY_ELEMENTS: 3959 case FAST_SMI_ELEMENTS:
3938 case FAST_DOUBLE_ELEMENTS: 3960 case FAST_DOUBLE_ELEMENTS:
3961 case FAST_HOLEY_ELEMENTS:
3962 case FAST_HOLEY_SMI_ELEMENTS:
3963 case FAST_HOLEY_DOUBLE_ELEMENTS:
3939 case DICTIONARY_ELEMENTS: 3964 case DICTIONARY_ELEMENTS:
3940 case NON_STRICT_ARGUMENTS_ELEMENTS: 3965 case NON_STRICT_ARGUMENTS_ELEMENTS:
3941 UNREACHABLE(); 3966 UNREACHABLE();
3942 break; 3967 break;
3943 } 3968 }
3944 } 3969 }
3945 3970
3946 // Entry registers are intact, a0 holds the value 3971 // Entry registers are intact, a0 holds the value
3947 // which is the return value. 3972 // which is the return value.
3948 __ mov(v0, a0); 3973 __ mov(v0, a0);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
4099 case EXTERNAL_INT_ELEMENTS: 4124 case EXTERNAL_INT_ELEMENTS:
4100 case EXTERNAL_UNSIGNED_INT_ELEMENTS: 4125 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
4101 __ sll(t8, key, 1); 4126 __ sll(t8, key, 1);
4102 __ addu(t8, a3, t8); 4127 __ addu(t8, a3, t8);
4103 __ sw(t3, MemOperand(t8, 0)); 4128 __ sw(t3, MemOperand(t8, 0));
4104 break; 4129 break;
4105 case EXTERNAL_PIXEL_ELEMENTS: 4130 case EXTERNAL_PIXEL_ELEMENTS:
4106 case EXTERNAL_FLOAT_ELEMENTS: 4131 case EXTERNAL_FLOAT_ELEMENTS:
4107 case EXTERNAL_DOUBLE_ELEMENTS: 4132 case EXTERNAL_DOUBLE_ELEMENTS:
4108 case FAST_ELEMENTS: 4133 case FAST_ELEMENTS:
4109 case FAST_SMI_ONLY_ELEMENTS: 4134 case FAST_SMI_ELEMENTS:
4110 case FAST_DOUBLE_ELEMENTS: 4135 case FAST_DOUBLE_ELEMENTS:
4136 case FAST_HOLEY_ELEMENTS:
4137 case FAST_HOLEY_SMI_ELEMENTS:
4138 case FAST_HOLEY_DOUBLE_ELEMENTS:
4111 case DICTIONARY_ELEMENTS: 4139 case DICTIONARY_ELEMENTS:
4112 case NON_STRICT_ARGUMENTS_ELEMENTS: 4140 case NON_STRICT_ARGUMENTS_ELEMENTS:
4113 UNREACHABLE(); 4141 UNREACHABLE();
4114 break; 4142 break;
4115 } 4143 }
4116 } 4144 }
4117 } 4145 }
4118 } 4146 }
4119 4147
4120 // Slow case, key and receiver still in a0 and a1. 4148 // Slow case, key and receiver still in a0 and a1.
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
4279 Register elements_reg = a3; 4307 Register elements_reg = a3;
4280 Register length_reg = t1; 4308 Register length_reg = t1;
4281 Register scratch2 = t2; 4309 Register scratch2 = t2;
4282 4310
4283 // This stub is meant to be tail-jumped to, the receiver must already 4311 // This stub is meant to be tail-jumped to, the receiver must already
4284 // have been verified by the caller to not be a smi. 4312 // have been verified by the caller to not be a smi.
4285 4313
4286 // Check that the key is a smi or a heap number convertible to a smi. 4314 // Check that the key is a smi or a heap number convertible to a smi.
4287 GenerateSmiKeyCheck(masm, key_reg, t0, t1, f2, &miss_force_generic); 4315 GenerateSmiKeyCheck(masm, key_reg, t0, t1, f2, &miss_force_generic);
4288 4316
4289 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { 4317 if (IsFastSmiElementsKind(elements_kind)) {
4290 __ JumpIfNotSmi(value_reg, &transition_elements_kind); 4318 __ JumpIfNotSmi(value_reg, &transition_elements_kind);
4291 } 4319 }
4292 4320
4293 // Check that the key is within bounds. 4321 // Check that the key is within bounds.
4294 __ lw(elements_reg, 4322 __ lw(elements_reg,
4295 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); 4323 FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
4296 if (is_js_array) { 4324 if (is_js_array) {
4297 __ lw(scratch, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); 4325 __ lw(scratch, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
4298 } else { 4326 } else {
4299 __ lw(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); 4327 __ lw(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset));
4300 } 4328 }
4301 // Compare smis. 4329 // Compare smis.
4302 if (is_js_array && grow_mode == ALLOW_JSARRAY_GROWTH) { 4330 if (is_js_array && grow_mode == ALLOW_JSARRAY_GROWTH) {
4303 __ Branch(&grow, hs, key_reg, Operand(scratch)); 4331 __ Branch(&grow, hs, key_reg, Operand(scratch));
4304 } else { 4332 } else {
4305 __ Branch(&miss_force_generic, hs, key_reg, Operand(scratch)); 4333 __ Branch(&miss_force_generic, hs, key_reg, Operand(scratch));
4306 } 4334 }
4307 4335
4308 // Make sure elements is a fast element array, not 'cow'. 4336 // Make sure elements is a fast element array, not 'cow'.
4309 __ CheckMap(elements_reg, 4337 __ CheckMap(elements_reg,
4310 scratch, 4338 scratch,
4311 Heap::kFixedArrayMapRootIndex, 4339 Heap::kFixedArrayMapRootIndex,
4312 &miss_force_generic, 4340 &miss_force_generic,
4313 DONT_DO_SMI_CHECK); 4341 DONT_DO_SMI_CHECK);
4314 4342
4315 __ bind(&finish_store); 4343 __ bind(&finish_store);
4316 4344
4317 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { 4345 if (IsFastSmiElementsKind(elements_kind)) {
4318 __ Addu(scratch, 4346 __ Addu(scratch,
4319 elements_reg, 4347 elements_reg,
4320 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 4348 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
4321 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2); 4349 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2);
4322 __ sll(scratch2, key_reg, kPointerSizeLog2 - kSmiTagSize); 4350 __ sll(scratch2, key_reg, kPointerSizeLog2 - kSmiTagSize);
4323 __ Addu(scratch, scratch, scratch2); 4351 __ Addu(scratch, scratch, scratch2);
4324 __ sw(value_reg, MemOperand(scratch)); 4352 __ sw(value_reg, MemOperand(scratch));
4325 } else { 4353 } else {
4326 ASSERT(elements_kind == FAST_ELEMENTS); 4354 ASSERT(IsFastObjectElementsKind(elements_kind));
4327 __ Addu(scratch, 4355 __ Addu(scratch,
4328 elements_reg, 4356 elements_reg,
4329 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 4357 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
4330 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2); 4358 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2);
4331 __ sll(scratch2, key_reg, kPointerSizeLog2 - kSmiTagSize); 4359 __ sll(scratch2, key_reg, kPointerSizeLog2 - kSmiTagSize);
4332 __ Addu(scratch, scratch, scratch2); 4360 __ Addu(scratch, scratch, scratch2);
4333 __ sw(value_reg, MemOperand(scratch)); 4361 __ sw(value_reg, MemOperand(scratch));
4334 __ mov(receiver_reg, value_reg); 4362 __ mov(receiver_reg, value_reg);
4335 ASSERT(elements_kind == FAST_ELEMENTS);
4336 __ RecordWrite(elements_reg, // Object. 4363 __ RecordWrite(elements_reg, // Object.
4337 scratch, // Address. 4364 scratch, // Address.
4338 receiver_reg, // Value. 4365 receiver_reg, // Value.
4339 kRAHasNotBeenSaved, 4366 kRAHasNotBeenSaved,
4340 kDontSaveFPRegs); 4367 kDontSaveFPRegs);
4341 } 4368 }
4342 // value_reg (a0) is preserved. 4369 // value_reg (a0) is preserved.
4343 // Done. 4370 // Done.
4344 __ Ret(); 4371 __ Ret();
4345 4372
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
4564 __ Jump(ic_slow, RelocInfo::CODE_TARGET); 4591 __ Jump(ic_slow, RelocInfo::CODE_TARGET);
4565 } 4592 }
4566 } 4593 }
4567 4594
4568 4595
4569 #undef __ 4596 #undef __
4570 4597
4571 } } // namespace v8::internal 4598 } } // namespace v8::internal
4572 4599
4573 #endif // V8_TARGET_ARCH_MIPS 4600 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698