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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « test/mjsunit/global-undefined-strict.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/access-builder.h" 5 #include "src/compiler/access-builder.h"
6 #include "src/compiler/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "src/compiler/js-operator.h" 7 #include "src/compiler/js-operator.h"
8 #include "src/compiler/js-typed-lowering.h" 8 #include "src/compiler/js-typed-lowering.h"
9 #include "src/compiler/machine-operator.h" 9 #include "src/compiler/machine-operator.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 ASSERT_TRUE(r.Changed()); 845 ASSERT_TRUE(r.Changed());
846 EXPECT_THAT( 846 EXPECT_THAT(
847 r.replacement(), 847 r.replacement(),
848 IsStoreElement( 848 IsStoreElement(
849 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), 849 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])),
850 key, value, effect, control)); 850 key, value, effect, control));
851 } 851 }
852 } 852 }
853 } 853 }
854 854
855
856 TEST_F(JSTypedLoweringTest, JSLoadNamedGlobalConstants) {
857 Handle<String> names[] = {
858 Handle<String>(isolate()->heap()->undefined_string(), isolate()),
859 Handle<String>(isolate()->heap()->infinity_string(), isolate()),
860 Handle<String>(isolate()->heap()->nan_string(), isolate()) // --
861 };
862 Matcher<Node*> matches[] = {
863 IsHeapConstant(Unique<HeapObject>::CreateImmovable(
864 Handle<HeapObject>(isolate()->heap()->undefined_value(), isolate()))),
865 IsNumberConstant(std::numeric_limits<double>::infinity()),
866 IsNumberConstant(IsNaN()) // --
867 };
868
869 VectorSlotPair feedback(Handle<TypeFeedbackVector>::null(),
870 FeedbackVectorICSlot::Invalid());
871 Node* global = Parameter(Type::GlobalObject());
872 Node* context = UndefinedConstant();
873 Node* effect = graph()->start();
874 Node* control = graph()->start();
875
876 for (size_t i = 0; i < arraysize(names); i++) {
877 Unique<Name> name = Unique<Name>::CreateImmovable(names[i]);
878 Node* node = graph()->NewNode(javascript()->LoadNamed(name, feedback),
879 global, context);
880 if (FLAG_turbo_deoptimization) {
881 node->AppendInput(zone(), EmptyFrameState());
882 }
883 node->AppendInput(zone(), effect);
884 node->AppendInput(zone(), control);
885
886 Reduction r = Reduce(node);
887
888 EXPECT_THAT(r.replacement(), matches[i]);
889 }
890 }
891
855 } // namespace compiler 892 } // namespace compiler
856 } // namespace internal 893 } // namespace internal
857 } // namespace v8 894 } // namespace v8
OLDNEW
« 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