| Index: test/unittests/compiler/js-typed-lowering-unittest.cc
|
| diff --git a/test/unittests/compiler/js-typed-lowering-unittest.cc b/test/unittests/compiler/js-typed-lowering-unittest.cc
|
| index 2cc48e797dbbc2ea4ce7ec1089ef3f69e9488733..0a8c8487ed901ef43c6afab0adf47edbe61765ed 100644
|
| --- a/test/unittests/compiler/js-typed-lowering-unittest.cc
|
| +++ b/test/unittests/compiler/js-typed-lowering-unittest.cc
|
| @@ -927,6 +927,40 @@ TEST_F(JSTypedLoweringTest, JSLoadDynamicGlobal) {
|
| }
|
| }
|
|
|
| +
|
| +// -----------------------------------------------------------------------------
|
| +// JSLoadDynamicContext
|
| +
|
| +
|
| +TEST_F(JSTypedLoweringTest, JSLoadDynamicContext) {
|
| + Node* const context = Parameter(Type::Any());
|
| + Node* const frame_state = EmptyFrameState();
|
| + Node* const effect = graph()->start();
|
| + Node* const control = graph()->start();
|
| + Handle<String> name = factory()->object_string();
|
| + for (int i = 0; i < DynamicContextAccess::kMaxCheckDepth; ++i) {
|
| + uint32_t bitset = 1 << i; // Only single check.
|
| + Reduction r = Reduce(
|
| + graph()->NewNode(javascript()->LoadDynamicContext(name, bitset, 23, 42),
|
| + context, context, frame_state, effect, control));
|
| + ASSERT_TRUE(r.Changed());
|
| + EXPECT_THAT(
|
| + r.replacement(),
|
| + IsPhi(kMachAnyTagged,
|
| + IsLoadContext(ContextAccess(23, 42, false), context), _,
|
| + IsMerge(
|
| + IsIfTrue(IsBranch(
|
| + IsReferenceEqual(
|
| + Type::Tagged(),
|
| + IsLoadContext(
|
| + ContextAccess(i, Context::EXTENSION_INDEX, false),
|
| + context),
|
| + IsNumberConstant(BitEq(0.0))),
|
| + control)),
|
| + _)));
|
| + }
|
| +}
|
| +
|
| #if V8_TURBOFAN_TARGET
|
|
|
| // -----------------------------------------------------------------------------
|
|
|