OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 3048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3059 ExternalArrayOpRequiresTemp(instr->hydrogen()->key()->representation(), | 3059 ExternalArrayOpRequiresTemp(instr->hydrogen()->key()->representation(), |
3060 elements_kind)) { | 3060 elements_kind)) { |
3061 __ SmiUntag(ToRegister(key)); | 3061 __ SmiUntag(ToRegister(key)); |
3062 } | 3062 } |
3063 Operand operand(BuildFastArrayOperand( | 3063 Operand operand(BuildFastArrayOperand( |
3064 instr->elements(), | 3064 instr->elements(), |
3065 key, | 3065 key, |
3066 instr->hydrogen()->key()->representation(), | 3066 instr->hydrogen()->key()->representation(), |
3067 elements_kind, | 3067 elements_kind, |
3068 instr->base_offset())); | 3068 instr->base_offset())); |
3069 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 3069 if (elements_kind == FLOAT32_ELEMENTS) { |
3070 elements_kind == FLOAT32_ELEMENTS) { | |
3071 XMMRegister result(ToDoubleRegister(instr->result())); | 3070 XMMRegister result(ToDoubleRegister(instr->result())); |
3072 __ movss(result, operand); | 3071 __ movss(result, operand); |
3073 __ cvtss2sd(result, result); | 3072 __ cvtss2sd(result, result); |
3074 } else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS || | 3073 } else if (elements_kind == FLOAT64_ELEMENTS) { |
3075 elements_kind == FLOAT64_ELEMENTS) { | |
3076 __ movsd(ToDoubleRegister(instr->result()), operand); | 3074 __ movsd(ToDoubleRegister(instr->result()), operand); |
3077 } else { | 3075 } else { |
3078 Register result(ToRegister(instr->result())); | 3076 Register result(ToRegister(instr->result())); |
3079 switch (elements_kind) { | 3077 switch (elements_kind) { |
3080 case EXTERNAL_INT8_ELEMENTS: | |
3081 case INT8_ELEMENTS: | 3078 case INT8_ELEMENTS: |
3082 __ movsx_b(result, operand); | 3079 __ movsx_b(result, operand); |
3083 break; | 3080 break; |
3084 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: | |
3085 case EXTERNAL_UINT8_ELEMENTS: | |
3086 case UINT8_ELEMENTS: | 3081 case UINT8_ELEMENTS: |
3087 case UINT8_CLAMPED_ELEMENTS: | 3082 case UINT8_CLAMPED_ELEMENTS: |
3088 __ movzx_b(result, operand); | 3083 __ movzx_b(result, operand); |
3089 break; | 3084 break; |
3090 case EXTERNAL_INT16_ELEMENTS: | |
3091 case INT16_ELEMENTS: | 3085 case INT16_ELEMENTS: |
3092 __ movsx_w(result, operand); | 3086 __ movsx_w(result, operand); |
3093 break; | 3087 break; |
3094 case EXTERNAL_UINT16_ELEMENTS: | |
3095 case UINT16_ELEMENTS: | 3088 case UINT16_ELEMENTS: |
3096 __ movzx_w(result, operand); | 3089 __ movzx_w(result, operand); |
3097 break; | 3090 break; |
3098 case EXTERNAL_INT32_ELEMENTS: | |
3099 case INT32_ELEMENTS: | 3091 case INT32_ELEMENTS: |
3100 __ mov(result, operand); | 3092 __ mov(result, operand); |
3101 break; | 3093 break; |
3102 case EXTERNAL_UINT32_ELEMENTS: | |
3103 case UINT32_ELEMENTS: | 3094 case UINT32_ELEMENTS: |
3104 __ mov(result, operand); | 3095 __ mov(result, operand); |
3105 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { | 3096 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { |
3106 __ test(result, Operand(result)); | 3097 __ test(result, Operand(result)); |
3107 DeoptimizeIf(negative, instr, Deoptimizer::kNegativeValue); | 3098 DeoptimizeIf(negative, instr, Deoptimizer::kNegativeValue); |
3108 } | 3099 } |
3109 break; | 3100 break; |
3110 case EXTERNAL_FLOAT32_ELEMENTS: | |
3111 case EXTERNAL_FLOAT64_ELEMENTS: | |
3112 case FLOAT32_ELEMENTS: | 3101 case FLOAT32_ELEMENTS: |
3113 case FLOAT64_ELEMENTS: | 3102 case FLOAT64_ELEMENTS: |
3114 case FAST_SMI_ELEMENTS: | 3103 case FAST_SMI_ELEMENTS: |
3115 case FAST_ELEMENTS: | 3104 case FAST_ELEMENTS: |
3116 case FAST_DOUBLE_ELEMENTS: | 3105 case FAST_DOUBLE_ELEMENTS: |
3117 case FAST_HOLEY_SMI_ELEMENTS: | 3106 case FAST_HOLEY_SMI_ELEMENTS: |
3118 case FAST_HOLEY_ELEMENTS: | 3107 case FAST_HOLEY_ELEMENTS: |
3119 case FAST_HOLEY_DOUBLE_ELEMENTS: | 3108 case FAST_HOLEY_DOUBLE_ELEMENTS: |
3120 case DICTIONARY_ELEMENTS: | 3109 case DICTIONARY_ELEMENTS: |
3121 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 3110 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3181 Immediate(Smi::FromInt(Isolate::kArrayProtectorValid))); | 3170 Immediate(Smi::FromInt(Isolate::kArrayProtectorValid))); |
3182 DeoptimizeIf(not_equal, instr, Deoptimizer::kHole); | 3171 DeoptimizeIf(not_equal, instr, Deoptimizer::kHole); |
3183 } | 3172 } |
3184 __ mov(result, isolate()->factory()->undefined_value()); | 3173 __ mov(result, isolate()->factory()->undefined_value()); |
3185 __ bind(&done); | 3174 __ bind(&done); |
3186 } | 3175 } |
3187 } | 3176 } |
3188 | 3177 |
3189 | 3178 |
3190 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { | 3179 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { |
3191 if (instr->is_typed_elements()) { | 3180 if (instr->is_fixed_typed_array()) { |
3192 DoLoadKeyedExternalArray(instr); | 3181 DoLoadKeyedExternalArray(instr); |
3193 } else if (instr->hydrogen()->representation().IsDouble()) { | 3182 } else if (instr->hydrogen()->representation().IsDouble()) { |
3194 DoLoadKeyedFixedDoubleArray(instr); | 3183 DoLoadKeyedFixedDoubleArray(instr); |
3195 } else { | 3184 } else { |
3196 DoLoadKeyedFixedArray(instr); | 3185 DoLoadKeyedFixedArray(instr); |
3197 } | 3186 } |
3198 } | 3187 } |
3199 | 3188 |
3200 | 3189 |
3201 Operand LCodeGen::BuildFastArrayOperand( | 3190 Operand LCodeGen::BuildFastArrayOperand( |
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4188 ExternalArrayOpRequiresTemp(instr->hydrogen()->key()->representation(), | 4177 ExternalArrayOpRequiresTemp(instr->hydrogen()->key()->representation(), |
4189 elements_kind)) { | 4178 elements_kind)) { |
4190 __ SmiUntag(ToRegister(key)); | 4179 __ SmiUntag(ToRegister(key)); |
4191 } | 4180 } |
4192 Operand operand(BuildFastArrayOperand( | 4181 Operand operand(BuildFastArrayOperand( |
4193 instr->elements(), | 4182 instr->elements(), |
4194 key, | 4183 key, |
4195 instr->hydrogen()->key()->representation(), | 4184 instr->hydrogen()->key()->representation(), |
4196 elements_kind, | 4185 elements_kind, |
4197 instr->base_offset())); | 4186 instr->base_offset())); |
4198 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 4187 if (elements_kind == FLOAT32_ELEMENTS) { |
4199 elements_kind == FLOAT32_ELEMENTS) { | |
4200 XMMRegister xmm_scratch = double_scratch0(); | 4188 XMMRegister xmm_scratch = double_scratch0(); |
4201 __ cvtsd2ss(xmm_scratch, ToDoubleRegister(instr->value())); | 4189 __ cvtsd2ss(xmm_scratch, ToDoubleRegister(instr->value())); |
4202 __ movss(operand, xmm_scratch); | 4190 __ movss(operand, xmm_scratch); |
4203 } else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS || | 4191 } else if (elements_kind == FLOAT64_ELEMENTS) { |
4204 elements_kind == FLOAT64_ELEMENTS) { | |
4205 __ movsd(operand, ToDoubleRegister(instr->value())); | 4192 __ movsd(operand, ToDoubleRegister(instr->value())); |
4206 } else { | 4193 } else { |
4207 Register value = ToRegister(instr->value()); | 4194 Register value = ToRegister(instr->value()); |
4208 switch (elements_kind) { | 4195 switch (elements_kind) { |
4209 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: | |
4210 case EXTERNAL_UINT8_ELEMENTS: | |
4211 case EXTERNAL_INT8_ELEMENTS: | |
4212 case UINT8_ELEMENTS: | 4196 case UINT8_ELEMENTS: |
4213 case INT8_ELEMENTS: | 4197 case INT8_ELEMENTS: |
4214 case UINT8_CLAMPED_ELEMENTS: | 4198 case UINT8_CLAMPED_ELEMENTS: |
4215 __ mov_b(operand, value); | 4199 __ mov_b(operand, value); |
4216 break; | 4200 break; |
4217 case EXTERNAL_INT16_ELEMENTS: | |
4218 case EXTERNAL_UINT16_ELEMENTS: | |
4219 case UINT16_ELEMENTS: | 4201 case UINT16_ELEMENTS: |
4220 case INT16_ELEMENTS: | 4202 case INT16_ELEMENTS: |
4221 __ mov_w(operand, value); | 4203 __ mov_w(operand, value); |
4222 break; | 4204 break; |
4223 case EXTERNAL_INT32_ELEMENTS: | |
4224 case EXTERNAL_UINT32_ELEMENTS: | |
4225 case UINT32_ELEMENTS: | 4205 case UINT32_ELEMENTS: |
4226 case INT32_ELEMENTS: | 4206 case INT32_ELEMENTS: |
4227 __ mov(operand, value); | 4207 __ mov(operand, value); |
4228 break; | 4208 break; |
4229 case EXTERNAL_FLOAT32_ELEMENTS: | |
4230 case EXTERNAL_FLOAT64_ELEMENTS: | |
4231 case FLOAT32_ELEMENTS: | 4209 case FLOAT32_ELEMENTS: |
4232 case FLOAT64_ELEMENTS: | 4210 case FLOAT64_ELEMENTS: |
4233 case FAST_SMI_ELEMENTS: | 4211 case FAST_SMI_ELEMENTS: |
4234 case FAST_ELEMENTS: | 4212 case FAST_ELEMENTS: |
4235 case FAST_DOUBLE_ELEMENTS: | 4213 case FAST_DOUBLE_ELEMENTS: |
4236 case FAST_HOLEY_SMI_ELEMENTS: | 4214 case FAST_HOLEY_SMI_ELEMENTS: |
4237 case FAST_HOLEY_ELEMENTS: | 4215 case FAST_HOLEY_ELEMENTS: |
4238 case FAST_HOLEY_DOUBLE_ELEMENTS: | 4216 case FAST_HOLEY_DOUBLE_ELEMENTS: |
4239 case DICTIONARY_ELEMENTS: | 4217 case DICTIONARY_ELEMENTS: |
4240 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 4218 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4306 kSaveFPRegs, | 4284 kSaveFPRegs, |
4307 EMIT_REMEMBERED_SET, | 4285 EMIT_REMEMBERED_SET, |
4308 check_needed, | 4286 check_needed, |
4309 instr->hydrogen()->PointersToHereCheckForValue()); | 4287 instr->hydrogen()->PointersToHereCheckForValue()); |
4310 } | 4288 } |
4311 } | 4289 } |
4312 | 4290 |
4313 | 4291 |
4314 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { | 4292 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { |
4315 // By cases...external, fast-double, fast | 4293 // By cases...external, fast-double, fast |
4316 if (instr->is_typed_elements()) { | 4294 if (instr->is_fixed_typed_array()) { |
4317 DoStoreKeyedExternalArray(instr); | 4295 DoStoreKeyedExternalArray(instr); |
4318 } else if (instr->hydrogen()->value()->representation().IsDouble()) { | 4296 } else if (instr->hydrogen()->value()->representation().IsDouble()) { |
4319 DoStoreKeyedFixedDoubleArray(instr); | 4297 DoStoreKeyedFixedDoubleArray(instr); |
4320 } else { | 4298 } else { |
4321 DoStoreKeyedFixedArray(instr); | 4299 DoStoreKeyedFixedArray(instr); |
4322 } | 4300 } |
4323 } | 4301 } |
4324 | 4302 |
4325 | 4303 |
4326 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4304 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5857 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5835 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5858 } | 5836 } |
5859 | 5837 |
5860 | 5838 |
5861 #undef __ | 5839 #undef __ |
5862 | 5840 |
5863 } // namespace internal | 5841 } // namespace internal |
5864 } // namespace v8 | 5842 } // namespace v8 |
5865 | 5843 |
5866 #endif // V8_TARGET_ARCH_IA32 | 5844 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |