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

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

Issue 2504153002: [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: REBASE. Created 3 years, 12 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
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"
11 #include "src/compiler/machine-operator.h" 11 #include "src/compiler/machine-operator.h"
12 #include "src/compiler/node-properties.h" 12 #include "src/compiler/node-properties.h"
13 #include "src/compiler/operator-properties.h" 13 #include "src/compiler/operator-properties.h"
14 #include "src/isolate-inl.h" 14 #include "src/isolate-inl.h"
15 #include "src/type-feedback-vector.h"
15 #include "test/unittests/compiler/compiler-test-utils.h" 16 #include "test/unittests/compiler/compiler-test-utils.h"
16 #include "test/unittests/compiler/graph-unittest.h" 17 #include "test/unittests/compiler/graph-unittest.h"
17 #include "test/unittests/compiler/node-test-utils.h" 18 #include "test/unittests/compiler/node-test-utils.h"
18 #include "testing/gmock-support.h" 19 #include "testing/gmock-support.h"
19 20
20 using testing::_; 21 using testing::_;
21 using testing::BitEq; 22 using testing::BitEq;
22 using testing::IsNaN; 23 using testing::IsNaN;
23 24
24 namespace v8 { 25 namespace v8 {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 136 }
136 137
137 // ----------------------------------------------------------------------------- 138 // -----------------------------------------------------------------------------
138 // JSCreateClosure 139 // JSCreateClosure
139 140
140 TEST_F(JSCreateLoweringTest, JSCreateClosureViaInlinedAllocation) { 141 TEST_F(JSCreateLoweringTest, JSCreateClosureViaInlinedAllocation) {
141 Node* const context = UndefinedConstant(); 142 Node* const context = UndefinedConstant();
142 Node* const effect = graph()->start(); 143 Node* const effect = graph()->start();
143 Node* const control = graph()->start(); 144 Node* const control = graph()->start();
144 Handle<SharedFunctionInfo> shared(isolate()->number_function()->shared()); 145 Handle<SharedFunctionInfo> shared(isolate()->number_function()->shared());
145 Reduction r = 146
146 Reduce(graph()->NewNode(javascript()->CreateClosure(shared, NOT_TENURED), 147 // Create a mock feedback vector. It just has to be an array with an array
147 context, effect, control)); 148 // in slot 0.
149 Handle<TypeFeedbackVector> vector =
150 Handle<TypeFeedbackVector>::cast(isolate()->factory()->NewFixedArray(
151 TypeFeedbackVector::kReservedIndexCount + 1));
152 FeedbackVectorSlot slot(0);
153 vector->Set(slot, *vector);
154 VectorSlotPair pair(vector, slot);
155
156 Reduction r = Reduce(
157 graph()->NewNode(javascript()->CreateClosure(shared, pair, NOT_TENURED),
158 context, effect, control));
148 ASSERT_TRUE(r.Changed()); 159 ASSERT_TRUE(r.Changed());
149 EXPECT_THAT(r.replacement(), 160 EXPECT_THAT(r.replacement(),
150 IsFinishRegion(IsAllocate(IsNumberConstant(JSFunction::kSize), 161 IsFinishRegion(IsAllocate(IsNumberConstant(JSFunction::kSize),
151 IsBeginRegion(_), control), 162 IsBeginRegion(_), control),
152 _)); 163 _));
153 } 164 }
154 165
155 // ----------------------------------------------------------------------------- 166 // -----------------------------------------------------------------------------
156 // JSCreateFunctionContext 167 // JSCreateFunctionContext
157 168
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 EXPECT_THAT(r.replacement(), 221 EXPECT_THAT(r.replacement(),
211 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( 222 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor(
212 Context::MIN_CONTEXT_SLOTS + 1)), 223 Context::MIN_CONTEXT_SLOTS + 1)),
213 IsBeginRegion(_), control), 224 IsBeginRegion(_), control),
214 _)); 225 _));
215 } 226 }
216 227
217 } // namespace compiler 228 } // namespace compiler
218 } // namespace internal 229 } // namespace internal
219 } // namespace v8 230 } // namespace v8
OLDNEW
« no previous file with comments | « test/mjsunit/strong-rooted-literals.js ('k') | test/unittests/interpreter/bytecode-array-builder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698