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

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

Issue 769193003: [turbofan] Cache the JSStoreProperty operator(s). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 | « src/compiler/js-operator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/js-operator-unittest.cc
diff --git a/test/unittests/compiler/js-operator-unittest.cc b/test/unittests/compiler/js-operator-unittest.cc
index f16629dcd709bf03d585cd42421410eb755a0546..fc8dfba75f27205e204ad9a360e9103a875f95a4 100644
--- a/test/unittests/compiler/js-operator-unittest.cc
+++ b/test/unittests/compiler/js-operator-unittest.cc
@@ -13,6 +13,7 @@ namespace compiler {
// -----------------------------------------------------------------------------
// Shared operators.
+
namespace {
struct SharedOperator {
@@ -142,6 +143,73 @@ TEST_P(JSSharedOperatorTest, Properties) {
INSTANTIATE_TEST_CASE_P(JSOperatorTest, JSSharedOperatorTest,
::testing::ValuesIn(kSharedOperators));
+
+// -----------------------------------------------------------------------------
+// JSStoreProperty.
+
+
+class JSStorePropertyOperatorTest
+ : public TestWithZone,
+ public ::testing::WithParamInterface<StrictMode> {};
+
+
+TEST_P(JSStorePropertyOperatorTest, InstancesAreGloballyShared) {
+ const StrictMode mode = GetParam();
+ JSOperatorBuilder javascript1(zone());
+ JSOperatorBuilder javascript2(zone());
+ EXPECT_EQ(javascript1.StoreProperty(mode), javascript2.StoreProperty(mode));
+}
+
+
+TEST_P(JSStorePropertyOperatorTest, NumberOfInputsAndOutputs) {
+ JSOperatorBuilder javascript(zone());
+ const StrictMode mode = GetParam();
+ const Operator* op = javascript.StoreProperty(mode);
+
+ // TODO(jarin): Get rid of this hack.
+ const int frame_state_input_count = FLAG_turbo_deoptimization ? 1 : 0;
+ EXPECT_EQ(3, op->ValueInputCount());
+ EXPECT_EQ(1, OperatorProperties::GetContextInputCount(op));
+ EXPECT_EQ(frame_state_input_count,
+ OperatorProperties::GetFrameStateInputCount(op));
+ EXPECT_EQ(1, op->EffectInputCount());
+ EXPECT_EQ(1, op->ControlInputCount());
+ EXPECT_EQ(6 + frame_state_input_count,
+ OperatorProperties::GetTotalInputCount(op));
+
+ EXPECT_EQ(0, op->ValueOutputCount());
+ EXPECT_EQ(1, op->EffectOutputCount());
+ EXPECT_EQ(0, op->ControlOutputCount());
+}
+
+
+TEST_P(JSStorePropertyOperatorTest, OpcodeIsCorrect) {
+ JSOperatorBuilder javascript(zone());
+ const StrictMode mode = GetParam();
+ const Operator* op = javascript.StoreProperty(mode);
+ EXPECT_EQ(IrOpcode::kJSStoreProperty, op->opcode());
+}
+
+
+TEST_P(JSStorePropertyOperatorTest, OpParameter) {
+ JSOperatorBuilder javascript(zone());
+ const StrictMode mode = GetParam();
+ const Operator* op = javascript.StoreProperty(mode);
+ EXPECT_EQ(mode, OpParameter<StrictMode>(op));
+}
+
+
+TEST_P(JSStorePropertyOperatorTest, Properties) {
+ JSOperatorBuilder javascript(zone());
+ const StrictMode mode = GetParam();
+ const Operator* op = javascript.StoreProperty(mode);
+ EXPECT_EQ(Operator::kNoProperties, op->properties());
+}
+
+
+INSTANTIATE_TEST_CASE_P(JSOperatorTest, JSStorePropertyOperatorTest,
+ ::testing::Values(SLOPPY, STRICT));
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/compiler/js-operator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698