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 3258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3269 int constant_key = 0; | 3269 int constant_key = 0; |
3270 if (key_is_constant) { | 3270 if (key_is_constant) { |
3271 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); | 3271 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
3272 if (constant_key & 0xF0000000) { | 3272 if (constant_key & 0xF0000000) { |
3273 Abort("array index constant value too big."); | 3273 Abort("array index constant value too big."); |
3274 } | 3274 } |
3275 } else { | 3275 } else { |
3276 key = ToRegister(instr->key()); | 3276 key = ToRegister(instr->key()); |
3277 } | 3277 } |
3278 int element_size_shift = ElementsKindToShiftSize(elements_kind); | 3278 int element_size_shift = ElementsKindToShiftSize(elements_kind); |
3279 int shift_size = (instr->hydrogen()->key()->representation().IsTagged()) | 3279 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) |
3280 ? (element_size_shift - kSmiTagSize) : element_size_shift; | 3280 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
3281 int additional_offset = instr->additional_index() << element_size_shift; | 3281 int additional_offset = instr->additional_index() << element_size_shift; |
3282 | 3282 |
3283 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || | 3283 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || |
3284 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | 3284 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { |
3285 DwVfpRegister result = ToDoubleRegister(instr->result()); | 3285 DwVfpRegister result = ToDoubleRegister(instr->result()); |
3286 Operand operand = key_is_constant | 3286 Operand operand = key_is_constant |
3287 ? Operand(constant_key << element_size_shift) | 3287 ? Operand(constant_key << element_size_shift) |
3288 : Operand(key, LSL, shift_size); | 3288 : Operand(key, LSL, shift_size); |
3289 __ add(scratch0(), external_pointer, operand); | 3289 __ add(scratch0(), external_pointer, operand); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3341 | 3341 |
3342 | 3342 |
3343 void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) { | 3343 void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) { |
3344 Register elements = ToRegister(instr->elements()); | 3344 Register elements = ToRegister(instr->elements()); |
3345 bool key_is_constant = instr->key()->IsConstantOperand(); | 3345 bool key_is_constant = instr->key()->IsConstantOperand(); |
3346 Register key = no_reg; | 3346 Register key = no_reg; |
3347 DwVfpRegister result = ToDoubleRegister(instr->result()); | 3347 DwVfpRegister result = ToDoubleRegister(instr->result()); |
3348 Register scratch = scratch0(); | 3348 Register scratch = scratch0(); |
3349 | 3349 |
3350 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); | 3350 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); |
3351 int shift_size = (instr->hydrogen()->key()->representation().IsTagged()) | 3351 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) |
3352 ? (element_size_shift - kSmiTagSize) : element_size_shift; | 3352 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
3353 int constant_key = 0; | 3353 int constant_key = 0; |
3354 if (key_is_constant) { | 3354 if (key_is_constant) { |
3355 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); | 3355 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
3356 if (constant_key & 0xF0000000) { | 3356 if (constant_key & 0xF0000000) { |
3357 Abort("array index constant value too big."); | 3357 Abort("array index constant value too big."); |
3358 } | 3358 } |
3359 } else { | 3359 } else { |
3360 key = ToRegister(instr->key()); | 3360 key = ToRegister(instr->key()); |
3361 } | 3361 } |
(...skipping 24 matching lines...) Expand all Loading... |
3386 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); | 3386 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); |
3387 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) + | 3387 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) + |
3388 instr->additional_index()); | 3388 instr->additional_index()); |
3389 store_base = elements; | 3389 store_base = elements; |
3390 } else { | 3390 } else { |
3391 Register key = EmitLoadRegister(instr->key(), scratch0()); | 3391 Register key = EmitLoadRegister(instr->key(), scratch0()); |
3392 // Even though the HLoadKeyed instruction forces the input | 3392 // Even though the HLoadKeyed instruction forces the input |
3393 // representation for the key to be an integer, the input gets replaced | 3393 // representation for the key to be an integer, the input gets replaced |
3394 // during bound check elimination with the index argument to the bounds | 3394 // during bound check elimination with the index argument to the bounds |
3395 // check, which can be tagged, so that case must be handled here, too. | 3395 // check, which can be tagged, so that case must be handled here, too. |
3396 if (instr->hydrogen()->key()->representation().IsTagged()) { | 3396 if (instr->hydrogen()->key()->representation().IsSmi()) { |
3397 __ add(scratch, elements, Operand::PointerOffsetFromSmiKey(key)); | 3397 __ add(scratch, elements, Operand::PointerOffsetFromSmiKey(key)); |
3398 } else { | 3398 } else { |
3399 __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2)); | 3399 __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2)); |
3400 } | 3400 } |
3401 offset = FixedArray::OffsetOfElementAt(instr->additional_index()); | 3401 offset = FixedArray::OffsetOfElementAt(instr->additional_index()); |
3402 } | 3402 } |
3403 __ ldr(result, FieldMemOperand(store_base, offset)); | 3403 __ ldr(result, FieldMemOperand(store_base, offset)); |
3404 | 3404 |
3405 // Check for the hole value. | 3405 // Check for the hole value. |
3406 if (instr->hydrogen()->RequiresHoleCheck()) { | 3406 if (instr->hydrogen()->RequiresHoleCheck()) { |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4322 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 4322 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
4323 } | 4323 } |
4324 | 4324 |
4325 | 4325 |
4326 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4326 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4327 if (instr->hydrogen()->skip_check()) return; | 4327 if (instr->hydrogen()->skip_check()) return; |
4328 | 4328 |
4329 if (instr->index()->IsConstantOperand()) { | 4329 if (instr->index()->IsConstantOperand()) { |
4330 int constant_index = | 4330 int constant_index = |
4331 ToInteger32(LConstantOperand::cast(instr->index())); | 4331 ToInteger32(LConstantOperand::cast(instr->index())); |
4332 if (instr->hydrogen()->length()->representation().IsTagged()) { | 4332 if (instr->hydrogen()->length()->representation().IsSmi()) { |
4333 __ mov(ip, Operand(Smi::FromInt(constant_index))); | 4333 __ mov(ip, Operand(Smi::FromInt(constant_index))); |
4334 } else { | 4334 } else { |
4335 __ mov(ip, Operand(constant_index)); | 4335 __ mov(ip, Operand(constant_index)); |
4336 } | 4336 } |
4337 __ cmp(ip, ToRegister(instr->length())); | 4337 __ cmp(ip, ToRegister(instr->length())); |
4338 } else { | 4338 } else { |
4339 __ cmp(ToRegister(instr->index()), ToRegister(instr->length())); | 4339 __ cmp(ToRegister(instr->index()), ToRegister(instr->length())); |
4340 } | 4340 } |
4341 DeoptimizeIf(hs, instr->environment()); | 4341 DeoptimizeIf(hs, instr->environment()); |
4342 } | 4342 } |
4343 | 4343 |
4344 | 4344 |
4345 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) { | 4345 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) { |
4346 Register external_pointer = ToRegister(instr->elements()); | 4346 Register external_pointer = ToRegister(instr->elements()); |
4347 Register key = no_reg; | 4347 Register key = no_reg; |
4348 ElementsKind elements_kind = instr->elements_kind(); | 4348 ElementsKind elements_kind = instr->elements_kind(); |
4349 bool key_is_constant = instr->key()->IsConstantOperand(); | 4349 bool key_is_constant = instr->key()->IsConstantOperand(); |
4350 int constant_key = 0; | 4350 int constant_key = 0; |
4351 if (key_is_constant) { | 4351 if (key_is_constant) { |
4352 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); | 4352 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
4353 if (constant_key & 0xF0000000) { | 4353 if (constant_key & 0xF0000000) { |
4354 Abort("array index constant value too big."); | 4354 Abort("array index constant value too big."); |
4355 } | 4355 } |
4356 } else { | 4356 } else { |
4357 key = ToRegister(instr->key()); | 4357 key = ToRegister(instr->key()); |
4358 } | 4358 } |
4359 int element_size_shift = ElementsKindToShiftSize(elements_kind); | 4359 int element_size_shift = ElementsKindToShiftSize(elements_kind); |
4360 int shift_size = (instr->hydrogen()->key()->representation().IsTagged()) | 4360 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) |
4361 ? (element_size_shift - kSmiTagSize) : element_size_shift; | 4361 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
4362 int additional_offset = instr->additional_index() << element_size_shift; | 4362 int additional_offset = instr->additional_index() << element_size_shift; |
4363 | 4363 |
4364 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || | 4364 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || |
4365 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | 4365 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { |
4366 DwVfpRegister value(ToDoubleRegister(instr->value())); | 4366 DwVfpRegister value(ToDoubleRegister(instr->value())); |
4367 Operand operand(key_is_constant | 4367 Operand operand(key_is_constant |
4368 ? Operand(constant_key << element_size_shift) | 4368 ? Operand(constant_key << element_size_shift) |
4369 : Operand(key, LSL, shift_size)); | 4369 : Operand(key, LSL, shift_size)); |
4370 __ add(scratch0(), external_pointer, operand); | 4370 __ add(scratch0(), external_pointer, operand); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4423 // double value. | 4423 // double value. |
4424 if (key_is_constant) { | 4424 if (key_is_constant) { |
4425 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); | 4425 constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
4426 if (constant_key & 0xF0000000) { | 4426 if (constant_key & 0xF0000000) { |
4427 Abort("array index constant value too big."); | 4427 Abort("array index constant value too big."); |
4428 } | 4428 } |
4429 } else { | 4429 } else { |
4430 key = ToRegister(instr->key()); | 4430 key = ToRegister(instr->key()); |
4431 } | 4431 } |
4432 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); | 4432 int element_size_shift = ElementsKindToShiftSize(FAST_DOUBLE_ELEMENTS); |
4433 int shift_size = (instr->hydrogen()->key()->representation().IsTagged()) | 4433 int shift_size = (instr->hydrogen()->key()->representation().IsSmi()) |
4434 ? (element_size_shift - kSmiTagSize) : element_size_shift; | 4434 ? (element_size_shift - kSmiTagSize) : element_size_shift; |
4435 Operand operand = key_is_constant | 4435 Operand operand = key_is_constant |
4436 ? Operand((constant_key << element_size_shift) + | 4436 ? Operand((constant_key << element_size_shift) + |
4437 FixedDoubleArray::kHeaderSize - kHeapObjectTag) | 4437 FixedDoubleArray::kHeaderSize - kHeapObjectTag) |
4438 : Operand(key, LSL, shift_size); | 4438 : Operand(key, LSL, shift_size); |
4439 __ add(scratch, elements, operand); | 4439 __ add(scratch, elements, operand); |
4440 if (!key_is_constant) { | 4440 if (!key_is_constant) { |
4441 __ add(scratch, scratch, | 4441 __ add(scratch, scratch, |
4442 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); | 4442 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); |
4443 } | 4443 } |
(...skipping 25 matching lines...) Expand all Loading... |
4469 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4469 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
4470 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); | 4470 LConstantOperand* const_operand = LConstantOperand::cast(instr->key()); |
4471 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) + | 4471 offset = FixedArray::OffsetOfElementAt(ToInteger32(const_operand) + |
4472 instr->additional_index()); | 4472 instr->additional_index()); |
4473 store_base = elements; | 4473 store_base = elements; |
4474 } else { | 4474 } else { |
4475 // Even though the HLoadKeyed instruction forces the input | 4475 // Even though the HLoadKeyed instruction forces the input |
4476 // representation for the key to be an integer, the input gets replaced | 4476 // representation for the key to be an integer, the input gets replaced |
4477 // during bound check elimination with the index argument to the bounds | 4477 // during bound check elimination with the index argument to the bounds |
4478 // check, which can be tagged, so that case must be handled here, too. | 4478 // check, which can be tagged, so that case must be handled here, too. |
4479 if (instr->hydrogen()->key()->representation().IsTagged()) { | 4479 if (instr->hydrogen()->key()->representation().IsSmi()) { |
4480 __ add(scratch, elements, Operand::PointerOffsetFromSmiKey(key)); | 4480 __ add(scratch, elements, Operand::PointerOffsetFromSmiKey(key)); |
4481 } else { | 4481 } else { |
4482 __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2)); | 4482 __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2)); |
4483 } | 4483 } |
4484 offset = FixedArray::OffsetOfElementAt(instr->additional_index()); | 4484 offset = FixedArray::OffsetOfElementAt(instr->additional_index()); |
4485 } | 4485 } |
4486 __ str(value, FieldMemOperand(store_base, offset)); | 4486 __ str(value, FieldMemOperand(store_base, offset)); |
4487 | 4487 |
4488 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4488 if (instr->hydrogen()->NeedsWriteBarrier()) { |
4489 HType type = instr->hydrogen()->value()->type(); | 4489 HType type = instr->hydrogen()->value()->type(); |
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5995 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5995 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5996 __ ldr(result, FieldMemOperand(scratch, | 5996 __ ldr(result, FieldMemOperand(scratch, |
5997 FixedArray::kHeaderSize - kPointerSize)); | 5997 FixedArray::kHeaderSize - kPointerSize)); |
5998 __ bind(&done); | 5998 __ bind(&done); |
5999 } | 5999 } |
6000 | 6000 |
6001 | 6001 |
6002 #undef __ | 6002 #undef __ |
6003 | 6003 |
6004 } } // namespace v8::internal | 6004 } } // namespace v8::internal |
OLD | NEW |