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 2942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2953 // the input representation for the key to be an integer, the input | 2953 // the input representation for the key to be an integer, the input |
2954 // gets replaced during bound check elimination with the index argument | 2954 // gets replaced during bound check elimination with the index argument |
2955 // to the bounds check, which can be tagged, so that case must be | 2955 // to the bounds check, which can be tagged, so that case must be |
2956 // handled here, too. | 2956 // handled here, too. |
2957 if (instr->hydrogen()->IsDehoisted()) { | 2957 if (instr->hydrogen()->IsDehoisted()) { |
2958 // Sign extend key because it could be a 32 bit negative value | 2958 // Sign extend key because it could be a 32 bit negative value |
2959 // and the dehoisted address computation happens in 64 bits | 2959 // and the dehoisted address computation happens in 64 bits |
2960 __ movsxlq(key_reg, key_reg); | 2960 __ movsxlq(key_reg, key_reg); |
2961 } | 2961 } |
2962 } | 2962 } |
| 2963 int base_offset = instr->is_fixed_typed_array() |
| 2964 ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag |
| 2965 : 0; |
2963 Operand operand(BuildFastArrayOperand( | 2966 Operand operand(BuildFastArrayOperand( |
2964 instr->elements(), | 2967 instr->elements(), |
2965 key, | 2968 key, |
2966 elements_kind, | 2969 elements_kind, |
2967 0, | 2970 base_offset, |
2968 instr->additional_index())); | 2971 instr->additional_index())); |
2969 | 2972 |
2970 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { | 2973 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || |
| 2974 elements_kind == FLOAT32_ELEMENTS) { |
2971 XMMRegister result(ToDoubleRegister(instr->result())); | 2975 XMMRegister result(ToDoubleRegister(instr->result())); |
2972 __ movss(result, operand); | 2976 __ movss(result, operand); |
2973 __ cvtss2sd(result, result); | 2977 __ cvtss2sd(result, result); |
2974 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | 2978 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS || |
| 2979 elements_kind == FLOAT64_ELEMENTS) { |
2975 __ movsd(ToDoubleRegister(instr->result()), operand); | 2980 __ movsd(ToDoubleRegister(instr->result()), operand); |
2976 } else { | 2981 } else { |
2977 Register result(ToRegister(instr->result())); | 2982 Register result(ToRegister(instr->result())); |
2978 switch (elements_kind) { | 2983 switch (elements_kind) { |
2979 case EXTERNAL_BYTE_ELEMENTS: | 2984 case EXTERNAL_BYTE_ELEMENTS: |
| 2985 case INT8_ELEMENTS: |
2980 __ movsxbq(result, operand); | 2986 __ movsxbq(result, operand); |
2981 break; | 2987 break; |
2982 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 2988 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
2983 case EXTERNAL_PIXEL_ELEMENTS: | 2989 case EXTERNAL_PIXEL_ELEMENTS: |
| 2990 case UINT8_ELEMENTS: |
| 2991 case UINT8_CLAMPED_ELEMENTS: |
2984 __ movzxbq(result, operand); | 2992 __ movzxbq(result, operand); |
2985 break; | 2993 break; |
2986 case EXTERNAL_SHORT_ELEMENTS: | 2994 case EXTERNAL_SHORT_ELEMENTS: |
| 2995 case INT16_ELEMENTS: |
2987 __ movsxwq(result, operand); | 2996 __ movsxwq(result, operand); |
2988 break; | 2997 break; |
2989 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 2998 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 2999 case UINT16_ELEMENTS: |
2990 __ movzxwq(result, operand); | 3000 __ movzxwq(result, operand); |
2991 break; | 3001 break; |
2992 case EXTERNAL_INT_ELEMENTS: | 3002 case EXTERNAL_INT_ELEMENTS: |
| 3003 case INT32_ELEMENTS: |
2993 __ movsxlq(result, operand); | 3004 __ movsxlq(result, operand); |
2994 break; | 3005 break; |
2995 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 3006 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 3007 case UINT32_ELEMENTS: |
2996 __ movl(result, operand); | 3008 __ movl(result, operand); |
2997 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { | 3009 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { |
2998 __ testl(result, result); | 3010 __ testl(result, result); |
2999 DeoptimizeIf(negative, instr->environment()); | 3011 DeoptimizeIf(negative, instr->environment()); |
3000 } | 3012 } |
3001 break; | 3013 break; |
3002 case EXTERNAL_FLOAT_ELEMENTS: | 3014 case EXTERNAL_FLOAT_ELEMENTS: |
3003 case EXTERNAL_DOUBLE_ELEMENTS: | 3015 case EXTERNAL_DOUBLE_ELEMENTS: |
| 3016 case FLOAT32_ELEMENTS: |
| 3017 case FLOAT64_ELEMENTS: |
3004 case FAST_ELEMENTS: | 3018 case FAST_ELEMENTS: |
3005 case FAST_SMI_ELEMENTS: | 3019 case FAST_SMI_ELEMENTS: |
3006 case FAST_DOUBLE_ELEMENTS: | 3020 case FAST_DOUBLE_ELEMENTS: |
3007 case FAST_HOLEY_ELEMENTS: | 3021 case FAST_HOLEY_ELEMENTS: |
3008 case FAST_HOLEY_SMI_ELEMENTS: | 3022 case FAST_HOLEY_SMI_ELEMENTS: |
3009 case FAST_HOLEY_DOUBLE_ELEMENTS: | 3023 case FAST_HOLEY_DOUBLE_ELEMENTS: |
3010 case DICTIONARY_ELEMENTS: | 3024 case DICTIONARY_ELEMENTS: |
3011 case NON_STRICT_ARGUMENTS_ELEMENTS: | 3025 case NON_STRICT_ARGUMENTS_ELEMENTS: |
3012 UNREACHABLE(); | 3026 UNREACHABLE(); |
3013 break; | 3027 break; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3101 DeoptimizeIf(NegateCondition(smi), instr->environment()); | 3115 DeoptimizeIf(NegateCondition(smi), instr->environment()); |
3102 } else { | 3116 } else { |
3103 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | 3117 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
3104 DeoptimizeIf(equal, instr->environment()); | 3118 DeoptimizeIf(equal, instr->environment()); |
3105 } | 3119 } |
3106 } | 3120 } |
3107 } | 3121 } |
3108 | 3122 |
3109 | 3123 |
3110 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { | 3124 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { |
3111 if (instr->is_external()) { | 3125 if (instr->is_external() || instr->is_fixed_typed_array()) { |
3112 DoLoadKeyedExternalArray(instr); | 3126 DoLoadKeyedExternalArray(instr); |
3113 } else if (instr->hydrogen()->representation().IsDouble()) { | 3127 } else if (instr->hydrogen()->representation().IsDouble()) { |
3114 DoLoadKeyedFixedDoubleArray(instr); | 3128 DoLoadKeyedFixedDoubleArray(instr); |
3115 } else { | 3129 } else { |
3116 DoLoadKeyedFixedArray(instr); | 3130 DoLoadKeyedFixedArray(instr); |
3117 } | 3131 } |
3118 } | 3132 } |
3119 | 3133 |
3120 | 3134 |
3121 Operand LCodeGen::BuildFastArrayOperand( | 3135 Operand LCodeGen::BuildFastArrayOperand( |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4143 // the input representation for the key to be an integer, the input | 4157 // the input representation for the key to be an integer, the input |
4144 // gets replaced during bound check elimination with the index | 4158 // gets replaced during bound check elimination with the index |
4145 // argument to the bounds check, which can be tagged, so that case | 4159 // argument to the bounds check, which can be tagged, so that case |
4146 // must be handled here, too. | 4160 // must be handled here, too. |
4147 if (instr->hydrogen()->IsDehoisted()) { | 4161 if (instr->hydrogen()->IsDehoisted()) { |
4148 // Sign extend key because it could be a 32 bit negative value | 4162 // Sign extend key because it could be a 32 bit negative value |
4149 // and the dehoisted address computation happens in 64 bits | 4163 // and the dehoisted address computation happens in 64 bits |
4150 __ movsxlq(key_reg, key_reg); | 4164 __ movsxlq(key_reg, key_reg); |
4151 } | 4165 } |
4152 } | 4166 } |
| 4167 int base_offset = instr->is_fixed_typed_array() |
| 4168 ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag |
| 4169 : 0; |
4153 Operand operand(BuildFastArrayOperand( | 4170 Operand operand(BuildFastArrayOperand( |
4154 instr->elements(), | 4171 instr->elements(), |
4155 key, | 4172 key, |
4156 elements_kind, | 4173 elements_kind, |
4157 0, | 4174 base_offset, |
4158 instr->additional_index())); | 4175 instr->additional_index())); |
4159 | 4176 |
4160 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { | 4177 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || |
| 4178 elements_kind == FLOAT32_ELEMENTS) { |
4161 XMMRegister value(ToDoubleRegister(instr->value())); | 4179 XMMRegister value(ToDoubleRegister(instr->value())); |
4162 __ cvtsd2ss(value, value); | 4180 __ cvtsd2ss(value, value); |
4163 __ movss(operand, value); | 4181 __ movss(operand, value); |
4164 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | 4182 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS || |
| 4183 elements_kind == FLOAT64_ELEMENTS) { |
4165 __ movsd(operand, ToDoubleRegister(instr->value())); | 4184 __ movsd(operand, ToDoubleRegister(instr->value())); |
4166 } else { | 4185 } else { |
4167 Register value(ToRegister(instr->value())); | 4186 Register value(ToRegister(instr->value())); |
4168 switch (elements_kind) { | 4187 switch (elements_kind) { |
4169 case EXTERNAL_PIXEL_ELEMENTS: | 4188 case EXTERNAL_PIXEL_ELEMENTS: |
4170 case EXTERNAL_BYTE_ELEMENTS: | 4189 case EXTERNAL_BYTE_ELEMENTS: |
4171 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 4190 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 4191 case INT8_ELEMENTS: |
| 4192 case UINT8_ELEMENTS: |
| 4193 case UINT8_CLAMPED_ELEMENTS: |
4172 __ movb(operand, value); | 4194 __ movb(operand, value); |
4173 break; | 4195 break; |
4174 case EXTERNAL_SHORT_ELEMENTS: | 4196 case EXTERNAL_SHORT_ELEMENTS: |
4175 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 4197 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 4198 case INT16_ELEMENTS: |
| 4199 case UINT16_ELEMENTS: |
4176 __ movw(operand, value); | 4200 __ movw(operand, value); |
4177 break; | 4201 break; |
4178 case EXTERNAL_INT_ELEMENTS: | 4202 case EXTERNAL_INT_ELEMENTS: |
4179 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 4203 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 4204 case INT32_ELEMENTS: |
| 4205 case UINT32_ELEMENTS: |
4180 __ movl(operand, value); | 4206 __ movl(operand, value); |
4181 break; | 4207 break; |
4182 case EXTERNAL_FLOAT_ELEMENTS: | 4208 case EXTERNAL_FLOAT_ELEMENTS: |
4183 case EXTERNAL_DOUBLE_ELEMENTS: | 4209 case EXTERNAL_DOUBLE_ELEMENTS: |
| 4210 case FLOAT32_ELEMENTS: |
| 4211 case FLOAT64_ELEMENTS: |
4184 case FAST_ELEMENTS: | 4212 case FAST_ELEMENTS: |
4185 case FAST_SMI_ELEMENTS: | 4213 case FAST_SMI_ELEMENTS: |
4186 case FAST_DOUBLE_ELEMENTS: | 4214 case FAST_DOUBLE_ELEMENTS: |
4187 case FAST_HOLEY_ELEMENTS: | 4215 case FAST_HOLEY_ELEMENTS: |
4188 case FAST_HOLEY_SMI_ELEMENTS: | 4216 case FAST_HOLEY_SMI_ELEMENTS: |
4189 case FAST_HOLEY_DOUBLE_ELEMENTS: | 4217 case FAST_HOLEY_DOUBLE_ELEMENTS: |
4190 case DICTIONARY_ELEMENTS: | 4218 case DICTIONARY_ELEMENTS: |
4191 case NON_STRICT_ARGUMENTS_ELEMENTS: | 4219 case NON_STRICT_ARGUMENTS_ELEMENTS: |
4192 UNREACHABLE(); | 4220 UNREACHABLE(); |
4193 break; | 4221 break; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4305 key_reg, | 4333 key_reg, |
4306 value, | 4334 value, |
4307 kSaveFPRegs, | 4335 kSaveFPRegs, |
4308 EMIT_REMEMBERED_SET, | 4336 EMIT_REMEMBERED_SET, |
4309 check_needed); | 4337 check_needed); |
4310 } | 4338 } |
4311 } | 4339 } |
4312 | 4340 |
4313 | 4341 |
4314 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { | 4342 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { |
4315 if (instr->is_external()) { | 4343 if (instr->is_external() || instr->is_fixed_typed_array()) { |
4316 DoStoreKeyedExternalArray(instr); | 4344 DoStoreKeyedExternalArray(instr); |
4317 } else if (instr->hydrogen()->value()->representation().IsDouble()) { | 4345 } else if (instr->hydrogen()->value()->representation().IsDouble()) { |
4318 DoStoreKeyedFixedDoubleArray(instr); | 4346 DoStoreKeyedFixedDoubleArray(instr); |
4319 } else { | 4347 } else { |
4320 DoStoreKeyedFixedArray(instr); | 4348 DoStoreKeyedFixedArray(instr); |
4321 } | 4349 } |
4322 } | 4350 } |
4323 | 4351 |
4324 | 4352 |
4325 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4353 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5631 FixedArray::kHeaderSize - kPointerSize)); | 5659 FixedArray::kHeaderSize - kPointerSize)); |
5632 __ bind(&done); | 5660 __ bind(&done); |
5633 } | 5661 } |
5634 | 5662 |
5635 | 5663 |
5636 #undef __ | 5664 #undef __ |
5637 | 5665 |
5638 } } // namespace v8::internal | 5666 } } // namespace v8::internal |
5639 | 5667 |
5640 #endif // V8_TARGET_ARCH_X64 | 5668 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |