| 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 904d5f7406d028dac6e9a186c17c0b98b0061656..b51b0d01a84c75f82b385700a4d55d1ed229e9db 100644
|
| --- a/test/unittests/compiler/js-typed-lowering-unittest.cc
|
| +++ b/test/unittests/compiler/js-typed-lowering-unittest.cc
|
| @@ -87,8 +87,9 @@ class JSTypedLoweringTest : public TypedGraphTest {
|
| // TODO(titzer): mock the GraphReducer here for better unit testing.
|
| GraphReducer graph_reducer(zone(), graph());
|
| JSTypedLowering reducer(&graph_reducer, &deps_,
|
| - JSTypedLowering::kDeoptimizationEnabled, &jsgraph,
|
| - zone());
|
| + JSTypedLowering::kDeoptimizationEnabled |
|
| + JSTypedLowering::kTypeFeedbackEnabled,
|
| + &jsgraph, zone());
|
| return reducer.Reduce(node);
|
| }
|
|
|
| @@ -838,6 +839,52 @@ TEST_F(JSTypedLoweringTest, JSAddWithString) {
|
| lhs, rhs, context, frame_state0, effect, control));
|
| }
|
|
|
| +TEST_F(JSTypedLoweringTest, JSAddSmis) {
|
| + BinaryOperationHints const hints(BinaryOperationHints::kSignedSmall,
|
| + BinaryOperationHints::kSignedSmall,
|
| + BinaryOperationHints::kSignedSmall);
|
| + TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
|
| + Node* lhs = Parameter(Type::Number(), 0);
|
| + Node* rhs = Parameter(Type::Number(), 1);
|
| + Node* context = Parameter(Type::Any(), 2);
|
| + Node* frame_state0 = EmptyFrameState();
|
| + Node* frame_state1 = EmptyFrameState();
|
| + Node* effect = graph()->start();
|
| + Node* control = graph()->start();
|
| + Reduction r =
|
| + Reduce(graph()->NewNode(javascript()->Add(hints), lhs, rhs, context,
|
| + frame_state0, frame_state1, effect, control));
|
| + ASSERT_TRUE(r.Changed());
|
| + EXPECT_THAT(r.replacement(),
|
| + IsSpeculativeNumberAdd(BinaryOperationHints::kSignedSmall, lhs,
|
| + rhs, frame_state1, effect, control));
|
| + }
|
| +}
|
| +
|
| +// -----------------------------------------------------------------------------
|
| +// JSSubtract
|
| +
|
| +TEST_F(JSTypedLoweringTest, JSSubtractSmis) {
|
| + BinaryOperationHints const hints(BinaryOperationHints::kSignedSmall,
|
| + BinaryOperationHints::kSignedSmall,
|
| + BinaryOperationHints::kSignedSmall);
|
| + TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
|
| + Node* lhs = Parameter(Type::Number(), 0);
|
| + Node* rhs = Parameter(Type::Number(), 1);
|
| + Node* context = Parameter(Type::Any(), 2);
|
| + Node* frame_state0 = EmptyFrameState();
|
| + Node* frame_state1 = EmptyFrameState();
|
| + Node* effect = graph()->start();
|
| + Node* control = graph()->start();
|
| + Reduction r = Reduce(graph()->NewNode(javascript()->Subtract(hints), lhs,
|
| + rhs, context, frame_state0,
|
| + frame_state1, effect, control));
|
| + ASSERT_TRUE(r.Changed());
|
| + EXPECT_THAT(r.replacement(), IsSpeculativeNumberSubtract(
|
| + BinaryOperationHints::kSignedSmall, lhs,
|
| + rhs, frame_state1, effect, control));
|
| + }
|
| +}
|
|
|
| // -----------------------------------------------------------------------------
|
| // JSInstanceOf
|
|
|