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

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

Issue 2680313002: Count closures using the feedback vector cell map, specialize if count==1. (Closed)
Patch Set: Only specialize if compiling from bytecode Created 3 years, 10 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 | « test/debugger/debug/debug-set-variable-value.js ('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/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
135 Reduction r = Reduce(graph()->NewNode( 135 Reduction r = Reduce(graph()->NewNode(
136 javascript()->CreateArguments(CreateArgumentsType::kRestParameter), 136 javascript()->CreateArguments(CreateArgumentsType::kRestParameter),
137 closure, context, frame_state_inner, effect)); 137 closure, context, frame_state_inner, effect));
138 ASSERT_TRUE(r.Changed()); 138 ASSERT_TRUE(r.Changed());
139 EXPECT_THAT( 139 EXPECT_THAT(
140 r.replacement(), 140 r.replacement(),
141 IsFinishRegion(IsAllocate(IsNumberConstant(JSArray::kSize), _, _), _)); 141 IsFinishRegion(IsAllocate(IsNumberConstant(JSArray::kSize), _, _), _));
142 } 142 }
143 143
144 // ----------------------------------------------------------------------------- 144 // -----------------------------------------------------------------------------
145 // JSCreateClosure
146
147 TEST_F(JSCreateLoweringTest, JSCreateClosureViaInlinedAllocation) {
148 if (!FLAG_turbo_lower_create_closure) return;
149 Node* const context = UndefinedConstant();
150 Node* const effect = graph()->start();
151 Node* const control = graph()->start();
152 Handle<SharedFunctionInfo> shared(isolate()->number_function()->shared());
153
154 // Create a mock feedback vector. It just has to be an array with an array
155 // in slot 0.
156 Handle<FixedArray> array = isolate()->factory()->NewFixedArray(
157 FeedbackVector::kReservedIndexCount + 1);
158 array->set_map_no_write_barrier(isolate()->heap()->feedback_vector_map());
159 Handle<FeedbackVector> vector = Handle<FeedbackVector>::cast(array);
160 FeedbackSlot slot(0);
161 vector->Set(slot, *vector);
162 VectorSlotPair pair(vector, slot);
163
164 Reduction r = Reduce(
165 graph()->NewNode(javascript()->CreateClosure(shared, pair, NOT_TENURED),
166 context, effect, control));
167 ASSERT_TRUE(r.Changed());
168 EXPECT_THAT(r.replacement(),
169 IsFinishRegion(IsAllocate(IsNumberConstant(JSFunction::kSize),
170 IsBeginRegion(_), control),
171 _));
172 }
173
174 // -----------------------------------------------------------------------------
175 // JSCreateFunctionContext 145 // JSCreateFunctionContext
176 146
177 TEST_F(JSCreateLoweringTest, JSCreateFunctionContextViaInlinedAllocation) { 147 TEST_F(JSCreateLoweringTest, JSCreateFunctionContextViaInlinedAllocation) {
178 Node* const closure = Parameter(Type::Any()); 148 Node* const closure = Parameter(Type::Any());
179 Node* const context = Parameter(Type::Any()); 149 Node* const context = Parameter(Type::Any());
180 Node* const effect = graph()->start(); 150 Node* const effect = graph()->start();
181 Node* const control = graph()->start(); 151 Node* const control = graph()->start();
182 Reduction const r = Reduce( 152 Reduction const r = Reduce(
183 graph()->NewNode(javascript()->CreateFunctionContext(8, FUNCTION_SCOPE), 153 graph()->NewNode(javascript()->CreateFunctionContext(8, FUNCTION_SCOPE),
184 closure, context, effect, control)); 154 closure, context, effect, control));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 EXPECT_THAT(r.replacement(), 199 EXPECT_THAT(r.replacement(),
230 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( 200 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor(
231 Context::MIN_CONTEXT_SLOTS + 1)), 201 Context::MIN_CONTEXT_SLOTS + 1)),
232 IsBeginRegion(_), control), 202 IsBeginRegion(_), control),
233 _)); 203 _));
234 } 204 }
235 205
236 } // namespace compiler 206 } // namespace compiler
237 } // namespace internal 207 } // namespace internal
238 } // namespace v8 208 } // namespace v8
OLDNEW
« no previous file with comments | « test/debugger/debug/debug-set-variable-value.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698