diff options
author | Michaël Zasso <targos@protonmail.com> | 2016-09-06 22:49:51 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2016-09-22 09:51:19 +0200 |
commit | ec02b811a8a5c999bab4de312be2d732b7d9d50b (patch) | |
tree | ca3068017254f238cf413a451c57a803572983a4 /deps/v8/test/cctest/compiler/test-js-context-specialization.cc | |
parent | d2eb7ce0105369a9cad82787cb33a665e9bd00ad (diff) | |
download | node-new-ec02b811a8a5c999bab4de312be2d732b7d9d50b.tar.gz |
deps: update V8 to 5.4.500.27
Pick up latest commit from the 5.4-lkgr branch.
deps: edit V8 gitignore to allow trace event copy
deps: update V8 trace event to 315bf1e2d45be7d53346c31cfcc37424a32c30c8
deps: edit V8 gitignore to allow gtest_prod.h copy
deps: update V8 gtest to 6f8a66431cb592dad629028a50b3dd418a408c87
PR-URL: https://github.com/nodejs/node/pull/8317
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Diffstat (limited to 'deps/v8/test/cctest/compiler/test-js-context-specialization.cc')
-rw-r--r-- | deps/v8/test/cctest/compiler/test-js-context-specialization.cc | 87 |
1 files changed, 8 insertions, 79 deletions
diff --git a/deps/v8/test/cctest/compiler/test-js-context-specialization.cc b/deps/v8/test/cctest/compiler/test-js-context-specialization.cc index c7cd47a55c..e9bf064750 100644 --- a/deps/v8/test/cctest/compiler/test-js-context-specialization.cc +++ b/deps/v8/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)" @@ -300,10 +225,14 @@ TEST(SpecializeJSFunction_ToConstant_uninit) { 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)); } { |