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

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

Issue 1077343002: [turbofan] Optimize loads of global constants in JSTypedLowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/global-undefined-strict.js ('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-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 8bb5798bd2fe6bbc591f81746ed9e4ca4e981512..d79ff743338dd8cd55a7c3b484fc9c527be9c18c 100644
--- a/test/unittests/compiler/js-typed-lowering-unittest.cc
+++ b/test/unittests/compiler/js-typed-lowering-unittest.cc
@@ -852,6 +852,43 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArrayWithSafeKey) {
}
}
+
+TEST_F(JSTypedLoweringTest, JSLoadNamedGlobalConstants) {
+ Handle<String> names[] = {
+ Handle<String>(isolate()->heap()->undefined_string(), isolate()),
+ Handle<String>(isolate()->heap()->infinity_string(), isolate()),
+ Handle<String>(isolate()->heap()->nan_string(), isolate()) // --
+ };
+ Matcher<Node*> matches[] = {
+ IsHeapConstant(Unique<HeapObject>::CreateImmovable(
+ Handle<HeapObject>(isolate()->heap()->undefined_value(), isolate()))),
+ IsNumberConstant(std::numeric_limits<double>::infinity()),
+ IsNumberConstant(IsNaN()) // --
+ };
+
+ VectorSlotPair feedback(Handle<TypeFeedbackVector>::null(),
+ FeedbackVectorICSlot::Invalid());
+ Node* global = Parameter(Type::GlobalObject());
+ Node* context = UndefinedConstant();
+ Node* effect = graph()->start();
+ Node* control = graph()->start();
+
+ for (size_t i = 0; i < arraysize(names); i++) {
+ Unique<Name> name = Unique<Name>::CreateImmovable(names[i]);
+ Node* node = graph()->NewNode(javascript()->LoadNamed(name, feedback),
+ global, context);
+ if (FLAG_turbo_deoptimization) {
+ node->AppendInput(zone(), EmptyFrameState());
+ }
+ node->AppendInput(zone(), effect);
+ node->AppendInput(zone(), control);
+
+ Reduction r = Reduce(node);
+
+ EXPECT_THAT(r.replacement(), matches[i]);
+ }
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « test/mjsunit/global-undefined-strict.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698