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

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

Issue 2309953002: [turbofan] Introduce dedicated NumberToBoolean operator. (Closed)
Patch Set: Fix unittest. Created 4 years, 3 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/unittests/compiler/node-test-utils.h » ('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-typed-lowering.h" 5 #include "src/compiler/js-typed-lowering.h"
6 #include "src/code-factory.h" 6 #include "src/code-factory.h"
7 #include "src/compilation-dependencies.h" 7 #include "src/compilation-dependencies.h"
8 #include "src/compiler/access-builder.h" 8 #include "src/compiler/access-builder.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/js-operator.h" 10 #include "src/compiler/js-operator.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 EXPECT_THAT(r.replacement(), 106 EXPECT_THAT(r.replacement(),
107 IsBooleanNot(IsNumberEqual(input, IsNumberConstant(0.0)))); 107 IsBooleanNot(IsNumberEqual(input, IsNumberConstant(0.0))));
108 } 108 }
109 109
110 TEST_F(JSTypedLoweringTest, JSToBooleanWithNumber) { 110 TEST_F(JSTypedLoweringTest, JSToBooleanWithNumber) {
111 Node* input = Parameter(Type::Number(), 0); 111 Node* input = Parameter(Type::Number(), 0);
112 Node* context = Parameter(Type::Any(), 1); 112 Node* context = Parameter(Type::Any(), 1);
113 Reduction r = Reduce(graph()->NewNode( 113 Reduction r = Reduce(graph()->NewNode(
114 javascript()->ToBoolean(ToBooleanHint::kAny), input, context)); 114 javascript()->ToBoolean(ToBooleanHint::kAny), input, context));
115 ASSERT_TRUE(r.Changed()); 115 ASSERT_TRUE(r.Changed());
116 EXPECT_THAT(r.replacement(), 116 EXPECT_THAT(r.replacement(), IsNumberToBoolean(input));
117 IsNumberLessThan(IsNumberConstant(0.0), IsNumberAbs(input)));
118 } 117 }
119 118
120 TEST_F(JSTypedLoweringTest, JSToBooleanWithString) { 119 TEST_F(JSTypedLoweringTest, JSToBooleanWithString) {
121 Node* input = Parameter(Type::String(), 0); 120 Node* input = Parameter(Type::String(), 0);
122 Node* context = Parameter(Type::Any(), 1); 121 Node* context = Parameter(Type::Any(), 1);
123 Reduction r = Reduce(graph()->NewNode( 122 Reduction r = Reduce(graph()->NewNode(
124 javascript()->ToBoolean(ToBooleanHint::kAny), input, context)); 123 javascript()->ToBoolean(ToBooleanHint::kAny), input, context));
125 ASSERT_TRUE(r.Changed()); 124 ASSERT_TRUE(r.Changed());
126 EXPECT_THAT( 125 EXPECT_THAT(
127 r.replacement(), 126 r.replacement(),
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 EmptyFrameState(), effect, control)); 1021 EmptyFrameState(), effect, control));
1023 ASSERT_TRUE(r.Changed()); 1022 ASSERT_TRUE(r.Changed());
1024 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseXor( 1023 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseXor(
1025 NumberOperationHint::kNumberOrOddball, lhs, 1024 NumberOperationHint::kNumberOrOddball, lhs,
1026 rhs, effect, control)); 1025 rhs, effect, control));
1027 } 1026 }
1028 1027
1029 } // namespace compiler 1028 } // namespace compiler
1030 } // namespace internal 1029 } // namespace internal
1031 } // namespace v8 1030 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/verifier.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698