OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
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 3241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3252 return MemOperand(base, | 3252 return MemOperand(base, |
3253 base_offset + (constant_key << element_size)); | 3253 base_offset + (constant_key << element_size)); |
3254 } | 3254 } |
3255 | 3255 |
3256 if (additional_offset != 0) { | 3256 if (additional_offset != 0) { |
3257 if (shift_size >= 0) { | 3257 if (shift_size >= 0) { |
3258 __ sll(scratch0(), key, shift_size); | 3258 __ sll(scratch0(), key, shift_size); |
3259 __ Addu(scratch0(), scratch0(), Operand(base_offset)); | 3259 __ Addu(scratch0(), scratch0(), Operand(base_offset)); |
3260 } else { | 3260 } else { |
3261 ASSERT_EQ(-1, shift_size); | 3261 ASSERT_EQ(-1, shift_size); |
3262 __ srl(scratch0(), key, 1); | 3262 // Key can be negative, so using sra here. |
| 3263 __ sra(scratch0(), key, 1); |
3263 __ Addu(scratch0(), scratch0(), Operand(base_offset)); | 3264 __ Addu(scratch0(), scratch0(), Operand(base_offset)); |
3264 } | 3265 } |
3265 __ Addu(scratch0(), base, scratch0()); | 3266 __ Addu(scratch0(), base, scratch0()); |
3266 return MemOperand(scratch0()); | 3267 return MemOperand(scratch0()); |
3267 } | 3268 } |
3268 | 3269 |
3269 if (additional_index != 0) { | 3270 if (additional_index != 0) { |
3270 additional_index *= 1 << (element_size - shift_size); | 3271 additional_index *= 1 << (element_size - shift_size); |
3271 __ Addu(scratch0(), key, Operand(additional_index)); | 3272 __ Addu(scratch0(), key, Operand(additional_index)); |
3272 } | 3273 } |
(...skipping 2541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5814 __ Subu(scratch, result, scratch); | 5815 __ Subu(scratch, result, scratch); |
5815 __ lw(result, FieldMemOperand(scratch, | 5816 __ lw(result, FieldMemOperand(scratch, |
5816 FixedArray::kHeaderSize - kPointerSize)); | 5817 FixedArray::kHeaderSize - kPointerSize)); |
5817 __ bind(&done); | 5818 __ bind(&done); |
5818 } | 5819 } |
5819 | 5820 |
5820 | 5821 |
5821 #undef __ | 5822 #undef __ |
5822 | 5823 |
5823 } } // namespace v8::internal | 5824 } } // namespace v8::internal |
OLD | NEW |