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

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

Issue 2504153002: [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: REBASE. Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: test/unittests/compiler/js-create-lowering-unittest.cc
diff --git a/test/unittests/compiler/js-create-lowering-unittest.cc b/test/unittests/compiler/js-create-lowering-unittest.cc
index a32920ae04e3d9de3364f2c6ddc2e6b9f889c90f..825c3b8049b3f6824517fec004f5e18c9f2f0696 100644
--- a/test/unittests/compiler/js-create-lowering-unittest.cc
+++ b/test/unittests/compiler/js-create-lowering-unittest.cc
@@ -12,6 +12,7 @@
#include "src/compiler/node-properties.h"
#include "src/compiler/operator-properties.h"
#include "src/isolate-inl.h"
+#include "src/type-feedback-vector.h"
#include "test/unittests/compiler/compiler-test-utils.h"
#include "test/unittests/compiler/graph-unittest.h"
#include "test/unittests/compiler/node-test-utils.h"
@@ -142,9 +143,19 @@ TEST_F(JSCreateLoweringTest, JSCreateClosureViaInlinedAllocation) {
Node* const effect = graph()->start();
Node* const control = graph()->start();
Handle<SharedFunctionInfo> shared(isolate()->number_function()->shared());
- Reduction r =
- Reduce(graph()->NewNode(javascript()->CreateClosure(shared, NOT_TENURED),
- context, effect, control));
+
+ // Create a mock feedback vector. It just has to be an array with an array
+ // in slot 0.
+ Handle<TypeFeedbackVector> vector =
+ Handle<TypeFeedbackVector>::cast(isolate()->factory()->NewFixedArray(
+ TypeFeedbackVector::kReservedIndexCount + 1));
+ FeedbackVectorSlot slot(0);
+ vector->Set(slot, *vector);
+ VectorSlotPair pair(vector, slot);
+
+ Reduction r = Reduce(
+ graph()->NewNode(javascript()->CreateClosure(shared, pair, NOT_TENURED),
+ context, effect, control));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(),
IsFinishRegion(IsAllocate(IsNumberConstant(JSFunction::kSize),
« 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