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

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

Issue 10209027: Implement tracking and optimizations of packed arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: New upload 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 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) { 1445 if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) {
1446 Label fast_object, not_fast_object; 1446 Label fast_object, not_fast_object;
1447 __ CheckFastObjectElements(ebx, &not_fast_object, Label::kNear); 1447 __ CheckFastObjectElements(ebx, &not_fast_object, Label::kNear);
1448 __ jmp(&fast_object); 1448 __ jmp(&fast_object);
1449 // In case of fast smi-only, convert to fast object, otherwise bail out. 1449 // In case of fast smi-only, convert to fast object, otherwise bail out.
1450 __ bind(&not_fast_object); 1450 __ bind(&not_fast_object);
1451 __ CheckFastSmiOnlyElements(ebx, &call_builtin); 1451 __ CheckFastSmiOnlyElements(ebx, &call_builtin);
1452 // edi: elements array 1452 // edi: elements array
1453 // edx: receiver 1453 // edx: receiver
1454 // ebx: map 1454 // ebx: map
1455 __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS, 1455 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
1456 FAST_ELEMENTS, 1456 FAST_ELEMENTS,
1457 ebx, 1457 ebx,
1458 edi, 1458 edi,
1459 &call_builtin); 1459 &call_builtin);
1460 ElementsTransitionGenerator::GenerateSmiOnlyToObject(masm()); 1460 ElementsTransitionGenerator::
1461 GenerateMapChangeElementTransition(masm());
1461 // Restore edi. 1462 // Restore edi.
1462 __ mov(edi, FieldOperand(edx, JSArray::kElementsOffset)); 1463 __ mov(edi, FieldOperand(edx, JSArray::kElementsOffset));
1463 __ bind(&fast_object); 1464 __ bind(&fast_object);
1464 } else { 1465 } else {
1465 __ CheckFastObjectElements(ebx, &call_builtin); 1466 __ CheckFastObjectElements(ebx, &call_builtin);
1466 } 1467 }
1467 1468
1468 // Save new length. 1469 // Save new length.
1469 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); 1470 __ mov(FieldOperand(edx, JSArray::kLengthOffset), eax);
1470 1471
(...skipping 2338 matching lines...) Expand 10 before | Expand all | Expand 10 after
3809 // ----------------------------------- 3810 // -----------------------------------
3810 Label miss_force_generic, grow, slow, transition_elements_kind; 3811 Label miss_force_generic, grow, slow, transition_elements_kind;
3811 Label check_capacity, prepare_slow, finish_store, commit_backing_store; 3812 Label check_capacity, prepare_slow, finish_store, commit_backing_store;
3812 3813
3813 // This stub is meant to be tail-jumped to, the receiver must already 3814 // This stub is meant to be tail-jumped to, the receiver must already
3814 // have been verified by the caller to not be a smi. 3815 // have been verified by the caller to not be a smi.
3815 3816
3816 // Check that the key is a smi or a heap number convertible to a smi. 3817 // Check that the key is a smi or a heap number convertible to a smi.
3817 GenerateSmiKeyCheck(masm, ecx, ebx, xmm0, xmm1, &miss_force_generic); 3818 GenerateSmiKeyCheck(masm, ecx, ebx, xmm0, xmm1, &miss_force_generic);
3818 3819
3819 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { 3820 if (IsFastSmiElementsKind(elements_kind)) {
3820 __ JumpIfNotSmi(eax, &transition_elements_kind); 3821 __ JumpIfNotSmi(eax, &transition_elements_kind);
3821 } 3822 }
3822 3823
3823 // Get the elements array and make sure it is a fast element array, not 'cow'. 3824 // Get the elements array and make sure it is a fast element array, not 'cow'.
3824 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); 3825 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
3825 if (is_js_array) { 3826 if (is_js_array) {
3826 // Check that the key is within bounds. 3827 // Check that the key is within bounds.
3827 __ cmp(ecx, FieldOperand(edx, JSArray::kLengthOffset)); // smis. 3828 __ cmp(ecx, FieldOperand(edx, JSArray::kLengthOffset)); // smis.
3828 if (grow_mode == ALLOW_JSARRAY_GROWTH) { 3829 if (grow_mode == ALLOW_JSARRAY_GROWTH) {
3829 __ j(above_equal, &grow); 3830 __ j(above_equal, &grow);
3830 } else { 3831 } else {
3831 __ j(above_equal, &miss_force_generic); 3832 __ j(above_equal, &miss_force_generic);
3832 } 3833 }
3833 } else { 3834 } else {
3834 // Check that the key is within bounds. 3835 // Check that the key is within bounds.
3835 __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); // smis. 3836 __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); // smis.
3836 __ j(above_equal, &miss_force_generic); 3837 __ j(above_equal, &miss_force_generic);
3837 } 3838 }
3838 3839
3839 __ cmp(FieldOperand(edi, HeapObject::kMapOffset), 3840 __ cmp(FieldOperand(edi, HeapObject::kMapOffset),
3840 Immediate(masm->isolate()->factory()->fixed_array_map())); 3841 Immediate(masm->isolate()->factory()->fixed_array_map()));
3841 __ j(not_equal, &miss_force_generic); 3842 __ j(not_equal, &miss_force_generic);
3842 3843
3843 __ bind(&finish_store); 3844 __ bind(&finish_store);
3844 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { 3845 if (IsFastSmiElementsKind(elements_kind)) {
3845 // ecx is a smi, use times_half_pointer_size instead of 3846 // ecx is a smi, use times_half_pointer_size instead of
3846 // times_pointer_size 3847 // times_pointer_size
3847 __ mov(FieldOperand(edi, 3848 __ mov(FieldOperand(edi,
3848 ecx, 3849 ecx,
3849 times_half_pointer_size, 3850 times_half_pointer_size,
3850 FixedArray::kHeaderSize), eax); 3851 FixedArray::kHeaderSize), eax);
3851 } else { 3852 } else {
3852 ASSERT(elements_kind == FAST_ELEMENTS); 3853 ASSERT(IsFastObjectElementsKind(elements_kind));
3853 // Do the store and update the write barrier. 3854 // Do the store and update the write barrier.
3854 // ecx is a smi, use times_half_pointer_size instead of 3855 // ecx is a smi, use times_half_pointer_size instead of
3855 // times_pointer_size 3856 // times_pointer_size
3856 __ lea(ecx, FieldOperand(edi, 3857 __ lea(ecx, FieldOperand(edi,
3857 ecx, 3858 ecx,
3858 times_half_pointer_size, 3859 times_half_pointer_size,
3859 FixedArray::kHeaderSize)); 3860 FixedArray::kHeaderSize));
3860 __ mov(Operand(ecx, 0), eax); 3861 __ mov(Operand(ecx, 0), eax);
3861 // Make sure to preserve the value in register eax. 3862 // Make sure to preserve the value in register eax.
3862 __ mov(ebx, eax); 3863 __ mov(ebx, eax);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
4079 __ jmp(ic_slow, RelocInfo::CODE_TARGET); 4080 __ jmp(ic_slow, RelocInfo::CODE_TARGET);
4080 } 4081 }
4081 } 4082 }
4082 4083
4083 4084
4084 #undef __ 4085 #undef __
4085 4086
4086 } } // namespace v8::internal 4087 } } // namespace v8::internal
4087 4088
4088 #endif // V8_TARGET_ARCH_IA32 4089 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/ic.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698