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

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

Powered by Google App Engine
This is Rietveld 408576698