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/address-map.h" | 7 #include "src/address-map.h" |
8 #include "src/base/adapters.h" | 8 #include "src/base/adapters.h" |
9 #include "src/compiler/code-generator-impl.h" | 9 #include "src/compiler/code-generator-impl.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 } else { | 854 } else { |
855 DCHECK_EQ(MachineRepresentation::kFloat32, type.representation()); | 855 DCHECK_EQ(MachineRepresentation::kFloat32, type.representation()); |
856 translation->StoreFloatRegister(converter.ToFloatRegister(op)); | 856 translation->StoreFloatRegister(converter.ToFloatRegister(op)); |
857 } | 857 } |
858 } else if (op->IsImmediate()) { | 858 } else if (op->IsImmediate()) { |
859 InstructionOperandConverter converter(this, instr); | 859 InstructionOperandConverter converter(this, instr); |
860 Constant constant = converter.ToConstant(op); | 860 Constant constant = converter.ToConstant(op); |
861 Handle<Object> constant_object; | 861 Handle<Object> constant_object; |
862 switch (constant.type()) { | 862 switch (constant.type()) { |
863 case Constant::kInt32: | 863 case Constant::kInt32: |
864 DCHECK(type == MachineType::Int32() || type == MachineType::Uint32() || | 864 if (type.representation() == MachineRepresentation::kTagged) { |
865 type.representation() == MachineRepresentation::kBit || | 865 // When pointers are 4 bytes, we can use int32 constants to represent |
866 type.representation() == MachineRepresentation::kNone); | 866 // Smis. |
867 DCHECK(type.representation() != MachineRepresentation::kNone || | 867 DCHECK_EQ(4, kPointerSize); |
868 constant.ToInt32() == FrameStateDescriptor::kImpossibleValue); | 868 constant_object = |
| 869 handle(reinterpret_cast<Smi*>(constant.ToInt32()), isolate()); |
| 870 DCHECK(constant_object->IsSmi()); |
| 871 } else { |
| 872 DCHECK(type == MachineType::Int32() || |
| 873 type == MachineType::Uint32() || |
| 874 type.representation() == MachineRepresentation::kBit || |
| 875 type.representation() == MachineRepresentation::kNone); |
| 876 DCHECK(type.representation() != MachineRepresentation::kNone || |
| 877 constant.ToInt32() == FrameStateDescriptor::kImpossibleValue); |
869 | 878 |
| 879 constant_object = |
| 880 isolate()->factory()->NewNumberFromInt(constant.ToInt32()); |
| 881 } |
| 882 break; |
| 883 case Constant::kInt64: |
| 884 // When pointers are 8 bytes, we can use int64 constants to represent |
| 885 // Smis. |
| 886 DCHECK_EQ(type.representation(), MachineRepresentation::kTagged); |
| 887 DCHECK_EQ(8, kPointerSize); |
870 constant_object = | 888 constant_object = |
871 isolate()->factory()->NewNumberFromInt(constant.ToInt32()); | 889 handle(reinterpret_cast<Smi*>(constant.ToInt64()), isolate()); |
| 890 DCHECK(constant_object->IsSmi()); |
872 break; | 891 break; |
873 case Constant::kFloat32: | 892 case Constant::kFloat32: |
874 DCHECK(type.representation() == MachineRepresentation::kFloat32 || | 893 DCHECK(type.representation() == MachineRepresentation::kFloat32 || |
875 type.representation() == MachineRepresentation::kTagged); | 894 type.representation() == MachineRepresentation::kTagged); |
876 constant_object = isolate()->factory()->NewNumber(constant.ToFloat32()); | 895 constant_object = isolate()->factory()->NewNumber(constant.ToFloat32()); |
877 break; | 896 break; |
878 case Constant::kFloat64: | 897 case Constant::kFloat64: |
879 DCHECK(type.representation() == MachineRepresentation::kFloat64 || | 898 DCHECK(type.representation() == MachineRepresentation::kFloat64 || |
880 type.representation() == MachineRepresentation::kTagged); | 899 type.representation() == MachineRepresentation::kTagged); |
881 constant_object = isolate()->factory()->NewNumber(constant.ToFloat64()); | 900 constant_object = isolate()->factory()->NewNumber(constant.ToFloat64()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { | 936 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { |
918 gen->ools_ = this; | 937 gen->ools_ = this; |
919 } | 938 } |
920 | 939 |
921 | 940 |
922 OutOfLineCode::~OutOfLineCode() {} | 941 OutOfLineCode::~OutOfLineCode() {} |
923 | 942 |
924 } // namespace compiler | 943 } // namespace compiler |
925 } // namespace internal | 944 } // namespace internal |
926 } // namespace v8 | 945 } // namespace v8 |
OLD | NEW |