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