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

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

Issue 894683003: Introduce LanguageMode, drop StrictMode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased (w/ conflicts) Created 5 years, 10 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/cctest/test-parsing.cc ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | 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/js-operator.h" 5 #include "src/compiler/js-operator.h"
6 #include "src/compiler/opcodes.h" 6 #include "src/compiler/opcodes.h"
7 #include "src/compiler/operator.h" 7 #include "src/compiler/operator.h"
8 #include "src/compiler/operator-properties.h" 8 #include "src/compiler/operator-properties.h"
9 #include "test/unittests/test-utils.h" 9 #include "test/unittests/test-utils.h"
10 10
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 INSTANTIATE_TEST_CASE_P(JSOperatorTest, JSSharedOperatorTest, 145 INSTANTIATE_TEST_CASE_P(JSOperatorTest, JSSharedOperatorTest,
146 ::testing::ValuesIn(kSharedOperators)); 146 ::testing::ValuesIn(kSharedOperators));
147 147
148 148
149 // ----------------------------------------------------------------------------- 149 // -----------------------------------------------------------------------------
150 // JSStoreProperty. 150 // JSStoreProperty.
151 151
152 152
153 class JSStorePropertyOperatorTest 153 class JSStorePropertyOperatorTest
154 : public TestWithZone, 154 : public TestWithZone,
155 public ::testing::WithParamInterface<StrictMode> {}; 155 public ::testing::WithParamInterface<LanguageMode> {};
156 156
157 157
158 TEST_P(JSStorePropertyOperatorTest, InstancesAreGloballyShared) { 158 TEST_P(JSStorePropertyOperatorTest, InstancesAreGloballyShared) {
159 const StrictMode mode = GetParam(); 159 const LanguageMode mode = GetParam();
160 JSOperatorBuilder javascript1(zone()); 160 JSOperatorBuilder javascript1(zone());
161 JSOperatorBuilder javascript2(zone()); 161 JSOperatorBuilder javascript2(zone());
162 EXPECT_EQ(javascript1.StoreProperty(mode), javascript2.StoreProperty(mode)); 162 EXPECT_EQ(javascript1.StoreProperty(mode), javascript2.StoreProperty(mode));
163 } 163 }
164 164
165 165
166 TEST_P(JSStorePropertyOperatorTest, NumberOfInputsAndOutputs) { 166 TEST_P(JSStorePropertyOperatorTest, NumberOfInputsAndOutputs) {
167 JSOperatorBuilder javascript(zone()); 167 JSOperatorBuilder javascript(zone());
168 const StrictMode mode = GetParam(); 168 const LanguageMode mode = GetParam();
169 const Operator* op = javascript.StoreProperty(mode); 169 const Operator* op = javascript.StoreProperty(mode);
170 170
171 // TODO(jarin): Get rid of this hack. 171 // TODO(jarin): Get rid of this hack.
172 const int frame_state_input_count = FLAG_turbo_deoptimization ? 1 : 0; 172 const int frame_state_input_count = FLAG_turbo_deoptimization ? 1 : 0;
173 EXPECT_EQ(3, op->ValueInputCount()); 173 EXPECT_EQ(3, op->ValueInputCount());
174 EXPECT_EQ(1, OperatorProperties::GetContextInputCount(op)); 174 EXPECT_EQ(1, OperatorProperties::GetContextInputCount(op));
175 EXPECT_EQ(frame_state_input_count, 175 EXPECT_EQ(frame_state_input_count,
176 OperatorProperties::GetFrameStateInputCount(op)); 176 OperatorProperties::GetFrameStateInputCount(op));
177 EXPECT_EQ(1, op->EffectInputCount()); 177 EXPECT_EQ(1, op->EffectInputCount());
178 EXPECT_EQ(1, op->ControlInputCount()); 178 EXPECT_EQ(1, op->ControlInputCount());
179 EXPECT_EQ(6 + frame_state_input_count, 179 EXPECT_EQ(6 + frame_state_input_count,
180 OperatorProperties::GetTotalInputCount(op)); 180 OperatorProperties::GetTotalInputCount(op));
181 181
182 EXPECT_EQ(0, op->ValueOutputCount()); 182 EXPECT_EQ(0, op->ValueOutputCount());
183 EXPECT_EQ(1, op->EffectOutputCount()); 183 EXPECT_EQ(1, op->EffectOutputCount());
184 EXPECT_EQ(0, op->ControlOutputCount()); 184 EXPECT_EQ(0, op->ControlOutputCount());
185 } 185 }
186 186
187 187
188 TEST_P(JSStorePropertyOperatorTest, OpcodeIsCorrect) { 188 TEST_P(JSStorePropertyOperatorTest, OpcodeIsCorrect) {
189 JSOperatorBuilder javascript(zone()); 189 JSOperatorBuilder javascript(zone());
190 const StrictMode mode = GetParam(); 190 const LanguageMode mode = GetParam();
191 const Operator* op = javascript.StoreProperty(mode); 191 const Operator* op = javascript.StoreProperty(mode);
192 EXPECT_EQ(IrOpcode::kJSStoreProperty, op->opcode()); 192 EXPECT_EQ(IrOpcode::kJSStoreProperty, op->opcode());
193 } 193 }
194 194
195 195
196 TEST_P(JSStorePropertyOperatorTest, OpParameter) { 196 TEST_P(JSStorePropertyOperatorTest, OpParameter) {
197 JSOperatorBuilder javascript(zone()); 197 JSOperatorBuilder javascript(zone());
198 const StrictMode mode = GetParam(); 198 const LanguageMode mode = GetParam();
199 const Operator* op = javascript.StoreProperty(mode); 199 const Operator* op = javascript.StoreProperty(mode);
200 EXPECT_EQ(mode, OpParameter<StrictMode>(op)); 200 EXPECT_EQ(mode, OpParameter<LanguageMode>(op));
201 } 201 }
202 202
203 203
204 TEST_P(JSStorePropertyOperatorTest, Properties) { 204 TEST_P(JSStorePropertyOperatorTest, Properties) {
205 JSOperatorBuilder javascript(zone()); 205 JSOperatorBuilder javascript(zone());
206 const StrictMode mode = GetParam(); 206 const LanguageMode mode = GetParam();
207 const Operator* op = javascript.StoreProperty(mode); 207 const Operator* op = javascript.StoreProperty(mode);
208 EXPECT_EQ(Operator::kNoProperties, op->properties()); 208 EXPECT_EQ(Operator::kNoProperties, op->properties());
209 } 209 }
210 210
211 211
212 INSTANTIATE_TEST_CASE_P(JSOperatorTest, JSStorePropertyOperatorTest, 212 INSTANTIATE_TEST_CASE_P(JSOperatorTest, JSStorePropertyOperatorTest,
213 ::testing::Values(SLOPPY, STRICT)); 213 ::testing::Values(SLOPPY, STRICT));
214 214
215 } // namespace compiler 215 } // namespace compiler
216 } // namespace internal 216 } // namespace internal
217 } // namespace v8 217 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698