OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 3096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3107 __ movsxlq(key_reg, key_reg); | 3107 __ movsxlq(key_reg, key_reg); |
3108 } | 3108 } |
3109 } | 3109 } |
3110 Operand operand(BuildFastArrayOperand( | 3110 Operand operand(BuildFastArrayOperand( |
3111 instr->elements(), | 3111 instr->elements(), |
3112 key, | 3112 key, |
3113 instr->hydrogen()->key()->representation(), | 3113 instr->hydrogen()->key()->representation(), |
3114 elements_kind, | 3114 elements_kind, |
3115 instr->base_offset())); | 3115 instr->base_offset())); |
3116 | 3116 |
3117 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 3117 if (elements_kind == FLOAT32_ELEMENTS) { |
3118 elements_kind == FLOAT32_ELEMENTS) { | |
3119 XMMRegister result(ToDoubleRegister(instr->result())); | 3118 XMMRegister result(ToDoubleRegister(instr->result())); |
3120 __ movss(result, operand); | 3119 __ movss(result, operand); |
3121 __ cvtss2sd(result, result); | 3120 __ cvtss2sd(result, result); |
3122 } else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS || | 3121 } else if (elements_kind == FLOAT64_ELEMENTS) { |
3123 elements_kind == FLOAT64_ELEMENTS) { | |
3124 __ movsd(ToDoubleRegister(instr->result()), operand); | 3122 __ movsd(ToDoubleRegister(instr->result()), operand); |
3125 } else { | 3123 } else { |
3126 Register result(ToRegister(instr->result())); | 3124 Register result(ToRegister(instr->result())); |
3127 switch (elements_kind) { | 3125 switch (elements_kind) { |
3128 case EXTERNAL_INT8_ELEMENTS: | |
3129 case INT8_ELEMENTS: | 3126 case INT8_ELEMENTS: |
3130 __ movsxbl(result, operand); | 3127 __ movsxbl(result, operand); |
3131 break; | 3128 break; |
3132 case EXTERNAL_UINT8_ELEMENTS: | |
3133 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: | |
3134 case UINT8_ELEMENTS: | 3129 case UINT8_ELEMENTS: |
3135 case UINT8_CLAMPED_ELEMENTS: | 3130 case UINT8_CLAMPED_ELEMENTS: |
3136 __ movzxbl(result, operand); | 3131 __ movzxbl(result, operand); |
3137 break; | 3132 break; |
3138 case EXTERNAL_INT16_ELEMENTS: | |
3139 case INT16_ELEMENTS: | 3133 case INT16_ELEMENTS: |
3140 __ movsxwl(result, operand); | 3134 __ movsxwl(result, operand); |
3141 break; | 3135 break; |
3142 case EXTERNAL_UINT16_ELEMENTS: | |
3143 case UINT16_ELEMENTS: | 3136 case UINT16_ELEMENTS: |
3144 __ movzxwl(result, operand); | 3137 __ movzxwl(result, operand); |
3145 break; | 3138 break; |
3146 case EXTERNAL_INT32_ELEMENTS: | |
3147 case INT32_ELEMENTS: | 3139 case INT32_ELEMENTS: |
3148 __ movl(result, operand); | 3140 __ movl(result, operand); |
3149 break; | 3141 break; |
3150 case EXTERNAL_UINT32_ELEMENTS: | |
3151 case UINT32_ELEMENTS: | 3142 case UINT32_ELEMENTS: |
3152 __ movl(result, operand); | 3143 __ movl(result, operand); |
3153 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { | 3144 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { |
3154 __ testl(result, result); | 3145 __ testl(result, result); |
3155 DeoptimizeIf(negative, instr, Deoptimizer::kNegativeValue); | 3146 DeoptimizeIf(negative, instr, Deoptimizer::kNegativeValue); |
3156 } | 3147 } |
3157 break; | 3148 break; |
3158 case EXTERNAL_FLOAT32_ELEMENTS: | |
3159 case EXTERNAL_FLOAT64_ELEMENTS: | |
3160 case FLOAT32_ELEMENTS: | 3149 case FLOAT32_ELEMENTS: |
3161 case FLOAT64_ELEMENTS: | 3150 case FLOAT64_ELEMENTS: |
3162 case FAST_ELEMENTS: | 3151 case FAST_ELEMENTS: |
3163 case FAST_SMI_ELEMENTS: | 3152 case FAST_SMI_ELEMENTS: |
3164 case FAST_DOUBLE_ELEMENTS: | 3153 case FAST_DOUBLE_ELEMENTS: |
3165 case FAST_HOLEY_ELEMENTS: | 3154 case FAST_HOLEY_ELEMENTS: |
3166 case FAST_HOLEY_SMI_ELEMENTS: | 3155 case FAST_HOLEY_SMI_ELEMENTS: |
3167 case FAST_HOLEY_DOUBLE_ELEMENTS: | 3156 case FAST_HOLEY_DOUBLE_ELEMENTS: |
3168 case DICTIONARY_ELEMENTS: | 3157 case DICTIONARY_ELEMENTS: |
3169 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 3158 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3268 Smi::FromInt(Isolate::kArrayProtectorValid)); | 3257 Smi::FromInt(Isolate::kArrayProtectorValid)); |
3269 DeoptimizeIf(not_equal, instr, Deoptimizer::kHole); | 3258 DeoptimizeIf(not_equal, instr, Deoptimizer::kHole); |
3270 } | 3259 } |
3271 __ Move(result, isolate()->factory()->undefined_value()); | 3260 __ Move(result, isolate()->factory()->undefined_value()); |
3272 __ bind(&done); | 3261 __ bind(&done); |
3273 } | 3262 } |
3274 } | 3263 } |
3275 | 3264 |
3276 | 3265 |
3277 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { | 3266 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { |
3278 if (instr->is_typed_elements()) { | 3267 if (instr->is_fixed_typed_array()) { |
3279 DoLoadKeyedExternalArray(instr); | 3268 DoLoadKeyedExternalArray(instr); |
3280 } else if (instr->hydrogen()->representation().IsDouble()) { | 3269 } else if (instr->hydrogen()->representation().IsDouble()) { |
3281 DoLoadKeyedFixedDoubleArray(instr); | 3270 DoLoadKeyedFixedDoubleArray(instr); |
3282 } else { | 3271 } else { |
3283 DoLoadKeyedFixedArray(instr); | 3272 DoLoadKeyedFixedArray(instr); |
3284 } | 3273 } |
3285 } | 3274 } |
3286 | 3275 |
3287 | 3276 |
3288 Operand LCodeGen::BuildFastArrayOperand( | 3277 Operand LCodeGen::BuildFastArrayOperand( |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4368 __ movsxlq(key_reg, key_reg); | 4357 __ movsxlq(key_reg, key_reg); |
4369 } | 4358 } |
4370 } | 4359 } |
4371 Operand operand(BuildFastArrayOperand( | 4360 Operand operand(BuildFastArrayOperand( |
4372 instr->elements(), | 4361 instr->elements(), |
4373 key, | 4362 key, |
4374 instr->hydrogen()->key()->representation(), | 4363 instr->hydrogen()->key()->representation(), |
4375 elements_kind, | 4364 elements_kind, |
4376 instr->base_offset())); | 4365 instr->base_offset())); |
4377 | 4366 |
4378 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 4367 if (elements_kind == FLOAT32_ELEMENTS) { |
4379 elements_kind == FLOAT32_ELEMENTS) { | |
4380 XMMRegister value(ToDoubleRegister(instr->value())); | 4368 XMMRegister value(ToDoubleRegister(instr->value())); |
4381 __ cvtsd2ss(value, value); | 4369 __ cvtsd2ss(value, value); |
4382 __ movss(operand, value); | 4370 __ movss(operand, value); |
4383 } else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS || | 4371 } else if (elements_kind == FLOAT64_ELEMENTS) { |
4384 elements_kind == FLOAT64_ELEMENTS) { | |
4385 __ movsd(operand, ToDoubleRegister(instr->value())); | 4372 __ movsd(operand, ToDoubleRegister(instr->value())); |
4386 } else { | 4373 } else { |
4387 Register value(ToRegister(instr->value())); | 4374 Register value(ToRegister(instr->value())); |
4388 switch (elements_kind) { | 4375 switch (elements_kind) { |
4389 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: | |
4390 case EXTERNAL_INT8_ELEMENTS: | |
4391 case EXTERNAL_UINT8_ELEMENTS: | |
4392 case INT8_ELEMENTS: | 4376 case INT8_ELEMENTS: |
4393 case UINT8_ELEMENTS: | 4377 case UINT8_ELEMENTS: |
4394 case UINT8_CLAMPED_ELEMENTS: | 4378 case UINT8_CLAMPED_ELEMENTS: |
4395 __ movb(operand, value); | 4379 __ movb(operand, value); |
4396 break; | 4380 break; |
4397 case EXTERNAL_INT16_ELEMENTS: | |
4398 case EXTERNAL_UINT16_ELEMENTS: | |
4399 case INT16_ELEMENTS: | 4381 case INT16_ELEMENTS: |
4400 case UINT16_ELEMENTS: | 4382 case UINT16_ELEMENTS: |
4401 __ movw(operand, value); | 4383 __ movw(operand, value); |
4402 break; | 4384 break; |
4403 case EXTERNAL_INT32_ELEMENTS: | |
4404 case EXTERNAL_UINT32_ELEMENTS: | |
4405 case INT32_ELEMENTS: | 4385 case INT32_ELEMENTS: |
4406 case UINT32_ELEMENTS: | 4386 case UINT32_ELEMENTS: |
4407 __ movl(operand, value); | 4387 __ movl(operand, value); |
4408 break; | 4388 break; |
4409 case EXTERNAL_FLOAT32_ELEMENTS: | |
4410 case EXTERNAL_FLOAT64_ELEMENTS: | |
4411 case FLOAT32_ELEMENTS: | 4389 case FLOAT32_ELEMENTS: |
4412 case FLOAT64_ELEMENTS: | 4390 case FLOAT64_ELEMENTS: |
4413 case FAST_ELEMENTS: | 4391 case FAST_ELEMENTS: |
4414 case FAST_SMI_ELEMENTS: | 4392 case FAST_SMI_ELEMENTS: |
4415 case FAST_DOUBLE_ELEMENTS: | 4393 case FAST_DOUBLE_ELEMENTS: |
4416 case FAST_HOLEY_ELEMENTS: | 4394 case FAST_HOLEY_ELEMENTS: |
4417 case FAST_HOLEY_SMI_ELEMENTS: | 4395 case FAST_HOLEY_SMI_ELEMENTS: |
4418 case FAST_HOLEY_DOUBLE_ELEMENTS: | 4396 case FAST_HOLEY_DOUBLE_ELEMENTS: |
4419 case DICTIONARY_ELEMENTS: | 4397 case DICTIONARY_ELEMENTS: |
4420 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 4398 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4524 value, | 4502 value, |
4525 kSaveFPRegs, | 4503 kSaveFPRegs, |
4526 EMIT_REMEMBERED_SET, | 4504 EMIT_REMEMBERED_SET, |
4527 check_needed, | 4505 check_needed, |
4528 hinstr->PointersToHereCheckForValue()); | 4506 hinstr->PointersToHereCheckForValue()); |
4529 } | 4507 } |
4530 } | 4508 } |
4531 | 4509 |
4532 | 4510 |
4533 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { | 4511 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { |
4534 if (instr->is_typed_elements()) { | 4512 if (instr->is_fixed_typed_array()) { |
4535 DoStoreKeyedExternalArray(instr); | 4513 DoStoreKeyedExternalArray(instr); |
4536 } else if (instr->hydrogen()->value()->representation().IsDouble()) { | 4514 } else if (instr->hydrogen()->value()->representation().IsDouble()) { |
4537 DoStoreKeyedFixedDoubleArray(instr); | 4515 DoStoreKeyedFixedDoubleArray(instr); |
4538 } else { | 4516 } else { |
4539 DoStoreKeyedFixedArray(instr); | 4517 DoStoreKeyedFixedArray(instr); |
4540 } | 4518 } |
4541 } | 4519 } |
4542 | 4520 |
4543 | 4521 |
4544 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4522 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6069 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6047 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6070 } | 6048 } |
6071 | 6049 |
6072 | 6050 |
6073 #undef __ | 6051 #undef __ |
6074 | 6052 |
6075 } // namespace internal | 6053 } // namespace internal |
6076 } // namespace v8 | 6054 } // namespace v8 |
6077 | 6055 |
6078 #endif // V8_TARGET_ARCH_X64 | 6056 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |