Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: test/unittests/compiler/js-create-lowering-unittest.cc

Issue 1573153002: [turbofan] Use inline allocation for closures. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/js-create-lowering.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/js-operator.h" 9 #include "src/compiler/js-operator.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 Reduction r = Reduce(graph()->NewNode( 165 Reduction r = Reduce(graph()->NewNode(
166 javascript()->CreateArguments(CreateArgumentsType::kRestParameter), 166 javascript()->CreateArguments(CreateArgumentsType::kRestParameter),
167 closure, context, frame_state_inner, effect, control)); 167 closure, context, frame_state_inner, effect, control));
168 ASSERT_TRUE(r.Changed()); 168 ASSERT_TRUE(r.Changed());
169 EXPECT_THAT(r.replacement(), 169 EXPECT_THAT(r.replacement(),
170 IsFinishRegion( 170 IsFinishRegion(
171 IsAllocate(IsNumberConstant(JSArray::kSize), _, control), _)); 171 IsAllocate(IsNumberConstant(JSArray::kSize), _, control), _));
172 } 172 }
173 173
174 // ----------------------------------------------------------------------------- 174 // -----------------------------------------------------------------------------
175 // JSCreateClosure
176
177 TEST_F(JSCreateLoweringTest, JSCreateClosureViaInlinedAllocation) {
178 Node* const context = UndefinedConstant();
179 Node* const effect = graph()->start();
180 Node* const control = graph()->start();
181 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared());
182 Reduction r =
183 Reduce(graph()->NewNode(javascript()->CreateClosure(shared, NOT_TENURED),
184 context, effect, control));
185 ASSERT_TRUE(r.Changed());
186 EXPECT_THAT(r.replacement(),
187 IsFinishRegion(IsAllocate(IsNumberConstant(JSFunction::kSize),
188 IsBeginRegion(_), control),
189 _));
190 }
191
192 // -----------------------------------------------------------------------------
175 // JSCreateFunctionContext 193 // JSCreateFunctionContext
176 194
177 TEST_F(JSCreateLoweringTest, JSCreateFunctionContextViaInlinedAllocation) { 195 TEST_F(JSCreateLoweringTest, JSCreateFunctionContextViaInlinedAllocation) {
178 Node* const closure = Parameter(Type::Any()); 196 Node* const closure = Parameter(Type::Any());
179 Node* const context = Parameter(Type::Any()); 197 Node* const context = Parameter(Type::Any());
180 Node* const effect = graph()->start(); 198 Node* const effect = graph()->start();
181 Node* const control = graph()->start(); 199 Node* const control = graph()->start();
182 Reduction const r = 200 Reduction const r =
183 Reduce(graph()->NewNode(javascript()->CreateFunctionContext(8), closure, 201 Reduce(graph()->NewNode(javascript()->CreateFunctionContext(8), closure,
184 context, effect, control)); 202 context, effect, control));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 EXPECT_THAT(r.replacement(), 245 EXPECT_THAT(r.replacement(),
228 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( 246 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor(
229 Context::MIN_CONTEXT_SLOTS + 1)), 247 Context::MIN_CONTEXT_SLOTS + 1)),
230 IsBeginRegion(_), control), 248 IsBeginRegion(_), control),
231 _)); 249 _));
232 } 250 }
233 251
234 } // namespace compiler 252 } // namespace compiler
235 } // namespace internal 253 } // namespace internal
236 } // namespace v8 254 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-create-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698