| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3117 | 3117 |
| 3118 | 3118 |
| 3119 void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) { | 3119 void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) { |
| 3120 Register elements = ToRegister(instr->elements()); | 3120 Register elements = ToRegister(instr->elements()); |
| 3121 bool key_is_constant = instr->key()->IsConstantOperand(); | 3121 bool key_is_constant = instr->key()->IsConstantOperand(); |
| 3122 Register key = no_reg; | 3122 Register key = no_reg; |
| 3123 DoubleRegister result = ToDoubleRegister(instr->result()); | 3123 DoubleRegister result = ToDoubleRegister(instr->result()); |
| 3124 Register scratch = scratch0(); | 3124 Register scratch = scratch0(); |
| 3125 | 3125 |
| 3126 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); | 3126 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); |
| 3127 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) | 3127 |
| 3128 ? (element_size_shift - kSmiTagSize) : element_size_shift; | 3128 int base_offset = |
| 3129 int constant_key = 0; | 3129 FixedDoubleArray::kHeaderSize - kHeapObjectTag + |
| 3130 (instr->additional_index() << element_size_shift); |
| 3130 if (key_is_constant) { | 3131 if (key_is_constant) { |
| 3131 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); | 3132 int constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
| 3132 if (constant_key & 0xF0000000) { | 3133 if (constant_key & 0xF0000000) { |
| 3133 Abort(kArrayIndexConstantValueTooBig); | 3134 Abort(kArrayIndexConstantValueTooBig); |
| 3134 } | 3135 } |
| 3135 } else { | 3136 base_offset += constant_key << element_size_shift; |
| 3137 } |
| 3138 __ Addu(scratch, elements, Operand(base_offset)); |
| 3139 |
| 3140 if (!key_is_constant) { |
| 3136 key = ToRegister(instr->key()); | 3141 key = ToRegister(instr->key()); |
| 3142 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) |
| 3143 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
| 3144 __ sll(at, key, shift_size); |
| 3145 __ Addu(scratch, scratch, at); |
| 3137 } | 3146 } |
| 3138 | 3147 |
| 3139 int base_offset = (FixedDoubleArray::kHeaderSize - kHeapObjectTag) + | 3148 __ ldc1(result, MemOperand(scratch)); |
| 3140 ((constant_key + instr->additional_index()) << element_size_shift); | 3149 |
| 3141 if (!key_is_constant) { | |
| 3142 __ sll(scratch, key, shift_size); | |
| 3143 __ Addu(elements, elements, scratch); | |
| 3144 } | |
| 3145 __ Addu(elements, elements, Operand(base_offset)); | |
| 3146 __ ldc1(result, MemOperand(elements)); | |
| 3147 if (instr->hydrogen()->RequiresHoleCheck()) { | 3150 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 3148 __ lw(scratch, MemOperand(elements, sizeof(kHoleNanLower32))); | 3151 __ lw(scratch, MemOperand(scratch, sizeof(kHoleNanLower32))); |
| 3149 DeoptimizeIf(eq, instr->environment(), scratch, Operand(kHoleNanUpper32)); | 3152 DeoptimizeIf(eq, instr->environment(), scratch, Operand(kHoleNanUpper32)); |
| 3150 } | 3153 } |
| 3151 } | 3154 } |
| 3152 | 3155 |
| 3153 | 3156 |
| 3154 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { | 3157 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { |
| 3155 Register elements = ToRegister(instr->elements()); | 3158 Register elements = ToRegister(instr->elements()); |
| 3156 Register result = ToRegister(instr->result()); | 3159 Register result = ToRegister(instr->result()); |
| 3157 Register scratch = scratch0(); | 3160 Register scratch = scratch0(); |
| 3158 Register store_base = scratch; | 3161 Register store_base = scratch; |
| 3159 int offset = 0; | 3162 int offset = 0; |
| 3160 | 3163 |
| 3161 if (instr->key()->IsConstantOperand()) { | 3164 if (instr->key()->IsConstantOperand()) { |
| 3162 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); | 3165 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); |
| 3163 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) + | 3166 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) + |
| 3164 instr->additional_index()); | 3167 instr->additional_index()); |
| 3165 store_base = elements; | 3168 store_base = elements; |
| 3166 } else { | 3169 } else { |
| 3167 Register key = EmitLoadRegister(instr->key(), scratch0()); | 3170 Register key = ToRegister(instr->key()); |
| 3168 // Even though the HLoadKeyed instruction forces the input | 3171 // Even though the HLoadKeyed instruction forces the input |
| 3169 // representation for the key to be an integer, the input gets replaced | 3172 // representation for the key to be an integer, the input gets replaced |
| 3170 // during bound check elimination with the index argument to the bounds | 3173 // during bound check elimination with the index argument to the bounds |
| 3171 // check, which can be tagged, so that case must be handled here, too. | 3174 // check, which can be tagged, so that case must be handled here, too. |
| 3172 if (instr->hydrogen()->key()->representation().IsSmi()) { | 3175 if (instr->hydrogen()->key()->representation().IsSmi()) { |
| 3173 __ sll(scratch, key, kPointerSizeLog2 - kSmiTagSize); | 3176 __ sll(scratch, key, kPointerSizeLog2 - kSmiTagSize); |
| 3174 __ addu(scratch, elements, scratch); | 3177 __ addu(scratch, elements, scratch); |
| 3175 } else { | 3178 } else { |
| 3176 __ sll(scratch, key, kPointerSizeLog2); | 3179 __ sll(scratch, key, kPointerSizeLog2); |
| 3177 __ addu(scratch, elements, scratch); | 3180 __ addu(scratch, elements, scratch); |
| (...skipping 2590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5768 __ Subu(scratch, result, scratch); | 5771 __ Subu(scratch, result, scratch); |
| 5769 __ lw(result, FieldMemOperand(scratch, | 5772 __ lw(result, FieldMemOperand(scratch, |
| 5770 FixedArray::kHeaderSize - kPointerSize)); | 5773 FixedArray::kHeaderSize - kPointerSize)); |
| 5771 __ bind(&done); | 5774 __ bind(&done); |
| 5772 } | 5775 } |
| 5773 | 5776 |
| 5774 | 5777 |
| 5775 #undef __ | 5778 #undef __ |
| 5776 | 5779 |
| 5777 } } // namespace v8::internal | 5780 } } // namespace v8::internal |
| OLD | NEW |