Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Unified Diff: test/unittests/compiler/js-typed-lowering-unittest.cc

Issue 1921563002: [turbofan] Initial version of number type feedback. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/compiler/turbo-number-feedback.js ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « test/mjsunit/compiler/turbo-number-feedback.js ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698