| 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 3198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3209 Register to_reg = ToRegister(instr->result()); | 3209 Register to_reg = ToRegister(instr->result()); |
| 3210 Register from_reg = ToRegister(instr->object()); | 3210 Register from_reg = ToRegister(instr->object()); |
| 3211 __ ldr(to_reg, FieldMemOperand(from_reg, | 3211 __ ldr(to_reg, FieldMemOperand(from_reg, |
| 3212 ExternalArray::kExternalPointerOffset)); | 3212 ExternalArray::kExternalPointerOffset)); |
| 3213 } | 3213 } |
| 3214 | 3214 |
| 3215 | 3215 |
| 3216 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { | 3216 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { |
| 3217 Register arguments = ToRegister(instr->arguments()); | 3217 Register arguments = ToRegister(instr->arguments()); |
| 3218 Register result = ToRegister(instr->result()); | 3218 Register result = ToRegister(instr->result()); |
| 3219 if (instr->length()->IsConstantOperand() && | 3219 // There are two words between the frame pointer and the last argument. |
| 3220 instr->index()->IsConstantOperand()) { | 3220 // Subtracting from length accounts for one of them add one more. |
| 3221 int const_index = ToInteger32(LConstantOperand::cast(instr->index())); | 3221 if (instr->length()->IsConstantOperand()) { |
| 3222 int const_length = ToInteger32(LConstantOperand::cast(instr->length())); | 3222 int const_length = ToInteger32(LConstantOperand::cast(instr->length())); |
| 3223 int index = (const_length - const_index) + 1; | 3223 if (instr->index()->IsConstantOperand()) { |
| 3224 __ ldr(result, MemOperand(arguments, index * kPointerSize)); | 3224 int const_index = ToInteger32(LConstantOperand::cast(instr->index())); |
| 3225 } else { | 3225 int index = (const_length - const_index) + 1; |
| 3226 __ ldr(result, MemOperand(arguments, index * kPointerSize)); |
| 3227 } else { |
| 3228 Register index = ToRegister(instr->index()); |
| 3229 __ rsb(result, index, Operand(const_length + 1)); |
| 3230 __ ldr(result, MemOperand(arguments, result, LSL, kPointerSizeLog2)); |
| 3231 } |
| 3232 } else if (instr->index()->IsConstantOperand()) { |
| 3233 Register length = ToRegister(instr->length()); |
| 3234 int const_index = ToInteger32(LConstantOperand::cast(instr->index())); |
| 3235 int loc = const_index - 1; |
| 3236 if (loc != 0) { |
| 3237 __ sub(result, length, Operand(loc)); |
| 3238 __ ldr(result, MemOperand(arguments, result, LSL, kPointerSizeLog2)); |
| 3239 } else { |
| 3240 __ ldr(result, MemOperand(arguments, length, LSL, kPointerSizeLog2)); |
| 3241 } |
| 3242 } else { |
| 3226 Register length = ToRegister(instr->length()); | 3243 Register length = ToRegister(instr->length()); |
| 3227 Register index = ToRegister(instr->index()); | 3244 Register index = ToRegister(instr->index()); |
| 3228 // There are two words between the frame pointer and the last argument. | 3245 __ sub(result, length, index); |
| 3229 // Subtracting from length accounts for one of them add one more. | 3246 __ add(result, result, Operand(1)); |
| 3230 __ sub(length, length, index); | 3247 __ ldr(result, MemOperand(arguments, result, LSL, kPointerSizeLog2)); |
| 3231 __ add(length, length, Operand(1)); | |
| 3232 __ ldr(result, MemOperand(arguments, length, LSL, kPointerSizeLog2)); | |
| 3233 } | 3248 } |
| 3234 } | 3249 } |
| 3235 | 3250 |
| 3236 | 3251 |
| 3237 void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) { | 3252 void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) { |
| 3238 Register external_pointer = ToRegister(instr->elements()); | 3253 Register external_pointer = ToRegister(instr->elements()); |
| 3239 Register key = no_reg; | 3254 Register key = no_reg; |
| 3240 ElementsKind elements_kind = instr->elements_kind(); | 3255 ElementsKind elements_kind = instr->elements_kind(); |
| 3241 bool key_is_constant = instr->key()->IsConstantOperand(); | 3256 bool key_is_constant = instr->key()->IsConstantOperand(); |
| 3242 int constant_key = 0; | 3257 int constant_key = 0; |
| (...skipping 2690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5933 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5948 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
| 5934 __ ldr(result, FieldMemOperand(scratch, | 5949 __ ldr(result, FieldMemOperand(scratch, |
| 5935 FixedArray::kHeaderSize - kPointerSize)); | 5950 FixedArray::kHeaderSize - kPointerSize)); |
| 5936 __ bind(&done); | 5951 __ bind(&done); |
| 5937 } | 5952 } |
| 5938 | 5953 |
| 5939 | 5954 |
| 5940 #undef __ | 5955 #undef __ |
| 5941 | 5956 |
| 5942 } } // namespace v8::internal | 5957 } } // namespace v8::internal |
| OLD | NEW |