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 3035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3046 instr->elements(), | 3046 instr->elements(), |
3047 key, | 3047 key, |
3048 FAST_DOUBLE_ELEMENTS, | 3048 FAST_DOUBLE_ELEMENTS, |
3049 FixedDoubleArray::kHeaderSize - kHeapObjectTag, | 3049 FixedDoubleArray::kHeaderSize - kHeapObjectTag, |
3050 instr->additional_index()); | 3050 instr->additional_index()); |
3051 __ movsd(result, double_load_operand); | 3051 __ movsd(result, double_load_operand); |
3052 } | 3052 } |
3053 | 3053 |
3054 | 3054 |
3055 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { | 3055 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { |
3056 HLoadKeyed* hinstr = instr->hydrogen(); | |
3056 Register result = ToRegister(instr->result()); | 3057 Register result = ToRegister(instr->result()); |
3057 LOperand* key = instr->key(); | 3058 LOperand* key = instr->key(); |
3058 if (!key->IsConstantOperand()) { | 3059 if (!key->IsConstantOperand()) { |
3059 Register key_reg = ToRegister(key); | 3060 Register key_reg = ToRegister(key); |
3060 // Even though the HLoad/StoreKeyedFastElement instructions force | 3061 // Even though the HLoad/StoreKeyedFastElement instructions force |
3061 // the input representation for the key to be an integer, the input | 3062 // the input representation for the key to be an integer, the input |
3062 // gets replaced during bound check elimination with the index | 3063 // gets replaced during bound check elimination with the index |
3063 // argument to the bounds check, which can be tagged, so that | 3064 // argument to the bounds check, which can be tagged, so that |
3064 // case must be handled here, too. | 3065 // case must be handled here, too. |
3065 if (instr->hydrogen()->IsDehoisted()) { | 3066 if (hinstr->IsDehoisted()) { |
3066 // Sign extend key because it could be a 32 bit negative value | 3067 // Sign extend key because it could be a 32 bit negative value |
3067 // and the dehoisted address computation happens in 64 bits | 3068 // and the dehoisted address computation happens in 64 bits |
3068 __ movsxlq(key_reg, key_reg); | 3069 __ movsxlq(key_reg, key_reg); |
3069 } | 3070 } |
3070 } | 3071 } |
3071 | 3072 |
3072 // Load the result. | 3073 bool requires_hole_check = hinstr->RequiresHoleCheck(); |
3073 __ movq(result, | 3074 int offs = FixedArray::kHeaderSize - kHeapObjectTag; |
Toon Verwaest
2013/12/09 13:47:23
Please write out variable names: "offset".
Igor Sheludko
2013/12/09 17:27:06
Done.
| |
3075 Representation representation = hinstr->representation(); | |
3076 | |
3077 if (hinstr->type().IsSmi() && representation.IsInteger32()) { | |
Toon Verwaest
2013/12/09 13:47:23
Why check for hinstr->type().IsSmi()? You should o
Igor Sheludko
2013/12/09 17:27:06
We can't rely only on IsInteger32() case since we
| |
3078 ASSERT(!requires_hole_check); | |
3079 // Read int value directly from upper half of the smi. | |
3080 offs += kPointerSize / 2; | |
Toon Verwaest
2013/12/09 13:47:23
Isn't there a kSmiTagSize you can use? You just wa
Igor Sheludko
2013/12/09 17:27:06
kSmiTagSize is a number of bits, so we can't use i
| |
3081 } | |
3082 | |
3083 __ Load(result, | |
3074 BuildFastArrayOperand(instr->elements(), | 3084 BuildFastArrayOperand(instr->elements(), |
3075 key, | 3085 key, |
3076 FAST_ELEMENTS, | 3086 FAST_ELEMENTS, |
3077 FixedArray::kHeaderSize - kHeapObjectTag, | 3087 offs, |
3078 instr->additional_index())); | 3088 instr->additional_index()), |
3089 representation); | |
3079 | 3090 |
3080 // Check for the hole value. | 3091 // Check for the hole value. |
3081 if (instr->hydrogen()->RequiresHoleCheck()) { | 3092 if (requires_hole_check) { |
3082 if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) { | 3093 if (IsFastSmiElementsKind(hinstr->elements_kind())) { |
3083 Condition smi = __ CheckSmi(result); | 3094 Condition smi = __ CheckSmi(result); |
3084 DeoptimizeIf(NegateCondition(smi), instr->environment()); | 3095 DeoptimizeIf(NegateCondition(smi), instr->environment()); |
3085 } else { | 3096 } else { |
3086 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | 3097 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
3087 DeoptimizeIf(equal, instr->environment()); | 3098 DeoptimizeIf(equal, instr->environment()); |
3088 } | 3099 } |
3089 } | 3100 } |
3090 } | 3101 } |
3091 | 3102 |
3092 | 3103 |
(...skipping 2489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5582 FixedArray::kHeaderSize - kPointerSize)); | 5593 FixedArray::kHeaderSize - kPointerSize)); |
5583 __ bind(&done); | 5594 __ bind(&done); |
5584 } | 5595 } |
5585 | 5596 |
5586 | 5597 |
5587 #undef __ | 5598 #undef __ |
5588 | 5599 |
5589 } } // namespace v8::internal | 5600 } } // namespace v8::internal |
5590 | 5601 |
5591 #endif // V8_TARGET_ARCH_X64 | 5602 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |