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

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

Issue 2591923003: [regexp] Remove IsRegExp intrinsic (Closed)
Patch Set: Rebase Created 3 years, 11 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/constant-fold-control-instructions.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/diamond.h" 6 #include "src/compiler/diamond.h"
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/js-intrinsic-lowering.h" 8 #include "src/compiler/js-intrinsic-lowering.h"
9 #include "src/compiler/js-operator.h" 9 #include "src/compiler/js-operator.h"
10 #include "test/unittests/compiler/graph-unittest.h" 10 #include "test/unittests/compiler/graph-unittest.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 effect, CaptureEq(&if_false)), 122 effect, CaptureEq(&if_false)),
123 effect, _), 123 effect, _),
124 IsNumberConstant(JS_TYPED_ARRAY_TYPE)), 124 IsNumberConstant(JS_TYPED_ARRAY_TYPE)),
125 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch), 125 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch),
126 IsBranch(IsObjectIsSmi(input), control))), 126 IsBranch(IsObjectIsSmi(input), control))),
127 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); 127 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch))))));
128 } 128 }
129 129
130 130
131 // ----------------------------------------------------------------------------- 131 // -----------------------------------------------------------------------------
132 // %_IsRegExp
133
134
135 TEST_F(JSIntrinsicLoweringTest, InlineIsRegExp) {
136 Node* const input = Parameter(0);
137 Node* const context = Parameter(1);
138 Node* const effect = graph()->start();
139 Node* const control = graph()->start();
140 Reduction const r = Reduce(
141 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineIsRegExp, 1),
142 input, context, effect, control));
143 ASSERT_TRUE(r.Changed());
144
145 Node* phi = r.replacement();
146 Capture<Node*> branch, if_false;
147 EXPECT_THAT(
148 phi,
149 IsPhi(
150 MachineRepresentation::kTagged, IsFalseConstant(),
151 IsNumberEqual(IsLoadField(AccessBuilder::ForMapInstanceType(),
152 IsLoadField(AccessBuilder::ForMap(), input,
153 effect, CaptureEq(&if_false)),
154 effect, _),
155 IsNumberConstant(JS_REGEXP_TYPE)),
156 IsMerge(IsIfTrue(AllOf(CaptureEq(&branch),
157 IsBranch(IsObjectIsSmi(input), control))),
158 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch))))));
159 }
160
161
162 // -----------------------------------------------------------------------------
163 // %_IsJSReceiver 132 // %_IsJSReceiver
164 133
165 134
166 TEST_F(JSIntrinsicLoweringTest, InlineIsJSReceiver) { 135 TEST_F(JSIntrinsicLoweringTest, InlineIsJSReceiver) {
167 Node* const input = Parameter(0); 136 Node* const input = Parameter(0);
168 Node* const context = Parameter(1); 137 Node* const context = Parameter(1);
169 Node* const effect = graph()->start(); 138 Node* const effect = graph()->start();
170 Node* const control = graph()->start(); 139 Node* const control = graph()->start();
171 Reduction const r = Reduce(graph()->NewNode( 140 Reduction const r = Reduce(graph()->NewNode(
172 javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1), input, 141 javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1), input,
173 context, effect, control)); 142 context, effect, control));
174 ASSERT_TRUE(r.Changed()); 143 ASSERT_TRUE(r.Changed());
175 EXPECT_THAT(r.replacement(), IsObjectIsReceiver(input)); 144 EXPECT_THAT(r.replacement(), IsObjectIsReceiver(input));
176 } 145 }
177 146
178 } // namespace compiler 147 } // namespace compiler
179 } // namespace internal 148 } // namespace internal
180 } // namespace v8 149 } // namespace v8
OLDNEW
« no previous file with comments | « test/mjsunit/constant-fold-control-instructions.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698