OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 #include "src/compiler/change-lowering.h" | 6 #include "src/compiler/change-lowering.h" |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/simplified-operator.h" | 10 #include "src/compiler/simplified-operator.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBoolToBit) { | 115 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBoolToBit) { |
116 Node* value = Parameter(Type::Number()); | 116 Node* value = Parameter(Type::Number()); |
117 Reduction r = | 117 Reduction r = |
118 Reduce(graph()->NewNode(simplified()->ChangeBoolToBit(), value)); | 118 Reduce(graph()->NewNode(simplified()->ChangeBoolToBit(), value)); |
119 ASSERT_TRUE(r.Changed()); | 119 ASSERT_TRUE(r.Changed()); |
120 EXPECT_THAT(r.replacement(), IsWordEqual(value, IsTrueConstant())); | 120 EXPECT_THAT(r.replacement(), IsWordEqual(value, IsTrueConstant())); |
121 } | 121 } |
122 | 122 |
123 | 123 |
124 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeFloat64ToTagged) { | |
125 Node* value = Parameter(Type::Number()); | |
126 Reduction r = | |
127 Reduce(graph()->NewNode(simplified()->ChangeFloat64ToTagged(), value)); | |
128 ASSERT_TRUE(r.Changed()); | |
129 Capture<Node*> heap_number; | |
130 EXPECT_THAT( | |
131 r.replacement(), | |
132 IsFinishRegion( | |
133 AllOf(CaptureEq(&heap_number), | |
134 IsAllocateHeapNumber(IsBeginRegion(graph()->start()), | |
135 graph()->start())), | |
136 IsStore(StoreRepresentation(kMachFloat64, kNoWriteBarrier), | |
137 CaptureEq(&heap_number), | |
138 IsIntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag), | |
139 value, CaptureEq(&heap_number), graph()->start()))); | |
140 } | |
141 | |
142 | |
143 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeInt32ToTaggedWithSignedSmall) { | 124 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeInt32ToTaggedWithSignedSmall) { |
144 Node* value = Parameter(Type::SignedSmall()); | 125 Node* value = Parameter(Type::SignedSmall()); |
145 Reduction r = | 126 Reduction r = |
146 Reduce(graph()->NewNode(simplified()->ChangeInt32ToTagged(), value)); | 127 Reduce(graph()->NewNode(simplified()->ChangeInt32ToTagged(), value)); |
147 ASSERT_TRUE(r.Changed()); | 128 ASSERT_TRUE(r.Changed()); |
148 EXPECT_THAT(r.replacement(), IsChangeInt32ToSmi(value)); | 129 EXPECT_THAT(r.replacement(), IsChangeInt32ToSmi(value)); |
149 } | 130 } |
150 | 131 |
151 | 132 |
152 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeUint32ToTaggedWithUnsignedSmall) { | 133 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeUint32ToTaggedWithUnsignedSmall) { |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 CaptureEq(&branch), | 441 CaptureEq(&branch), |
461 IsBranch(IsUint32LessThanOrEqual( | 442 IsBranch(IsUint32LessThanOrEqual( |
462 value, IsInt32Constant(Smi::kMaxValue)), | 443 value, IsInt32Constant(Smi::kMaxValue)), |
463 graph()->start()))), | 444 graph()->start()))), |
464 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | 445 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
465 } | 446 } |
466 | 447 |
467 } // namespace compiler | 448 } // namespace compiler |
468 } // namespace internal | 449 } // namespace internal |
469 } // namespace v8 | 450 } // namespace v8 |
OLD | NEW |