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-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/compiler/access-builder.h" | 6 #include "src/compiler/access-builder.h" |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 ASSERT_TRUE(r.Changed()); | 1133 ASSERT_TRUE(r.Changed()); |
1134 EXPECT_THAT(r.replacement(), | 1134 EXPECT_THAT(r.replacement(), |
1135 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( | 1135 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( |
1136 Context::MIN_CONTEXT_SLOTS)), | 1136 Context::MIN_CONTEXT_SLOTS)), |
1137 IsBeginRegion(_), control), | 1137 IsBeginRegion(_), control), |
1138 _)); | 1138 _)); |
1139 } | 1139 } |
1140 | 1140 |
1141 | 1141 |
1142 // ----------------------------------------------------------------------------- | 1142 // ----------------------------------------------------------------------------- |
| 1143 // JSCreateCatchContext |
| 1144 |
| 1145 |
| 1146 TEST_F(JSTypedLoweringTest, JSCreateCatchContext) { |
| 1147 Handle<String> name = factory()->length_string(); |
| 1148 Node* const exception = Parameter(Type::Receiver()); |
| 1149 Node* const closure = Parameter(Type::Function()); |
| 1150 Node* const context = Parameter(Type::Any()); |
| 1151 Node* const effect = graph()->start(); |
| 1152 Node* const control = graph()->start(); |
| 1153 Reduction r = |
| 1154 Reduce(graph()->NewNode(javascript()->CreateCatchContext(name), exception, |
| 1155 closure, context, effect, control)); |
| 1156 ASSERT_TRUE(r.Changed()); |
| 1157 EXPECT_THAT(r.replacement(), |
| 1158 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( |
| 1159 Context::MIN_CONTEXT_SLOTS + 1)), |
| 1160 IsBeginRegion(_), control), |
| 1161 _)); |
| 1162 } |
| 1163 |
| 1164 |
| 1165 // ----------------------------------------------------------------------------- |
1143 // JSInstanceOf | 1166 // JSInstanceOf |
1144 // Test that instanceOf is reduced if and only if the right-hand side is a | 1167 // Test that instanceOf is reduced if and only if the right-hand side is a |
1145 // function constant. Functional correctness is ensured elsewhere. | 1168 // function constant. Functional correctness is ensured elsewhere. |
1146 | 1169 |
1147 | 1170 |
1148 TEST_F(JSTypedLoweringTest, JSInstanceOfSpecializationWithoutSmiCheck) { | 1171 TEST_F(JSTypedLoweringTest, JSInstanceOfSpecializationWithoutSmiCheck) { |
1149 Node* const context = Parameter(Type::Any()); | 1172 Node* const context = Parameter(Type::Any()); |
1150 Node* const frame_state = EmptyFrameState(); | 1173 Node* const frame_state = EmptyFrameState(); |
1151 Node* const effect = graph()->start(); | 1174 Node* const effect = graph()->start(); |
1152 Node* const control = graph()->start(); | 1175 Node* const control = graph()->start(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, | 1221 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, |
1199 frame_state, effect, control); | 1222 frame_state, effect, control); |
1200 Reduction r = Reduce(instanceOf); | 1223 Reduction r = Reduce(instanceOf); |
1201 ASSERT_FALSE(r.Changed()); | 1224 ASSERT_FALSE(r.Changed()); |
1202 ASSERT_EQ(instanceOf, dummy->InputAt(0)); | 1225 ASSERT_EQ(instanceOf, dummy->InputAt(0)); |
1203 } | 1226 } |
1204 | 1227 |
1205 } // namespace compiler | 1228 } // namespace compiler |
1206 } // namespace internal | 1229 } // namespace internal |
1207 } // namespace v8 | 1230 } // namespace v8 |
OLD | NEW |