| Index: test/cctest/compiler/test-js-context-specialization.cc
|
| diff --git a/test/cctest/compiler/test-js-context-specialization.cc b/test/cctest/compiler/test-js-context-specialization.cc
|
| index c7cd47a55cd57e32b5bf00be2f91e6d73784e31e..9c024f8816d24e4f10b0283f2d5a7f9086525594 100644
|
| --- a/test/cctest/compiler/test-js-context-specialization.cc
|
| +++ b/test/cctest/compiler/test-js-context-specialization.cc
|
| @@ -186,81 +186,6 @@ TEST(ReduceJSStoreContext) {
|
| }
|
|
|
|
|
| -// TODO(titzer): factor out common code with effects checking in typed lowering.
|
| -static void CheckEffectInput(Node* effect, Node* use) {
|
| - CHECK_EQ(effect, NodeProperties::GetEffectInput(use));
|
| -}
|
| -
|
| -
|
| -TEST(SpecializeToContext) {
|
| - ContextSpecializationTester t;
|
| -
|
| - Node* start = t.graph()->NewNode(t.common()->Start(0));
|
| - t.graph()->SetStart(start);
|
| -
|
| - // Make a context and initialize it a bit for this test.
|
| - Handle<Context> native = t.factory()->NewNativeContext();
|
| - Handle<Object> expected = t.factory()->InternalizeUtf8String("gboy!");
|
| - const int slot = Context::NATIVE_CONTEXT_INDEX;
|
| - native->set(slot, *expected);
|
| -
|
| - Node* const_context = t.jsgraph()->Constant(native);
|
| - Node* param_context = t.graph()->NewNode(t.common()->Parameter(0), start);
|
| -
|
| - {
|
| - // Check that specialization replaces values and forwards effects
|
| - // correctly, and folds values from constant and non-constant contexts
|
| - Node* effect_in = start;
|
| - Node* load = t.graph()->NewNode(t.javascript()->LoadContext(0, slot, true),
|
| - const_context, const_context, effect_in);
|
| -
|
| -
|
| - Node* value_use =
|
| - t.graph()->NewNode(t.simplified()->ChangeTaggedToInt32(), load);
|
| - Node* other_load =
|
| - t.graph()->NewNode(t.javascript()->LoadContext(0, slot, true),
|
| - param_context, param_context, load);
|
| - Node* effect_use = other_load;
|
| - Node* other_use =
|
| - t.graph()->NewNode(t.simplified()->ChangeTaggedToInt32(), other_load);
|
| -
|
| - Node* add = t.graph()->NewNode(
|
| - t.javascript()->Add(BinaryOperationHints::Any()), value_use, other_use,
|
| - param_context, t.jsgraph()->EmptyFrameState(),
|
| - t.jsgraph()->EmptyFrameState(), other_load, start);
|
| -
|
| - Node* ret =
|
| - t.graph()->NewNode(t.common()->Return(), add, effect_use, start);
|
| - Node* end = t.graph()->NewNode(t.common()->End(1), ret);
|
| - USE(end);
|
| - t.graph()->SetEnd(end);
|
| -
|
| - // Double check the above graph is what we expect, or the test is broken.
|
| - CheckEffectInput(effect_in, load);
|
| - CheckEffectInput(load, effect_use);
|
| -
|
| - // Perform the reduction on the entire graph.
|
| - GraphReducer graph_reducer(t.main_zone(), t.graph());
|
| - JSContextSpecialization spec(&graph_reducer, t.jsgraph(),
|
| - MaybeHandle<Context>());
|
| - graph_reducer.AddReducer(&spec);
|
| - graph_reducer.ReduceGraph();
|
| -
|
| - // Effects should have been forwarded (not replaced with a value).
|
| - CheckEffectInput(effect_in, effect_use);
|
| -
|
| - // Use of {other_load} should not have been replaced.
|
| - CHECK_EQ(other_load, other_use->InputAt(0));
|
| -
|
| - Node* replacement = value_use->InputAt(0);
|
| - HeapObjectMatcher match(replacement);
|
| - CHECK(match.HasValue());
|
| - CHECK_EQ(*expected, *match.Value());
|
| - }
|
| - // TODO(titzer): clean up above test and test more complicated effects.
|
| -}
|
| -
|
| -
|
| TEST(SpecializeJSFunction_ToConstant1) {
|
| FunctionTester T(
|
| "(function() { var x = 1; function inc(a)"
|
|
|