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

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

Issue 1487973002: [turbofan] Add binary operation hints for javascript operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: test/cctest/compiler/test-js-typed-lowering.cc
diff --git a/test/cctest/compiler/test-js-typed-lowering.cc b/test/cctest/compiler/test-js-typed-lowering.cc
index b22785207de22b802064274670e44b75b61a70db..0ed4cf5d922390d4c3dc45349f82b284e4999a2d 100644
--- a/test/cctest/compiler/test-js-typed-lowering.cc
+++ b/test/cctest/compiler/test-js-typed-lowering.cc
@@ -63,6 +63,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
Graph graph;
Typer typer;
Node* context_node;
+ BinaryOperationHints const hints = BinaryOperationHints::Any();
Node* Parameter(Type* t, int32_t index = 0) {
Node* n = graph.NewNode(common.Parameter(index), graph.start());
@@ -268,7 +269,8 @@ TEST_WITH_STRONG(AddNumber1) {
for (size_t i = 0; i < arraysize(kNumberTypes); ++i) {
Node* p0 = R.Parameter(kNumberTypes[i], 0);
Node* p1 = R.Parameter(kNumberTypes[i], 1);
- Node* add = R.Binop(R.javascript.Add(language_mode), p0, p1);
+ Node* add = R.Binop(
+ R.javascript.Add(language_mode, BinaryOperationHints::Any()), p0, p1);
Node* r = R.reduce(add);
R.CheckBinop(IrOpcode::kNumberAdd, r);
@@ -281,11 +283,16 @@ TEST_WITH_STRONG(AddNumber1) {
TEST_WITH_STRONG(NumberBinops) {
JSTypedLoweringTester R;
const Operator* ops[] = {
- R.javascript.Add(language_mode), R.simplified.NumberAdd(),
- R.javascript.Subtract(language_mode), R.simplified.NumberSubtract(),
- R.javascript.Multiply(language_mode), R.simplified.NumberMultiply(),
- R.javascript.Divide(language_mode), R.simplified.NumberDivide(),
- R.javascript.Modulus(language_mode), R.simplified.NumberModulus(),
+ R.javascript.Add(language_mode, R.hints),
+ R.simplified.NumberAdd(),
+ R.javascript.Subtract(language_mode, R.hints),
+ R.simplified.NumberSubtract(),
+ R.javascript.Multiply(language_mode, R.hints),
+ R.simplified.NumberMultiply(),
+ R.javascript.Divide(language_mode, R.hints),
+ R.simplified.NumberDivide(),
+ R.javascript.Modulus(language_mode, R.hints),
+ R.simplified.NumberModulus(),
};
for (size_t i = 0; i < arraysize(kNumberTypes); ++i) {
@@ -328,11 +335,11 @@ class JSBitwiseShiftTypedLoweringTester : public JSTypedLoweringTester {
explicit JSBitwiseShiftTypedLoweringTester(LanguageMode language_mode)
: JSTypedLoweringTester(), language_mode_(language_mode) {
int i = 0;
- set(i++, javascript.ShiftLeft(language_mode_), true);
+ set(i++, javascript.ShiftLeft(language_mode_, hints), true);
set(i++, simplified.NumberShiftLeft(), false);
- set(i++, javascript.ShiftRight(language_mode_), true);
+ set(i++, javascript.ShiftRight(language_mode_, hints), true);
set(i++, simplified.NumberShiftRight(), false);
- set(i++, javascript.ShiftRightLogical(language_mode_), false);
+ set(i++, javascript.ShiftRightLogical(language_mode_, hints), false);
set(i++, simplified.NumberShiftRightLogical(), false);
}
static const int kNumberOps = 6;
@@ -386,11 +393,11 @@ class JSBitwiseTypedLoweringTester : public JSTypedLoweringTester {
explicit JSBitwiseTypedLoweringTester(LanguageMode language_mode)
: JSTypedLoweringTester(), language_mode_(language_mode) {
int i = 0;
- set(i++, javascript.BitwiseOr(language_mode_), true);
+ set(i++, javascript.BitwiseOr(language_mode_, hints), true);
set(i++, simplified.NumberBitwiseOr(), true);
- set(i++, javascript.BitwiseXor(language_mode_), true);
+ set(i++, javascript.BitwiseXor(language_mode_, hints), true);
set(i++, simplified.NumberBitwiseXor(), true);
- set(i++, javascript.BitwiseAnd(language_mode_), true);
+ set(i++, javascript.BitwiseAnd(language_mode_, hints), true);
set(i++, simplified.NumberBitwiseAnd(), true);
}
static const int kNumberOps = 6;
@@ -740,14 +747,14 @@ TEST_WITH_STRONG(RemoveToNumberEffects) {
case 2:
effect_use = R.graph.NewNode(R.common.EffectPhi(1), ton, R.start());
case 3:
- effect_use = R.graph.NewNode(R.javascript.Add(language_mode), ton, ton,
- R.context(), frame_state, frame_state, ton,
- R.start());
+ effect_use = R.graph.NewNode(R.javascript.Add(language_mode, R.hints),
+ ton, ton, R.context(), frame_state,
+ frame_state, ton, R.start());
break;
case 4:
- effect_use = R.graph.NewNode(R.javascript.Add(language_mode), p0, p0,
- R.context(), frame_state, frame_state, ton,
- R.start());
+ effect_use = R.graph.NewNode(R.javascript.Add(language_mode, R.hints),
+ p0, p0, R.context(), frame_state,
+ frame_state, ton, R.start());
break;
case 5:
effect_use = R.graph.NewNode(R.common.Return(), p0, ton, R.start());
@@ -910,13 +917,20 @@ TEST_WITH_STRONG(RemovePureNumberBinopEffects) {
JSTypedLoweringTester R;
const Operator* ops[] = {
- R.javascript.Equal(), R.simplified.NumberEqual(),
- R.javascript.Add(language_mode), R.simplified.NumberAdd(),
- R.javascript.Subtract(language_mode), R.simplified.NumberSubtract(),
- R.javascript.Multiply(language_mode), R.simplified.NumberMultiply(),
- R.javascript.Divide(language_mode), R.simplified.NumberDivide(),
- R.javascript.Modulus(language_mode), R.simplified.NumberModulus(),
- R.javascript.LessThan(language_mode), R.simplified.NumberLessThan(),
+ R.javascript.Equal(),
+ R.simplified.NumberEqual(),
+ R.javascript.Add(language_mode, R.hints),
+ R.simplified.NumberAdd(),
+ R.javascript.Subtract(language_mode, R.hints),
+ R.simplified.NumberSubtract(),
+ R.javascript.Multiply(language_mode, R.hints),
+ R.simplified.NumberMultiply(),
+ R.javascript.Divide(language_mode, R.hints),
+ R.simplified.NumberDivide(),
+ R.javascript.Modulus(language_mode, R.hints),
+ R.simplified.NumberModulus(),
+ R.javascript.LessThan(language_mode),
+ R.simplified.NumberLessThan(),
R.javascript.LessThanOrEqual(language_mode),
R.simplified.NumberLessThanOrEqual(),
};
@@ -939,11 +953,11 @@ TEST(OrderNumberBinopEffects1) {
JSTypedLoweringTester R;
const Operator* ops[] = {
- R.javascript.Subtract(LanguageMode::SLOPPY),
+ R.javascript.Subtract(LanguageMode::SLOPPY, R.hints),
R.simplified.NumberSubtract(),
- R.javascript.Multiply(LanguageMode::SLOPPY),
+ R.javascript.Multiply(LanguageMode::SLOPPY, R.hints),
R.simplified.NumberMultiply(),
- R.javascript.Divide(LanguageMode::SLOPPY),
+ R.javascript.Divide(LanguageMode::SLOPPY, R.hints),
R.simplified.NumberDivide(),
};
@@ -967,13 +981,13 @@ TEST(OrderNumberBinopEffects2) {
JSTypedLoweringTester R;
const Operator* ops[] = {
- R.javascript.Add(LanguageMode::SLOPPY),
+ R.javascript.Add(LanguageMode::SLOPPY, R.hints),
R.simplified.NumberAdd(),
- R.javascript.Subtract(LanguageMode::SLOPPY),
+ R.javascript.Subtract(LanguageMode::SLOPPY, R.hints),
R.simplified.NumberSubtract(),
- R.javascript.Multiply(LanguageMode::SLOPPY),
+ R.javascript.Multiply(LanguageMode::SLOPPY, R.hints),
R.simplified.NumberMultiply(),
- R.javascript.Divide(LanguageMode::SLOPPY),
+ R.javascript.Divide(LanguageMode::SLOPPY, R.hints),
R.simplified.NumberDivide(),
};

Powered by Google App Engine
This is Rietveld 408576698