OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3056 instr->elements(), | 3056 instr->elements(), |
3057 key, | 3057 key, |
3058 FAST_DOUBLE_ELEMENTS, | 3058 FAST_DOUBLE_ELEMENTS, |
3059 FixedDoubleArray::kHeaderSize - kHeapObjectTag, | 3059 FixedDoubleArray::kHeaderSize - kHeapObjectTag, |
3060 instr->additional_index()); | 3060 instr->additional_index()); |
3061 __ movsd(result, double_load_operand); | 3061 __ movsd(result, double_load_operand); |
3062 } | 3062 } |
3063 | 3063 |
3064 | 3064 |
3065 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { | 3065 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { |
| 3066 HLoadKeyed* hinstr = instr->hydrogen(); |
3066 Register result = ToRegister(instr->result()); | 3067 Register result = ToRegister(instr->result()); |
3067 LOperand* key = instr->key(); | 3068 LOperand* key = instr->key(); |
3068 if (!key->IsConstantOperand()) { | 3069 if (!key->IsConstantOperand()) { |
3069 Register key_reg = ToRegister(key); | 3070 Register key_reg = ToRegister(key); |
3070 // Even though the HLoad/StoreKeyedFastElement instructions force | 3071 // Even though the HLoad/StoreKeyedFastElement instructions force |
3071 // the input representation for the key to be an integer, the input | 3072 // the input representation for the key to be an integer, the input |
3072 // gets replaced during bound check elimination with the index | 3073 // gets replaced during bound check elimination with the index |
3073 // argument to the bounds check, which can be tagged, so that | 3074 // argument to the bounds check, which can be tagged, so that |
3074 // case must be handled here, too. | 3075 // case must be handled here, too. |
3075 if (instr->hydrogen()->IsDehoisted()) { | 3076 if (hinstr->IsDehoisted()) { |
3076 // Sign extend key because it could be a 32 bit negative value | 3077 // Sign extend key because it could be a 32 bit negative value |
3077 // and the dehoisted address computation happens in 64 bits | 3078 // and the dehoisted address computation happens in 64 bits |
3078 __ movsxlq(key_reg, key_reg); | 3079 __ movsxlq(key_reg, key_reg); |
3079 } | 3080 } |
3080 } | 3081 } |
3081 | 3082 |
3082 // Load the result. | 3083 bool requires_hole_check = hinstr->RequiresHoleCheck(); |
3083 __ movq(result, | 3084 int offset = FixedArray::kHeaderSize - kHeapObjectTag; |
| 3085 Representation representation = hinstr->representation(); |
| 3086 |
| 3087 if (representation.IsInteger32() && |
| 3088 hinstr->elements_kind() == FAST_SMI_ELEMENTS) { |
| 3089 ASSERT(!requires_hole_check); |
| 3090 // Read int value directly from upper half of the smi. |
| 3091 STATIC_ASSERT(kSmiTag == 0); |
| 3092 STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 32); |
| 3093 offset += kPointerSize / 2; |
| 3094 } |
| 3095 |
| 3096 __ Load(result, |
3084 BuildFastArrayOperand(instr->elements(), | 3097 BuildFastArrayOperand(instr->elements(), |
3085 key, | 3098 key, |
3086 FAST_ELEMENTS, | 3099 FAST_ELEMENTS, |
3087 FixedArray::kHeaderSize - kHeapObjectTag, | 3100 offset, |
3088 instr->additional_index())); | 3101 instr->additional_index()), |
| 3102 representation); |
3089 | 3103 |
3090 // Check for the hole value. | 3104 // Check for the hole value. |
3091 if (instr->hydrogen()->RequiresHoleCheck()) { | 3105 if (requires_hole_check) { |
3092 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) { | 3106 if (IsFastSmiElementsKind(hinstr->elements_kind())) { |
3093 Condition smi = __ CheckSmi(result); | 3107 Condition smi = __ CheckSmi(result); |
3094 DeoptimizeIf(NegateCondition(smi), instr->environment()); | 3108 DeoptimizeIf(NegateCondition(smi), instr->environment()); |
3095 } else { | 3109 } else { |
3096 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | 3110 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
3097 DeoptimizeIf(equal, instr->environment()); | 3111 DeoptimizeIf(equal, instr->environment()); |
3098 } | 3112 } |
3099 } | 3113 } |
3100 } | 3114 } |
3101 | 3115 |
3102 | 3116 |
(...skipping 2489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5592 FixedArray::kHeaderSize - kPointerSize)); | 5606 FixedArray::kHeaderSize - kPointerSize)); |
5593 __ bind(&done); | 5607 __ bind(&done); |
5594 } | 5608 } |
5595 | 5609 |
5596 | 5610 |
5597 #undef __ | 5611 #undef __ |
5598 | 5612 |
5599 } } // namespace v8::internal | 5613 } } // namespace v8::internal |
5600 | 5614 |
5601 #endif // V8_TARGET_ARCH_X64 | 5615 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |