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 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 Node* const context = Parameter(Type::Any()); | 1152 Node* const context = Parameter(Type::Any()); |
1153 Node* const effect = graph()->start(); | 1153 Node* const effect = graph()->start(); |
1154 Node* const control = graph()->start(); | 1154 Node* const control = graph()->start(); |
1155 Reduction const r = | 1155 Reduction const r = |
1156 Reduce(graph()->NewNode(javascript()->CreateFunctionContext(8), closure, | 1156 Reduce(graph()->NewNode(javascript()->CreateFunctionContext(8), closure, |
1157 context, effect, control)); | 1157 context, effect, control)); |
1158 ASSERT_TRUE(r.Changed()); | 1158 ASSERT_TRUE(r.Changed()); |
1159 EXPECT_THAT(r.replacement(), | 1159 EXPECT_THAT(r.replacement(), |
1160 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( | 1160 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( |
1161 8 + Context::MIN_CONTEXT_SLOTS)), | 1161 8 + Context::MIN_CONTEXT_SLOTS)), |
1162 IsBeginRegion(_), control), | 1162 IsBeginRegion(effect), control), |
1163 _)); | 1163 _)); |
1164 } | 1164 } |
1165 | 1165 |
1166 | 1166 |
1167 TEST_F(JSTypedLoweringTest, JSCreateFunctionContextViaStub) { | 1167 TEST_F(JSTypedLoweringTest, JSCreateFunctionContextViaStub) { |
1168 Node* const closure = Parameter(Type::Any()); | 1168 Node* const closure = Parameter(Type::Any()); |
1169 Node* const context = Parameter(Type::Any()); | 1169 Node* const context = Parameter(Type::Any()); |
1170 Node* const effect = graph()->start(); | 1170 Node* const effect = graph()->start(); |
1171 Node* const control = graph()->start(); | 1171 Node* const control = graph()->start(); |
1172 Reduction const r = | 1172 Reduction const r = |
(...skipping 15 matching lines...) Expand all Loading... |
1188 Node* const object = Parameter(Type::Receiver()); | 1188 Node* const object = Parameter(Type::Receiver()); |
1189 Node* const closure = Parameter(Type::Function()); | 1189 Node* const closure = Parameter(Type::Function()); |
1190 Node* const context = Parameter(Type::Any()); | 1190 Node* const context = Parameter(Type::Any()); |
1191 Node* const frame_state = EmptyFrameState(); | 1191 Node* const frame_state = EmptyFrameState(); |
1192 Node* const effect = graph()->start(); | 1192 Node* const effect = graph()->start(); |
1193 Node* const control = graph()->start(); | 1193 Node* const control = graph()->start(); |
1194 Reduction r = | 1194 Reduction r = |
1195 Reduce(graph()->NewNode(javascript()->CreateWithContext(), object, | 1195 Reduce(graph()->NewNode(javascript()->CreateWithContext(), object, |
1196 closure, context, frame_state, effect, control)); | 1196 closure, context, frame_state, effect, control)); |
1197 ASSERT_TRUE(r.Changed()); | 1197 ASSERT_TRUE(r.Changed()); |
1198 EXPECT_THAT(r.replacement(), | 1198 EXPECT_THAT( |
1199 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( | 1199 r.replacement(), |
1200 Context::MIN_CONTEXT_SLOTS)), | 1200 IsFinishRegion( |
1201 IsBeginRegion(_), control), | 1201 IsAllocate( |
1202 _)); | 1202 IsNumberConstant(Context::SizeFor(Context::MIN_CONTEXT_SLOTS)), |
| 1203 IsBeginRegion(IsLoadField( |
| 1204 AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), |
| 1205 context, effect, control)), |
| 1206 control), |
| 1207 _)); |
1203 } | 1208 } |
1204 | 1209 |
1205 | 1210 |
1206 // ----------------------------------------------------------------------------- | 1211 // ----------------------------------------------------------------------------- |
1207 // JSInstanceOf | 1212 // JSInstanceOf |
1208 // Test that instanceOf is reduced if and only if the right-hand side is a | 1213 // Test that instanceOf is reduced if and only if the right-hand side is a |
1209 // function constant. Functional correctness is ensured elsewhere. | 1214 // function constant. Functional correctness is ensured elsewhere. |
1210 | 1215 |
1211 | 1216 |
1212 TEST_F(JSTypedLoweringTest, JSInstanceOfSpecializationWithoutSmiCheck) { | 1217 TEST_F(JSTypedLoweringTest, JSInstanceOfSpecializationWithoutSmiCheck) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, | 1267 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, |
1263 frame_state, effect, control); | 1268 frame_state, effect, control); |
1264 Reduction r = Reduce(instanceOf); | 1269 Reduction r = Reduce(instanceOf); |
1265 ASSERT_FALSE(r.Changed()); | 1270 ASSERT_FALSE(r.Changed()); |
1266 ASSERT_EQ(instanceOf, dummy->InputAt(0)); | 1271 ASSERT_EQ(instanceOf, dummy->InputAt(0)); |
1267 } | 1272 } |
1268 | 1273 |
1269 } // namespace compiler | 1274 } // namespace compiler |
1270 } // namespace internal | 1275 } // namespace internal |
1271 } // namespace v8 | 1276 } // namespace v8 |
OLD | NEW |