OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2956 // the input representation for the key to be an integer, the input | 2956 // the input representation for the key to be an integer, the input |
2957 // gets replaced during bound check elimination with the index argument | 2957 // gets replaced during bound check elimination with the index argument |
2958 // to the bounds check, which can be tagged, so that case must be | 2958 // to the bounds check, which can be tagged, so that case must be |
2959 // handled here, too. | 2959 // handled here, too. |
2960 if (instr->hydrogen()->IsDehoisted()) { | 2960 if (instr->hydrogen()->IsDehoisted()) { |
2961 // Sign extend key because it could be a 32 bit negative value | 2961 // Sign extend key because it could be a 32 bit negative value |
2962 // and the dehoisted address computation happens in 64 bits | 2962 // and the dehoisted address computation happens in 64 bits |
2963 __ movsxlq(key_reg, key_reg); | 2963 __ movsxlq(key_reg, key_reg); |
2964 } | 2964 } |
2965 } | 2965 } |
2966 int base_offset = instr->is_fixed_typed_array() | |
2967 ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag | |
2968 : 0; | |
2969 Operand operand(BuildFastArrayOperand( | 2966 Operand operand(BuildFastArrayOperand( |
2970 instr->elements(), | 2967 instr->elements(), |
2971 key, | 2968 key, |
2972 elements_kind, | 2969 elements_kind, |
2973 base_offset, | 2970 0, |
2974 instr->additional_index())); | 2971 instr->additional_index())); |
2975 | 2972 |
2976 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || | 2973 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { |
2977 elements_kind == FLOAT32_ELEMENTS) { | |
2978 XMMRegister result(ToDoubleRegister(instr->result())); | 2974 XMMRegister result(ToDoubleRegister(instr->result())); |
2979 __ movss(result, operand); | 2975 __ movss(result, operand); |
2980 __ cvtss2sd(result, result); | 2976 __ cvtss2sd(result, result); |
2981 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS || | 2977 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { |
2982 elements_kind == FLOAT64_ELEMENTS) { | |
2983 __ movsd(ToDoubleRegister(instr->result()), operand); | 2978 __ movsd(ToDoubleRegister(instr->result()), operand); |
2984 } else { | 2979 } else { |
2985 Register result(ToRegister(instr->result())); | 2980 Register result(ToRegister(instr->result())); |
2986 switch (elements_kind) { | 2981 switch (elements_kind) { |
2987 case EXTERNAL_BYTE_ELEMENTS: | 2982 case EXTERNAL_BYTE_ELEMENTS: |
2988 case INT8_ELEMENTS: | |
2989 __ movsxbq(result, operand); | 2983 __ movsxbq(result, operand); |
2990 break; | 2984 break; |
2991 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 2985 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
2992 case EXTERNAL_PIXEL_ELEMENTS: | 2986 case EXTERNAL_PIXEL_ELEMENTS: |
2993 case UINT8_ELEMENTS: | |
2994 case UINT8_CLAMPED_ELEMENTS: | |
2995 __ movzxbq(result, operand); | 2987 __ movzxbq(result, operand); |
2996 break; | 2988 break; |
2997 case EXTERNAL_SHORT_ELEMENTS: | 2989 case EXTERNAL_SHORT_ELEMENTS: |
2998 case INT16_ELEMENTS: | |
2999 __ movsxwq(result, operand); | 2990 __ movsxwq(result, operand); |
3000 break; | 2991 break; |
3001 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 2992 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
3002 case UINT16_ELEMENTS: | |
3003 __ movzxwq(result, operand); | 2993 __ movzxwq(result, operand); |
3004 break; | 2994 break; |
3005 case EXTERNAL_INT_ELEMENTS: | 2995 case EXTERNAL_INT_ELEMENTS: |
3006 case INT32_ELEMENTS: | |
3007 __ movsxlq(result, operand); | 2996 __ movsxlq(result, operand); |
3008 break; | 2997 break; |
3009 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 2998 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
3010 case UINT32_ELEMENTS: | |
3011 __ movl(result, operand); | 2999 __ movl(result, operand); |
3012 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { | 3000 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { |
3013 __ testl(result, result); | 3001 __ testl(result, result); |
3014 DeoptimizeIf(negative, instr->environment()); | 3002 DeoptimizeIf(negative, instr->environment()); |
3015 } | 3003 } |
3016 break; | 3004 break; |
3017 case EXTERNAL_FLOAT_ELEMENTS: | 3005 case EXTERNAL_FLOAT_ELEMENTS: |
3018 case EXTERNAL_DOUBLE_ELEMENTS: | 3006 case EXTERNAL_DOUBLE_ELEMENTS: |
3019 case FLOAT32_ELEMENTS: | |
3020 case FLOAT64_ELEMENTS: | |
3021 case FAST_ELEMENTS: | 3007 case FAST_ELEMENTS: |
3022 case FAST_SMI_ELEMENTS: | 3008 case FAST_SMI_ELEMENTS: |
3023 case FAST_DOUBLE_ELEMENTS: | 3009 case FAST_DOUBLE_ELEMENTS: |
3024 case FAST_HOLEY_ELEMENTS: | 3010 case FAST_HOLEY_ELEMENTS: |
3025 case FAST_HOLEY_SMI_ELEMENTS: | 3011 case FAST_HOLEY_SMI_ELEMENTS: |
3026 case FAST_HOLEY_DOUBLE_ELEMENTS: | 3012 case FAST_HOLEY_DOUBLE_ELEMENTS: |
3027 case DICTIONARY_ELEMENTS: | 3013 case DICTIONARY_ELEMENTS: |
3028 case NON_STRICT_ARGUMENTS_ELEMENTS: | 3014 case NON_STRICT_ARGUMENTS_ELEMENTS: |
3029 UNREACHABLE(); | 3015 UNREACHABLE(); |
3030 break; | 3016 break; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3118 DeoptimizeIf(NegateCondition(smi), instr->environment()); | 3104 DeoptimizeIf(NegateCondition(smi), instr->environment()); |
3119 } else { | 3105 } else { |
3120 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | 3106 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
3121 DeoptimizeIf(equal, instr->environment()); | 3107 DeoptimizeIf(equal, instr->environment()); |
3122 } | 3108 } |
3123 } | 3109 } |
3124 } | 3110 } |
3125 | 3111 |
3126 | 3112 |
3127 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { | 3113 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { |
3128 if (instr->is_typed_elements()) { | 3114 if (instr->is_external()) { |
3129 DoLoadKeyedExternalArray(instr); | 3115 DoLoadKeyedExternalArray(instr); |
3130 } else if (instr->hydrogen()->representation().IsDouble()) { | 3116 } else if (instr->hydrogen()->representation().IsDouble()) { |
3131 DoLoadKeyedFixedDoubleArray(instr); | 3117 DoLoadKeyedFixedDoubleArray(instr); |
3132 } else { | 3118 } else { |
3133 DoLoadKeyedFixedArray(instr); | 3119 DoLoadKeyedFixedArray(instr); |
3134 } | 3120 } |
3135 } | 3121 } |
3136 | 3122 |
3137 | 3123 |
3138 Operand LCodeGen::BuildFastArrayOperand( | 3124 Operand LCodeGen::BuildFastArrayOperand( |
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4149 // the input representation for the key to be an integer, the input | 4135 // the input representation for the key to be an integer, the input |
4150 // gets replaced during bound check elimination with the index | 4136 // gets replaced during bound check elimination with the index |
4151 // argument to the bounds check, which can be tagged, so that case | 4137 // argument to the bounds check, which can be tagged, so that case |
4152 // must be handled here, too. | 4138 // must be handled here, too. |
4153 if (instr->hydrogen()->IsDehoisted()) { | 4139 if (instr->hydrogen()->IsDehoisted()) { |
4154 // Sign extend key because it could be a 32 bit negative value | 4140 // Sign extend key because it could be a 32 bit negative value |
4155 // and the dehoisted address computation happens in 64 bits | 4141 // and the dehoisted address computation happens in 64 bits |
4156 __ movsxlq(key_reg, key_reg); | 4142 __ movsxlq(key_reg, key_reg); |
4157 } | 4143 } |
4158 } | 4144 } |
4159 int base_offset = instr->is_fixed_typed_array() | |
4160 ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag | |
4161 : 0; | |
4162 Operand operand(BuildFastArrayOperand( | 4145 Operand operand(BuildFastArrayOperand( |
4163 instr->elements(), | 4146 instr->elements(), |
4164 key, | 4147 key, |
4165 elements_kind, | 4148 elements_kind, |
4166 base_offset, | 4149 0, |
4167 instr->additional_index())); | 4150 instr->additional_index())); |
4168 | 4151 |
4169 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || | 4152 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { |
4170 elements_kind == FLOAT32_ELEMENTS) { | |
4171 XMMRegister value(ToDoubleRegister(instr->value())); | 4153 XMMRegister value(ToDoubleRegister(instr->value())); |
4172 __ cvtsd2ss(value, value); | 4154 __ cvtsd2ss(value, value); |
4173 __ movss(operand, value); | 4155 __ movss(operand, value); |
4174 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS || | 4156 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { |
4175 elements_kind == FLOAT64_ELEMENTS) { | |
4176 __ movsd(operand, ToDoubleRegister(instr->value())); | 4157 __ movsd(operand, ToDoubleRegister(instr->value())); |
4177 } else { | 4158 } else { |
4178 Register value(ToRegister(instr->value())); | 4159 Register value(ToRegister(instr->value())); |
4179 switch (elements_kind) { | 4160 switch (elements_kind) { |
4180 case EXTERNAL_PIXEL_ELEMENTS: | 4161 case EXTERNAL_PIXEL_ELEMENTS: |
4181 case EXTERNAL_BYTE_ELEMENTS: | 4162 case EXTERNAL_BYTE_ELEMENTS: |
4182 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 4163 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
4183 case INT8_ELEMENTS: | |
4184 case UINT8_ELEMENTS: | |
4185 case UINT8_CLAMPED_ELEMENTS: | |
4186 __ movb(operand, value); | 4164 __ movb(operand, value); |
4187 break; | 4165 break; |
4188 case EXTERNAL_SHORT_ELEMENTS: | 4166 case EXTERNAL_SHORT_ELEMENTS: |
4189 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 4167 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
4190 case INT16_ELEMENTS: | |
4191 case UINT16_ELEMENTS: | |
4192 __ movw(operand, value); | 4168 __ movw(operand, value); |
4193 break; | 4169 break; |
4194 case EXTERNAL_INT_ELEMENTS: | 4170 case EXTERNAL_INT_ELEMENTS: |
4195 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 4171 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
4196 case INT32_ELEMENTS: | |
4197 case UINT32_ELEMENTS: | |
4198 __ movl(operand, value); | 4172 __ movl(operand, value); |
4199 break; | 4173 break; |
4200 case EXTERNAL_FLOAT_ELEMENTS: | 4174 case EXTERNAL_FLOAT_ELEMENTS: |
4201 case EXTERNAL_DOUBLE_ELEMENTS: | 4175 case EXTERNAL_DOUBLE_ELEMENTS: |
4202 case FLOAT32_ELEMENTS: | |
4203 case FLOAT64_ELEMENTS: | |
4204 case FAST_ELEMENTS: | 4176 case FAST_ELEMENTS: |
4205 case FAST_SMI_ELEMENTS: | 4177 case FAST_SMI_ELEMENTS: |
4206 case FAST_DOUBLE_ELEMENTS: | 4178 case FAST_DOUBLE_ELEMENTS: |
4207 case FAST_HOLEY_ELEMENTS: | 4179 case FAST_HOLEY_ELEMENTS: |
4208 case FAST_HOLEY_SMI_ELEMENTS: | 4180 case FAST_HOLEY_SMI_ELEMENTS: |
4209 case FAST_HOLEY_DOUBLE_ELEMENTS: | 4181 case FAST_HOLEY_DOUBLE_ELEMENTS: |
4210 case DICTIONARY_ELEMENTS: | 4182 case DICTIONARY_ELEMENTS: |
4211 case NON_STRICT_ARGUMENTS_ELEMENTS: | 4183 case NON_STRICT_ARGUMENTS_ELEMENTS: |
4212 UNREACHABLE(); | 4184 UNREACHABLE(); |
4213 break; | 4185 break; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4325 key_reg, | 4297 key_reg, |
4326 value, | 4298 value, |
4327 kSaveFPRegs, | 4299 kSaveFPRegs, |
4328 EMIT_REMEMBERED_SET, | 4300 EMIT_REMEMBERED_SET, |
4329 check_needed); | 4301 check_needed); |
4330 } | 4302 } |
4331 } | 4303 } |
4332 | 4304 |
4333 | 4305 |
4334 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { | 4306 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { |
4335 if (instr->is_typed_elements()) { | 4307 if (instr->is_external()) { |
4336 DoStoreKeyedExternalArray(instr); | 4308 DoStoreKeyedExternalArray(instr); |
4337 } else if (instr->hydrogen()->value()->representation().IsDouble()) { | 4309 } else if (instr->hydrogen()->value()->representation().IsDouble()) { |
4338 DoStoreKeyedFixedDoubleArray(instr); | 4310 DoStoreKeyedFixedDoubleArray(instr); |
4339 } else { | 4311 } else { |
4340 DoStoreKeyedFixedArray(instr); | 4312 DoStoreKeyedFixedArray(instr); |
4341 } | 4313 } |
4342 } | 4314 } |
4343 | 4315 |
4344 | 4316 |
4345 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4317 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5650 FixedArray::kHeaderSize - kPointerSize)); | 5622 FixedArray::kHeaderSize - kPointerSize)); |
5651 __ bind(&done); | 5623 __ bind(&done); |
5652 } | 5624 } |
5653 | 5625 |
5654 | 5626 |
5655 #undef __ | 5627 #undef __ |
5656 | 5628 |
5657 } } // namespace v8::internal | 5629 } } // namespace v8::internal |
5658 | 5630 |
5659 #endif // V8_TARGET_ARCH_X64 | 5631 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |