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