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

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

Issue 12390031: Unify grow mode and stub kind (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 7 years, 9 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 | « no previous file | src/code-stubs.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 3076 matching lines...) Expand 10 before | Expand all | Expand 10 after
3087 // -- r1 : key 3087 // -- r1 : key
3088 // -- r2 : receiver 3088 // -- r2 : receiver
3089 // -- lr : return address 3089 // -- lr : return address
3090 // -- r3 : scratch 3090 // -- r3 : scratch
3091 // ----------------------------------- 3091 // -----------------------------------
3092 ElementsKind elements_kind = receiver_map->elements_kind(); 3092 ElementsKind elements_kind = receiver_map->elements_kind();
3093 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 3093 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
3094 Handle<Code> stub = 3094 Handle<Code> stub =
3095 KeyedStoreElementStub(is_js_array, 3095 KeyedStoreElementStub(is_js_array,
3096 elements_kind, 3096 elements_kind,
3097 grow_mode_).GetCode(isolate()); 3097 store_mode_).GetCode(isolate());
3098 3098
3099 __ DispatchMap(r2, r3, receiver_map, stub, DO_SMI_CHECK); 3099 __ DispatchMap(r2, r3, receiver_map, stub, DO_SMI_CHECK);
3100 3100
3101 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); 3101 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss();
3102 __ Jump(ic, RelocInfo::CODE_TARGET); 3102 __ Jump(ic, RelocInfo::CODE_TARGET);
3103 3103
3104 // Return the generated code. 3104 // Return the generated code.
3105 return GetCode(Code::NORMAL, factory()->empty_string()); 3105 return GetCode(Code::NORMAL, factory()->empty_string());
3106 } 3106 }
3107 3107
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
3750 Handle<Code> miss_ic = 3750 Handle<Code> miss_ic =
3751 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); 3751 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
3752 __ Jump(miss_ic, RelocInfo::CODE_TARGET); 3752 __ Jump(miss_ic, RelocInfo::CODE_TARGET);
3753 } 3753 }
3754 3754
3755 3755
3756 void KeyedStoreStubCompiler::GenerateStoreFastElement( 3756 void KeyedStoreStubCompiler::GenerateStoreFastElement(
3757 MacroAssembler* masm, 3757 MacroAssembler* masm,
3758 bool is_js_array, 3758 bool is_js_array,
3759 ElementsKind elements_kind, 3759 ElementsKind elements_kind,
3760 KeyedAccessGrowMode grow_mode) { 3760 KeyedAccessStoreMode store_mode) {
3761 // ----------- S t a t e ------------- 3761 // ----------- S t a t e -------------
3762 // -- r0 : value 3762 // -- r0 : value
3763 // -- r1 : key 3763 // -- r1 : key
3764 // -- r2 : receiver 3764 // -- r2 : receiver
3765 // -- lr : return address 3765 // -- lr : return address
3766 // -- r3 : scratch 3766 // -- r3 : scratch
3767 // -- r4 : scratch (elements) 3767 // -- r4 : scratch (elements)
3768 // ----------------------------------- 3768 // -----------------------------------
3769 Label miss_force_generic, transition_elements_kind, grow, slow; 3769 Label miss_force_generic, transition_elements_kind, grow, slow;
3770 Label finish_store, check_capacity; 3770 Label finish_store, check_capacity;
(...skipping 19 matching lines...) Expand all
3790 // Check that the key is within bounds. 3790 // Check that the key is within bounds.
3791 __ ldr(elements_reg, 3791 __ ldr(elements_reg,
3792 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); 3792 FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
3793 if (is_js_array) { 3793 if (is_js_array) {
3794 __ ldr(scratch, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); 3794 __ ldr(scratch, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
3795 } else { 3795 } else {
3796 __ ldr(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); 3796 __ ldr(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset));
3797 } 3797 }
3798 // Compare smis. 3798 // Compare smis.
3799 __ cmp(key_reg, scratch); 3799 __ cmp(key_reg, scratch);
3800 if (is_js_array && grow_mode == ALLOW_JSARRAY_GROWTH) { 3800 if (is_js_array && IsGrowStoreMode(store_mode)) {
3801 __ b(hs, &grow); 3801 __ b(hs, &grow);
3802 } else { 3802 } else {
3803 __ b(hs, &miss_force_generic); 3803 __ b(hs, &miss_force_generic);
3804 } 3804 }
3805 3805
3806 // Make sure elements is a fast element array, not 'cow'. 3806 // Make sure elements is a fast element array, not 'cow'.
3807 __ CheckMap(elements_reg, 3807 __ CheckMap(elements_reg,
3808 scratch, 3808 scratch,
3809 Heap::kFixedArrayMapRootIndex, 3809 Heap::kFixedArrayMapRootIndex,
3810 &miss_force_generic, 3810 &miss_force_generic,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3843 3843
3844 __ bind(&miss_force_generic); 3844 __ bind(&miss_force_generic);
3845 Handle<Code> ic = 3845 Handle<Code> ic =
3846 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); 3846 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
3847 __ Jump(ic, RelocInfo::CODE_TARGET); 3847 __ Jump(ic, RelocInfo::CODE_TARGET);
3848 3848
3849 __ bind(&transition_elements_kind); 3849 __ bind(&transition_elements_kind);
3850 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); 3850 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss();
3851 __ Jump(ic_miss, RelocInfo::CODE_TARGET); 3851 __ Jump(ic_miss, RelocInfo::CODE_TARGET);
3852 3852
3853 if (is_js_array && grow_mode == ALLOW_JSARRAY_GROWTH) { 3853 if (is_js_array && IsGrowStoreMode(store_mode)) {
3854 // Grow the array by a single element if possible. 3854 // Grow the array by a single element if possible.
3855 __ bind(&grow); 3855 __ bind(&grow);
3856 3856
3857 // Make sure the array is only growing by a single element, anything else 3857 // Make sure the array is only growing by a single element, anything else
3858 // must be handled by the runtime. Flags already set by previous compare. 3858 // must be handled by the runtime. Flags already set by previous compare.
3859 __ b(ne, &miss_force_generic); 3859 __ b(ne, &miss_force_generic);
3860 3860
3861 // Check for the empty array, and preallocate a small backing store if 3861 // Check for the empty array, and preallocate a small backing store if
3862 // possible. 3862 // possible.
3863 __ ldr(length_reg, 3863 __ ldr(length_reg,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
3915 __ bind(&slow); 3915 __ bind(&slow);
3916 Handle<Code> ic_slow = masm->isolate()->builtins()->KeyedStoreIC_Slow(); 3916 Handle<Code> ic_slow = masm->isolate()->builtins()->KeyedStoreIC_Slow();
3917 __ Jump(ic_slow, RelocInfo::CODE_TARGET); 3917 __ Jump(ic_slow, RelocInfo::CODE_TARGET);
3918 } 3918 }
3919 } 3919 }
3920 3920
3921 3921
3922 void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement( 3922 void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(
3923 MacroAssembler* masm, 3923 MacroAssembler* masm,
3924 bool is_js_array, 3924 bool is_js_array,
3925 KeyedAccessGrowMode grow_mode) { 3925 KeyedAccessStoreMode store_mode) {
3926 // ----------- S t a t e ------------- 3926 // ----------- S t a t e -------------
3927 // -- r0 : value 3927 // -- r0 : value
3928 // -- r1 : key 3928 // -- r1 : key
3929 // -- r2 : receiver 3929 // -- r2 : receiver
3930 // -- lr : return address 3930 // -- lr : return address
3931 // -- r3 : scratch (elements backing store) 3931 // -- r3 : scratch (elements backing store)
3932 // -- r4 : scratch 3932 // -- r4 : scratch
3933 // -- r5 : scratch 3933 // -- r5 : scratch
3934 // -- r6 : scratch 3934 // -- r6 : scratch
3935 // -- r7 : scratch 3935 // -- r7 : scratch
(...skipping 25 matching lines...) Expand all
3961 // Check that the key is within bounds. 3961 // Check that the key is within bounds.
3962 if (is_js_array) { 3962 if (is_js_array) {
3963 __ ldr(scratch1, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); 3963 __ ldr(scratch1, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
3964 } else { 3964 } else {
3965 __ ldr(scratch1, 3965 __ ldr(scratch1,
3966 FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); 3966 FieldMemOperand(elements_reg, FixedArray::kLengthOffset));
3967 } 3967 }
3968 // Compare smis, unsigned compare catches both negative and out-of-bound 3968 // Compare smis, unsigned compare catches both negative and out-of-bound
3969 // indexes. 3969 // indexes.
3970 __ cmp(key_reg, scratch1); 3970 __ cmp(key_reg, scratch1);
3971 if (grow_mode == ALLOW_JSARRAY_GROWTH) { 3971 if (IsGrowStoreMode(store_mode)) {
3972 __ b(hs, &grow); 3972 __ b(hs, &grow);
3973 } else { 3973 } else {
3974 __ b(hs, &miss_force_generic); 3974 __ b(hs, &miss_force_generic);
3975 } 3975 }
3976 3976
3977 __ bind(&finish_store); 3977 __ bind(&finish_store);
3978 __ StoreNumberToDoubleElements(value_reg, 3978 __ StoreNumberToDoubleElements(value_reg,
3979 key_reg, 3979 key_reg,
3980 // All registers after this are overwritten. 3980 // All registers after this are overwritten.
3981 elements_reg, 3981 elements_reg,
3982 scratch1, 3982 scratch1,
3983 scratch2, 3983 scratch2,
3984 scratch3, 3984 scratch3,
3985 scratch4, 3985 scratch4,
3986 &transition_elements_kind); 3986 &transition_elements_kind);
3987 __ Ret(); 3987 __ Ret();
3988 3988
3989 // Handle store cache miss, replacing the ic with the generic stub. 3989 // Handle store cache miss, replacing the ic with the generic stub.
3990 __ bind(&miss_force_generic); 3990 __ bind(&miss_force_generic);
3991 Handle<Code> ic = 3991 Handle<Code> ic =
3992 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); 3992 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
3993 __ Jump(ic, RelocInfo::CODE_TARGET); 3993 __ Jump(ic, RelocInfo::CODE_TARGET);
3994 3994
3995 __ bind(&transition_elements_kind); 3995 __ bind(&transition_elements_kind);
3996 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); 3996 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss();
3997 __ Jump(ic_miss, RelocInfo::CODE_TARGET); 3997 __ Jump(ic_miss, RelocInfo::CODE_TARGET);
3998 3998
3999 if (is_js_array && grow_mode == ALLOW_JSARRAY_GROWTH) { 3999 if (is_js_array && IsGrowStoreMode(store_mode)) {
4000 // Grow the array by a single element if possible. 4000 // Grow the array by a single element if possible.
4001 __ bind(&grow); 4001 __ bind(&grow);
4002 4002
4003 // Make sure the array is only growing by a single element, anything else 4003 // Make sure the array is only growing by a single element, anything else
4004 // must be handled by the runtime. Flags already set by previous compare. 4004 // must be handled by the runtime. Flags already set by previous compare.
4005 __ b(ne, &miss_force_generic); 4005 __ b(ne, &miss_force_generic);
4006 4006
4007 // Transition on values that can't be stored in a FixedDoubleArray. 4007 // Transition on values that can't be stored in a FixedDoubleArray.
4008 Label value_is_smi; 4008 Label value_is_smi;
4009 __ JumpIfSmi(value_reg, &value_is_smi); 4009 __ JumpIfSmi(value_reg, &value_is_smi);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
4083 __ Jump(ic_slow, RelocInfo::CODE_TARGET); 4083 __ Jump(ic_slow, RelocInfo::CODE_TARGET);
4084 } 4084 }
4085 } 4085 }
4086 4086
4087 4087
4088 #undef __ 4088 #undef __
4089 4089
4090 } } // namespace v8::internal 4090 } } // namespace v8::internal
4091 4091
4092 #endif // V8_TARGET_ARCH_ARM 4092 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698