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

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

Issue 1213803008: [turbofan] Right hand side of shifts needs ToUint32. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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 | « src/compiler/verifier.cc ('k') | test/mjsunit/compiler/regress-shift-left.js » ('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-graph.h" 5 #include "src/compiler/js-graph.h"
6 #include "src/compiler/js-typed-lowering.h" 6 #include "src/compiler/js-typed-lowering.h"
7 #include "src/compiler/machine-operator.h" 7 #include "src/compiler/machine-operator.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 #include "src/compiler/opcodes.h" 9 #include "src/compiler/opcodes.h"
10 #include "src/compiler/operator-properties.h" 10 #include "src/compiler/operator-properties.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 } 313 }
314 314
315 315
316 // A helper class for testing lowering of bitwise shift operators. 316 // A helper class for testing lowering of bitwise shift operators.
317 class JSBitwiseShiftTypedLoweringTester : public JSTypedLoweringTester { 317 class JSBitwiseShiftTypedLoweringTester : public JSTypedLoweringTester {
318 public: 318 public:
319 explicit JSBitwiseShiftTypedLoweringTester(LanguageMode language_mode) 319 explicit JSBitwiseShiftTypedLoweringTester(LanguageMode language_mode)
320 : JSTypedLoweringTester(), language_mode_(language_mode) { 320 : JSTypedLoweringTester(), language_mode_(language_mode) {
321 int i = 0; 321 int i = 0;
322 set(i++, javascript.ShiftLeft(language_mode_), true); 322 set(i++, javascript.ShiftLeft(language_mode_), true);
323 set(i++, machine.Word32Shl(), false); 323 set(i++, simplified.NumberShiftLeft(), false);
324 set(i++, javascript.ShiftRight(language_mode_), true); 324 set(i++, javascript.ShiftRight(language_mode_), true);
325 set(i++, machine.Word32Sar(), false); 325 set(i++, simplified.NumberShiftRight(), false);
326 set(i++, javascript.ShiftRightLogical(language_mode_), false); 326 set(i++, javascript.ShiftRightLogical(language_mode_), false);
327 set(i++, machine.Word32Shr(), false); 327 set(i++, simplified.NumberShiftRightLogical(), false);
328 } 328 }
329 static const int kNumberOps = 6; 329 static const int kNumberOps = 6;
330 const Operator* ops[kNumberOps]; 330 const Operator* ops[kNumberOps];
331 bool signedness[kNumberOps]; 331 bool signedness[kNumberOps];
332 332
333 private: 333 private:
334 LanguageMode language_mode_; 334 LanguageMode language_mode_;
335 void set(int idx, const Operator* op, bool s) { 335 void set(int idx, const Operator* op, bool s) {
336 ops[idx] = op; 336 ops[idx] = op;
337 signedness[idx] = s; 337 signedness[idx] = s;
(...skipping 19 matching lines...) Expand all
357 357
358 for (int k = 0; k < R.kNumberOps; k += 2) { 358 for (int k = 0; k < R.kNumberOps; k += 2) {
359 Node* add = R.Binop(R.ops[k], p0, p1); 359 Node* add = R.Binop(R.ops[k], p0, p1);
360 Node* r = R.reduce(add); 360 Node* r = R.reduce(add);
361 361
362 R.CheckPureBinop(R.ops[k + 1], r); 362 R.CheckPureBinop(R.ops[k + 1], r);
363 Node* r0 = r->InputAt(0); 363 Node* r0 = r->InputAt(0);
364 Node* r1 = r->InputAt(1); 364 Node* r1 = r->InputAt(1);
365 365
366 CheckToI32(p0, r0, R.signedness[k]); 366 CheckToI32(p0, r0, R.signedness[k]);
367 367 CheckToI32(p1, r1, false);
368 if (r1->opcode() == IrOpcode::kWord32And) {
369 R.CheckPureBinop(IrOpcode::kWord32And, r1);
370 CheckToI32(p1, r1->InputAt(0), R.signedness[k + 1]);
371 R.CheckInt32Constant(0x1F, r1->InputAt(1));
372 } else {
373 CheckToI32(p1, r1, R.signedness[k]);
374 }
375 } 368 }
376 } 369 }
377 } 370 }
378 } 371 }
379 372
380 373
381 // A helper class for testing lowering of bitwise operators. 374 // A helper class for testing lowering of bitwise operators.
382 class JSBitwiseTypedLoweringTester : public JSTypedLoweringTester { 375 class JSBitwiseTypedLoweringTester : public JSTypedLoweringTester {
383 public: 376 public:
384 explicit JSBitwiseTypedLoweringTester(LanguageMode language_mode) 377 explicit JSBitwiseTypedLoweringTester(LanguageMode language_mode)
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 CHECK_EQ(p1, r->InputAt(0)); 1251 CHECK_EQ(p1, r->InputAt(0));
1259 CHECK_EQ(p0, r->InputAt(1)); 1252 CHECK_EQ(p0, r->InputAt(1));
1260 } else { 1253 } else {
1261 CHECK_EQ(p0, r->InputAt(0)); 1254 CHECK_EQ(p0, r->InputAt(0));
1262 CHECK_EQ(p1, r->InputAt(1)); 1255 CHECK_EQ(p1, r->InputAt(1));
1263 } 1256 }
1264 } 1257 }
1265 } 1258 }
1266 } 1259 }
1267 } 1260 }
OLDNEW
« no previous file with comments | « src/compiler/verifier.cc ('k') | test/mjsunit/compiler/regress-shift-left.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698