Merge V8 5.3.332.45. DO NOT MERGE
Test: Manual
FPIIM-449
Change-Id: Id3254828b068abdea3cb10442e0172a8c9a98e03
(cherry picked from commit 13e2dadd00298019ed862f2b2fc5068bba730bcf)
diff --git a/test/cctest/compiler/test-js-context-specialization.cc b/test/cctest/compiler/test-js-context-specialization.cc
index c7cd47a..e9bf064 100644
--- a/test/cctest/compiler/test-js-context-specialization.cc
+++ b/test/cctest/compiler/test-js-context-specialization.cc
@@ -186,81 +186,6 @@
}
-// 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)"
@@ -300,10 +225,14 @@
FunctionTester T(
"(function() { if (false) { var x = 1; } function inc(a)"
" { return x; } return inc; })()"); // x is undefined!
-
- CHECK(T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsUndefined());
- CHECK(T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsUndefined());
- CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsUndefined());
+ i::Isolate* isolate = CcTest::i_isolate();
+ CHECK(
+ T.Call(T.Val(0.0), T.Val(0.0)).ToHandleChecked()->IsUndefined(isolate));
+ CHECK(
+ T.Call(T.Val(2.0), T.Val(0.0)).ToHandleChecked()->IsUndefined(isolate));
+ CHECK(T.Call(T.Val(-2.1), T.Val(0.0))
+ .ToHandleChecked()
+ ->IsUndefined(isolate));
}
{