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 4592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4603 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { | 4603 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { |
4604 Register scratch = scratch0(); | 4604 Register scratch = scratch0(); |
4605 Register input = ToRegister(instr->value()); | 4605 Register input = ToRegister(instr->value()); |
4606 Register result = ToRegister(instr->result()); | 4606 Register result = ToRegister(instr->result()); |
4607 if (instr->needs_check()) { | 4607 if (instr->needs_check()) { |
4608 STATIC_ASSERT(kHeapObjectTag == 1); | 4608 STATIC_ASSERT(kHeapObjectTag == 1); |
4609 // If the input is a HeapObject, value of scratch won't be zero. | 4609 // If the input is a HeapObject, value of scratch won't be zero. |
4610 __ And(scratch, input, Operand(kHeapObjectTag)); | 4610 __ And(scratch, input, Operand(kHeapObjectTag)); |
4611 __ SmiUntag(result, input); | 4611 __ SmiUntag(result, input); |
4612 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg)); | 4612 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg)); |
| 4613 } else if (instr->hydrogen()->value()->IsLoadKeyed()) { |
| 4614 HLoadKeyed* load = HLoadKeyed::cast(instr->hydrogen()->value()); |
| 4615 if (load->UsesMustHandleHole()) { |
| 4616 __ And(scratch, input, Operand(kHeapObjectTag)); |
| 4617 __ SmiUntag(result, input); |
| 4618 if (load->hole_mode() == ALLOW_RETURN_HOLE) { |
| 4619 Label done; |
| 4620 __ Branch(&done, eq, scratch, Operand(zero_reg)); |
| 4621 __ li(result, Operand(Smi::FromInt(0))); |
| 4622 __ bind(&done); |
| 4623 } else { |
| 4624 DeoptimizeIf(ne, instr->environment(), scratch, Operand(zero_reg)); |
| 4625 } |
| 4626 } else { |
| 4627 __ SmiUntag(result, input); |
| 4628 } |
4613 } else { | 4629 } else { |
4614 __ SmiUntag(result, input); | 4630 __ SmiUntag(result, input); |
4615 } | 4631 } |
4616 } | 4632 } |
4617 | 4633 |
4618 | 4634 |
4619 void LCodeGen::EmitNumberUntagD(Register input_reg, | 4635 void LCodeGen::EmitNumberUntagD(Register input_reg, |
4620 DoubleRegister result_reg, | 4636 DoubleRegister result_reg, |
4621 bool deoptimize_on_undefined, | 4637 bool deoptimize_on_undefined, |
4622 bool deoptimize_on_minus_zero, | 4638 bool deoptimize_on_minus_zero, |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5657 __ Subu(scratch, result, scratch); | 5673 __ Subu(scratch, result, scratch); |
5658 __ lw(result, FieldMemOperand(scratch, | 5674 __ lw(result, FieldMemOperand(scratch, |
5659 FixedArray::kHeaderSize - kPointerSize)); | 5675 FixedArray::kHeaderSize - kPointerSize)); |
5660 __ bind(&done); | 5676 __ bind(&done); |
5661 } | 5677 } |
5662 | 5678 |
5663 | 5679 |
5664 #undef __ | 5680 #undef __ |
5665 | 5681 |
5666 } } // namespace v8::internal | 5682 } } // namespace v8::internal |
OLD | NEW |