| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 } | 135 } |
| 136 | 136 |
| 137 // ----------------------------------------------------------------------------- | 137 // ----------------------------------------------------------------------------- |
| 138 // JSCreateClosure | 138 // JSCreateClosure |
| 139 | 139 |
| 140 TEST_F(JSCreateLoweringTest, JSCreateClosureViaInlinedAllocation) { | 140 TEST_F(JSCreateLoweringTest, JSCreateClosureViaInlinedAllocation) { |
| 141 Node* const context = UndefinedConstant(); | 141 Node* const context = UndefinedConstant(); |
| 142 Node* const effect = graph()->start(); | 142 Node* const effect = graph()->start(); |
| 143 Node* const control = graph()->start(); | 143 Node* const control = graph()->start(); |
| 144 Handle<SharedFunctionInfo> shared(isolate()->number_function()->shared()); | 144 Handle<SharedFunctionInfo> shared(isolate()->number_function()->shared()); |
| 145 Reduction r = | 145 |
| 146 Reduce(graph()->NewNode(javascript()->CreateClosure(shared, NOT_TENURED), | 146 // Create a mock feedback vector. |
| 147 context, effect, control)); | 147 Zone zone(isolate()->allocator(), ZONE_NAME); |
| 148 FeedbackVectorSpec spec(&zone); |
| 149 spec.AddCreateClosureSlot(1); |
| 150 Handle<TypeFeedbackMetadata> metadata = |
| 151 TypeFeedbackMetadata::New(isolate(), &spec); |
| 152 Handle<TypeFeedbackVector> vector = |
| 153 TypeFeedbackVector::New(isolate(), metadata); |
| 154 DCHECK(vector->slot_count() == 1); |
| 155 FeedbackVectorSlot slot(0); |
| 156 VectorSlotPair pair(vector, slot); |
| 157 |
| 158 Reduction r = Reduce( |
| 159 graph()->NewNode(javascript()->CreateClosure(shared, pair, NOT_TENURED), |
| 160 context, effect, control)); |
| 148 ASSERT_TRUE(r.Changed()); | 161 ASSERT_TRUE(r.Changed()); |
| 149 EXPECT_THAT(r.replacement(), | 162 EXPECT_THAT(r.replacement(), |
| 150 IsFinishRegion(IsAllocate(IsNumberConstant(JSFunction::kSize), | 163 IsFinishRegion(IsAllocate(IsNumberConstant(JSFunction::kSize), |
| 151 IsBeginRegion(_), control), | 164 IsBeginRegion(_), control), |
| 152 _)); | 165 _)); |
| 153 } | 166 } |
| 154 | 167 |
| 155 // ----------------------------------------------------------------------------- | 168 // ----------------------------------------------------------------------------- |
| 156 // JSCreateFunctionContext | 169 // JSCreateFunctionContext |
| 157 | 170 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 EXPECT_THAT(r.replacement(), | 223 EXPECT_THAT(r.replacement(), |
| 211 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( | 224 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( |
| 212 Context::MIN_CONTEXT_SLOTS + 1)), | 225 Context::MIN_CONTEXT_SLOTS + 1)), |
| 213 IsBeginRegion(_), control), | 226 IsBeginRegion(_), control), |
| 214 _)); | 227 _)); |
| 215 } | 228 } |
| 216 | 229 |
| 217 } // namespace compiler | 230 } // namespace compiler |
| 218 } // namespace internal | 231 } // namespace internal |
| 219 } // namespace v8 | 232 } // namespace v8 |
| OLD | NEW |