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

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

Issue 2366363003: [turbofan] Remove unsafe JSToBoolean lowering. (Closed)
Patch Set: Remove unit test. Created 4 years, 2 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/js-typed-lowering.cc ('k') | no next file » | 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(), IsNumberToBoolean(input)); 116 EXPECT_THAT(r.replacement(), IsNumberToBoolean(input));
117 } 117 }
118 118
119 TEST_F(JSTypedLoweringTest, JSToBooleanWithString) {
120 Node* input = Parameter(Type::String(), 0);
121 Node* context = Parameter(Type::Any(), 1);
122 Reduction r = Reduce(graph()->NewNode(
123 javascript()->ToBoolean(ToBooleanHint::kAny), input, context));
124 ASSERT_TRUE(r.Changed());
125 EXPECT_THAT(
126 r.replacement(),
127 IsNumberLessThan(IsNumberConstant(0.0),
128 IsLoadField(AccessBuilder::ForStringLength(), input,
129 graph()->start(), graph()->start())));
130 }
131
132
133 TEST_F(JSTypedLoweringTest, JSToBooleanWithAny) { 119 TEST_F(JSTypedLoweringTest, JSToBooleanWithAny) {
134 Node* input = Parameter(Type::Any(), 0); 120 Node* input = Parameter(Type::Any(), 0);
135 Node* context = Parameter(Type::Any(), 1); 121 Node* context = Parameter(Type::Any(), 1);
136 Reduction r = Reduce(graph()->NewNode( 122 Reduction r = Reduce(graph()->NewNode(
137 javascript()->ToBoolean(ToBooleanHint::kAny), input, context)); 123 javascript()->ToBoolean(ToBooleanHint::kAny), input, context));
138 ASSERT_FALSE(r.Changed()); 124 ASSERT_FALSE(r.Changed());
139 } 125 }
140 126
141 127
142 // ----------------------------------------------------------------------------- 128 // -----------------------------------------------------------------------------
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 EmptyFrameState(), effect, control)); 1007 EmptyFrameState(), effect, control));
1022 ASSERT_TRUE(r.Changed()); 1008 ASSERT_TRUE(r.Changed());
1023 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseXor( 1009 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseXor(
1024 NumberOperationHint::kNumberOrOddball, lhs, 1010 NumberOperationHint::kNumberOrOddball, lhs,
1025 rhs, effect, control)); 1011 rhs, effect, control));
1026 } 1012 }
1027 1013
1028 } // namespace compiler 1014 } // namespace compiler
1029 } // namespace internal 1015 } // namespace internal
1030 } // namespace v8 1016 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698