OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/js-create-lowering.h" | 5 #include "src/compiler/js-create-lowering.h" |
6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
7 #include "src/compilation-dependencies.h" | 7 #include "src/compilation-dependencies.h" |
8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/js-operator.h" | 10 #include "src/compiler/js-operator.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( | 167 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( |
168 8 + Context::MIN_CONTEXT_SLOTS)), | 168 8 + Context::MIN_CONTEXT_SLOTS)), |
169 IsBeginRegion(_), control), | 169 IsBeginRegion(_), control), |
170 _)); | 170 _)); |
171 } | 171 } |
172 | 172 |
173 // ----------------------------------------------------------------------------- | 173 // ----------------------------------------------------------------------------- |
174 // JSCreateWithContext | 174 // JSCreateWithContext |
175 | 175 |
176 TEST_F(JSCreateLoweringTest, JSCreateWithContext) { | 176 TEST_F(JSCreateLoweringTest, JSCreateWithContext) { |
| 177 Handle<ScopeInfo> scope_info(factory()->NewScopeInfo(1)); |
177 Node* const object = Parameter(Type::Receiver()); | 178 Node* const object = Parameter(Type::Receiver()); |
178 Node* const closure = Parameter(Type::Function()); | 179 Node* const closure = Parameter(Type::Function()); |
179 Node* const context = Parameter(Type::Any()); | 180 Node* const context = Parameter(Type::Any()); |
180 Node* const effect = graph()->start(); | 181 Node* const effect = graph()->start(); |
181 Node* const control = graph()->start(); | 182 Node* const control = graph()->start(); |
182 Reduction r = | 183 Reduction r = |
183 Reduce(graph()->NewNode(javascript()->CreateWithContext(), object, | 184 Reduce(graph()->NewNode(javascript()->CreateWithContext(scope_info), |
184 closure, context, effect, control)); | 185 object, closure, context, effect, control)); |
185 ASSERT_TRUE(r.Changed()); | 186 ASSERT_TRUE(r.Changed()); |
186 EXPECT_THAT(r.replacement(), | 187 EXPECT_THAT(r.replacement(), |
187 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( | 188 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( |
188 Context::MIN_CONTEXT_SLOTS)), | 189 Context::MIN_CONTEXT_SLOTS)), |
189 IsBeginRegion(_), control), | 190 IsBeginRegion(_), control), |
190 _)); | 191 _)); |
191 } | 192 } |
192 | 193 |
193 // ----------------------------------------------------------------------------- | 194 // ----------------------------------------------------------------------------- |
194 // JSCreateCatchContext | 195 // JSCreateCatchContext |
(...skipping 13 matching lines...) Expand all Loading... |
208 EXPECT_THAT(r.replacement(), | 209 EXPECT_THAT(r.replacement(), |
209 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( | 210 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( |
210 Context::MIN_CONTEXT_SLOTS + 1)), | 211 Context::MIN_CONTEXT_SLOTS + 1)), |
211 IsBeginRegion(_), control), | 212 IsBeginRegion(_), control), |
212 _)); | 213 _)); |
213 } | 214 } |
214 | 215 |
215 } // namespace compiler | 216 } // namespace compiler |
216 } // namespace internal | 217 } // namespace internal |
217 } // namespace v8 | 218 } // namespace v8 |
OLD | NEW |