OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/scopes.h" | 10 #include "src/scopes.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 return ToImmediate(instr_->InputAt(index)); | 31 return ToImmediate(instr_->InputAt(index)); |
32 } | 32 } |
33 | 33 |
34 Operand InputOperand(size_t index, int extra = 0) { | 34 Operand InputOperand(size_t index, int extra = 0) { |
35 return ToOperand(instr_->InputAt(index), extra); | 35 return ToOperand(instr_->InputAt(index), extra); |
36 } | 36 } |
37 | 37 |
38 Operand OutputOperand() { return ToOperand(instr_->Output()); } | 38 Operand OutputOperand() { return ToOperand(instr_->Output()); } |
39 | 39 |
40 Immediate ToImmediate(InstructionOperand* operand) { | 40 Immediate ToImmediate(InstructionOperand* operand) { |
41 return Immediate(ToConstant(operand).ToInt32()); | 41 Constant constant = ToConstant(operand); |
| 42 if (constant.type() == Constant::kFloat64) { |
| 43 DCHECK_EQ(0, bit_cast<int64_t>(constant.ToFloat64())); |
| 44 return Immediate(0); |
| 45 } |
| 46 return Immediate(constant.ToInt32()); |
42 } | 47 } |
43 | 48 |
44 Operand ToOperand(InstructionOperand* op, int extra = 0) { | 49 Operand ToOperand(InstructionOperand* op, int extra = 0) { |
45 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); | 50 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); |
46 // The linkage computes where all spill slots are located. | 51 // The linkage computes where all spill slots are located. |
47 FrameOffset offset = linkage()->GetFrameOffset( | 52 FrameOffset offset = linkage()->GetFrameOffset( |
48 AllocatedOperand::cast(op)->index(), frame(), extra); | 53 AllocatedOperand::cast(op)->index(), frame(), extra); |
49 return Operand(offset.from_stack_pointer() ? rsp : rbp, offset.offset()); | 54 return Operand(offset.from_stack_pointer() ? rsp : rbp, offset.offset()); |
50 } | 55 } |
51 | 56 |
(...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 } | 1710 } |
1706 } | 1711 } |
1707 MarkLazyDeoptSite(); | 1712 MarkLazyDeoptSite(); |
1708 } | 1713 } |
1709 | 1714 |
1710 #undef __ | 1715 #undef __ |
1711 | 1716 |
1712 } // namespace internal | 1717 } // namespace internal |
1713 } // namespace compiler | 1718 } // namespace compiler |
1714 } // namespace v8 | 1719 } // namespace v8 |
OLD | NEW |