| 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 3052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3063 ExternalArrayOpRequiresTemp(instr->hydrogen()->key()->representation(), | 3063 ExternalArrayOpRequiresTemp(instr->hydrogen()->key()->representation(), |
| 3064 elements_kind)) { | 3064 elements_kind)) { |
| 3065 __ SmiUntag(ToRegister(key)); | 3065 __ SmiUntag(ToRegister(key)); |
| 3066 } | 3066 } |
| 3067 Operand operand(BuildFastArrayOperand( | 3067 Operand operand(BuildFastArrayOperand( |
| 3068 instr->elements(), | 3068 instr->elements(), |
| 3069 key, | 3069 key, |
| 3070 instr->hydrogen()->key()->representation(), | 3070 instr->hydrogen()->key()->representation(), |
| 3071 elements_kind, | 3071 elements_kind, |
| 3072 instr->base_offset())); | 3072 instr->base_offset())); |
| 3073 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 3073 if (elements_kind == FLOAT32_ELEMENTS) { |
| 3074 elements_kind == FLOAT32_ELEMENTS) { | |
| 3075 XMMRegister result(ToDoubleRegister(instr->result())); | 3074 XMMRegister result(ToDoubleRegister(instr->result())); |
| 3076 __ movss(result, operand); | 3075 __ movss(result, operand); |
| 3077 __ cvtss2sd(result, result); | 3076 __ cvtss2sd(result, result); |
| 3078 } else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS || | 3077 } else if (elements_kind == FLOAT64_ELEMENTS) { |
| 3079 elements_kind == FLOAT64_ELEMENTS) { | |
| 3080 __ movsd(ToDoubleRegister(instr->result()), operand); | 3078 __ movsd(ToDoubleRegister(instr->result()), operand); |
| 3081 } else { | 3079 } else { |
| 3082 Register result(ToRegister(instr->result())); | 3080 Register result(ToRegister(instr->result())); |
| 3083 switch (elements_kind) { | 3081 switch (elements_kind) { |
| 3084 case EXTERNAL_INT8_ELEMENTS: | |
| 3085 case INT8_ELEMENTS: | 3082 case INT8_ELEMENTS: |
| 3086 __ movsx_b(result, operand); | 3083 __ movsx_b(result, operand); |
| 3087 break; | 3084 break; |
| 3088 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: | |
| 3089 case EXTERNAL_UINT8_ELEMENTS: | |
| 3090 case UINT8_ELEMENTS: | 3085 case UINT8_ELEMENTS: |
| 3091 case UINT8_CLAMPED_ELEMENTS: | 3086 case UINT8_CLAMPED_ELEMENTS: |
| 3092 __ movzx_b(result, operand); | 3087 __ movzx_b(result, operand); |
| 3093 break; | 3088 break; |
| 3094 case EXTERNAL_INT16_ELEMENTS: | |
| 3095 case INT16_ELEMENTS: | 3089 case INT16_ELEMENTS: |
| 3096 __ movsx_w(result, operand); | 3090 __ movsx_w(result, operand); |
| 3097 break; | 3091 break; |
| 3098 case EXTERNAL_UINT16_ELEMENTS: | |
| 3099 case UINT16_ELEMENTS: | 3092 case UINT16_ELEMENTS: |
| 3100 __ movzx_w(result, operand); | 3093 __ movzx_w(result, operand); |
| 3101 break; | 3094 break; |
| 3102 case EXTERNAL_INT32_ELEMENTS: | |
| 3103 case INT32_ELEMENTS: | 3095 case INT32_ELEMENTS: |
| 3104 __ mov(result, operand); | 3096 __ mov(result, operand); |
| 3105 break; | 3097 break; |
| 3106 case EXTERNAL_UINT32_ELEMENTS: | |
| 3107 case UINT32_ELEMENTS: | 3098 case UINT32_ELEMENTS: |
| 3108 __ mov(result, operand); | 3099 __ mov(result, operand); |
| 3109 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { | 3100 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { |
| 3110 __ test(result, Operand(result)); | 3101 __ test(result, Operand(result)); |
| 3111 DeoptimizeIf(negative, instr, Deoptimizer::kNegativeValue); | 3102 DeoptimizeIf(negative, instr, Deoptimizer::kNegativeValue); |
| 3112 } | 3103 } |
| 3113 break; | 3104 break; |
| 3114 case EXTERNAL_FLOAT32_ELEMENTS: | |
| 3115 case EXTERNAL_FLOAT64_ELEMENTS: | |
| 3116 case FLOAT32_ELEMENTS: | 3105 case FLOAT32_ELEMENTS: |
| 3117 case FLOAT64_ELEMENTS: | 3106 case FLOAT64_ELEMENTS: |
| 3118 case FAST_SMI_ELEMENTS: | 3107 case FAST_SMI_ELEMENTS: |
| 3119 case FAST_ELEMENTS: | 3108 case FAST_ELEMENTS: |
| 3120 case FAST_DOUBLE_ELEMENTS: | 3109 case FAST_DOUBLE_ELEMENTS: |
| 3121 case FAST_HOLEY_SMI_ELEMENTS: | 3110 case FAST_HOLEY_SMI_ELEMENTS: |
| 3122 case FAST_HOLEY_ELEMENTS: | 3111 case FAST_HOLEY_ELEMENTS: |
| 3123 case FAST_HOLEY_DOUBLE_ELEMENTS: | 3112 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 3124 case DICTIONARY_ELEMENTS: | 3113 case DICTIONARY_ELEMENTS: |
| 3125 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 3114 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3185 Immediate(Smi::FromInt(Isolate::kArrayProtectorValid))); | 3174 Immediate(Smi::FromInt(Isolate::kArrayProtectorValid))); |
| 3186 DeoptimizeIf(not_equal, instr, Deoptimizer::kHole); | 3175 DeoptimizeIf(not_equal, instr, Deoptimizer::kHole); |
| 3187 } | 3176 } |
| 3188 __ mov(result, isolate()->factory()->undefined_value()); | 3177 __ mov(result, isolate()->factory()->undefined_value()); |
| 3189 __ bind(&done); | 3178 __ bind(&done); |
| 3190 } | 3179 } |
| 3191 } | 3180 } |
| 3192 | 3181 |
| 3193 | 3182 |
| 3194 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { | 3183 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { |
| 3195 if (instr->is_typed_elements()) { | 3184 if (instr->is_fixed_typed_array()) { |
| 3196 DoLoadKeyedExternalArray(instr); | 3185 DoLoadKeyedExternalArray(instr); |
| 3197 } else if (instr->hydrogen()->representation().IsDouble()) { | 3186 } else if (instr->hydrogen()->representation().IsDouble()) { |
| 3198 DoLoadKeyedFixedDoubleArray(instr); | 3187 DoLoadKeyedFixedDoubleArray(instr); |
| 3199 } else { | 3188 } else { |
| 3200 DoLoadKeyedFixedArray(instr); | 3189 DoLoadKeyedFixedArray(instr); |
| 3201 } | 3190 } |
| 3202 } | 3191 } |
| 3203 | 3192 |
| 3204 | 3193 |
| 3205 Operand LCodeGen::BuildFastArrayOperand( | 3194 Operand LCodeGen::BuildFastArrayOperand( |
| (...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4200 ExternalArrayOpRequiresTemp(instr->hydrogen()->key()->representation(), | 4189 ExternalArrayOpRequiresTemp(instr->hydrogen()->key()->representation(), |
| 4201 elements_kind)) { | 4190 elements_kind)) { |
| 4202 __ SmiUntag(ToRegister(key)); | 4191 __ SmiUntag(ToRegister(key)); |
| 4203 } | 4192 } |
| 4204 Operand operand(BuildFastArrayOperand( | 4193 Operand operand(BuildFastArrayOperand( |
| 4205 instr->elements(), | 4194 instr->elements(), |
| 4206 key, | 4195 key, |
| 4207 instr->hydrogen()->key()->representation(), | 4196 instr->hydrogen()->key()->representation(), |
| 4208 elements_kind, | 4197 elements_kind, |
| 4209 instr->base_offset())); | 4198 instr->base_offset())); |
| 4210 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 4199 if (elements_kind == FLOAT32_ELEMENTS) { |
| 4211 elements_kind == FLOAT32_ELEMENTS) { | |
| 4212 XMMRegister xmm_scratch = double_scratch0(); | 4200 XMMRegister xmm_scratch = double_scratch0(); |
| 4213 __ cvtsd2ss(xmm_scratch, ToDoubleRegister(instr->value())); | 4201 __ cvtsd2ss(xmm_scratch, ToDoubleRegister(instr->value())); |
| 4214 __ movss(operand, xmm_scratch); | 4202 __ movss(operand, xmm_scratch); |
| 4215 } else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS || | 4203 } else if (elements_kind == FLOAT64_ELEMENTS) { |
| 4216 elements_kind == FLOAT64_ELEMENTS) { | |
| 4217 __ movsd(operand, ToDoubleRegister(instr->value())); | 4204 __ movsd(operand, ToDoubleRegister(instr->value())); |
| 4218 } else { | 4205 } else { |
| 4219 Register value = ToRegister(instr->value()); | 4206 Register value = ToRegister(instr->value()); |
| 4220 switch (elements_kind) { | 4207 switch (elements_kind) { |
| 4221 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: | |
| 4222 case EXTERNAL_UINT8_ELEMENTS: | |
| 4223 case EXTERNAL_INT8_ELEMENTS: | |
| 4224 case UINT8_ELEMENTS: | 4208 case UINT8_ELEMENTS: |
| 4225 case INT8_ELEMENTS: | 4209 case INT8_ELEMENTS: |
| 4226 case UINT8_CLAMPED_ELEMENTS: | 4210 case UINT8_CLAMPED_ELEMENTS: |
| 4227 __ mov_b(operand, value); | 4211 __ mov_b(operand, value); |
| 4228 break; | 4212 break; |
| 4229 case EXTERNAL_INT16_ELEMENTS: | |
| 4230 case EXTERNAL_UINT16_ELEMENTS: | |
| 4231 case UINT16_ELEMENTS: | 4213 case UINT16_ELEMENTS: |
| 4232 case INT16_ELEMENTS: | 4214 case INT16_ELEMENTS: |
| 4233 __ mov_w(operand, value); | 4215 __ mov_w(operand, value); |
| 4234 break; | 4216 break; |
| 4235 case EXTERNAL_INT32_ELEMENTS: | |
| 4236 case EXTERNAL_UINT32_ELEMENTS: | |
| 4237 case UINT32_ELEMENTS: | 4217 case UINT32_ELEMENTS: |
| 4238 case INT32_ELEMENTS: | 4218 case INT32_ELEMENTS: |
| 4239 __ mov(operand, value); | 4219 __ mov(operand, value); |
| 4240 break; | 4220 break; |
| 4241 case EXTERNAL_FLOAT32_ELEMENTS: | |
| 4242 case EXTERNAL_FLOAT64_ELEMENTS: | |
| 4243 case FLOAT32_ELEMENTS: | 4221 case FLOAT32_ELEMENTS: |
| 4244 case FLOAT64_ELEMENTS: | 4222 case FLOAT64_ELEMENTS: |
| 4245 case FAST_SMI_ELEMENTS: | 4223 case FAST_SMI_ELEMENTS: |
| 4246 case FAST_ELEMENTS: | 4224 case FAST_ELEMENTS: |
| 4247 case FAST_DOUBLE_ELEMENTS: | 4225 case FAST_DOUBLE_ELEMENTS: |
| 4248 case FAST_HOLEY_SMI_ELEMENTS: | 4226 case FAST_HOLEY_SMI_ELEMENTS: |
| 4249 case FAST_HOLEY_ELEMENTS: | 4227 case FAST_HOLEY_ELEMENTS: |
| 4250 case FAST_HOLEY_DOUBLE_ELEMENTS: | 4228 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 4251 case DICTIONARY_ELEMENTS: | 4229 case DICTIONARY_ELEMENTS: |
| 4252 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 4230 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4318 kSaveFPRegs, | 4296 kSaveFPRegs, |
| 4319 EMIT_REMEMBERED_SET, | 4297 EMIT_REMEMBERED_SET, |
| 4320 check_needed, | 4298 check_needed, |
| 4321 instr->hydrogen()->PointersToHereCheckForValue()); | 4299 instr->hydrogen()->PointersToHereCheckForValue()); |
| 4322 } | 4300 } |
| 4323 } | 4301 } |
| 4324 | 4302 |
| 4325 | 4303 |
| 4326 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { | 4304 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { |
| 4327 // By cases...external, fast-double, fast | 4305 // By cases...external, fast-double, fast |
| 4328 if (instr->is_typed_elements()) { | 4306 if (instr->is_fixed_typed_array()) { |
| 4329 DoStoreKeyedExternalArray(instr); | 4307 DoStoreKeyedExternalArray(instr); |
| 4330 } else if (instr->hydrogen()->value()->representation().IsDouble()) { | 4308 } else if (instr->hydrogen()->value()->representation().IsDouble()) { |
| 4331 DoStoreKeyedFixedDoubleArray(instr); | 4309 DoStoreKeyedFixedDoubleArray(instr); |
| 4332 } else { | 4310 } else { |
| 4333 DoStoreKeyedFixedArray(instr); | 4311 DoStoreKeyedFixedArray(instr); |
| 4334 } | 4312 } |
| 4335 } | 4313 } |
| 4336 | 4314 |
| 4337 | 4315 |
| 4338 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4316 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
| (...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5869 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5847 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5870 } | 5848 } |
| 5871 | 5849 |
| 5872 | 5850 |
| 5873 #undef __ | 5851 #undef __ |
| 5874 | 5852 |
| 5875 } // namespace internal | 5853 } // namespace internal |
| 5876 } // namespace v8 | 5854 } // namespace v8 |
| 5877 | 5855 |
| 5878 #endif // V8_TARGET_ARCH_IA32 | 5856 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |