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 3172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3183 Abort(kArrayIndexConstantValueTooBig); | 3183 Abort(kArrayIndexConstantValueTooBig); |
3184 } | 3184 } |
3185 } else { | 3185 } else { |
3186 key = ToRegister(instr->key()); | 3186 key = ToRegister(instr->key()); |
3187 } | 3187 } |
3188 int element_size_shift = ElementsKindToShiftSize(elements_kind); | 3188 int element_size_shift = ElementsKindToShiftSize(elements_kind); |
3189 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) | 3189 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) |
3190 ? (element_size_shift - kSmiTagSize) : element_size_shift; | 3190 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
3191 int base_offset = instr->base_offset(); | 3191 int base_offset = instr->base_offset(); |
3192 | 3192 |
3193 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) { | 3193 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || |
| 3194 elements_kind == FLOAT32_ELEMENTS || |
| 3195 elements_kind == EXTERNAL_FLOAT64_ELEMENTS || |
| 3196 elements_kind == FLOAT64_ELEMENTS) { |
3194 DwVfpRegister result = ToDoubleRegister(instr->result()); | 3197 DwVfpRegister result = ToDoubleRegister(instr->result()); |
3195 Operand operand = key_is_constant | 3198 Operand operand = key_is_constant |
3196 ? Operand(constant_key << element_size_shift) | 3199 ? Operand(constant_key << element_size_shift) |
3197 : Operand(key, LSL, shift_size); | 3200 : Operand(key, LSL, shift_size); |
3198 __ add(scratch0(), external_pointer, operand); | 3201 __ add(scratch0(), external_pointer, operand); |
3199 if (elements_kind == FLOAT32_ELEMENTS) { | 3202 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || |
| 3203 elements_kind == FLOAT32_ELEMENTS) { |
3200 __ vldr(double_scratch0().low(), scratch0(), base_offset); | 3204 __ vldr(double_scratch0().low(), scratch0(), base_offset); |
3201 __ vcvt_f64_f32(result, double_scratch0().low()); | 3205 __ vcvt_f64_f32(result, double_scratch0().low()); |
3202 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS | 3206 } else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS |
3203 __ vldr(result, scratch0(), base_offset); | 3207 __ vldr(result, scratch0(), base_offset); |
3204 } | 3208 } |
3205 } else { | 3209 } else { |
3206 Register result = ToRegister(instr->result()); | 3210 Register result = ToRegister(instr->result()); |
3207 MemOperand mem_operand = PrepareKeyedOperand( | 3211 MemOperand mem_operand = PrepareKeyedOperand( |
3208 key, external_pointer, key_is_constant, constant_key, | 3212 key, external_pointer, key_is_constant, constant_key, |
3209 element_size_shift, shift_size, base_offset); | 3213 element_size_shift, shift_size, base_offset); |
3210 switch (elements_kind) { | 3214 switch (elements_kind) { |
| 3215 case EXTERNAL_INT8_ELEMENTS: |
3211 case INT8_ELEMENTS: | 3216 case INT8_ELEMENTS: |
3212 __ ldrsb(result, mem_operand); | 3217 __ ldrsb(result, mem_operand); |
3213 break; | 3218 break; |
| 3219 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: |
| 3220 case EXTERNAL_UINT8_ELEMENTS: |
3214 case UINT8_ELEMENTS: | 3221 case UINT8_ELEMENTS: |
3215 case UINT8_CLAMPED_ELEMENTS: | 3222 case UINT8_CLAMPED_ELEMENTS: |
3216 __ ldrb(result, mem_operand); | 3223 __ ldrb(result, mem_operand); |
3217 break; | 3224 break; |
| 3225 case EXTERNAL_INT16_ELEMENTS: |
3218 case INT16_ELEMENTS: | 3226 case INT16_ELEMENTS: |
3219 __ ldrsh(result, mem_operand); | 3227 __ ldrsh(result, mem_operand); |
3220 break; | 3228 break; |
| 3229 case EXTERNAL_UINT16_ELEMENTS: |
3221 case UINT16_ELEMENTS: | 3230 case UINT16_ELEMENTS: |
3222 __ ldrh(result, mem_operand); | 3231 __ ldrh(result, mem_operand); |
3223 break; | 3232 break; |
| 3233 case EXTERNAL_INT32_ELEMENTS: |
3224 case INT32_ELEMENTS: | 3234 case INT32_ELEMENTS: |
3225 __ ldr(result, mem_operand); | 3235 __ ldr(result, mem_operand); |
3226 break; | 3236 break; |
| 3237 case EXTERNAL_UINT32_ELEMENTS: |
3227 case UINT32_ELEMENTS: | 3238 case UINT32_ELEMENTS: |
3228 __ ldr(result, mem_operand); | 3239 __ ldr(result, mem_operand); |
3229 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { | 3240 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { |
3230 __ cmp(result, Operand(0x80000000)); | 3241 __ cmp(result, Operand(0x80000000)); |
3231 DeoptimizeIf(cs, instr, Deoptimizer::kNegativeValue); | 3242 DeoptimizeIf(cs, instr, Deoptimizer::kNegativeValue); |
3232 } | 3243 } |
3233 break; | 3244 break; |
3234 case FLOAT32_ELEMENTS: | 3245 case FLOAT32_ELEMENTS: |
3235 case FLOAT64_ELEMENTS: | 3246 case FLOAT64_ELEMENTS: |
| 3247 case EXTERNAL_FLOAT32_ELEMENTS: |
| 3248 case EXTERNAL_FLOAT64_ELEMENTS: |
3236 case FAST_HOLEY_DOUBLE_ELEMENTS: | 3249 case FAST_HOLEY_DOUBLE_ELEMENTS: |
3237 case FAST_HOLEY_ELEMENTS: | 3250 case FAST_HOLEY_ELEMENTS: |
3238 case FAST_HOLEY_SMI_ELEMENTS: | 3251 case FAST_HOLEY_SMI_ELEMENTS: |
3239 case FAST_DOUBLE_ELEMENTS: | 3252 case FAST_DOUBLE_ELEMENTS: |
3240 case FAST_ELEMENTS: | 3253 case FAST_ELEMENTS: |
3241 case FAST_SMI_ELEMENTS: | 3254 case FAST_SMI_ELEMENTS: |
3242 case DICTIONARY_ELEMENTS: | 3255 case DICTIONARY_ELEMENTS: |
3243 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 3256 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
3244 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: | 3257 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: |
3245 UNREACHABLE(); | 3258 UNREACHABLE(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3335 __ cmp(result, Operand(Smi::FromInt(Isolate::kArrayProtectorValid))); | 3348 __ cmp(result, Operand(Smi::FromInt(Isolate::kArrayProtectorValid))); |
3336 DeoptimizeIf(ne, instr, Deoptimizer::kHole); | 3349 DeoptimizeIf(ne, instr, Deoptimizer::kHole); |
3337 } | 3350 } |
3338 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); | 3351 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); |
3339 __ bind(&done); | 3352 __ bind(&done); |
3340 } | 3353 } |
3341 } | 3354 } |
3342 | 3355 |
3343 | 3356 |
3344 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { | 3357 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { |
3345 if (instr->is_fixed_typed_array()) { | 3358 if (instr->is_typed_elements()) { |
3346 DoLoadKeyedExternalArray(instr); | 3359 DoLoadKeyedExternalArray(instr); |
3347 } else if (instr->hydrogen()->representation().IsDouble()) { | 3360 } else if (instr->hydrogen()->representation().IsDouble()) { |
3348 DoLoadKeyedFixedDoubleArray(instr); | 3361 DoLoadKeyedFixedDoubleArray(instr); |
3349 } else { | 3362 } else { |
3350 DoLoadKeyedFixedArray(instr); | 3363 DoLoadKeyedFixedArray(instr); |
3351 } | 3364 } |
3352 } | 3365 } |
3353 | 3366 |
3354 | 3367 |
3355 MemOperand LCodeGen::PrepareKeyedOperand(Register key, | 3368 MemOperand LCodeGen::PrepareKeyedOperand(Register key, |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4297 Abort(kArrayIndexConstantValueTooBig); | 4310 Abort(kArrayIndexConstantValueTooBig); |
4298 } | 4311 } |
4299 } else { | 4312 } else { |
4300 key = ToRegister(instr->key()); | 4313 key = ToRegister(instr->key()); |
4301 } | 4314 } |
4302 int element_size_shift = ElementsKindToShiftSize(elements_kind); | 4315 int element_size_shift = ElementsKindToShiftSize(elements_kind); |
4303 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) | 4316 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) |
4304 ? (element_size_shift - kSmiTagSize) : element_size_shift; | 4317 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
4305 int base_offset = instr->base_offset(); | 4318 int base_offset = instr->base_offset(); |
4306 | 4319 |
4307 if (elements_kind == FLOAT32_ELEMENTS || elements_kind == FLOAT64_ELEMENTS) { | 4320 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || |
| 4321 elements_kind == FLOAT32_ELEMENTS || |
| 4322 elements_kind == EXTERNAL_FLOAT64_ELEMENTS || |
| 4323 elements_kind == FLOAT64_ELEMENTS) { |
4308 Register address = scratch0(); | 4324 Register address = scratch0(); |
4309 DwVfpRegister value(ToDoubleRegister(instr->value())); | 4325 DwVfpRegister value(ToDoubleRegister(instr->value())); |
4310 if (key_is_constant) { | 4326 if (key_is_constant) { |
4311 if (constant_key != 0) { | 4327 if (constant_key != 0) { |
4312 __ add(address, external_pointer, | 4328 __ add(address, external_pointer, |
4313 Operand(constant_key << element_size_shift)); | 4329 Operand(constant_key << element_size_shift)); |
4314 } else { | 4330 } else { |
4315 address = external_pointer; | 4331 address = external_pointer; |
4316 } | 4332 } |
4317 } else { | 4333 } else { |
4318 __ add(address, external_pointer, Operand(key, LSL, shift_size)); | 4334 __ add(address, external_pointer, Operand(key, LSL, shift_size)); |
4319 } | 4335 } |
4320 if (elements_kind == FLOAT32_ELEMENTS) { | 4336 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || |
| 4337 elements_kind == FLOAT32_ELEMENTS) { |
4321 __ vcvt_f32_f64(double_scratch0().low(), value); | 4338 __ vcvt_f32_f64(double_scratch0().low(), value); |
4322 __ vstr(double_scratch0().low(), address, base_offset); | 4339 __ vstr(double_scratch0().low(), address, base_offset); |
4323 } else { // Storing doubles, not floats. | 4340 } else { // Storing doubles, not floats. |
4324 __ vstr(value, address, base_offset); | 4341 __ vstr(value, address, base_offset); |
4325 } | 4342 } |
4326 } else { | 4343 } else { |
4327 Register value(ToRegister(instr->value())); | 4344 Register value(ToRegister(instr->value())); |
4328 MemOperand mem_operand = PrepareKeyedOperand( | 4345 MemOperand mem_operand = PrepareKeyedOperand( |
4329 key, external_pointer, key_is_constant, constant_key, | 4346 key, external_pointer, key_is_constant, constant_key, |
4330 element_size_shift, shift_size, | 4347 element_size_shift, shift_size, |
4331 base_offset); | 4348 base_offset); |
4332 switch (elements_kind) { | 4349 switch (elements_kind) { |
| 4350 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: |
| 4351 case EXTERNAL_INT8_ELEMENTS: |
| 4352 case EXTERNAL_UINT8_ELEMENTS: |
4333 case UINT8_ELEMENTS: | 4353 case UINT8_ELEMENTS: |
4334 case UINT8_CLAMPED_ELEMENTS: | 4354 case UINT8_CLAMPED_ELEMENTS: |
4335 case INT8_ELEMENTS: | 4355 case INT8_ELEMENTS: |
4336 __ strb(value, mem_operand); | 4356 __ strb(value, mem_operand); |
4337 break; | 4357 break; |
| 4358 case EXTERNAL_INT16_ELEMENTS: |
| 4359 case EXTERNAL_UINT16_ELEMENTS: |
4338 case INT16_ELEMENTS: | 4360 case INT16_ELEMENTS: |
4339 case UINT16_ELEMENTS: | 4361 case UINT16_ELEMENTS: |
4340 __ strh(value, mem_operand); | 4362 __ strh(value, mem_operand); |
4341 break; | 4363 break; |
| 4364 case EXTERNAL_INT32_ELEMENTS: |
| 4365 case EXTERNAL_UINT32_ELEMENTS: |
4342 case INT32_ELEMENTS: | 4366 case INT32_ELEMENTS: |
4343 case UINT32_ELEMENTS: | 4367 case UINT32_ELEMENTS: |
4344 __ str(value, mem_operand); | 4368 __ str(value, mem_operand); |
4345 break; | 4369 break; |
4346 case FLOAT32_ELEMENTS: | 4370 case FLOAT32_ELEMENTS: |
4347 case FLOAT64_ELEMENTS: | 4371 case FLOAT64_ELEMENTS: |
| 4372 case EXTERNAL_FLOAT32_ELEMENTS: |
| 4373 case EXTERNAL_FLOAT64_ELEMENTS: |
4348 case FAST_DOUBLE_ELEMENTS: | 4374 case FAST_DOUBLE_ELEMENTS: |
4349 case FAST_ELEMENTS: | 4375 case FAST_ELEMENTS: |
4350 case FAST_SMI_ELEMENTS: | 4376 case FAST_SMI_ELEMENTS: |
4351 case FAST_HOLEY_DOUBLE_ELEMENTS: | 4377 case FAST_HOLEY_DOUBLE_ELEMENTS: |
4352 case FAST_HOLEY_ELEMENTS: | 4378 case FAST_HOLEY_ELEMENTS: |
4353 case FAST_HOLEY_SMI_ELEMENTS: | 4379 case FAST_HOLEY_SMI_ELEMENTS: |
4354 case DICTIONARY_ELEMENTS: | 4380 case DICTIONARY_ELEMENTS: |
4355 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 4381 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
4356 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: | 4382 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: |
4357 UNREACHABLE(); | 4383 UNREACHABLE(); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4443 kSaveFPRegs, | 4469 kSaveFPRegs, |
4444 EMIT_REMEMBERED_SET, | 4470 EMIT_REMEMBERED_SET, |
4445 check_needed, | 4471 check_needed, |
4446 instr->hydrogen()->PointersToHereCheckForValue()); | 4472 instr->hydrogen()->PointersToHereCheckForValue()); |
4447 } | 4473 } |
4448 } | 4474 } |
4449 | 4475 |
4450 | 4476 |
4451 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { | 4477 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { |
4452 // By cases: external, fast double | 4478 // By cases: external, fast double |
4453 if (instr->is_fixed_typed_array()) { | 4479 if (instr->is_typed_elements()) { |
4454 DoStoreKeyedExternalArray(instr); | 4480 DoStoreKeyedExternalArray(instr); |
4455 } else if (instr->hydrogen()->value()->representation().IsDouble()) { | 4481 } else if (instr->hydrogen()->value()->representation().IsDouble()) { |
4456 DoStoreKeyedFixedDoubleArray(instr); | 4482 DoStoreKeyedFixedDoubleArray(instr); |
4457 } else { | 4483 } else { |
4458 DoStoreKeyedFixedArray(instr); | 4484 DoStoreKeyedFixedArray(instr); |
4459 } | 4485 } |
4460 } | 4486 } |
4461 | 4487 |
4462 | 4488 |
4463 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4489 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6023 __ push(ToRegister(instr->function())); | 6049 __ push(ToRegister(instr->function())); |
6024 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6050 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6025 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6051 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6026 } | 6052 } |
6027 | 6053 |
6028 | 6054 |
6029 #undef __ | 6055 #undef __ |
6030 | 6056 |
6031 } // namespace internal | 6057 } // namespace internal |
6032 } // namespace v8 | 6058 } // namespace v8 |
OLD | NEW |