OLD | NEW |
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 3044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3055 // -- a1 : key | 3055 // -- a1 : key |
3056 // -- a2 : receiver | 3056 // -- a2 : receiver |
3057 // -- ra : return address | 3057 // -- ra : return address |
3058 // -- a3 : scratch | 3058 // -- a3 : scratch |
3059 // ----------------------------------- | 3059 // ----------------------------------- |
3060 ElementsKind elements_kind = receiver_map->elements_kind(); | 3060 ElementsKind elements_kind = receiver_map->elements_kind(); |
3061 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 3061 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
3062 Handle<Code> stub = | 3062 Handle<Code> stub = |
3063 KeyedStoreElementStub(is_js_array, | 3063 KeyedStoreElementStub(is_js_array, |
3064 elements_kind, | 3064 elements_kind, |
3065 grow_mode_).GetCode(isolate()); | 3065 store_mode_).GetCode(isolate()); |
3066 | 3066 |
3067 __ DispatchMap(a2, a3, receiver_map, stub, DO_SMI_CHECK); | 3067 __ DispatchMap(a2, a3, receiver_map, stub, DO_SMI_CHECK); |
3068 | 3068 |
3069 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); | 3069 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); |
3070 __ Jump(ic, RelocInfo::CODE_TARGET); | 3070 __ Jump(ic, RelocInfo::CODE_TARGET); |
3071 | 3071 |
3072 // Return the generated code. | 3072 // Return the generated code. |
3073 return GetCode(Code::NORMAL, factory()->empty_string()); | 3073 return GetCode(Code::NORMAL, factory()->empty_string()); |
3074 } | 3074 } |
3075 | 3075 |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3820 | 3820 |
3821 // Check that the key is within bounds. | 3821 // Check that the key is within bounds. |
3822 __ lw(elements_reg, | 3822 __ lw(elements_reg, |
3823 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); | 3823 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); |
3824 if (is_js_array) { | 3824 if (is_js_array) { |
3825 __ lw(scratch, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); | 3825 __ lw(scratch, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); |
3826 } else { | 3826 } else { |
3827 __ lw(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); | 3827 __ lw(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); |
3828 } | 3828 } |
3829 // Compare smis. | 3829 // Compare smis. |
3830 if (is_js_array && grow_mode == ALLOW_JSARRAY_GROWTH) { | 3830 if (is_js_array && IsGrowStoreMode(store_mode)) { |
3831 __ Branch(&grow, hs, key_reg, Operand(scratch)); | 3831 __ Branch(&grow, hs, key_reg, Operand(scratch)); |
3832 } else { | 3832 } else { |
3833 __ Branch(&miss_force_generic, hs, key_reg, Operand(scratch)); | 3833 __ Branch(&miss_force_generic, hs, key_reg, Operand(scratch)); |
3834 } | 3834 } |
3835 | 3835 |
3836 // Make sure elements is a fast element array, not 'cow'. | 3836 // Make sure elements is a fast element array, not 'cow'. |
3837 __ CheckMap(elements_reg, | 3837 __ CheckMap(elements_reg, |
3838 scratch, | 3838 scratch, |
3839 Heap::kFixedArrayMapRootIndex, | 3839 Heap::kFixedArrayMapRootIndex, |
3840 &miss_force_generic, | 3840 &miss_force_generic, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3872 | 3872 |
3873 __ bind(&miss_force_generic); | 3873 __ bind(&miss_force_generic); |
3874 Handle<Code> ic = | 3874 Handle<Code> ic = |
3875 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 3875 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
3876 __ Jump(ic, RelocInfo::CODE_TARGET); | 3876 __ Jump(ic, RelocInfo::CODE_TARGET); |
3877 | 3877 |
3878 __ bind(&transition_elements_kind); | 3878 __ bind(&transition_elements_kind); |
3879 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); | 3879 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); |
3880 __ Jump(ic_miss, RelocInfo::CODE_TARGET); | 3880 __ Jump(ic_miss, RelocInfo::CODE_TARGET); |
3881 | 3881 |
3882 if (is_js_array && grow_mode == ALLOW_JSARRAY_GROWTH) { | 3882 if (is_js_array && IsGrowStoreMode(store_mode)) { |
3883 // Grow the array by a single element if possible. | 3883 // Grow the array by a single element if possible. |
3884 __ bind(&grow); | 3884 __ bind(&grow); |
3885 | 3885 |
3886 // Make sure the array is only growing by a single element, anything else | 3886 // Make sure the array is only growing by a single element, anything else |
3887 // must be handled by the runtime. | 3887 // must be handled by the runtime. |
3888 __ Branch(&miss_force_generic, ne, key_reg, Operand(scratch)); | 3888 __ Branch(&miss_force_generic, ne, key_reg, Operand(scratch)); |
3889 | 3889 |
3890 // Check for the empty array, and preallocate a small backing store if | 3890 // Check for the empty array, and preallocate a small backing store if |
3891 // possible. | 3891 // possible. |
3892 __ lw(length_reg, | 3892 __ lw(length_reg, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3988 | 3988 |
3989 // Check that the key is within bounds. | 3989 // Check that the key is within bounds. |
3990 if (is_js_array) { | 3990 if (is_js_array) { |
3991 __ lw(scratch1, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); | 3991 __ lw(scratch1, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); |
3992 } else { | 3992 } else { |
3993 __ lw(scratch1, | 3993 __ lw(scratch1, |
3994 FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); | 3994 FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); |
3995 } | 3995 } |
3996 // Compare smis, unsigned compare catches both negative and out-of-bound | 3996 // Compare smis, unsigned compare catches both negative and out-of-bound |
3997 // indexes. | 3997 // indexes. |
3998 if (grow_mode == ALLOW_JSARRAY_GROWTH) { | 3998 if (IsGrowStoreMode(store_mode)) { |
3999 __ Branch(&grow, hs, key_reg, Operand(scratch1)); | 3999 __ Branch(&grow, hs, key_reg, Operand(scratch1)); |
4000 } else { | 4000 } else { |
4001 __ Branch(&miss_force_generic, hs, key_reg, Operand(scratch1)); | 4001 __ Branch(&miss_force_generic, hs, key_reg, Operand(scratch1)); |
4002 } | 4002 } |
4003 | 4003 |
4004 __ bind(&finish_store); | 4004 __ bind(&finish_store); |
4005 | 4005 |
4006 __ StoreNumberToDoubleElements(value_reg, | 4006 __ StoreNumberToDoubleElements(value_reg, |
4007 key_reg, | 4007 key_reg, |
4008 // All registers after this are overwritten. | 4008 // All registers after this are overwritten. |
(...skipping 10 matching lines...) Expand all Loading... |
4019 // Handle store cache miss, replacing the ic with the generic stub. | 4019 // Handle store cache miss, replacing the ic with the generic stub. |
4020 __ bind(&miss_force_generic); | 4020 __ bind(&miss_force_generic); |
4021 Handle<Code> ic = | 4021 Handle<Code> ic = |
4022 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 4022 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
4023 __ Jump(ic, RelocInfo::CODE_TARGET); | 4023 __ Jump(ic, RelocInfo::CODE_TARGET); |
4024 | 4024 |
4025 __ bind(&transition_elements_kind); | 4025 __ bind(&transition_elements_kind); |
4026 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); | 4026 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); |
4027 __ Jump(ic_miss, RelocInfo::CODE_TARGET); | 4027 __ Jump(ic_miss, RelocInfo::CODE_TARGET); |
4028 | 4028 |
4029 if (is_js_array && grow_mode == ALLOW_JSARRAY_GROWTH) { | 4029 if (is_js_array && IsGrowStoreMode(store_mode)) { |
4030 // Grow the array by a single element if possible. | 4030 // Grow the array by a single element if possible. |
4031 __ bind(&grow); | 4031 __ bind(&grow); |
4032 | 4032 |
4033 // Make sure the array is only growing by a single element, anything else | 4033 // Make sure the array is only growing by a single element, anything else |
4034 // must be handled by the runtime. | 4034 // must be handled by the runtime. |
4035 __ Branch(&miss_force_generic, ne, key_reg, Operand(scratch1)); | 4035 __ Branch(&miss_force_generic, ne, key_reg, Operand(scratch1)); |
4036 | 4036 |
4037 // Transition on values that can't be stored in a FixedDoubleArray. | 4037 // Transition on values that can't be stored in a FixedDoubleArray. |
4038 Label value_is_smi; | 4038 Label value_is_smi; |
4039 __ JumpIfSmi(value_reg, &value_is_smi); | 4039 __ JumpIfSmi(value_reg, &value_is_smi); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4111 __ Jump(ic_slow, RelocInfo::CODE_TARGET); | 4111 __ Jump(ic_slow, RelocInfo::CODE_TARGET); |
4112 } | 4112 } |
4113 } | 4113 } |
4114 | 4114 |
4115 | 4115 |
4116 #undef __ | 4116 #undef __ |
4117 | 4117 |
4118 } } // namespace v8::internal | 4118 } } // namespace v8::internal |
4119 | 4119 |
4120 #endif // V8_TARGET_ARCH_MIPS | 4120 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |