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

Unified Diff: test/unittests/compiler/js-builtin-reducer-unittest.cc

Issue 1103143002: Revert of [turbofan] Add language mode to JSCallFunction operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/js-operator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/js-builtin-reducer-unittest.cc
diff --git a/test/unittests/compiler/js-builtin-reducer-unittest.cc b/test/unittests/compiler/js-builtin-reducer-unittest.cc
index 090f6100660ca63ff006a8dbb787c0a413ca5ef5..5c508a5d4bcd37cb3cd9be15d6134e2f12b9fd46 100644
--- a/test/unittests/compiler/js-builtin-reducer-unittest.cc
+++ b/test/unittests/compiler/js-builtin-reducer-unittest.cc
@@ -30,7 +30,7 @@
return reducer.Reduce(node);
}
- Node* MathFunction(const char* name) {
+ Handle<JSFunction> MathFunction(const char* name) {
Handle<Object> m =
JSObject::GetProperty(isolate()->global_object(),
isolate()->factory()->NewStringFromAsciiChecked(
@@ -39,7 +39,7 @@
JSObject::GetProperty(
m, isolate()->factory()->NewStringFromAsciiChecked(name))
.ToHandleChecked());
- return HeapConstant(Unique<JSFunction>::CreateUninitialized(f));
+ return f;
}
JSOperatorBuilder* javascript() { return &javascript_; }
@@ -50,15 +50,6 @@
namespace {
-
-Type* const kIntegral32Types[] = {Type::UnsignedSmall(), Type::Negative32(),
- Type::Unsigned31(), Type::SignedSmall(),
- Type::Signed32(), Type::Unsigned32(),
- Type::Integral32()};
-
-
-const LanguageMode kLanguageModes[] = {SLOPPY, STRICT, STRONG};
-
// TODO(mstarzinger): Find a common place and unify with test-js-typed-lowering.
Type* const kNumberTypes[] = {
@@ -75,55 +66,56 @@
TEST_F(JSBuiltinReducerTest, MathMax0) {
- Node* function = MathFunction("max");
+ Handle<JSFunction> f = MathFunction("max");
- TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
- Node* call = graph()->NewNode(
- javascript()->CallFunction(2, NO_CALL_FUNCTION_FLAGS, language_mode),
- function, UndefinedConstant());
- Reduction r = Reduce(call);
+ Node* fun = HeapConstant(Unique<HeapObject>::CreateUninitialized(f));
+ Node* call =
+ graph()->NewNode(javascript()->CallFunction(2, NO_CALL_FUNCTION_FLAGS),
+ fun, UndefinedConstant());
+ Reduction r = Reduce(call);
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(), IsNumberConstant(-V8_INFINITY));
- }
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsNumberConstant(-V8_INFINITY));
}
TEST_F(JSBuiltinReducerTest, MathMax1) {
- Node* function = MathFunction("max");
+ Handle<JSFunction> f = MathFunction("max");
- TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
- TRACED_FOREACH(Type*, t0, kNumberTypes) {
- Node* p0 = Parameter(t0, 0);
- Node* call = graph()->NewNode(
- javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS, language_mode),
- function, UndefinedConstant(), p0);
- Reduction r = Reduce(call);
+ TRACED_FOREACH(Type*, t0, kNumberTypes) {
+ Node* p0 = Parameter(t0, 0);
+ Node* fun = HeapConstant(Unique<HeapObject>::CreateUninitialized(f));
+ Node* call =
+ graph()->NewNode(javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS),
+ fun, UndefinedConstant(), p0);
+ Reduction r = Reduce(call);
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(), p0);
- }
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), p0);
}
}
TEST_F(JSBuiltinReducerTest, MathMax2) {
- Node* function = MathFunction("max");
+ Handle<JSFunction> f = MathFunction("max");
- TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
- TRACED_FOREACH(Type*, t0, kIntegral32Types) {
- TRACED_FOREACH(Type*, t1, kIntegral32Types) {
- Node* p0 = Parameter(t0, 0);
- Node* p1 = Parameter(t1, 1);
- Node* call =
- graph()->NewNode(javascript()->CallFunction(
- 4, NO_CALL_FUNCTION_FLAGS, language_mode),
- function, UndefinedConstant(), p0, p1);
- Reduction r = Reduce(call);
+ TRACED_FOREACH(Type*, t0, kNumberTypes) {
+ TRACED_FOREACH(Type*, t1, kNumberTypes) {
+ Node* p0 = Parameter(t0, 0);
+ Node* p1 = Parameter(t1, 1);
+ Node* fun = HeapConstant(Unique<HeapObject>::CreateUninitialized(f));
+ Node* call = graph()->NewNode(
+ javascript()->CallFunction(4, NO_CALL_FUNCTION_FLAGS), fun,
+ UndefinedConstant(), p0, p1);
+ Reduction r = Reduce(call);
+ if (t0->Is(Type::Integral32()) && t1->Is(Type::Integral32())) {
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(),
IsSelect(kMachNone, IsNumberLessThan(p1, p0), p0, p1));
+ } else {
+ ASSERT_FALSE(r.Changed());
+ EXPECT_EQ(IrOpcode::kJSCallFunction, call->opcode());
}
}
}
@@ -135,21 +127,24 @@
TEST_F(JSBuiltinReducerTest, MathImul) {
- Node* function = MathFunction("imul");
+ Handle<JSFunction> f = MathFunction("imul");
- TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
- TRACED_FOREACH(Type*, t0, kIntegral32Types) {
- TRACED_FOREACH(Type*, t1, kIntegral32Types) {
- Node* p0 = Parameter(t0, 0);
- Node* p1 = Parameter(t1, 1);
- Node* call =
- graph()->NewNode(javascript()->CallFunction(
- 4, NO_CALL_FUNCTION_FLAGS, language_mode),
- function, UndefinedConstant(), p0, p1);
- Reduction r = Reduce(call);
+ TRACED_FOREACH(Type*, t0, kNumberTypes) {
+ TRACED_FOREACH(Type*, t1, kNumberTypes) {
+ Node* p0 = Parameter(t0, 0);
+ Node* p1 = Parameter(t1, 1);
+ Node* fun = HeapConstant(Unique<HeapObject>::CreateUninitialized(f));
+ Node* call = graph()->NewNode(
+ javascript()->CallFunction(4, NO_CALL_FUNCTION_FLAGS), fun,
+ UndefinedConstant(), p0, p1);
+ Reduction r = Reduce(call);
+ if (t0->Is(Type::Integral32()) && t1->Is(Type::Integral32())) {
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsInt32Mul(p0, p1));
+ } else {
+ ASSERT_FALSE(r.Changed());
+ EXPECT_EQ(IrOpcode::kJSCallFunction, call->opcode());
}
}
}
@@ -161,19 +156,18 @@
TEST_F(JSBuiltinReducerTest, MathFround) {
- Node* function = MathFunction("fround");
+ Handle<JSFunction> f = MathFunction("fround");
- TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
- TRACED_FOREACH(Type*, t0, kNumberTypes) {
- Node* p0 = Parameter(t0, 0);
- Node* call = graph()->NewNode(
- javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS, language_mode),
- function, UndefinedConstant(), p0);
- Reduction r = Reduce(call);
+ TRACED_FOREACH(Type*, t0, kNumberTypes) {
+ Node* p0 = Parameter(t0, 0);
+ Node* fun = HeapConstant(Unique<HeapObject>::CreateUninitialized(f));
+ Node* call =
+ graph()->NewNode(javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS),
+ fun, UndefinedConstant(), p0);
+ Reduction r = Reduce(call);
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(), IsTruncateFloat64ToFloat32(p0));
- }
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsTruncateFloat64ToFloat32(p0));
}
}
« no previous file with comments | « src/compiler/js-operator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698