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

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

Issue 1407413014: [turbofan] Pseudo-inline instanceof (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Pre-dinner try Created 5 years, 1 month 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
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/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/compiler/access-builder.h" 6 #include "src/compiler/access-builder.h"
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/js-operator.h" 8 #include "src/compiler/js-operator.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 68
69 STATIC_ASSERT(LANGUAGE_END == 3); 69 STATIC_ASSERT(LANGUAGE_END == 3);
70 const LanguageMode kLanguageModes[] = {SLOPPY, STRICT, STRONG}; 70 const LanguageMode kLanguageModes[] = {SLOPPY, STRICT, STRONG};
71 71
72 } // namespace 72 } // namespace
73 73
74 74
75 class JSTypedLoweringTest : public TypedGraphTest { 75 class JSTypedLoweringTest : public TypedGraphTest {
76 public: 76 public:
77 JSTypedLoweringTest() : TypedGraphTest(3), javascript_(zone()) {} 77 JSTypedLoweringTest()
78 : TypedGraphTest(3), javascript_(zone()), deps_(isolate(), zone()) {}
78 ~JSTypedLoweringTest() override {} 79 ~JSTypedLoweringTest() override {}
79 80
80 protected: 81 protected:
81 Reduction Reduce(Node* node) { 82 Reduction Reduce(Node* node) {
82 MachineOperatorBuilder machine(zone()); 83 MachineOperatorBuilder machine(zone());
83 SimplifiedOperatorBuilder simplified(zone()); 84 SimplifiedOperatorBuilder simplified(zone());
84 JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified, 85 JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified,
85 &machine); 86 &machine);
86 // TODO(titzer): mock the GraphReducer here for better unit testing. 87 // TODO(titzer): mock the GraphReducer here for better unit testing.
87 GraphReducer graph_reducer(zone(), graph()); 88 GraphReducer graph_reducer(zone(), graph());
88 JSTypedLowering reducer(&graph_reducer, &jsgraph, zone()); 89 JSTypedLowering reducer(&graph_reducer, &deps_, &jsgraph, zone());
89 return reducer.Reduce(node); 90 return reducer.Reduce(node);
90 } 91 }
91 92
92 Node* FrameState(Handle<SharedFunctionInfo> shared, Node* outer_frame_state) { 93 Node* FrameState(Handle<SharedFunctionInfo> shared, Node* outer_frame_state) {
93 Node* state_values = graph()->NewNode(common()->StateValues(0)); 94 Node* state_values = graph()->NewNode(common()->StateValues(0));
94 return graph()->NewNode( 95 return graph()->NewNode(
95 common()->FrameState(BailoutId::None(), 96 common()->FrameState(BailoutId::None(),
96 OutputFrameStateCombine::Ignore(), 97 OutputFrameStateCombine::Ignore(),
97 common()->CreateFrameStateFunctionInfo( 98 common()->CreateFrameStateFunctionInfo(
98 FrameStateType::kJavaScriptFunction, 1, 0, 99 FrameStateType::kJavaScriptFunction, 1, 0,
(...skipping 10 matching lines...) Expand all
109 110
110 Matcher<Node*> IsIntPtrConstant(intptr_t value) { 111 Matcher<Node*> IsIntPtrConstant(intptr_t value) {
111 return sizeof(value) == 4 ? IsInt32Constant(static_cast<int32_t>(value)) 112 return sizeof(value) == 4 ? IsInt32Constant(static_cast<int32_t>(value))
112 : IsInt64Constant(static_cast<int64_t>(value)); 113 : IsInt64Constant(static_cast<int64_t>(value));
113 } 114 }
114 115
115 JSOperatorBuilder* javascript() { return &javascript_; } 116 JSOperatorBuilder* javascript() { return &javascript_; }
116 117
117 private: 118 private:
118 JSOperatorBuilder javascript_; 119 JSOperatorBuilder javascript_;
120 CompilationDependencies deps_;
119 }; 121 };
120 122
121 123
122 // ----------------------------------------------------------------------------- 124 // -----------------------------------------------------------------------------
123 // JSUnaryNot 125 // JSUnaryNot
124 126
125 127
126 TEST_F(JSTypedLoweringTest, JSUnaryNotWithBoolean) { 128 TEST_F(JSTypedLoweringTest, JSUnaryNotWithBoolean) {
127 Node* input = Parameter(Type::Boolean(), 0); 129 Node* input = Parameter(Type::Boolean(), 0);
128 Node* context = Parameter(Type::Any(), 1); 130 Node* context = Parameter(Type::Any(), 1);
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 EXPECT_THAT(r.replacement(), 1166 EXPECT_THAT(r.replacement(),
1165 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( 1167 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor(
1166 Context::MIN_CONTEXT_SLOTS)), 1168 Context::MIN_CONTEXT_SLOTS)),
1167 IsBeginRegion(effect), control), 1169 IsBeginRegion(effect), control),
1168 _)); 1170 _));
1169 } 1171 }
1170 1172
1171 } // namespace compiler 1173 } // namespace compiler
1172 } // namespace internal 1174 } // namespace internal
1173 } // namespace v8 1175 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698