| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/arm/lithium-codegen-arm.h" | 7 #include "src/arm/lithium-codegen-arm.h" |
| 8 #include "src/arm/lithium-gap-resolver-arm.h" | 8 #include "src/arm/lithium-gap-resolver-arm.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 3169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3180 Abort(kArrayIndexConstantValueTooBig); | 3180 Abort(kArrayIndexConstantValueTooBig); |
| 3181 } | 3181 } |
| 3182 } else { | 3182 } else { |
| 3183 key = ToRegister(instr->key()); | 3183 key = ToRegister(instr->key()); |
| 3184 } | 3184 } |
| 3185 int element_size_shift = ElementsKindToShiftSize(elements_kind); | 3185 int element_size_shift = ElementsKindToShiftSize(elements_kind); |
| 3186 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) | 3186 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) |
| 3187 ? (element_size_shift - kSmiTagSize) : element_size_shift; | 3187 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
| 3188 int base_offset = instr->base_offset(); | 3188 int base_offset = instr->base_offset(); |
| 3189 | 3189 |
| 3190 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 3190 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) { |
| 3191 elements_kind == FLOAT32_ELEMENTS || | |
| 3192 elements_kind == EXTERNAL_FLOAT64_ELEMENTS || | |
| 3193 elements_kind == FLOAT64_ELEMENTS) { | |
| 3194 DwVfpRegister result = ToDoubleRegister(instr->result()); | 3191 DwVfpRegister result = ToDoubleRegister(instr->result()); |
| 3195 Operand operand = key_is_constant | 3192 Operand operand = key_is_constant |
| 3196 ? Operand(constant_key << element_size_shift) | 3193 ? Operand(constant_key << element_size_shift) |
| 3197 : Operand(key, LSL, shift_size); | 3194 : Operand(key, LSL, shift_size); |
| 3198 __ add(scratch0(), external_pointer, operand); | 3195 __ add(scratch0(), external_pointer, operand); |
| 3199 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 3196 if (elements_kind == FLOAT32_ELEMENTS) { |
| 3200 elements_kind == FLOAT32_ELEMENTS) { | |
| 3201 __ vldr(double_scratch0().low(), scratch0(), base_offset); | 3197 __ vldr(double_scratch0().low(), scratch0(), base_offset); |
| 3202 __ vcvt_f64_f32(result, double_scratch0().low()); | 3198 __ vcvt_f64_f32(result, double_scratch0().low()); |
| 3203 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS | 3199 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS |
| 3204 __ vldr(result, scratch0(), base_offset); | 3200 __ vldr(result, scratch0(), base_offset); |
| 3205 } | 3201 } |
| 3206 } else { | 3202 } else { |
| 3207 Register result = ToRegister(instr->result()); | 3203 Register result = ToRegister(instr->result()); |
| 3208 MemOperand mem_operand = PrepareKeyedOperand( | 3204 MemOperand mem_operand = PrepareKeyedOperand( |
| 3209 key, external_pointer, key_is_constant, constant_key, | 3205 key, external_pointer, key_is_constant, constant_key, |
| 3210 element_size_shift, shift_size, base_offset); | 3206 element_size_shift, shift_size, base_offset); |
| 3211 switch (elements_kind) { | 3207 switch (elements_kind) { |
| 3212 case EXTERNAL_INT8_ELEMENTS: | |
| 3213 case INT8_ELEMENTS: | 3208 case INT8_ELEMENTS: |
| 3214 __ ldrsb(result, mem_operand); | 3209 __ ldrsb(result, mem_operand); |
| 3215 break; | 3210 break; |
| 3216 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: | |
| 3217 case EXTERNAL_UINT8_ELEMENTS: | |
| 3218 case UINT8_ELEMENTS: | 3211 case UINT8_ELEMENTS: |
| 3219 case UINT8_CLAMPED_ELEMENTS: | 3212 case UINT8_CLAMPED_ELEMENTS: |
| 3220 __ ldrb(result, mem_operand); | 3213 __ ldrb(result, mem_operand); |
| 3221 break; | 3214 break; |
| 3222 case EXTERNAL_INT16_ELEMENTS: | |
| 3223 case INT16_ELEMENTS: | 3215 case INT16_ELEMENTS: |
| 3224 __ ldrsh(result, mem_operand); | 3216 __ ldrsh(result, mem_operand); |
| 3225 break; | 3217 break; |
| 3226 case EXTERNAL_UINT16_ELEMENTS: | |
| 3227 case UINT16_ELEMENTS: | 3218 case UINT16_ELEMENTS: |
| 3228 __ ldrh(result, mem_operand); | 3219 __ ldrh(result, mem_operand); |
| 3229 break; | 3220 break; |
| 3230 case EXTERNAL_INT32_ELEMENTS: | |
| 3231 case INT32_ELEMENTS: | 3221 case INT32_ELEMENTS: |
| 3232 __ ldr(result, mem_operand); | 3222 __ ldr(result, mem_operand); |
| 3233 break; | 3223 break; |
| 3234 case EXTERNAL_UINT32_ELEMENTS: | |
| 3235 case UINT32_ELEMENTS: | 3224 case UINT32_ELEMENTS: |
| 3236 __ ldr(result, mem_operand); | 3225 __ ldr(result, mem_operand); |
| 3237 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { | 3226 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { |
| 3238 __ cmp(result, Operand(0x80000000)); | 3227 __ cmp(result, Operand(0x80000000)); |
| 3239 DeoptimizeIf(cs, instr, Deoptimizer::kNegativeValue); | 3228 DeoptimizeIf(cs, instr, Deoptimizer::kNegativeValue); |
| 3240 } | 3229 } |
| 3241 break; | 3230 break; |
| 3242 case FLOAT32_ELEMENTS: | 3231 case FLOAT32_ELEMENTS: |
| 3243 case FLOAT64_ELEMENTS: | 3232 case FLOAT64_ELEMENTS: |
| 3244 case EXTERNAL_FLOAT32_ELEMENTS: | |
| 3245 case EXTERNAL_FLOAT64_ELEMENTS: | |
| 3246 case FAST_HOLEY_DOUBLE_ELEMENTS: | 3233 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 3247 case FAST_HOLEY_ELEMENTS: | 3234 case FAST_HOLEY_ELEMENTS: |
| 3248 case FAST_HOLEY_SMI_ELEMENTS: | 3235 case FAST_HOLEY_SMI_ELEMENTS: |
| 3249 case FAST_DOUBLE_ELEMENTS: | 3236 case FAST_DOUBLE_ELEMENTS: |
| 3250 case FAST_ELEMENTS: | 3237 case FAST_ELEMENTS: |
| 3251 case FAST_SMI_ELEMENTS: | 3238 case FAST_SMI_ELEMENTS: |
| 3252 case DICTIONARY_ELEMENTS: | 3239 case DICTIONARY_ELEMENTS: |
| 3253 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 3240 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
| 3254 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: | 3241 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: |
| 3255 UNREACHABLE(); | 3242 UNREACHABLE(); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3345 __ cmp(result, Operand(Smi::FromInt(Isolate::kArrayProtectorValid))); | 3332 __ cmp(result, Operand(Smi::FromInt(Isolate::kArrayProtectorValid))); |
| 3346 DeoptimizeIf(ne, instr, Deoptimizer::kHole); | 3333 DeoptimizeIf(ne, instr, Deoptimizer::kHole); |
| 3347 } | 3334 } |
| 3348 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); | 3335 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); |
| 3349 __ bind(&done); | 3336 __ bind(&done); |
| 3350 } | 3337 } |
| 3351 } | 3338 } |
| 3352 | 3339 |
| 3353 | 3340 |
| 3354 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { | 3341 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { |
| 3355 if (instr->is_typed_elements()) { | 3342 if (instr->is_fixed_typed_array()) { |
| 3356 DoLoadKeyedExternalArray(instr); | 3343 DoLoadKeyedExternalArray(instr); |
| 3357 } else if (instr->hydrogen()->representation().IsDouble()) { | 3344 } else if (instr->hydrogen()->representation().IsDouble()) { |
| 3358 DoLoadKeyedFixedDoubleArray(instr); | 3345 DoLoadKeyedFixedDoubleArray(instr); |
| 3359 } else { | 3346 } else { |
| 3360 DoLoadKeyedFixedArray(instr); | 3347 DoLoadKeyedFixedArray(instr); |
| 3361 } | 3348 } |
| 3362 } | 3349 } |
| 3363 | 3350 |
| 3364 | 3351 |
| 3365 MemOperand LCodeGen::PrepareKeyedOperand(Register key, | 3352 MemOperand LCodeGen::PrepareKeyedOperand(Register key, |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4304 Abort(kArrayIndexConstantValueTooBig); | 4291 Abort(kArrayIndexConstantValueTooBig); |
| 4305 } | 4292 } |
| 4306 } else { | 4293 } else { |
| 4307 key = ToRegister(instr->key()); | 4294 key = ToRegister(instr->key()); |
| 4308 } | 4295 } |
| 4309 int element_size_shift = ElementsKindToShiftSize(elements_kind); | 4296 int element_size_shift = ElementsKindToShiftSize(elements_kind); |
| 4310 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) | 4297 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) |
| 4311 ? (element_size_shift - kSmiTagSize) : element_size_shift; | 4298 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
| 4312 int base_offset = instr->base_offset(); | 4299 int base_offset = instr->base_offset(); |
| 4313 | 4300 |
| 4314 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 4301 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) { |
| 4315 elements_kind == FLOAT32_ELEMENTS || | |
| 4316 elements_kind == EXTERNAL_FLOAT64_ELEMENTS || | |
| 4317 elements_kind == FLOAT64_ELEMENTS) { | |
| 4318 Register address = scratch0(); | 4302 Register address = scratch0(); |
| 4319 DwVfpRegister value(ToDoubleRegister(instr->value())); | 4303 DwVfpRegister value(ToDoubleRegister(instr->value())); |
| 4320 if (key_is_constant) { | 4304 if (key_is_constant) { |
| 4321 if (constant_key != 0) { | 4305 if (constant_key != 0) { |
| 4322 __ add(address, external_pointer, | 4306 __ add(address, external_pointer, |
| 4323 Operand(constant_key << element_size_shift)); | 4307 Operand(constant_key << element_size_shift)); |
| 4324 } else { | 4308 } else { |
| 4325 address = external_pointer; | 4309 address = external_pointer; |
| 4326 } | 4310 } |
| 4327 } else { | 4311 } else { |
| 4328 __ add(address, external_pointer, Operand(key, LSL, shift_size)); | 4312 __ add(address, external_pointer, Operand(key, LSL, shift_size)); |
| 4329 } | 4313 } |
| 4330 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 4314 if (elements_kind == FLOAT32_ELEMENTS) { |
| 4331 elements_kind == FLOAT32_ELEMENTS) { | |
| 4332 __ vcvt_f32_f64(double_scratch0().low(), value); | 4315 __ vcvt_f32_f64(double_scratch0().low(), value); |
| 4333 __ vstr(double_scratch0().low(), address, base_offset); | 4316 __ vstr(double_scratch0().low(), address, base_offset); |
| 4334 } else { // Storing doubles, not floats. | 4317 } else { // Storing doubles, not floats. |
| 4335 __ vstr(value, address, base_offset); | 4318 __ vstr(value, address, base_offset); |
| 4336 } | 4319 } |
| 4337 } else { | 4320 } else { |
| 4338 Register value(ToRegister(instr->value())); | 4321 Register value(ToRegister(instr->value())); |
| 4339 MemOperand mem_operand = PrepareKeyedOperand( | 4322 MemOperand mem_operand = PrepareKeyedOperand( |
| 4340 key, external_pointer, key_is_constant, constant_key, | 4323 key, external_pointer, key_is_constant, constant_key, |
| 4341 element_size_shift, shift_size, | 4324 element_size_shift, shift_size, |
| 4342 base_offset); | 4325 base_offset); |
| 4343 switch (elements_kind) { | 4326 switch (elements_kind) { |
| 4344 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: | |
| 4345 case EXTERNAL_INT8_ELEMENTS: | |
| 4346 case EXTERNAL_UINT8_ELEMENTS: | |
| 4347 case UINT8_ELEMENTS: | 4327 case UINT8_ELEMENTS: |
| 4348 case UINT8_CLAMPED_ELEMENTS: | 4328 case UINT8_CLAMPED_ELEMENTS: |
| 4349 case INT8_ELEMENTS: | 4329 case INT8_ELEMENTS: |
| 4350 __ strb(value, mem_operand); | 4330 __ strb(value, mem_operand); |
| 4351 break; | 4331 break; |
| 4352 case EXTERNAL_INT16_ELEMENTS: | |
| 4353 case EXTERNAL_UINT16_ELEMENTS: | |
| 4354 case INT16_ELEMENTS: | 4332 case INT16_ELEMENTS: |
| 4355 case UINT16_ELEMENTS: | 4333 case UINT16_ELEMENTS: |
| 4356 __ strh(value, mem_operand); | 4334 __ strh(value, mem_operand); |
| 4357 break; | 4335 break; |
| 4358 case EXTERNAL_INT32_ELEMENTS: | |
| 4359 case EXTERNAL_UINT32_ELEMENTS: | |
| 4360 case INT32_ELEMENTS: | 4336 case INT32_ELEMENTS: |
| 4361 case UINT32_ELEMENTS: | 4337 case UINT32_ELEMENTS: |
| 4362 __ str(value, mem_operand); | 4338 __ str(value, mem_operand); |
| 4363 break; | 4339 break; |
| 4364 case FLOAT32_ELEMENTS: | 4340 case FLOAT32_ELEMENTS: |
| 4365 case FLOAT64_ELEMENTS: | 4341 case FLOAT64_ELEMENTS: |
| 4366 case EXTERNAL_FLOAT32_ELEMENTS: | |
| 4367 case EXTERNAL_FLOAT64_ELEMENTS: | |
| 4368 case FAST_DOUBLE_ELEMENTS: | 4342 case FAST_DOUBLE_ELEMENTS: |
| 4369 case FAST_ELEMENTS: | 4343 case FAST_ELEMENTS: |
| 4370 case FAST_SMI_ELEMENTS: | 4344 case FAST_SMI_ELEMENTS: |
| 4371 case FAST_HOLEY_DOUBLE_ELEMENTS: | 4345 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 4372 case FAST_HOLEY_ELEMENTS: | 4346 case FAST_HOLEY_ELEMENTS: |
| 4373 case FAST_HOLEY_SMI_ELEMENTS: | 4347 case FAST_HOLEY_SMI_ELEMENTS: |
| 4374 case DICTIONARY_ELEMENTS: | 4348 case DICTIONARY_ELEMENTS: |
| 4375 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 4349 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
| 4376 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: | 4350 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: |
| 4377 UNREACHABLE(); | 4351 UNREACHABLE(); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4463 kSaveFPRegs, | 4437 kSaveFPRegs, |
| 4464 EMIT_REMEMBERED_SET, | 4438 EMIT_REMEMBERED_SET, |
| 4465 check_needed, | 4439 check_needed, |
| 4466 instr->hydrogen()->PointersToHereCheckForValue()); | 4440 instr->hydrogen()->PointersToHereCheckForValue()); |
| 4467 } | 4441 } |
| 4468 } | 4442 } |
| 4469 | 4443 |
| 4470 | 4444 |
| 4471 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { | 4445 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { |
| 4472 // By cases: external, fast double | 4446 // By cases: external, fast double |
| 4473 if (instr->is_typed_elements()) { | 4447 if (instr->is_fixed_typed_array()) { |
| 4474 DoStoreKeyedExternalArray(instr); | 4448 DoStoreKeyedExternalArray(instr); |
| 4475 } else if (instr->hydrogen()->value()->representation().IsDouble()) { | 4449 } else if (instr->hydrogen()->value()->representation().IsDouble()) { |
| 4476 DoStoreKeyedFixedDoubleArray(instr); | 4450 DoStoreKeyedFixedDoubleArray(instr); |
| 4477 } else { | 4451 } else { |
| 4478 DoStoreKeyedFixedArray(instr); | 4452 DoStoreKeyedFixedArray(instr); |
| 4479 } | 4453 } |
| 4480 } | 4454 } |
| 4481 | 4455 |
| 4482 | 4456 |
| 4483 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4457 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
| (...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6043 __ push(ToRegister(instr->function())); | 6017 __ push(ToRegister(instr->function())); |
| 6044 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6018 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6045 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6019 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6046 } | 6020 } |
| 6047 | 6021 |
| 6048 | 6022 |
| 6049 #undef __ | 6023 #undef __ |
| 6050 | 6024 |
| 6051 } // namespace internal | 6025 } // namespace internal |
| 6052 } // namespace v8 | 6026 } // namespace v8 |
| OLD | NEW |