| 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/crankshaft/arm/lithium-codegen-arm.h" | 5 #include "src/crankshaft/arm/lithium-codegen-arm.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/crankshaft/arm/lithium-gap-resolver-arm.h" | 10 #include "src/crankshaft/arm/lithium-gap-resolver-arm.h" |
| (...skipping 4520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4531 // SmiUntag(heap_object, SetCC) | 4531 // SmiUntag(heap_object, SetCC) |
| 4532 STATIC_ASSERT(kHeapObjectTag == 1); | 4532 STATIC_ASSERT(kHeapObjectTag == 1); |
| 4533 __ adc(scratch2, input_reg, Operand(input_reg)); | 4533 __ adc(scratch2, input_reg, Operand(input_reg)); |
| 4534 | 4534 |
| 4535 // Heap number map check. | 4535 // Heap number map check. |
| 4536 __ ldr(scratch1, FieldMemOperand(scratch2, HeapObject::kMapOffset)); | 4536 __ ldr(scratch1, FieldMemOperand(scratch2, HeapObject::kMapOffset)); |
| 4537 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 4537 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
| 4538 __ cmp(scratch1, Operand(ip)); | 4538 __ cmp(scratch1, Operand(ip)); |
| 4539 | 4539 |
| 4540 if (instr->truncating()) { | 4540 if (instr->truncating()) { |
| 4541 // Performs a truncating conversion of a floating point number as used by | 4541 Label truncate; |
| 4542 // the JS bitwise operations. | 4542 __ b(eq, &truncate); |
| 4543 Label no_heap_number, check_bools, check_false; | 4543 __ CompareInstanceType(scratch1, scratch1, ODDBALL_TYPE); |
| 4544 __ b(ne, &no_heap_number); | 4544 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotANumberOrOddball); |
| 4545 __ bind(&truncate); |
| 4545 __ TruncateHeapNumberToI(input_reg, scratch2); | 4546 __ TruncateHeapNumberToI(input_reg, scratch2); |
| 4546 __ b(&done); | |
| 4547 | |
| 4548 // Check for Oddballs. Undefined/False is converted to zero and True to one | |
| 4549 // for truncating conversions. | |
| 4550 __ bind(&no_heap_number); | |
| 4551 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | |
| 4552 __ cmp(scratch2, Operand(ip)); | |
| 4553 __ b(ne, &check_bools); | |
| 4554 __ mov(input_reg, Operand::Zero()); | |
| 4555 __ b(&done); | |
| 4556 | |
| 4557 __ bind(&check_bools); | |
| 4558 __ LoadRoot(ip, Heap::kTrueValueRootIndex); | |
| 4559 __ cmp(scratch2, Operand(ip)); | |
| 4560 __ b(ne, &check_false); | |
| 4561 __ mov(input_reg, Operand(1)); | |
| 4562 __ b(&done); | |
| 4563 | |
| 4564 __ bind(&check_false); | |
| 4565 __ LoadRoot(ip, Heap::kFalseValueRootIndex); | |
| 4566 __ cmp(scratch2, Operand(ip)); | |
| 4567 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumberUndefinedBoolean); | |
| 4568 __ mov(input_reg, Operand::Zero()); | |
| 4569 } else { | 4547 } else { |
| 4570 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumber); | 4548 DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumber); |
| 4571 | 4549 |
| 4572 __ sub(ip, scratch2, Operand(kHeapObjectTag)); | 4550 __ sub(ip, scratch2, Operand(kHeapObjectTag)); |
| 4573 __ vldr(double_scratch2, ip, HeapNumber::kValueOffset); | 4551 __ vldr(double_scratch2, ip, HeapNumber::kValueOffset); |
| 4574 __ TryDoubleToInt32Exact(input_reg, double_scratch2, double_scratch); | 4552 __ TryDoubleToInt32Exact(input_reg, double_scratch2, double_scratch); |
| 4575 DeoptimizeIf(ne, instr, DeoptimizeReason::kLostPrecisionOrNaN); | 4553 DeoptimizeIf(ne, instr, DeoptimizeReason::kLostPrecisionOrNaN); |
| 4576 | 4554 |
| 4577 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 4555 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 4578 __ cmp(input_reg, Operand::Zero()); | 4556 __ cmp(input_reg, Operand::Zero()); |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5406 __ ldr(result, FieldMemOperand(scratch, | 5384 __ ldr(result, FieldMemOperand(scratch, |
| 5407 FixedArray::kHeaderSize - kPointerSize)); | 5385 FixedArray::kHeaderSize - kPointerSize)); |
| 5408 __ bind(deferred->exit()); | 5386 __ bind(deferred->exit()); |
| 5409 __ bind(&done); | 5387 __ bind(&done); |
| 5410 } | 5388 } |
| 5411 | 5389 |
| 5412 #undef __ | 5390 #undef __ |
| 5413 | 5391 |
| 5414 } // namespace internal | 5392 } // namespace internal |
| 5415 } // namespace v8 | 5393 } // namespace v8 |
| OLD | NEW |