Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: src/compiler/code-generator.cc

Issue 2362173003: [turbofan] Improve representation selection for Smi checking. (Closed)
Patch Set: Address comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/effect-control-linearizer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/compilation-info.h" 9 #include "src/compilation-info.h"
10 #include "src/compiler/code-generator-impl.h" 10 #include "src/compiler/code-generator-impl.h"
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 // When pointers are 8 bytes, we can use int64 constants to represent 873 // When pointers are 8 bytes, we can use int64 constants to represent
874 // Smis. 874 // Smis.
875 DCHECK(type.representation() == MachineRepresentation::kTagged || 875 DCHECK(type.representation() == MachineRepresentation::kTagged ||
876 type.representation() == MachineRepresentation::kTaggedSigned); 876 type.representation() == MachineRepresentation::kTaggedSigned);
877 DCHECK_EQ(8, kPointerSize); 877 DCHECK_EQ(8, kPointerSize);
878 constant_object = 878 constant_object =
879 handle(reinterpret_cast<Smi*>(constant.ToInt64()), isolate()); 879 handle(reinterpret_cast<Smi*>(constant.ToInt64()), isolate());
880 DCHECK(constant_object->IsSmi()); 880 DCHECK(constant_object->IsSmi());
881 break; 881 break;
882 case Constant::kFloat32: 882 case Constant::kFloat32:
883 DCHECK(type.representation() == MachineRepresentation::kFloat32 || 883 if (type.representation() == MachineRepresentation::kTaggedSigned) {
884 CanBeTaggedPointer(type.representation())); 884 DCHECK(IsSmiDouble(constant.ToFloat32()));
885 } else {
886 DCHECK(type.representation() == MachineRepresentation::kFloat32 ||
887 CanBeTaggedPointer(type.representation()));
888 }
885 constant_object = isolate()->factory()->NewNumber(constant.ToFloat32()); 889 constant_object = isolate()->factory()->NewNumber(constant.ToFloat32());
886 break; 890 break;
887 case Constant::kFloat64: 891 case Constant::kFloat64:
888 DCHECK(type.representation() == MachineRepresentation::kFloat64 || 892 if (type.representation() == MachineRepresentation::kTaggedSigned) {
889 CanBeTaggedPointer(type.representation())); 893 DCHECK(IsSmiDouble(constant.ToFloat64()));
894 } else {
895 DCHECK(type.representation() == MachineRepresentation::kFloat64 ||
896 CanBeTaggedPointer(type.representation()));
897 }
890 constant_object = isolate()->factory()->NewNumber(constant.ToFloat64()); 898 constant_object = isolate()->factory()->NewNumber(constant.ToFloat64());
891 break; 899 break;
892 case Constant::kHeapObject: 900 case Constant::kHeapObject:
893 DCHECK(CanBeTaggedPointer(type.representation())); 901 DCHECK(CanBeTaggedPointer(type.representation()));
894 constant_object = constant.ToHeapObject(); 902 constant_object = constant.ToHeapObject();
895 break; 903 break;
896 default: 904 default:
897 CHECK(false); 905 CHECK(false);
898 } 906 }
899 if (constant_object.is_identical_to(info()->closure())) { 907 if (constant_object.is_identical_to(info()->closure())) {
(...skipping 26 matching lines...) Expand all
926 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { 934 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) {
927 gen->ools_ = this; 935 gen->ools_ = this;
928 } 936 }
929 937
930 938
931 OutOfLineCode::~OutOfLineCode() {} 939 OutOfLineCode::~OutOfLineCode() {}
932 940
933 } // namespace compiler 941 } // namespace compiler
934 } // namespace internal 942 } // namespace internal
935 } // namespace v8 943 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/effect-control-linearizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698