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